From f64691e7b15f385a9c0c46cb0536659e346bf49e Mon Sep 17 00:00:00 2001 From: JoseSantosAMD Date: Tue, 15 Aug 2023 15:56:23 -0500 Subject: [PATCH] add smart units in gui/cli Signed-off-by: JoseSantosAMD --- .../gfx906/0200_system-speed-of-light.yaml | 2 +- .../gfx908/0200_system-speed-of-light.yaml | 2 +- .../gfx90a/0200_system-speed-of-light.yaml | 2 +- src/omniperf_analyze/utils/gui.py | 82 +++++++++ src/omniperf_analyze/utils/tty.py | 165 +++++++++++++++++- 5 files changed, 249 insertions(+), 4 deletions(-) diff --git a/src/omniperf_analyze/configs/gfx906/0200_system-speed-of-light.yaml b/src/omniperf_analyze/configs/gfx906/0200_system-speed-of-light.yaml index 986b2f0ae..cde2fab9e 100644 --- a/src/omniperf_analyze/configs/gfx906/0200_system-speed-of-light.yaml +++ b/src/omniperf_analyze/configs/gfx906/0200_system-speed-of-light.yaml @@ -107,7 +107,7 @@ Panel Config: LDS BW: value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs))) - unit: GB/sec + unit: Gb/s peak: (($sclk * $numCU) * 0.128) pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128))) diff --git a/src/omniperf_analyze/configs/gfx908/0200_system-speed-of-light.yaml b/src/omniperf_analyze/configs/gfx908/0200_system-speed-of-light.yaml index 986b2f0ae..cde2fab9e 100644 --- a/src/omniperf_analyze/configs/gfx908/0200_system-speed-of-light.yaml +++ b/src/omniperf_analyze/configs/gfx908/0200_system-speed-of-light.yaml @@ -107,7 +107,7 @@ Panel Config: LDS BW: value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs))) - unit: GB/sec + unit: Gb/s peak: (($sclk * $numCU) * 0.128) pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128))) diff --git a/src/omniperf_analyze/configs/gfx90a/0200_system-speed-of-light.yaml b/src/omniperf_analyze/configs/gfx90a/0200_system-speed-of-light.yaml index c197c0fc5..5d207c77e 100644 --- a/src/omniperf_analyze/configs/gfx90a/0200_system-speed-of-light.yaml +++ b/src/omniperf_analyze/configs/gfx90a/0200_system-speed-of-light.yaml @@ -124,7 +124,7 @@ Panel Config: LDS BW: value: AVG(((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs))) - unit: GB/sec + unit: Gb/s peak: (($sclk * $numCU) * 0.128) pop: AVG((((((SQ_LDS_IDX_ACTIVE - SQ_LDS_BANK_CONFLICT) * 4) * TO_INT($LDSBanks)) / (EndNs - BeginNs)) / (($sclk * $numCU) * 0.00128))) diff --git a/src/omniperf_analyze/utils/gui.py b/src/omniperf_analyze/utils/gui.py index ca05bd3ea..b5c2d5151 100644 --- a/src/omniperf_analyze/utils/gui.py +++ b/src/omniperf_analyze/utils/gui.py @@ -287,6 +287,88 @@ def build_bar_chart(display_df, table_config, norm_filt): def build_table_chart( display_df, table_config, original_df, display_columns, comparable_columns, decimal ): + if "Unit" in display_df: + what = display_df["Unit"] + if "Gb/s" in display_df["Unit"].values: + for idx, row in display_df[display_df["Unit"] == "Gb/s"].items(): + for curr_metric in row: + curr_row = display_df[display_df["Metric"] == curr_metric] + if not curr_row.empty: + if "Value" in curr_row: + if isinstance( + curr_row["Value"][0], + float, + ): + if curr_row.Value[0] < 0.001: + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Unit", + ] = "Kb/s" + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Value", + ] = ( + 1000000 * curr_row.Value + ) + elif curr_row.Value[0] < 1: + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Unit", + ] = "Mb/s" + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Value", + ] = ( + 1000 * curr_row.Value + ) + elif "Avg" in curr_row: + if isinstance(curr_row["Avg"][0], float): + if curr_row.Avg[0] < 0.001: + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Unit", + ] = "Kb/s" + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Avg", + ] = ( + 1000000 * curr_row.Avg + ) + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Min", + ] = ( + 1000000 * curr_row.Min + ) + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Max", + ] = ( + 1000000 * curr_row.Max + ) + elif curr_row.Avg[0] < 1: + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Unit", + ] = "Mb/s" + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Avg", + ] = ( + 1000 * curr_row.Avg + ) + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Min", + ] = ( + 1000 * curr_row.Min + ) + display_df.loc[ + (display_df["Metric"] == curr_metric), + "Max", + ] = ( + 1000 * curr_row.Max + ) d_figs = [] # build comlumns/header with formatting diff --git a/src/omniperf_analyze/utils/tty.py b/src/omniperf_analyze/utils/tty.py index d04dc2cb9..e429bc1d0 100644 --- a/src/omniperf_analyze/utils/tty.py +++ b/src/omniperf_analyze/utils/tty.py @@ -106,6 +106,7 @@ def show_all(args, runs, archConfigs, output): float(x) if x != "" else float(0) for x in base_df[header] ] + # insert unit fix here cur_df[header] = [ float(x) if x != "" else float(0) for x in cur_df[header] @@ -141,13 +142,175 @@ def show_all(args, runs, archConfigs, output): df = pd.concat([df, t_df], axis=1) else: + # insert unit fix here cur_df[header] = [ round(float(x), args.decimal) if x != "" else x for x in base_df[header] ] - + if "Unit" in cur_df.columns: + for idx, row in cur_df[ + cur_df["Unit"] == "Gb/s" + ].items(): + for curr_metric in row: + curr_row = cur_df[ + cur_df["Metric"] == curr_metric + ] + if not curr_row.empty: + if "Value" in curr_row: + if isinstance( + curr_row["Value"][0], + float, + ): + if ( + curr_row.Value[0] + < 0.001 + ): + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Unit", + ] = "Kb/s" + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Value", + ] = ( + 1000000 + * curr_row.Value + ) + elif ( + curr_row.Value[0] < 1 + ): + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Unit", + ] = "Mb/s" + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Value", + ] = ( + 1000 + * curr_row.Value + ) + elif "Avg" in curr_row: + if isinstance( + curr_row["Avg"][0], float + ): + if ( + curr_row.Avg[0] + < 0.001 + ): + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Unit", + ] = "Kb/s" + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Avg", + ] = ( + 1000000 + * curr_row.Avg + ) + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Min", + ] = ( + 1000000 + * curr_row.Min + ) + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Max", + ] = ( + 1000000 + * curr_row.Max + ) + elif curr_row.Avg[0] < 1: + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Unit", + ] = "Mb/s" + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Avg", + ] = ( + 1000 + * curr_row.Avg + ) + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Min", + ] = ( + 1000 + * curr_row.Min + ) + cur_df.loc[ + ( + cur_df[ + "Metric" + ] + == curr_metric + ), + "Max", + ] = ( + 1000 + * curr_row.Max + ) df = pd.concat([df, cur_df[header]], axis=1) if not df.empty: