diff --git a/src/omniperf_base.py b/src/omniperf_base.py index 39b84946..50a6cf00 100644 --- a/src/omniperf_base.py +++ b/src/omniperf_base.py @@ -55,6 +55,12 @@ "gfx942": {"mi300": ["MI300A_A1", "MI300X_A1"]}, } +MI300_CHIP_IDS = { + "29856": "MI300A_A1", + "29857": "MI300X_A1", + "29858": "MI308X", +} + class Omniperf: def __init__(self): diff --git a/src/omniperf_soc/soc_base.py b/src/omniperf_soc/soc_base.py index 446c6a82..8a480872 100644 --- a/src/omniperf_soc/soc_base.py +++ b/src/omniperf_soc/soc_base.py @@ -34,6 +34,7 @@ from collections import OrderedDict from omniperf_base import SUPPORTED_ARCHS +from omniperf_base import MI300_CHIP_IDS class OmniSoC_Base: @@ -100,11 +101,6 @@ def get_profiler_options(self): # assume no SoC specific options and return empty list by default return [] - def check_arch_override(self): - if "OMNIPERF_ARCH_OVERRIDE" in os.environ.keys(): - return os.environ["OMNIPERF_ARCH_OVERRIDE"] - return "" - @demarcate def populate_mspec(self): from utils.specs import search, run, total_sqc, total_xcds @@ -156,6 +152,11 @@ def populate_mspec(self): self._mspec.workgroup_max_size = key continue + key = search(r"^\s*Chip ID:\s+ ([a-zA-Z0-9]+)\s*", linetext) + if key != None: + self._mspec.chip_id = key + continue + key = search(r"^\s*Max Waves Per CU:\s+ ([a-zA-Z0-9]+)\s*", linetext) if key != None: self._mspec.max_waves_per_cu = key @@ -181,28 +182,9 @@ def populate_mspec(self): 0 ].upper() if self._mspec.gpu_model == "MI300": - self._mspec.gpu_model = list(SUPPORTED_ARCHS[self._mspec.gpu_arch].values())[ - 0 - ][0] - if self._mspec.gpu_arch == "gfx942": - if ( - "MI300A" in "\n".join(self._mspec._rocminfo) - or "MI300A" in self.check_arch_override() - ): - self._mspec.gpu_model = "MI300A_A1" - elif ( - "MI300X" in "\n".join(self._mspec._rocminfo) - or "MI300X" in self.check_arch_override() - ): - self._mspec.gpu_model = "MI300X_A1" - # We need to distinguish MI308X by peeking reported num CUs - elif self._mspec.cu_per_gpu == "80" or "MI308X" in self.check_arch_override(): - self._mspec.gpu_model = "MI308X" - else: - console_error( - "Cannot parse MI300 details from rocminfo. Please verify output or set the arch using (e.g.,) " - 'export OMNIPERF_ARCH_OVERRIDE="MI300A"' - ) + # Use Chip ID to distinguish MI300 gpu model using the built-in dictionary + if self._mspec.chip_id in MI300_CHIP_IDS: + self._mspec.chip_id = MI300_CHIP_IDS[self._mspec.chip_id] self._mspec.num_xcd = str( total_xcds(self._mspec.gpu_model, self._mspec.compute_partition) diff --git a/src/utils/specs.py b/src/utils/specs.py index 02f58489..07938bcf 100644 --- a/src/utils/specs.py +++ b/src/utils/specs.py @@ -403,6 +403,13 @@ class MachineSpecs: "name": "Workgroup Max Size", }, ) + chip_id: str = field( + default=None, + metadata={ + "doc": "<>", + "name": "Chip ID", + }, + ) max_waves_per_cu: str = field( default=None, metadata={