Skip to content

Commit

Permalink
Revert "Only necessary arch in archconfigs"
Browse files Browse the repository at this point in the history
This reverts commit 0ffb25b.
  • Loading branch information
JoseSantosAMD committed Jul 19, 2023
1 parent 0ffb25b commit 0fefca6
Showing 1 changed file with 41 additions and 36 deletions.
77 changes: 41 additions & 36 deletions src/omniperf_analyze/omniperf_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,46 @@ 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 @@ -81,46 +121,11 @@ 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"]

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 = copy.deepcopy(archConfigs[arch].dfs)
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 0fefca6

Please sign in to comment.