Skip to content

Commit

Permalink
Cherry-pick [Reduce number of calls to rocprof #384] into release/roc…
Browse files Browse the repository at this point in the history
…m-rel-6.2 (#422)

* Improve perfmon coalescing

Signed-off-by: benrichard-amd <[email protected]>

* Interleve TCC channel counters

Signed-off-by: benrichard-amd <[email protected]>

* Remove duplicate normal counters
Interleve TCC channel counters in putput file  e.g.  TCC_HIT[0] TCC_ATOMIC[0] ... TCC_HIT[1] TCC_ATOMIC[1]

Signed-off-by: benrichard-amd <[email protected]>

* Save accumulate counters to SQ_ files

Omniperf analyze expects the accumulate files to be in SQ_*.csv files.

Since these files also contain PMC counters (we are trying to
fit as many counters into each file as possible to minimize runs),
we need to include these SQ_*.csv files in pmc_perf.csv.

Signed-off-by: benrichard-amd <[email protected]>

* Update to work with rocprof v1

Signed-off-by: benrichard-amd <[email protected]>

* Remove unused method

Signed-off-by: benrichard-amd <[email protected]>

* Set correct number of TCC channels for gfx942

Ran into rocprof error:
ROCProfiler: fatal error: input metric'TCC_EA0_RDREQ[16]' not supported on this hardware: gfx942

gfx942 has 16 channels, not 32.

Signed-off-by: benrichard-amd <[email protected]>

* Fix code formatting

Signed-off-by: benrichard-amd <[email protected]>

---------

Signed-off-by: benrichard-amd <[email protected]>
  • Loading branch information
benrichard-amd authored Sep 9, 2024
1 parent 119db87 commit afa43ff
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 263 deletions.
42 changes: 4 additions & 38 deletions src/omniperf_profile/profiler_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,43 +62,6 @@ def get_profiler_options(self, fname):
# assume no SoC specific options and return empty list by default
return []

@demarcate
def pmc_perf_split(self):
"""Avoid default rocprof join utility by spliting each line into a separate input file"""
workload_perfmon_dir = os.path.join(self.__args.path, "perfmon")
lines = (
open(os.path.join(workload_perfmon_dir, "pmc_perf.txt"), "r")
.read()
.splitlines()
)

# Iterate over each line in pmc_perf.txt
mpattern = r"^pmc:(.*)"
i = 0
for line in lines:
# Verify no comments
stext = line.split("#")[0].strip()
if not stext:
continue

# all pmc counters start with "pmc:"
m = re.match(mpattern, stext)
if m is None:
continue

# Create separate file for each line
fd = open(workload_perfmon_dir + "/pmc_perf_" + str(i) + ".txt", "w")
fd.write(stext + "\n\n")
fd.write("gpu:\n")
fd.write("range:\n")
fd.write("kernel:\n")
fd.close()

i += 1

# Remove old pmc_perf.txt input from perfmon dir
os.remove(workload_perfmon_dir + "/pmc_perf.txt")

@demarcate
def join_prof(self, out=None):
"""Manually join separated rocprof runs"""
Expand All @@ -107,6 +70,7 @@ def join_prof(self, out=None):
if out is None:
out = self.__args.path + "/pmc_perf.csv"
files = glob.glob(self.__args.path + "/" + "pmc_perf_*.csv")
files.extend(glob.glob(self.__args.path + "/" + "SQ_*.csv"))
elif type(self.__args.path) == list:
files = self.__args.path
else:
Expand Down Expand Up @@ -261,7 +225,9 @@ def join_prof(self, out=None):
df.to_csv(out, index=False)
if not self.__args.verbose:
for file in files:
os.remove(file)
# Do not remove accumulate counter files
if "SQ_" not in file:
os.remove(file)
else:
return df

Expand Down
2 changes: 0 additions & 2 deletions src/omniperf_profile/profiler_rocprof_v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ def get_profiler_options(self, fname):
def pre_processing(self):
"""Perform any pre-processing steps prior to profiling."""
super().pre_processing()
if self.ready_to_profile:
self.pmc_perf_split()

@demarcate
def run_profiling(self, version: str, prog: str):
Expand Down
2 changes: 0 additions & 2 deletions src/omniperf_profile/profiler_rocprof_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ def get_profiler_options(self, fname):
def pre_processing(self):
"""Perform any pre-processing steps prior to profiling."""
super().pre_processing()
if self.ready_to_profile:
self.pmc_perf_split()

@demarcate
def run_profiling(self, version, prog):
Expand Down
Loading

0 comments on commit afa43ff

Please sign in to comment.