From 9930c1ced0ec250155d8bae9c33a4ab3c08f4747 Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Tue, 8 Nov 2022 15:41:41 -0600 Subject: [PATCH 1/3] Implement basic loading spinner [ROCm/rocprofiler-compute commit: 1e2370209e7713f21387a2d75f19a0fcf99ebe31] --- projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py index cbff21927c..b3ac93dfbd 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py @@ -29,6 +29,7 @@ from dash.dash_table import FormatTemplate from dash.dash_table.Format import Format, Scheme, Symbol from dash import html, dash_table from dash.dependencies import Input, Output, State +import dash_bootstrap_components as dbc from dash import dcc import plotly.express as px @@ -319,8 +320,10 @@ def build_layout( app.layout.children = html.Div( children=[ - get_header(runs[path_to_dir].raw_pmc, input_filters, filt_kernel_names), - html.Div(id="container", children=[]), + dbc.Spinner(children=[ + get_header(runs[path_to_dir].raw_pmc, input_filters, filt_kernel_names), + html.Div(id="container", children=[]), + ], fullscreen=True, color="primary", spinner_style={"width": "6rem", "height": "6rem"}) ] ) From 8b219d86c247f0ac653a4b6193bcf604b2d34aae Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Tue, 8 Nov 2022 16:06:53 -0600 Subject: [PATCH 2/3] Enable verbosity level in GUI Signed-off-by: colramos-amd [ROCm/rocprofiler-compute commit: f03d69ed33c22b0f375782b2ebf4ff94a1a33dcb] --- .../src/omniperf_cli/utils/gui.py | 19 +++++++++++++------ .../utils/gui_components/roofline.py | 2 +- .../src/omniperf_cli/utils/roofline_calc.py | 16 ++++++++-------- projects/rocprofiler-compute/src/parser.py | 6 +++--- .../src/utils/plot_roofline.py | 16 ++++++++-------- 5 files changed, 33 insertions(+), 26 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py index b3ac93dfbd..1c347e2088 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py @@ -320,10 +320,17 @@ def build_layout( app.layout.children = html.Div( children=[ - dbc.Spinner(children=[ - get_header(runs[path_to_dir].raw_pmc, input_filters, filt_kernel_names), - html.Div(id="container", children=[]), - ], fullscreen=True, color="primary", spinner_style={"width": "6rem", "height": "6rem"}) + dbc.Spinner( + children=[ + get_header( + runs[path_to_dir].raw_pmc, input_filters, filt_kernel_names + ), + html.Div(id="container", children=[]), + ], + fullscreen=True, + color="primary", + spinner_style={"width": "6rem", "height": "6rem"}, + ) ] ) @@ -338,10 +345,10 @@ def build_layout( runs[path_to_dir].dfs = copy.deepcopy(archConfigs.dfs) # reset the equations # Generate original raw df runs[path_to_dir].raw_pmc = file_io.create_df_pmc(path_to_dir) - if verbose: + if verbose >= 1: print("disp-filter is ", disp_filt) print("kernel-filter is ", kernel_filter) - print("gpu-filter is ", gcd_filter) + print("gpu-filter is ", gcd_filter, "\n") runs[path_to_dir].filter_kernel_ids = kernel_filter runs[path_to_dir].filter_gpu_ids = gcd_filter runs[path_to_dir].filter_dispatch_ids = disp_filt diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui_components/roofline.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui_components/roofline.py index ee68e15762..ec33d7b231 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui_components/roofline.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui_components/roofline.py @@ -183,7 +183,7 @@ def get_roofline(path_to_dir, ret_df, verbose): # Generate roofline plots print("Path: ", path_to_dir) ai_data = roofline_calc.plot_application("kernels", ret_df, verbose) - if verbose: + if verbose >= 1: # print AI data for each mem level for i in ai_data: print(i, "->", ai_data[i]) diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/roofline_calc.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/roofline_calc.py index 93f6f6670f..1f49c7dde2 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/roofline_calc.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/roofline_calc.py @@ -239,7 +239,7 @@ def plot_application(sortType, ret_df, verbose): avgDuration / calls, ) ) - if verbose: + if verbose >= 2: print( "Just added {} to AI_Data at index {}. # of calls: {}".format( kernelName, index, calls @@ -299,7 +299,7 @@ def plot_application(sortType, ret_df, verbose): + (row["SQ_INSTS_VALU_MFMA_MOPS_F64"] * 512) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped total_flops at index {}".format(index)) pass try: @@ -327,7 +327,7 @@ def plot_application(sortType, ret_df, verbose): ) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped valu_flops at index {}".format(index)) pass @@ -338,7 +338,7 @@ def plot_application(sortType, ret_df, verbose): mfma_flops_f64 += row["SQ_INSTS_VALU_MFMA_MOPS_F64"] * 512 mfma_iops_i8 += row["SQ_INSTS_VALU_MFMA_MOPS_I8"] * 512 except KeyError: - if verbose: + if verbose >= 2: print("Skipped mfma ops at index {}".format(index)) pass @@ -347,14 +347,14 @@ def plot_application(sortType, ret_df, verbose): (row["SQ_LDS_IDX_ACTIVE"] - row["SQ_LDS_BANK_CONFLICT"]) * 4 * L2_BANKS ) # L2_BANKS = 32 (since assuming mi200) except KeyError: - if verbose: + if verbose >= 2: print("Skipped lds_data at index {}".format(index)) pass try: L1cache_data += row["TCP_TOTAL_CACHE_ACCESSES_sum"] * 64 except KeyError: - if verbose: + if verbose >= 2: print("Skipped L1cache_data at index {}".format(index)) pass @@ -366,7 +366,7 @@ def plot_application(sortType, ret_df, verbose): + row["TCP_TCC_READ_REQ_sum"] * 64 ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped L2cache_data at index {}".format(index)) pass try: @@ -377,7 +377,7 @@ def plot_application(sortType, ret_df, verbose): + ((row["TCC_EA_WRREQ_sum"] - row["TCC_EA_WRREQ_64B_sum"]) * 32) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped hbm_data at index {}".format(index)) pass diff --git a/projects/rocprofiler-compute/src/parser.py b/projects/rocprofiler-compute/src/parser.py index 6559e7dc0b..0d94e2b2e3 100644 --- a/projects/rocprofiler-compute/src/parser.py +++ b/projects/rocprofiler-compute/src/parser.py @@ -80,7 +80,7 @@ def parse(my_parser): "-v", "--version", action="version", version="%(PROG)s (" + VER + ")" ) general_group.add_argument( - "-V", "--verbose", help="Increase output verbosity", action="store_true" + "-V", "--verbose", help="Increase output verbosity", action="count", default=0 ) profile_group.add_argument( @@ -231,7 +231,7 @@ def parse(my_parser): "-v", "--version", action="version", version="%(PROG)s (" + VER + ")" ) general_group.add_argument( - "-V", "--verbose", help="Increase output verbosity", action="store_true" + "-V", "--verbose", help="Increase output verbosity", action="count", default=0 ) interaction_group.add_argument( @@ -331,7 +331,7 @@ def parse(my_parser): "-v", "--version", action="version", version="%(PROG)s (" + VER + ")" ) general_group.add_argument( - "-V", "--verbose", help="Increase output verbosity", action="store_true" + "-V", "--verbose", help="Increase output verbosity", action="count", default=0 ) analyze_group.add_argument( diff --git a/projects/rocprofiler-compute/src/utils/plot_roofline.py b/projects/rocprofiler-compute/src/utils/plot_roofline.py index 496c5bffae..d1d0958cc7 100644 --- a/projects/rocprofiler-compute/src/utils/plot_roofline.py +++ b/projects/rocprofiler-compute/src/utils/plot_roofline.py @@ -294,7 +294,7 @@ def plot_application(inputs, verbose): avgDuration / calls, ) ) - if verbose: + if verbose >= 2: print( "Just added {} to AI_Data at index {}. # of calls: {}".format( kernelName, index, calls @@ -354,7 +354,7 @@ def plot_application(inputs, verbose): + (row["SQ_INSTS_VALU_MFMA_MOPS_F64"] * 512) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped total_flops at index {}".format(index)) pass try: @@ -382,7 +382,7 @@ def plot_application(inputs, verbose): ) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped valu_flops at index {}".format(index)) pass @@ -393,7 +393,7 @@ def plot_application(inputs, verbose): mfma_flops_f64 += row["SQ_INSTS_VALU_MFMA_MOPS_F64"] * 512 mfma_iops_i8 += row["SQ_INSTS_VALU_MFMA_MOPS_I8"] * 512 except KeyError: - if verbose: + if verbose >= 2: print("Skipped mfma ops at index {}".format(index)) pass @@ -402,14 +402,14 @@ def plot_application(inputs, verbose): (row["SQ_LDS_IDX_ACTIVE"] - row["SQ_LDS_BANK_CONFLICT"]) * 4 * L2_BANKS ) # L2_BANKS = 32 (since assuming mi200) except KeyError: - if verbose: + if verbose >= 2: print("Skipped lds_data at index {}".format(index)) pass try: L1cache_data += row["TCP_TOTAL_CACHE_ACCESSES_sum"] * 64 except KeyError: - if verbose: + if verbose >= 2: print("Skipped L1cache_data at index {}".format(index)) pass @@ -421,7 +421,7 @@ def plot_application(inputs, verbose): + row["TCP_TCC_READ_REQ_sum"] * 64 ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped L2cache_data at index {}".format(index)) pass try: @@ -432,7 +432,7 @@ def plot_application(inputs, verbose): + ((row["TCC_EA_WRREQ_sum"] - row["TCC_EA_WRREQ_64B_sum"]) * 32) ) except KeyError: - if verbose: + if verbose >= 2: print("Skipped hbm_data at index {}".format(index)) pass From d67d888e14fbf7e328df3cd013dbd6f656bcab53 Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Wed, 9 Nov 2022 12:25:20 -0600 Subject: [PATCH 3/3] Reduce default content in GUI #9 Signed-off-by: colramos-amd [ROCm/rocprofiler-compute commit: d4bf9d1c162dd966ca83e842ce945c68df97627d] --- .../src/omniperf_cli/omniperf_cli.py | 4 +--- .../src/omniperf_cli/utils/gui.py | 23 +++++++++++++++---- .../src/omniperf_cli/utils/parser.py | 17 +++++++------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py b/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py index bf900c9d27..e7a03dc32e 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/omniperf_cli.py @@ -175,9 +175,7 @@ def omniperf_cli(args): args.path[0][0] ) # create mega df is_gui = False - # parser.load_table_data( - # runs[args.path[0][0]], args.path[0][0], is_gui, args.g - # ) # create the loaded table + parser.load_kernel_top(runs[args.path[0][0]], args.path[0][0]) input_filters = { "kernel": runs[args.path[0][0]].filter_kernel_ids, diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py index 1c347e2088..fb67974b26 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/gui.py @@ -308,9 +308,7 @@ def build_layout( Build gui layout """ comparable_columns = parser.build_comparable_columns(time_unit) - base_run, base_data = next(iter(runs.items())) - app.layout = html.Div(style={"backgroundColor": "rgb(50, 50, 50)" if IS_DARK else ""}) filt_kernel_names = [] @@ -343,6 +341,7 @@ def build_layout( ) def generate_from_filter(disp_filt, kernel_filter, gcd_filter, div_children): runs[path_to_dir].dfs = copy.deepcopy(archConfigs.dfs) # reset the equations + panel_configs = copy.deepcopy(archConfigs.panel_configs) # Generate original raw df runs[path_to_dir].raw_pmc = file_io.create_df_pmc(path_to_dir) if verbose >= 1: @@ -361,11 +360,27 @@ def build_layout( time_unit, num_results, ) - # Evaluate metrics and table data from the raw df is_gui = True + # Only display basic metrics if no filters are applied + if not (disp_filt or kernel_filter or gcd_filter): + temp = {} + keep = [1, 201, 101, 1901] + for key in runs[path_to_dir].dfs: + if keep.count(key) != 0: + temp[key] = runs[path_to_dir].dfs[key] + + runs[path_to_dir].dfs = temp + temp = {} + keep = [0, 100, 200, 1900] + for key in panel_configs: + if keep.count(key) != 0: + temp[key] = panel_configs[key] + panel_configs = temp + parser.load_table_data( runs[path_to_dir], path_to_dir, True, debug ) # Note: All the filtering happens in this function + div_children = [] div_children.append( get_memchart(archConfigs.panel_configs[1900]["data source"], base_data) @@ -379,7 +394,7 @@ def build_layout( ) ) # Iterate over each section as defined in panel configs - for panel_id, panel in archConfigs.panel_configs.items(): + for panel_id, panel in panel_configs.items(): title = str(panel_id // 100) + ". " + panel["title"] section_title = ( panel["title"] diff --git a/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py b/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py index de416ac174..4b674ab592 100644 --- a/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py +++ b/projects/rocprofiler-compute/src/omniperf_cli/utils/parser.py @@ -650,7 +650,6 @@ def apply_filters(workload, is_gui, debug): # NB: support ignoring the 1st n dispatched execution by '> n' # The better way may be parsing python slice string for d in workload.filter_dispatch_ids: - print("len of ret_df is ", len(ret_df)) if int(d) > len(ret_df) - 2: # subtract 2 bc of the two header rows print("{} is an invalid dispatch id.".format(d)) sys.exit(1) @@ -674,12 +673,7 @@ def apply_filters(workload, is_gui, debug): return ret_df -def load_table_data(workload, dir, is_gui, debug): - """ - Load data for all "raw_csv_table". - Calculate mertric value for all "metric_table". - """ - +def load_kernel_top(workload, dir): # NB: # - Do pmc_kernel_top.csv loading before eval_metric because we need the kernel names. # - There might be a better way/timing to load raw_csv_table. @@ -698,9 +692,16 @@ def load_table_data(workload, dir, is_gui, debug): # All transposed columns should be marked with a general header, # so tty could detect them and show them correctly in comparison. tmp[id].columns = ["Info"] - workload.dfs.update(tmp) + +def load_table_data(workload, dir, is_gui, debug): + """ + Load data for all "raw_csv_table". + Calculate mertric value for all "metric_table". + """ + load_kernel_top(workload, dir) + eval_metric( workload.dfs, workload.dfs_type,