From 61025a82cbd7af0b6f4ff1e886704ec631703658 Mon Sep 17 00:00:00 2001 From: Matthias Gehre Date: Tue, 8 Sep 2026 06:48:30 -0600 Subject: [PATCH] Emit a usable product name from microbench _arch_product_name names the arch spec that microbench generates. Off the two Instinct memory tiers it recognises, it returned the last word of the device string, which is not a product name: "AMD Radeon 8060S Graphics" ends in a marketing suffix, so the generated spec was named "Graphics". Client parts report the model between the brand and that suffix, so it is read from there instead. The memory tier is left alone and still covers the generic strings ROCm containers report -- "AMD Radeon Graphics" at 192 GB has nothing between brand and suffix, so it does not match and resolves to MI300X as before. Changes: - The regex only matches the "AMD Radeon Graphics" form, so discrete boards ("AMD Radeon RX 7900 XTX") keep the last-word fallback. That form is what the affected APUs report; widening it to every Radeon string would need a list of marketing suffixes this does not want to carry. - Names are joined with "_" so the result is usable as an arch JSON stem, the way MI300X.json's name field already matches its filename. - The added test_arch_product_name cases cannot execute anywhere torch is installed: 6306fc7d dropped the import from _import_microbench, so it returns an unbound name and the torch-gated half of that file raises NameError. CI has no torch and skips it, so the suite stays green either way. Restoring those imports is left to a separate change. Tested on gfx1151: the generated spec is now named Radeon_8060S. --- TraceLens/PerfModel/benchmarking/microbench.py | 7 +++++++ tests/test_perfmodel_benchmarking.py | 5 +++++ 2 files changed, 12 insertions(+) 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):