From 91dee25ea2f54f825d41fe829fed241eceeb98a7 Mon Sep 17 00:00:00 2001 From: colramos-amd Date: Tue, 11 Jul 2023 14:14:10 -0500 Subject: [PATCH] Comply to Python formatting Signed-off-by: colramos-amd [ROCm/rocprofiler-compute commit: 4d8383b4390cf8cacf225954e971f31891dea39d] --- .../src/omniperf_analyze/utils/parser.py | 8 +++--- .../rocprofiler-compute/src/utils/perfagg.py | 26 +++++++++---------- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/projects/rocprofiler-compute/src/omniperf_analyze/utils/parser.py b/projects/rocprofiler-compute/src/omniperf_analyze/utils/parser.py index 025745b174..0328d7aa84 100644 --- a/projects/rocprofiler-compute/src/omniperf_analyze/utils/parser.py +++ b/projects/rocprofiler-compute/src/omniperf_analyze/utils/parser.py @@ -342,7 +342,7 @@ def gen_counter_list(formula): "GFLOPs": None, } - built_in_counter=[ + built_in_counter = [ "lds", "grd", "wgr", @@ -351,7 +351,7 @@ def gen_counter_list(formula): "sgpr", "scr", "BeginNs", - "EndNs" + "EndNs", ] visited = False @@ -367,7 +367,7 @@ def gen_counter_list(formula): for node in ast.walk(tree): if isinstance(node, ast.Name): val = str(node.id)[:-4] if str(node.id).endswith("_sum") else str(node.id) - if (val.isupper() and val not in function_filter): + if val.isupper() and val not in function_filter: counters.append(val) visited = True if val in built_in_counter: @@ -404,7 +404,7 @@ def build_dfs(archConfigs, filter_metrics): metric_list[panel_idx] = panel["title"] table_idx = panel_idx + "." + str(data_cofig["id"] % 100) metric_list[table_idx] = data_cofig["title"] - + headers = ["Index"] for key, tile in data_cofig["header"].items(): if key != "tips": diff --git a/projects/rocprofiler-compute/src/utils/perfagg.py b/projects/rocprofiler-compute/src/utils/perfagg.py index 8e95482c54..04658795c8 100755 --- a/projects/rocprofiler-compute/src/utils/perfagg.py +++ b/projects/rocprofiler-compute/src/utils/perfagg.py @@ -257,19 +257,16 @@ def pmc_perf_split(workload_dir): def update_pmc_bucket( - counters, - save_file, - soc, - pmc_list=None, - stext=None, - workload_perfmon_dir=None - ): + counters, save_file, soc, pmc_list=None, stext=None, workload_perfmon_dir=None +): # Verify inputs. # If save_file is True, we're being called internally, from perfmon_coalesce # Else we're being called externally, from rocomni detected_extermal_call = False if save_file and (stext is None or workload_perfmon_dir is None): - raise ValueError("stext and workload_perfmon_dir must be specified if save_file is True") + raise ValueError( + "stext and workload_perfmon_dir must be specified if save_file is True" + ) if pmc_list is None: detected_extermal_call = True pmc_list = dict( @@ -289,7 +286,7 @@ def update_pmc_bucket( ) for ch in range(perfmon_config[soc]["TCC_channels"]): pmc_list["TCC2"][str(ch)] = [] - + if "SQ_ACCUM_PREV_HIRES" in counters: # save all level counters separately nindex = counters.index("SQ_ACCUM_PREV_HIRES") @@ -305,7 +302,7 @@ def update_pmc_bucket( fd.close() return pmc_list - + # save normal pmc counters in matching buckets for counter in counters: IP_block = counter.split(sep="_")[0].upper() @@ -386,11 +383,13 @@ def perfmon_coalesce(pmc_files_list, workload_dir, soc): # we have found all the counters, store them in buckets counters = m.group(1).split() - + # Utilitze helper function once a list of counters has be extracted save_file = True - pmc_list = update_pmc_bucket(counters, save_file, soc, pmc_list, stext, workload_perfmon_dir) - + pmc_list = update_pmc_bucket( + counters, save_file, soc, pmc_list, stext, workload_perfmon_dir + ) + # add a timestamp file fd = open(workload_perfmon_dir + "/timestamps.txt", "w") fd.write("pmc:\n\n") @@ -434,7 +433,6 @@ def perfmon_emit(pmc_list, soc, save_file=True, workload_dir=None): else: batches = [] - tcc2_index = 0 for iter in range(niter): # Prefix