Skip to content

Commit

Permalink
Fix Dispatch_ID column and remove unnamed column
Browse files Browse the repository at this point in the history
-Pandas was inserting an unnamed column (index column)
-Overwrite the Dispatch_ID column so that every row is unique, starting at 0
-Remove fixup_rocprofv2_dispatch_ids as no longer needed
  • Loading branch information
benrichard-amd committed Jun 10, 2024
1 parent 49a1ed4 commit a60f232
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
3 changes: 0 additions & 3 deletions src/omniperf_profile/profiler_rocprof_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
demarcate,
console_log,
replace_timestamps,
fixup_rocprofv2_dispatch_ids,
)


Expand Down Expand Up @@ -84,7 +83,5 @@ def post_processing(self):
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)
19 changes: 5 additions & 14 deletions src/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,12 @@ def run_prof(fname, profiler_options, workload_dir, mspec, loglevel):

# Combine results into single CSV file
combined_results = pd.concat([pd.read_csv(f) for f in results_files], ignore_index=True)
combined_results.to_csv(workload_dir + "/out/pmc_1/results_" + fbase + ".csv")

# 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")
Expand Down Expand Up @@ -663,16 +667,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)

0 comments on commit a60f232

Please sign in to comment.