Combine kernel and dispatch stats in the Top Stats section of analysis

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


[ROCm/rocprofiler-compute commit: 2526e14802]
Этот коммит содержится в:
colramos-amd
2024-02-13 19:17:41 -06:00
родитель 6bedf1ebf6
Коммит 85c4cec42e
5 изменённых файлов: 49 добавлений и 33 удалений
+5 -5
Просмотреть файл
@@ -391,9 +391,9 @@ def omniarg_parser(parser, omniperf_home, supported_archs, omniperf_version):
help="\t\tSpecify the raw data root dirs or desired results directory.",
)
analyze_group.add_argument(
"--list-kernels",
"--list-stats",
action="store_true",
help="\t\tList all detected kernels. Sorted by duration (descending order).",
help="\t\tList all detected kernels and kernel dispatches.",
)
analyze_group.add_argument(
"--list-metrics",
@@ -455,12 +455,12 @@ def omniarg_parser(parser, omniperf_home, supported_archs, omniperf_version):
help="\t\tRandomly generate a port to launch GUI application.\n\t\tRegistered Ports range inclusive (1024-49151).",
)
analyze_advanced_group.add_argument(
"--max-kernel-num",
dest="max_kernel_num",
"--max-stat-num",
dest="max_stat_num",
metavar="",
type=int,
default=10,
help="\t\tSpecify the maximum number of kernels shown in \"Top Stats\" table (DEFAULT: 10)",
help="\t\tSpecify the maximum number of stats shown in \"Top Stats\" tables (DEFAULT: 10)",
)
analyze_advanced_group.add_argument(
"-n",
+4 -4
Просмотреть файл
@@ -51,11 +51,11 @@ class OmniAnalyze_Base():
return self.__socs
@demarcate
def generate_configs(self, arch, config_dir, list_kernels, filter_metrics, sys_info):
def generate_configs(self, arch, config_dir, list_stats, filter_metrics, sys_info):
single_panel_config = file_io.is_single_panel_config(Path(config_dir), self.__supported_archs)
ac = schema.ArchConfig()
if list_kernels:
if list_stats:
ac.panel_configs = file_io.top_stats_build_in_config
else:
arch_panel_config = (
@@ -81,7 +81,7 @@ class OmniAnalyze_Base():
arch = args.list_metrics
if arch not in self._arch_configs.keys():
sys_info = file_io.load_sys_info(Path(self.__args.path[0][0], "sysinfo.csv"))
self.generate_configs(arch, args.config_dir, args.list_kernels, args.filter_metrics, sys_info.iloc[0])
self.generate_configs(arch, args.config_dir, args.list_stats, args.filter_metrics, sys_info.iloc[0])
for key, value in self._arch_configs[args.list_metrics].metric_list.items():
prefix = ""
@@ -124,7 +124,7 @@ class OmniAnalyze_Base():
sys_info = file_io.load_sys_info(Path(d[0], "sysinfo.csv"))
arch = sys_info.iloc[0]["gpu_soc"]
args = self.__args
self.generate_configs(arch, args.config_dir, args.list_kernels, args.filter_metrics, sys_info.iloc[0])
self.generate_configs(arch, args.config_dir, args.list_stats, args.filter_metrics, sys_info.iloc[0])
self.load_options(normalization_filter)
+3 -3
Просмотреть файл
@@ -48,7 +48,7 @@ class cli_analysis(OmniAnalyze_Base):
filter_gpu_ids=self._runs[d[0]].filter_gpu_ids,
filter_dispatch_ids=self._runs[d[0]].filter_dispatch_ids,
time_unit=self.get_args().time_unit,
max_kernel_num=self.get_args().max_kernel_num
max_stat_num=self.get_args().max_stat_num
)
# create 'mega dataframe'
self._runs[d[0]].raw_pmc = file_io.create_df_pmc(
@@ -69,8 +69,8 @@ class cli_analysis(OmniAnalyze_Base):
"""Run CLI analysis.
"""
super().run_analysis()
if self.get_args().list_kernels:
tty.show_kernels(
if self.get_args().list_stats:
tty.show_kernel_stats(
self.get_args(),
self._runs,
self._arch_configs[self._runs[self.get_args().path[0][0]].sys_info.iloc[0]["gpu_soc"]],
+7 -7
Просмотреть файл
@@ -43,8 +43,13 @@ import logging
top_stats_build_in_config = {
0: {
"id": 0,
"title": "Top Stat",
"title": "Top Kernels",
"data source": [{"raw_csv_table": {"id": 1, "source": "pmc_kernel_top.csv"}}],
},
1: {
"id": 1,
"title": "Dispatch List",
"data source": [{"raw_csv_table": {"id": 2, "source": "pmc_dispatch_info.csv"}}],
}
}
@@ -82,7 +87,7 @@ def create_df_kernel_top_stats(
filter_gpu_ids,
filter_dispatch_ids,
time_unit,
max_kernel_num,
max_stat_num,
sortby="sum",
):
"""
@@ -142,14 +147,9 @@ def create_df_kernel_top_stats(
# Sort by total time as default.
if sortby == "sum":
grouped = grouped.sort_values(by=("Sum" + time_unit_str), ascending=False)
grouped = grouped.head(max_kernel_num) # Display only the top n results
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
elif sortby == "kernel":
grouped = grouped.sort_values("Kernel_Name")
grouped = grouped.head(max_kernel_num) # Display only the top n results
grouped.to_csv(os.path.join(raw_data_dir, "pmc_kernel_top.csv"), index=False)
+30 -14
Просмотреть файл
@@ -200,6 +200,12 @@ def show_all(args, runs, archConfigs, output):
index=False,
)
# Only show top N kernels (as specified in --max-kernel-num) in "Top Stats" section
if(
type == "raw_csv_table"
and (table_config["source"] == "pmc_kernel_top.csv" or table_config["source"] == "pmc_dispatch_info.csv")
):
df = df.head(args.max_stat_num)
# NB:
# "columnwise: True" is a special attr of a table/df
# For raw_csv_table, such as system_info, we transpose the
@@ -226,30 +232,40 @@ def show_all(args, runs, archConfigs, output):
print(ss, file=output)
def show_kernels(args, runs, archConfigs, output):
def show_kernel_stats(args, runs, archConfigs, output):
"""
Show the kernels from top stats.
Show the kernels and dispatches from "Top Stats" section.
"""
print("\n" + "-" * 80, file=output)
print("Detected Kernels", file=output)
# print("\n" + "-" * 80, file=output)
# print("Detected Kernels (sorted decending by duration)", file=output)
df = pd.DataFrame()
for panel_id, panel in archConfigs.panel_configs.items():
for data_source in panel["data source"]:
for type, table_config in data_source.items():
for run, data in runs.items():
df = pd.DataFrame()
single_df = data.dfs[table_config["id"]]
# NB:
# For pmc_kernel_top.csv, have to sort here if not
# sorted when load_table_data.
df = pd.concat([df, single_df["Kernel_Name"]], axis=1)
if table_config["id"] == 1:
print("\n" + "-" * 80, file=output)
print("Detected Kernels (sorted decending by duration)", file=output)
df = pd.concat([df, single_df["Kernel_Name"]], axis=1)
if table_config["id"] == 2:
print("\n" + "-" * 80, file=output)
print("Dispatch list", file=output)
df = single_df
print(
tabulate(
df,
headers="keys",
tablefmt="fancy_grid",
floatfmt="." + str(args.decimal) + "f",
),
file=output,
)
print(
tabulate(
df,
headers="keys",
tablefmt="fancy_grid",
floatfmt="." + str(args.decimal) + "f",
),
file=output,
)