Enable baseline comparison between workloads from the same path (#447)

* Enable baseline comparison between workloads from the same path

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

* Formatting

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

* Change test to verify baseline works with same path

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

* Add three-way comparison test case

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

---------

Signed-off-by: zichguan-amd <zichuan.guan@amd.com>

[ROCm/rocprofiler-compute commit: 13a06f5131]
Dieser Commit ist enthalten in:
zichguan-amd
2024-10-24 13:00:36 -04:00
committet von GitHub
Ursprung e188429f06
Commit 3328cf8d6c
31 geänderte Dateien mit 492 neuen und 41 gelöschten Zeilen
@@ -151,7 +151,7 @@ class OmniAnalyze_Base:
self.load_options(normalization_filter)
for d in self.__args.path:
for i, d in enumerate(self.__args.path):
w = schema.Workload()
w.sys_info = file_io.load_sys_info(Path(d[0], "sysinfo.csv"))
arch = w.sys_info.iloc[0]["gpu_arch"]
@@ -161,7 +161,7 @@ class OmniAnalyze_Base:
w.avail_ips = w.sys_info["ip_blocks"].item().split("|")
w.dfs = copy.deepcopy(self._arch_configs[arch].dfs)
w.dfs_type = self._arch_configs[arch].dfs_type
self._runs[d[0]] = w
self._runs[i] = w
return self._runs
@@ -184,15 +184,6 @@ class OmniAnalyze_Base:
# validate profiling data
is_workload_empty(dir[0])
# no using same paths
occurances = set()
for dir in self.__args.path:
dir = dir[0]
if dir in occurances:
console_error("You cannot provide the same path twice.")
else:
occurances.add(dir)
# ----------------------------------------------------
# Required methods to be implemented by child classes
# ----------------------------------------------------
@@ -211,20 +202,20 @@ class OmniAnalyze_Base:
# set filters
if self.__args.gpu_kernel:
for d, gk in zip(self.__args.path, self.__args.gpu_kernel):
self._runs[d[0]].filter_kernel_ids = gk
for i, gk in enumerate(self.__args.gpu_kernel):
self._runs[i].filter_kernel_ids = gk
if self.__args.gpu_id:
if len(self.__args.gpu_id) == 1 and len(self.__args.path) != 1:
for i in range(len(self.__args.path) - 1):
self.__args.gpu_id.extend(self.__args.gpu_id)
for d, gi in zip(self.__args.path, self.__args.gpu_id):
self._runs[d[0]].filter_gpu_ids = gi
for i, gi in enumerate(self.__args.gpu_id):
self._runs[i].filter_gpu_ids = gi
if self.__args.gpu_dispatch_id:
if len(self.__args.gpu_dispatch_id) == 1 and len(self.__args.path) != 1:
for i in range(len(self.__args.path) - 1):
self.__args.gpu_dispatch_id.extend(self.__args.gpu_dispatch_id)
for d, gd in zip(self.__args.path, self.__args.gpu_dispatch_id):
self._runs[d[0]].filter_dispatch_ids = gd
for i, gd in enumerate(self.__args.gpu_dispatch_id):
self._runs[i].filter_dispatch_ids = gd
@abstractmethod
def run_analysis(self):
@@ -38,27 +38,25 @@ class cli_analysis(OmniAnalyze_Base):
super().pre_processing()
if self.get_args().random_port:
console_error("--gui flag is required to enable --random-port")
for d in self.get_args().path:
for i, d in enumerate(self.get_args().path):
file_io.create_df_kernel_top_stats(
raw_data_dir=d[0],
filter_gpu_ids=self._runs[d[0]].filter_gpu_ids,
filter_dispatch_ids=self._runs[d[0]].filter_dispatch_ids,
filter_gpu_ids=self._runs[i].filter_gpu_ids,
filter_dispatch_ids=self._runs[i].filter_dispatch_ids,
time_unit=self.get_args().time_unit,
max_stat_num=self.get_args().max_stat_num,
kernel_verbose=self.get_args().kernel_verbose,
)
# create 'mega dataframe'
self._runs[d[0]].raw_pmc = file_io.create_df_pmc(
self._runs[i].raw_pmc = file_io.create_df_pmc(
d[0], self.get_args().kernel_verbose, self.get_args().verbose
)
# demangle and overwrite original 'Kernel_Name'
kernel_name_shortener(
self._runs[d[0]].raw_pmc, self.get_args().kernel_verbose
)
kernel_name_shortener(self._runs[i].raw_pmc, self.get_args().kernel_verbose)
# create the loaded table
parser.load_table_data(
workload=self._runs[d[0]],
workload=self._runs[i],
dir=d[0],
is_gui=False,
debug=self.get_args().debug,
@@ -73,17 +71,13 @@ class cli_analysis(OmniAnalyze_Base):
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_arch"]
],
self._arch_configs[self._runs[0].sys_info.iloc[0]["gpu_arch"]],
self._output,
)
else:
tty.show_all(
self.get_args(),
self._runs,
self._arch_configs[
self._runs[self.get_args().path[0][0]].sys_info.iloc[0]["gpu_arch"]
],
self._arch_configs[self._runs[0].sys_info.iloc[0]["gpu_arch"]],
self._output,
)
@@ -274,20 +274,20 @@ class webui_analysis(OmniAnalyze_Base):
args = self.get_args()
file_io.create_df_kernel_top_stats(
raw_data_dir=self.dest_dir,
filter_gpu_ids=self._runs[self.dest_dir].filter_gpu_ids,
filter_dispatch_ids=self._runs[self.dest_dir].filter_dispatch_ids,
filter_gpu_ids=self._runs[0].filter_gpu_ids,
filter_dispatch_ids=self._runs[0].filter_dispatch_ids,
time_unit=args.time_unit,
max_stat_num=args.max_stat_num,
kernel_verbose=self.get_args().kernel_verbose,
)
# create 'mega dataframe'
self._runs[self.dest_dir].raw_pmc = file_io.create_df_pmc(
self._runs[0].raw_pmc = file_io.create_df_pmc(
self.dest_dir, self.get_args().kernel_verbose, args.verbose
)
# create the loaded kernel stats
parser.load_kernel_top(self._runs[self.dest_dir], self.dest_dir)
parser.load_kernel_top(self._runs[0], self.dest_dir)
# set architecture
self.arch = self._runs[self.dest_dir].sys_info.iloc[0]["gpu_arch"]
self.arch = self._runs[0].sys_info.iloc[0]["gpu_arch"]
else:
console_error(
@@ -300,9 +300,9 @@ class webui_analysis(OmniAnalyze_Base):
super().run_analysis()
args = self.get_args()
input_filters = {
"kernel": self._runs[self.dest_dir].filter_kernel_ids,
"gpu": self._runs[self.dest_dir].filter_gpu_ids,
"dispatch": self._runs[self.dest_dir].filter_dispatch_ids,
"kernel": self._runs[0].filter_kernel_ids,
"gpu": self._runs[0].filter_gpu_ids,
"dispatch": self._runs[0].filter_dispatch_ids,
"normalization": args.normal_unit,
"top_n": args.max_stat_num,
}