Comply to Python formatting

Signed-off-by: colramos-amd <colramos@amd.com>


[ROCm/rocprofiler-compute commit: 4d8383b439]
This commit is contained in:
colramos-amd
2023-07-11 14:14:10 -05:00
vanhempi 1145579dbe
commit 91dee25ea2
2 muutettua tiedostoa jossa 16 lisäystä ja 18 poistoa
@@ -342,7 +342,7 @@ def gen_counter_list(formula):
"GFLOPs": None, "GFLOPs": None,
} }
built_in_counter=[ built_in_counter = [
"lds", "lds",
"grd", "grd",
"wgr", "wgr",
@@ -351,7 +351,7 @@ def gen_counter_list(formula):
"sgpr", "sgpr",
"scr", "scr",
"BeginNs", "BeginNs",
"EndNs" "EndNs",
] ]
visited = False visited = False
@@ -367,7 +367,7 @@ def gen_counter_list(formula):
for node in ast.walk(tree): for node in ast.walk(tree):
if isinstance(node, ast.Name): if isinstance(node, ast.Name):
val = str(node.id)[:-4] if str(node.id).endswith("_sum") else str(node.id) 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) counters.append(val)
visited = True visited = True
if val in built_in_counter: if val in built_in_counter:
@@ -404,7 +404,7 @@ def build_dfs(archConfigs, filter_metrics):
metric_list[panel_idx] = panel["title"] metric_list[panel_idx] = panel["title"]
table_idx = panel_idx + "." + str(data_cofig["id"] % 100) table_idx = panel_idx + "." + str(data_cofig["id"] % 100)
metric_list[table_idx] = data_cofig["title"] metric_list[table_idx] = data_cofig["title"]
headers = ["Index"] headers = ["Index"]
for key, tile in data_cofig["header"].items(): for key, tile in data_cofig["header"].items():
if key != "tips": if key != "tips":
@@ -257,19 +257,16 @@ def pmc_perf_split(workload_dir):
def update_pmc_bucket( def update_pmc_bucket(
counters, counters, save_file, soc, pmc_list=None, stext=None, workload_perfmon_dir=None
save_file, ):
soc,
pmc_list=None,
stext=None,
workload_perfmon_dir=None
):
# Verify inputs. # Verify inputs.
# If save_file is True, we're being called internally, from perfmon_coalesce # If save_file is True, we're being called internally, from perfmon_coalesce
# Else we're being called externally, from rocomni # Else we're being called externally, from rocomni
detected_extermal_call = False detected_extermal_call = False
if save_file and (stext is None or workload_perfmon_dir is None): 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: if pmc_list is None:
detected_extermal_call = True detected_extermal_call = True
pmc_list = dict( pmc_list = dict(
@@ -289,7 +286,7 @@ def update_pmc_bucket(
) )
for ch in range(perfmon_config[soc]["TCC_channels"]): for ch in range(perfmon_config[soc]["TCC_channels"]):
pmc_list["TCC2"][str(ch)] = [] pmc_list["TCC2"][str(ch)] = []
if "SQ_ACCUM_PREV_HIRES" in counters: if "SQ_ACCUM_PREV_HIRES" in counters:
# save all level counters separately # save all level counters separately
nindex = counters.index("SQ_ACCUM_PREV_HIRES") nindex = counters.index("SQ_ACCUM_PREV_HIRES")
@@ -305,7 +302,7 @@ def update_pmc_bucket(
fd.close() fd.close()
return pmc_list return pmc_list
# save normal pmc counters in matching buckets # save normal pmc counters in matching buckets
for counter in counters: for counter in counters:
IP_block = counter.split(sep="_")[0].upper() 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 # we have found all the counters, store them in buckets
counters = m.group(1).split() counters = m.group(1).split()
# Utilitze helper function once a list of counters has be extracted # Utilitze helper function once a list of counters has be extracted
save_file = True 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 # add a timestamp file
fd = open(workload_perfmon_dir + "/timestamps.txt", "w") fd = open(workload_perfmon_dir + "/timestamps.txt", "w")
fd.write("pmc:\n\n") fd.write("pmc:\n\n")
@@ -434,7 +433,6 @@ def perfmon_emit(pmc_list, soc, save_file=True, workload_dir=None):
else: else:
batches = [] batches = []
tcc2_index = 0 tcc2_index = 0
for iter in range(niter): for iter in range(niter):
# Prefix # Prefix