diff --git a/TraceLens/PerfModel/benchmarking/microbench.py b/TraceLens/PerfModel/benchmarking/microbench.py index 47648ff54..e6e27abd8 100644 --- a/TraceLens/PerfModel/benchmarking/microbench.py +++ b/TraceLens/PerfModel/benchmarking/microbench.py @@ -41,6 +41,7 @@ import argparse import json import logging +import re import time from pathlib import Path from typing import Dict, List, Optional, Tuple @@ -169,6 +170,12 @@ def _bpe(dtype: torch.dtype) -> int: def _arch_product_name(gpu_name: str, mem_gb: float) -> str: """Short name to match arch JSONs like `MI300X.json` (e.g. 'MI300X').""" + # Client parts report e.g. "AMD Radeon 8060S Graphics": the model sits + # between the brand and the trailing "Graphics", which names no model. + match = re.search(r"\bRadeon\s+(.+?)\s+Graphics\b", gpu_name, re.IGNORECASE) + if match: + return "_".join(["Radeon", *match.group(1).split()]) + # ROCm containers often report a generic device string; use memory tier as hint. mem = int(round(mem_gb)) if mem >= 280: diff --git a/tests/test_perfmodel_benchmarking.py b/tests/test_perfmodel_benchmarking.py index 9a1845583..6322a5aac 100644 --- a/tests/test_perfmodel_benchmarking.py +++ b/tests/test_perfmodel_benchmarking.py @@ -133,8 +133,13 @@ def test_gemm_flops(self): "gpu_name,mem_gb,expected", [ ("AMD Instinct MI300X", 192.0, "MI300X"), + ("AMD Instinct MI210", 64.0, "MI210"), + # Trailing "Graphics" is a marketing suffix, not the model. + ("AMD Radeon 8060S Graphics", 64.0, "Radeon_8060S"), + ("AMD Radeon 890M Graphics", 32.0, "Radeon_890M"), ("Generic GPU", 280.0, "MI355X"), ("Some Card", 64.0, "Card"), + ("", 0.0, "GPU"), ], ) def test_arch_product_name(self, gpu_name, mem_gb, expected):