Skip to content

Commit

Permalink
Only necessary arch in archconfigs
Browse files Browse the repository at this point in the history
-  Moved creating archConfigs so that only necessary arch are used
-  Moved build_metric_value_string for same reason
-  Moved list_metrics to after archConfigs creation

Signed-off-by: JoseSantosAMD <[email protected]>
  • Loading branch information
JoseSantosAMD committed Jul 18, 2023
1 parent d7ba2ac commit 0ffb25b
Showing 1 changed file with 36 additions and 41 deletions.
77 changes: 36 additions & 41 deletions src/omniperf_analyze/omniperf_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,46 +60,6 @@ def initialize_run(args, normalization_filter=None):
single_panel_config = file_io.is_single_panel_config(Path(args.config_dir))
global archConfigs
archConfigs = {}
for arch in file_io.supported_arch.keys():
ac = schema.ArchConfig()
if args.list_kernels:
ac.panel_configs = file_io.top_stats_build_in_config
else:
arch_panel_config = (
args.config_dir if single_panel_config else args.config_dir.joinpath(arch)
)
ac.panel_configs = file_io.load_panel_configs(arch_panel_config)

# TODO: filter_metrics should/might be one per arch
# print(ac)

parser.build_dfs(ac, args.filter_metrics)

archConfigs[arch] = ac

if args.list_metrics in file_io.supported_arch.keys():
print(
tabulate(
pd.DataFrame.from_dict(
archConfigs[args.list_metrics].metric_list,
orient="index",
columns=["Metric"],
),
headers="keys",
tablefmt="fancy_grid",
),
file=output,
)
sys.exit(0)

# Use original normalization or user input from GUI
if not normalization_filter:
for k, v in archConfigs.items():
parser.build_metric_value_string(v.dfs, v.dfs_type, args.normal_unit)
else:
for k, v in archConfigs.items():
parser.build_metric_value_string(v.dfs, v.dfs_type, normalization_filter)

runs = OrderedDict()

# err checking for multiple runs and multiple gpu_kernel filter
Expand All @@ -121,11 +81,46 @@ def initialize_run(args, normalization_filter=None):
w.sys_info = file_io.load_sys_info(Path(d[0], "sysinfo.csv"))
w.avail_ips = w.sys_info["ip_blocks"].item().split("|")
arch = w.sys_info.iloc[0]["gpu_soc"]
w.dfs = copy.deepcopy(archConfigs[arch].dfs)

if arch in file_io.supported_arch.keys() and not(arch in archConfigs.keys()):
ac = schema.ArchConfig()
if args.list_kernels:
ac.panel_configs = file_io.top_stats_build_in_config
else:
arch_panel_config = (
args.config_dir if single_panel_config else args.config_dir.joinpath(arch)
)
ac.panel_configs = file_io.load_panel_configs(arch_panel_config)
parser.build_dfs(ac, args.filter_metrics)
archConfigs[arch] = ac

if not normalization_filter:
for k, v in archConfigs.items():
parser.build_metric_value_string(v.dfs, v.dfs_type, args.normal_unit)
else:
for k, v in archConfigs.items():
parser.build_metric_value_string(v.dfs, v.dfs_type, normalization_filter)

w.dfs = copy.deepcopy(archConfigs[arch].dfs) # generate here if needed
w.dfs_type = archConfigs[arch].dfs_type
w.soc_spec = file_io.get_soc_params(soc_spec_df, arch)
runs[d[0]] = w

if args.list_metrics in file_io.supported_arch.keys():
print(
tabulate(
pd.DataFrame.from_dict(
archConfigs[args.list_metrics].metric_list,
orient="index",
columns=["Metric"],
),
headers="keys",
tablefmt="fancy_grid",
),
file=output,
)
sys.exit(0)

# Return rather than referencing 'runs' globally (since used outside of file scope)
return runs

Expand Down

0 comments on commit 0ffb25b

Please sign in to comment.