fix crash for running rocprofv3 on mi100 (#557)

* initial hack to fix for v3 stucking on mi100 becasue of -m parameter and missing counter csv file

* proper formating

* refactored profiler option function to take soc arch

* resolve missing step that casued error for profiler option

* fix typo of arch name

* change method of putting soc info into profiler option

* isort and black format

* add comment for the part that handles missing counter csv file

* remove unncecessary import

---------

Co-authored-by: YANG WANG <ywang@ywang-ubuntu.amd.com>
このコミットが含まれているのは:
ywang103-amd
2025-02-10 17:59:03 -05:00
committed by GitHub
コミット 5ee37b3353
7個のファイルの変更27行の追加21行の削除
+2 -4
ファイルの表示
@@ -63,7 +63,7 @@ class RocProfCompute_Base:
def get_args(self):
return self.__args
def get_profiler_options(self, fname):
def get_profiler_options(self, fname, soc):
"""Fetch any version specific arguments required by profiler"""
# assume no SoC specific options and return empty list by default
return []
@@ -361,9 +361,7 @@ class RocProfCompute_Base:
console_debug(output)
console_log("profiling", "Current input file: %s" % fname)
# Fetch any SoC/profiler specific profiling options
options = self._soc.get_profiler_options()
options += self.get_profiler_options(fname)
options = self.get_profiler_options(fname, self._soc)
if (
self.__profiler == "rocprofv1"
or self.__profiler == "rocprofv2"
+8 -2
ファイルの表示
@@ -38,10 +38,16 @@ class rocprof_v1_profiler(RocProfCompute_Base):
or not self.get_args().roof_only
)
def get_profiler_options(self, fname):
def get_profiler_options(self, fname, soc):
fbase = Path(fname).stem
app_cmd = self.get_args().remaining
args = [
args = []
# can be removed in the future. It supports gfx908 + v1
if soc.get_arch() == "gfx908":
args += ["-m", soc.get_workload_perfmon_dir() + "/" + "metrics.xml"]
args += [
# v1 requires request for timestamps
"--timestamp",
"on",
+8 -2
ファイルの表示
@@ -39,10 +39,16 @@ class rocprof_v2_profiler(RocProfCompute_Base):
or not self.get_args().roof_only
)
def get_profiler_options(self, fname):
def get_profiler_options(self, fname, soc):
fbase = Path(fname).stem
app_cmd = shlex.split(self.get_args().remaining)
args = [
args = []
# can be removed in the future. It supports gfx908 + v2
if soc.get_arch() == "gfx908":
args += ["-m", soc.get_workload_perfmon_dir() + "/" + "metrics.xml"]
args += [
# v2 requires output directory argument
"-d",
self.get_args().path + "/" + "out",
+1 -1
ファイルの表示
@@ -40,7 +40,7 @@ class rocprof_v3_profiler(RocProfCompute_Base):
or not self.get_args().roof_only
)
def get_profiler_options(self, fname):
def get_profiler_options(self, fname, soc):
app_cmd = shlex.split(self.get_args().remaining)
trace_option = "--kernel-trace"
rocprof_out_format = "json"
-6
ファイルの表示
@@ -97,12 +97,6 @@ class OmniSoC_Base:
def get_compatible_profilers(self):
return self.__compatible_profilers
@demarcate
def get_profiler_options(self):
"""Fetch any SoC specific arguments required by the profiler"""
# assume no SoC specific options and return empty list by default
return []
@demarcate
def populate_mspec(self):
from utils.specs import run, search, total_sqc, total_xcds
-5
ファイルの表示
@@ -69,11 +69,6 @@ class gfx908_soc(OmniSoC_Base):
self._mspec.max_mclk = 1200
self._mspec.cur_mclk = 1200
@demarcate
def get_profiler_options(self):
# Mi100 requires a custom xml config
return ["-m", self.get_workload_perfmon_dir() + "/" + "metrics.xml"]
# -----------------------
# Required child methods
# -----------------------
+8 -1
ファイルの表示
@@ -596,6 +596,9 @@ def run_prof(
new_env = os.environ.copy()
new_env["ROCPROFILER_INDIVIDUAL_XCC_MODE"] = "1"
is_timestamps = False
if path(fname).name == "timestamps.txt":
is_timestamps = True
time_1 = time.time()
# profile the app
@@ -686,10 +689,14 @@ def run_prof(
results_files_csv = glob.glob(
workload_dir + "/out/pmc_1/*/*_converted.csv"
)
else:
elif is_timestamps:
# when the input is timestamps, we know counter csv file is not generated and will instead parse kernel trace file
results_files_csv = glob.glob(
workload_dir + "/out/pmc_1/*/*_kernel_trace.csv"
)
else:
# when the input is not for timestamps, and counter csv file is not generated, we assume failed rocprof run and will completely bypass the file generation and merging for current pmc
return
else:
console_error("The output file of rocprofv3 can only support json or csv!!!")