From d89d9b1389cdaf827756da651c46d3ef60317322 Mon Sep 17 00:00:00 2001 From: LeoBorcherding Date: Sat, 16 May 2026 17:55:31 -0500 Subject: [PATCH] fix(linux): route Strix + ROCm 7.1 to AMD arch-specific index Instead of falling back to pytorch.org/rocm7.2, the Strix override now routes to repo.amd.com/rocm/whl/gfx1151/ (or gfx1150/) which serves torch 2.11.0+rocm7.13.0 -- AMD's build containing the actual _grouped_mm kernel fix, verified on real gfx1151 hardware by h34v3nzc0dex. This exercises the real GPU kernel path rather than the rocm7.2 workaround. UNSLOTH_AMD_ROCM_MIRROR can override the base URL for air-gapped installs. Also teaches _tauri_torch_index_family to recognise AMD arch-specific URLs (repo.amd.com/rocm/whl/gfx*) and return the rocm7.13 family label so _tauri_gpu_branch correctly classifies these installs as rocm. Suggested by h34v3nzc0dex based on hardware-verified probe results. --- install.sh | 15 +++++++--- tests/studio/install/test_rocm_support.py | 36 ++++++++++++++++------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/install.sh b/install.sh index a5767705c8..b27955a1f2 100755 --- a/install.sh +++ b/install.sh @@ -243,6 +243,9 @@ _tauri_torch_index_family() { rocm[0-9]*.[0-9]*) echo "$_diag_family" ;; *) echo "auto" ;; esac ;; + # AMD arch-specific index (e.g. repo.amd.com/rocm/whl/gfx1151/) -- + # used for Strix Halo/Point where torch 2.11+rocm7.13 has the real fix. + *repo.amd.com/rocm/whl/gfx*|*rocm/whl/gfx*) echo "rocm7.13" ;; "") echo "none" ;; *) echo "auto" ;; esac @@ -1765,12 +1768,16 @@ case "$TORCH_INDEX_URL" in echo "" >&2 echo " [WARN] $_strix_gfx (Strix) + ROCm 7.1 detected -- known _grouped_mm segfault" >&2 echo " [WARN] ROCm 7.1 wheels are broken for gfx1150/gfx1151 (moe_utils.py:167)" >&2 - echo " [WARN] Overriding to rocm7.2 PyTorch index to avoid the driver bug" >&2 - echo " [WARN] Upgrade ROCm to 7.2+ to silence this warning:" >&2 + echo " [WARN] Routing to AMD arch-specific index (torch 2.11+rocm7.13 has the real fix)" >&2 + echo " [WARN] Upgrade ROCm to 7.2+ to use the standard index:" >&2 echo " [WARN] https://rocm.docs.amd.com/en/latest/deploy/linux/index.html" >&2 echo "" >&2 - _base="${UNSLOTH_PYTORCH_MIRROR:-https://download.pytorch.org/whl}" - TORCH_INDEX_URL="${_base%/}/rocm7.2" + # AMD's arch-specific index serves torch 2.11.0+rocm7.13.0 which has AMD's + # actual fix for the gfx1151/gfx1150 _grouped_mm kernel bug -- preferred + # over the pytorch.org rocm7.2 fallback because it exercises the real GPU + # kernel path. Set UNSLOTH_AMD_ROCM_MIRROR to override for air-gapped installs. + _amd_strix_base="${UNSLOTH_AMD_ROCM_MIRROR:-https://repo.amd.com/rocm/whl}" + TORCH_INDEX_URL="${_amd_strix_base%/}/${_strix_gfx}/" TORCH_CONSTRAINT="torch>=2.11.0,<2.12.0" _amd_gpu_radeon=false fi diff --git a/tests/studio/install/test_rocm_support.py b/tests/studio/install/test_rocm_support.py index 9f746e6096..7011abc451 100644 --- a/tests/studio/install/test_rocm_support.py +++ b/tests/studio/install/test_rocm_support.py @@ -2264,25 +2264,30 @@ _SETUP_SH_PATH = PACKAGE_ROOT / "studio" / "setup.sh" class TestStrixRocm71Override: - """Verify install.sh skips Radeon repo and forces rocm7.2 for gfx1151/gfx1150 - when ROCm 7.1 would otherwise be selected (known _grouped_mm segfault).""" + """Verify install.sh skips Radeon repo and routes to AMD arch-specific index + for gfx1151/gfx1150 when ROCm 7.1 would otherwise be selected (known _grouped_mm segfault). + AMD's repo.amd.com/rocm/whl/gfx1151/ serves torch 2.11+rocm7.13 which has the real fix.""" def test_strix_gfx_detection_in_install_sh(self): """install.sh must detect gfx1151 and gfx1150 for the override.""" source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") assert "gfx1151" in source and "gfx1150" in source - def test_rocm71_override_to_rocm72_in_install_sh(self): - """install.sh must override TORCH_INDEX_URL from rocm7.1 to rocm7.2 for Strix.""" + def test_rocm71_override_to_amd_arch_index_in_install_sh(self): + """install.sh must override TORCH_INDEX_URL to AMD arch-specific index for Strix.""" source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") - # The override must explicitly reference rocm7.2 in context with Strix detection - assert "rocm7.2" in source + # The override must route to AMD's arch-specific index (repo.amd.com/rocm/whl) + assert "repo.amd.com/rocm/whl" in source assert "_strix_gfx" in source + # The URL must incorporate the detected gfx arch so gfx1151 → .../gfx1151/ + strix_idx = source.find("_amd_strix_base") + assert strix_idx != -1 + ctx = source[strix_idx : strix_idx + 200] + assert "_strix_gfx" in ctx def test_radeon_repo_bypassed_for_strix_in_install_sh(self): """install.sh must set _amd_gpu_radeon=false when Strix + ROCm 7.1 detected.""" source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") - # After Strix detection the Radeon repo flag must be disabled assert "_amd_gpu_radeon=false" in source def test_strix_override_warns_with_moe_utils_reference(self): @@ -2293,19 +2298,28 @@ class TestStrixRocm71Override: def test_strix_override_only_fires_on_rocm71(self): """install.sh must scope the Strix override to rocm7.1 only (not rocm7.2+).""" source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") - # The Strix guard must be inside a rocm7.1 case branch strix_idx = source.find("_strix_gfx") assert strix_idx != -1 # Look back for the rocm7.1 pattern within 600 chars before _strix_gfx context_before = source[max(0, strix_idx - 600) : strix_idx] assert "rocm7.1" in context_before - def test_torch_constraint_updated_for_rocm72(self): - """install.sh must update TORCH_CONSTRAINT to allow torch>=2.11 when forcing rocm7.2.""" + def test_torch_constraint_updated_for_strix_amd_index(self): + """install.sh must set TORCH_CONSTRAINT>=2.11 when routing Strix to AMD index.""" source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") - # TORCH_CONSTRAINT must be set inside the Strix override block assert "TORCH_CONSTRAINT" in source and "2.11" in source + def test_amd_rocm_mirror_env_var_respected(self): + """install.sh must honour UNSLOTH_AMD_ROCM_MIRROR for air-gapped installs.""" + source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") + assert "UNSLOTH_AMD_ROCM_MIRROR" in source + + def test_tauri_family_recognises_amd_arch_url(self): + """_tauri_torch_index_family must return a rocm* family for AMD arch-specific URLs.""" + source = _INSTALL_SH_PATH.read_text(encoding = "utf-8") + # The function must have a case branch for repo.amd.com/rocm/whl/gfx* URLs + assert "rocm/whl/gfx" in source + # ============================================================================= # TEST: setup.sh -- gcc-install-dir fix for Ubuntu 24.04 + ROCm 7.x clang-20