From 1ebf994da1fc893cb786981c2843e9aab2e4149d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=87=91=E9=BB=84=E8=89=B2=E8=91=A1=E8=90=84=E7=90=83?= =?UTF-8?q?=E5=90=9B=E5=90=9B?= Date: Tue, 3 Mar 2026 19:05:38 +0800 Subject: [PATCH] fix(ROCm): restrict is_rdna() to ROCm-officially-supported RDNA GPUs (#4136) Current arch.startswith("gfx1") incorrectly matches: - RDNA1 (gfx10xx) and RDNA2 (gfx103x): not ROCm supported - gfx1102 (RX 7600), gfx1103 (Phoenix APU): not in ROCm support matrix - gfx1150/1151/1152 (RDNA3.5 APUs): not in ROCm support matrix Replace with explicit whitelist aligned to the ROCm Linux support matrix: https://rocm.docs.amd.com/projects/install-on-linux/en/latest/reference/system-requirements.html gfx1100 - RDNA3 discrete (RX 7900 series, PRO W7900/W7800) gfx1101 - RDNA3 discrete (RX 7800/7700 series, PRO W7700) gfx1200 - RDNA4 discrete (RX 9060 series) gfx1201 - RDNA4 discrete (RX 9070 series, AI PRO R9700) Mirrors the existing is_cdna() pattern. Avoids silently applying unverified Triton kernel tuning to unsupported hardware. --- unsloth/kernels/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/unsloth/kernels/utils.py b/unsloth/kernels/utils.py index 3122282b38..90f2d5d238 100644 --- a/unsloth/kernels/utils.py +++ b/unsloth/kernels/utils.py @@ -88,11 +88,13 @@ def is_cdna(): @functools.lru_cache(1) def is_rdna(): - """Detect RDNA consumer/workstation GPUs (RDNA3, RDNA3.5, RDNA4).""" - if not is_hip(): - return False - arch = triton.runtime.driver.active.get_current_target().arch - return arch.startswith("gfx1") and not is_cdna() + """Detect ROCm-supported RDNA consumer/workstation GPUs (RDNA3, RDNA4).""" + return is_hip() and triton.runtime.driver.active.get_current_target().arch in ( + "gfx1100", + "gfx1101", + "gfx1200", + "gfx1201", + ) def calculate_settings(