diff --git a/projects/rocprofiler-compute/src/omniperf_profile/profiler_rocprof_v2.py b/projects/rocprofiler-compute/src/omniperf_profile/profiler_rocprof_v2.py index cbe69242a0..b6fcbd8672 100644 --- a/projects/rocprofiler-compute/src/omniperf_profile/profiler_rocprof_v2.py +++ b/projects/rocprofiler-compute/src/omniperf_profile/profiler_rocprof_v2.py @@ -28,7 +28,6 @@ from utils.utils import ( demarcate, console_log, replace_timestamps, - fixup_rocprofv2_dispatch_ids, ) @@ -48,10 +47,7 @@ class rocprof_v2_profiler(OmniProfiler_Base): # v2 requires output directory argument "-d", self.get_args().path + "/" + "out", - # v2 does not require csv extension - "-o", - fbase, - # v2 doen not require quotes on cmd + # v2 does not require quotes on cmd app_cmd, ] return args @@ -87,7 +83,5 @@ class rocprof_v2_profiler(OmniProfiler_Base): if self.ready_to_profile: # Manually join each pmc_perf*.csv output self.join_prof() - # Correct dispatch ids - fixup_rocprofv2_dispatch_ids(self.get_args().path) # Replace timestamp data to solve a known rocprof bug replace_timestamps(self.get_args().path) diff --git a/projects/rocprofiler-compute/src/utils/utils.py b/projects/rocprofiler-compute/src/utils/utils.py index b99d6a0b43..a4b1a10b33 100644 --- a/projects/rocprofiler-compute/src/utils/utils.py +++ b/projects/rocprofiler-compute/src/utils/utils.py @@ -282,6 +282,22 @@ def run_prof(fname, profiler_options, workload_dir, mspec, loglevel): console_error(output, exit=False) console_error("Profiling execution failed.") + if rocprof_cmd.endswith("v2"): + # rocprofv2 has separate csv files for each process + results_files = glob.glob(workload_dir + "/out/pmc_1/results_*.csv") + + # Combine results into single CSV file + combined_results = pd.concat( + [pd.read_csv(f) for f in results_files], ignore_index=True + ) + + # Overwrite column to ensure unique IDs. + combined_results["Dispatch_ID"] = range(0, len(combined_results)) + + combined_results.to_csv( + workload_dir + "/out/pmc_1/results_" + fbase + ".csv", index=False + ) + if new_env: # flatten tcc for applicable mi300 input f = path(workload_dir + "/out/pmc_1/results_" + fbase + ".csv") @@ -655,16 +671,3 @@ def set_locale_encoding(): exit=False, ) console_error(error) - - -def fixup_rocprofv2_dispatch_ids(workload_dir): - # Workaround for rocprofv2 using 1-based dispatch indicies - # first read pmc_perf - df = pd.read_csv(workload_dir + "/pmc_perf.csv") - df["Dispatch_ID"] -= 1 - df.to_csv(workload_dir + "/pmc_perf.csv", index=False) - # next glob for *LEVEL*.csv - for f in glob.glob(workload_dir + "/*LEVEL*.csv"): - df = pd.read_csv(f) - df["Dispatch_ID"] -= 1 - df.to_csv(f, index=False)