Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Unsloth Studio (AMD RDNA 1, Windows): install ROCm torch for the RX 5700 XT from AMD's multi-arch index (#11755)
Leo Borcherding79ba3eacfc49
diff --git a/install.ps1 b/install.ps1index b4f70dc1c94..048760c41e2 100644--- a/install.ps1+++ b/install.ps1@@ -9819,18 +9819,11 @@ main()$wmiAmdNames = @($usePeers | ForEach-Object { $_.Name })} catch {}}- # GPU name -> gfx arch for AMD generations Unsloth's ROCm wheels do NOT cover:- # RDNA 1 and Polaris 10/20/30 (unslothai#8529). Kept apart from $nameArchTable on- # purpose: it only WORDS a message, never selects a wheel index. AMD's TheRock- # ships RDNA 1 wheels, but not on the repo.amd.com indexes routed here, and never- # gfx803. The (?!0) guards stop "RX 570" swallowing an "RX 5700". Names from- # LLVM's AMDGPU tables plus libdrm amdgpu.ids/pci.ids for the Navi 10/14- # professional parts LLVM omits; nothing is guessed, so Polaris 11/12 (RX- # 460/550/560, a different die) is left out.+ # GPU name -> gfx arch for AMD generations no ROCm wheel covers: Polaris 10/20/30+ # (unslothai#8529). Kept apart from $nameArchTable on purpose: it only WORDS a+ # message, never selects a wheel index. The (?!0) guards stop "RX 570" swallowing+ # an "RX 5700"; Polaris 11/12 (RX 460/550/560, a different die) is left out.$unsupportedNameArchTable = @(- @{ P = "Radeon Pro V520|Radeon Pro 5600M"; A = "gfx1011" } # RDNA 1- @{ P = "RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700"; A = "gfx1010" } # RDNA 1 (Navi 10)- @{ P = "RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300"; A = "gfx1012" } # RDNA 1 (Navi 14)@{ P = "RX 4[78]0(?!0)|RX 5[789]0(?!0)|Radeon Pro WX 7100|Radeon Pro WX 5100"; A = "gfx803" } # Polaris 10/20/30)# ── Arch resolution: env-var override → name inference ──────────────@@ -9841,7 +9834,7 @@ main()if (-not $ROCmGfxArch) {# 1. Manual override: set UNSLOTH_ROCM_GFX_ARCH=gfx1151 before running.if ($env:UNSLOTH_ROCM_GFX_ARCH) {- $ROCmGfxArch = $env:UNSLOTH_ROCM_GFX_ARCH.Trim().ToLower()+ $ROCmGfxArch = ($env:UNSLOTH_ROCM_GFX_ARCH.Trim().ToLower() -split ':')[0] # drop HIP feature suffixes (gfx1010:xnack-)$ROCmGpuLabel = "AMD ROCm ($ROCmGfxArch)"substep "gfx arch from UNSLOTH_ROCM_GFX_ARCH env override: $ROCmGfxArch" "Cyan"}@@ -9859,6 +9852,9 @@ main()@{ P = "RX 6950|RX 6900|RX 6850|RX 6800|RX 6750|RX 6700|PRO W6800|PRO W6900"; A = "gfx1030" } # RDNA 2 (Navi 21) -- gfx103X family@{ P = "RX 6650|RX 6600|PRO W6600|PRO W6650"; A = "gfx1032" } # RDNA 2 (Navi 23) -- gfx103X family@{ P = "RX 6550|RX 6500|RX 6450|RX 6400|RX 6300|PRO W6400|PRO W6500|PRO W6300"; A = "gfx1034" } # RDNA 2 (Navi 24) -- gfx103X family+ @{ P = "Radeon Pro V520|Radeon Pro 5600M"; A = "gfx1011" } # RDNA 1 (Navi 12) -- multi-arch index+ @{ P = "RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700"; A = "gfx1010" } # RDNA 1 (Navi 10) -- multi-arch index+ @{ P = "RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300"; A = "gfx1012" } # RDNA 1 (Navi 14) -- multi-arch index)foreach ($row in $nameArchTable) {if ($ROCmGpuLabel -match $row.P) {@@ -9997,9 +9993,16 @@ main()"gfx1030" = "gfx103X-all""gfx90a" = "gfx90a"; "gfx908" = "gfx908" # MI200/MI100}+ # RDNA 1: AMD multi-arch index (unslothai#11614). Keep in sync with _ROCM_MULTIARCH_* in studio/install_python_stack.py.+ $multiArchGfx = @("gfx1010", "gfx1011", "gfx1012")+ $MultiArchIndexBase = if ($env:UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR) { $env:UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR.TrimEnd('/') } else { "https://repo.amd.com/rocm/whl-multi-arch" }+ $MultiArchTag = "rocm7.14.1"+ $MultiArchTorchVersion = "2.11.0"+ $MultiArchTorchvisionVersion = "0.26.0"+ $MultiArchTorchaudioVersion = "2.11.0"# "AMD gets GPU wheels here", NOT "an AMD GPU is present": $HasROCm / $ROCmGfxArch are# true on unmapped arches too, and those install CPU torch.- $AmdHasGpuWheels = [bool]($ROCmGfxArch -and $archFamilyMap.ContainsKey($ROCmGfxArch))+ $AmdHasGpuWheels = [bool]($ROCmGfxArch -and ($archFamilyMap.ContainsKey($ROCmGfxArch) -or $multiArchGfx -contains $ROCmGfxArch))# ── Intel GPU detection (Arc / Data Center GPU Max / Flex) ──# Runs BEFORE the report chain, not inside its final else: a WMI-named-only AMD adapter@@ -10595,6 +10598,7 @@ main()$ROCmTorchFloor = $null$PinnedRocmVisionSpec = $null$PinnedRocmAudioSpec = $null+ $ROCmMultiArch = $falseif (-not $TorchIndexPinned -and ($HasROCm -or $ROCmGfxArch) -and $TorchIndexUrl -like "*/cpu" -and -not $SkipTorch) {$amdIndexBase = if ($env:UNSLOTH_ROCM_WINDOWS_MIRROR) { $env:UNSLOTH_ROCM_WINDOWS_MIRROR.TrimEnd('/') } else { "https://repo.amd.com/rocm/whl" }# $archFamilyMap is defined above the Intel scan (the scan needs it too).@@ -10643,7 +10647,14 @@ main()"gfx1103" = "torchaudio>=2.11.0,<2.12.0"}$archFamily = if ($ROCmGfxArch -and $archFamilyMap.ContainsKey($ROCmGfxArch)) { $archFamilyMap[$ROCmGfxArch] } else { $null }- if ($archFamily) {+ $ROCmMultiArch = [bool]($ROCmGfxArch -and $multiArchGfx -contains $ROCmGfxArch)+ if ($ROCmMultiArch) {+ $ROCmIndexUrl = "$MultiArchIndexBase/"+ $ROCmTorchFloor = "torch[device-$ROCmGfxArch]==$MultiArchTorchVersion+$MultiArchTag"+ $PinnedRocmVisionSpec = "torchvision==$MultiArchTorchvisionVersion+$MultiArchTag"+ $PinnedRocmAudioSpec = "torchaudio==$MultiArchTorchaudioVersion+$MultiArchTag"+ substep "$ROCmGfxArch is RDNA 1 -- AMD multi-arch index, pinned to $MultiArchTorchVersion+$MultiArchTag (torch, torchvision, torchaudio)" "Cyan"+ } elseif ($archFamily) {$ROCmIndexUrl = "$amdIndexBase/$archFamily/"$ROCmTorchFloor = if ($ROCmGfxArch -and $torchFloorMap.ContainsKey($ROCmGfxArch)) { $torchFloorMap[$ROCmGfxArch] } else { $null }$archLabel = if ($ROCmGfxArch) { $ROCmGfxArch } else { "AMD GPU" }@@ -10953,7 +10964,7 @@ main()$script:PrevTorchPin = $null# An interrupted run leaks a stale pin, so clear before deciding.Remove-Item Env:UNSLOTH_KEPT_TORCH -ErrorAction SilentlyContinue- if (-not $SkipTorch -and $script:PrevTorchVer) {+ if (-not $SkipTorch -and $script:PrevTorchVer -and -not $ROCmMultiArch) {$_routeWindow = $_pinTorchSpec# Vet the kept release against the XPU window, or a kept 2.5 becomes an unsatisfiable pin.if ((Get-TorchIndexLeafName $TorchIndexUrl) -eq "xpu") { $_routeWindow = (Get-XpuTorchSpecs -Platform (Get-VenvPlatformTag -PythonExe $VenvPython))[0] }diff --git a/studio/backend/tests/test_install_resolve_prebuilt.py b/studio/backend/tests/test_install_resolve_prebuilt.pyindex b087af8ce21..e29b1b358a7 100644--- a/studio/backend/tests/test_install_resolve_prebuilt.py+++ b/studio/backend/tests/test_install_resolve_prebuilt.py@@ -1368,6 +1368,26 @@ def test_route_to_vulkan_prebuilt_auto_fallback_when_no_amd_gpu_reaches_floor():assert routed.has_rocm is False+def test_a_lone_rdna1_card_takes_the_vulkan_route(monkeypatch):+ # RDNA 1 has ROCm torch (#11614) but no HIP llama.cpp prebuilt: route to Vulkan.+ for var in ("HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES"):+ monkeypatch.delenv(var, raising = False)+ host = _windows_amd_host(rocm_gfx_target = "gfx1010", rocm_gfx_targets = ["gfx1010"])+ assert ilp._should_auto_vulkan_for_amd_windows(host, FORK) is True+ routed, repo, _tag, persist = ilp._route_to_vulkan_prebuilt(host, FORK, "pin", force_cpu = False)+ assert repo == FORK+ assert persist == "auto"+ assert routed.has_rocm is False+++def test_rdna1_beside_a_hip_capable_card_keeps_the_hip_bundle(monkeypatch):+ # Mixed host keeps the HIP prebuilt: Vulkan would enumerate both cards.+ for var in ("HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES"):+ monkeypatch.delenv(var, raising = False)+ host = _windows_amd_host(rocm_gfx_target = "gfx1010", rocm_gfx_targets = ["gfx1010", "gfx1034"])+ assert ilp._should_auto_vulkan_for_amd_windows(host, FORK) is False++@pytest.mark.parametrize("mask_env", ["HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES"])diff --git a/studio/backend/tests/test_torch_cpu_build_on_nvidia_host.py b/studio/backend/tests/test_torch_cpu_build_on_nvidia_host.pyindex bce4ae3d102..63f05af8acb 100644--- a/studio/backend/tests/test_torch_cpu_build_on_nvidia_host.py+++ b/studio/backend/tests/test_torch_cpu_build_on_nvidia_host.py@@ -1205,11 +1205,12 @@ def test_an_amd_card_named_only_by_its_marketing_string_establishes_a_mismatch(for device in covered:assert hw._devices_that_can_establish_a_mismatch([device]) == [device], device["name"]- # RDNA 1 is declined on purpose: a repair here would reinstall the same CPU wheel.- declined = [- {"vendor": "amd", "name": "AMD Radeon RX 5700 XT", "index": 0, "gfx_candidates": []}- ]- assert hw._devices_that_can_establish_a_mismatch(declined) == []+ # RDNA 1: declined on Linux (same CPU wheel), repairable on Windows (#11755).+ rdna1 = [{"vendor": "amd", "name": "AMD Radeon RX 5700 XT", "index": 0, "gfx_candidates": []}]+ monkeypatch.setattr(hw.platform, "system", lambda: "Linux")+ assert hw._devices_that_can_establish_a_mismatch(rdna1) == []+ monkeypatch.setattr(hw.platform, "system", lambda: "Windows")+ assert hw._devices_that_can_establish_a_mismatch(rdna1) == rdna1def test_a_nameless_intel_card_counts_once_xpu_was_actually_chosen(monkeypatch, tmp_path):@@ -2455,10 +2456,10 @@ def test_the_ranking_callers_still_see_an_empty_map(monkeypatch):("AMD Radeon RX 7900 XT", True),("AMD Radeon RX 9070 XT", True),("AMD Radeon 780M Graphics", True),- # Polaris and RDNA 1: no wheel family covers them, so a repair could not change- # anything and this host is on CPU torch on purpose.+ # Polaris: no wheel family, CPU torch on purpose.("AMD Radeon RX 580", False),- ("AMD Radeon RX 5700 XT", False),+ # RDNA 1: routed on Windows through AMD's multi-arch index (unslothai/unsloth#11755).+ ("AMD Radeon RX 5700 XT", True),("", False),],)diff --git a/studio/backend/utils/hardware/hardware.py b/studio/backend/utils/hardware/hardware.pyindex 80fe3d2e79c..88875185069 100644--- a/studio/backend/utils/hardware/hardware.py+++ b/studio/backend/utils/hardware/hardware.py@@ -887,7 +887,7 @@ def _devices_that_can_establish_a_mismatch(devices: list[Dict[str, Any]]) -> lisreturn keep-# The gfx targets this stack will actually install a ROCm wheel for (install.sh's _amd_arch_index_family_for_gfx, plus gfx906 from the ROCm 6.3 path). A card outside this set (Polaris gfx803, RDNA 1 gfx101x) is left on CPU torch ON PURPOSE.+# The gfx targets this stack will actually install a ROCm wheel for (install.sh's _amd_arch_index_family_for_gfx, plus gfx906 from the ROCm 6.3 path). A card outside this set (Polaris gfx803; RDNA 1 gfx101x off Windows, see _rocm_supported_gfx_here) is left on CPU torch ON PURPOSE._ROCM_SUPPORTED_GFX = frozenset({"gfx906",@@ -1013,15 +1013,30 @@ _GPU_NAME_GFX_TABLE: "list[tuple[str, str]]" = [(r"RX 6950|RX 6900|RX 6850|RX 6800|RX 6750|RX 6700|PRO W6800|PRO W6900", "gfx1030"),(r"RX 6650|RX 6600|PRO W6600|PRO W6650", "gfx1032"),(r"RX 6550|RX 6500|RX 6450|RX 6400|RX 6300|PRO W6400|PRO W6500|PRO W6300", "gfx1034"),+ (r"Radeon Pro V520|Radeon Pro 5600M", "gfx1011"),+ (r"RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700", "gfx1010"),+ (r"RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300", "gfx1012"),]+# RDNA 1 gets ROCm wheels on Windows only (multi-arch index, #11755).+_ROCM_SUPPORTED_GFX_WINDOWS_ONLY = frozenset({"gfx1010", "gfx1011", "gfx1012"})+++def _rocm_supported_gfx_here() -> "frozenset[str]":+ """The arches the installers ship a ROCm wheel for on THIS platform."""+ if platform.system() == "Windows":+ return _ROCM_SUPPORTED_GFX | _ROCM_SUPPORTED_GFX_WINDOWS_ONLY+ return _ROCM_SUPPORTED_GFX++def _rocm_supported_gfx_from_gpu_name(name: str) -> Optional[str]:"""The gfx arch this marketing name maps to, when the ROCm wheels cover it."""if not name:return None+ _supported = _rocm_supported_gfx_here()for pattern, arch in _GPU_NAME_GFX_TABLE:- if re.search(pattern, name, re.IGNORECASE) and arch in _ROCM_SUPPORTED_GFX:+ if re.search(pattern, name, re.IGNORECASE) and arch in _supported:return archreturn None@@ -1042,7 +1057,7 @@ def _amd_device_can_establish_a_mismatch(device: Dict[str, Any]) -> bool:return True# Nothing NAMES the card, so ask what the installer asks: _has_rocm_gpu() falls back to the KFD topology, and a card `studio update` would repair is eligible here.return _linux_kfd_reports_an_amd_gpu()- return any(gfx in _ROCM_SUPPORTED_GFX for gfx in candidates)+ return any(gfx in _rocm_supported_gfx_here() for gfx in candidates)def _expected_xpu_flavor_was_chosen() -> bool:diff --git a/studio/install_python_stack.py b/studio/install_python_stack.pyindex 664d9f81d7b..58b4c7f3f9f 100644--- a/studio/install_python_stack.py+++ b/studio/install_python_stack.py@@ -306,6 +306,56 @@ _WINDOWS_ROCM_TORCH_PKG_SPECS: dict[str, tuple[str, str, str]] = {"gfx1102": _ROCM_TORCH_PKG_SPECS["rocm7.2"],"gfx1103": _ROCM_TORCH_PKG_SPECS["rocm7.2"],}+# RDNA 1 has no repo.amd.com/rocm/whl family; the multi-arch index picks the card by the+# torch[device-gfxNNNN] extra. Exact pin: its next tag (2.12.0) sits on the Windows ceiling. #11614+_ROCM_WINDOWS_MULTIARCH_INDEX_BASE = (+ os.environ.get("UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR")+ or "https://repo.amd.com/rocm/whl-multi-arch"+)+_ROCM_MULTIARCH_TAG = "rocm7.14.1"+_ROCM_MULTIARCH_TORCH_VERSION = "2.11.0"+_ROCM_MULTIARCH_TORCHVISION_VERSION = "0.26.0"+_ROCM_MULTIARCH_TORCHAUDIO_VERSION = "2.11.0"+# Only gfx1010 measured; gfx1011/gfx1012 ride along since the Triton and zoo fixes key on gfx101x.+_WINDOWS_MULTIARCH_GFX: "frozenset[str]" = frozenset({"gfx1010", "gfx1011", "gfx1012"})+++def _bare_gfx(gfx_arch: "str | None") -> str:+ """'GFX1010:xnack-' -> 'gfx1010': hipinfo prints feature suffixes and users type any case."""+ return (gfx_arch or "").strip().lower().split(":")[0]+++def _is_windows_multiarch_gfx(gfx_arch: "str | None") -> bool:+ return _bare_gfx(gfx_arch) in _WINDOWS_MULTIARCH_GFX+++def _multiarch_device_pack_installed(gfx_arch: "str | None") -> bool:+ """Whether the venv carries AMD's amd-torch-device-<gfx> kernel pack for this card."""+ try:+ from importlib import metadata+ metadata.distribution(f"amd-torch-device-{_bare_gfx(gfx_arch)}")+ return True+ except Exception:+ return False+++def _windows_multiarch_torch_pkg_specs(gfx_arch: str) -> tuple[str, str, str]:+ gfx = _bare_gfx(gfx_arch)+ return (+ f"torch[device-{gfx}]=={_ROCM_MULTIARCH_TORCH_VERSION}+{_ROCM_MULTIARCH_TAG}",+ f"torchvision=={_ROCM_MULTIARCH_TORCHVISION_VERSION}+{_ROCM_MULTIARCH_TAG}",+ f"torchaudio=={_ROCM_MULTIARCH_TORCHAUDIO_VERSION}+{_ROCM_MULTIARCH_TAG}",+ )+++def _windows_rocm_torch_pkg_specs(gfx_arch: "str | None") -> tuple[str, str, str]:+ if _is_windows_multiarch_gfx(gfx_arch):+ return _windows_multiarch_torch_pkg_specs(gfx_arch)+ return _WINDOWS_ROCM_TORCH_PKG_SPECS.get(+ _bare_gfx(gfx_arch), ("torch", "torchvision", "torchaudio")+ )++# Bound companion versions for ABI compatibility while retaining older per-arch mirror builds._ROCM_ARCH_INDEX_TORCH_PKG_SPEC: tuple[str, str, str] = ("torch>=2.4,<2.12.0",@@ -1761,8 +1811,8 @@ def _detect_windows_gfx_arch() -> str | None:# put the APU first and the user may still want a different device.if _pick in _SHADOWING_INTEGRATED_GFX:_others = [t for t in tokens if t not in _SHADOWING_INTEGRATED_GFX]- # Deposing the pick for a card with no Windows wheels (gfx1036 + an older- # gfx1010) resolves to no index and drops the host to CPU, so prefer a+ # Deposing the pick for a card with no Windows wheels (gfx1036 + a gfx803)+ # resolves to no index and drops the host to CPU, so prefer a# wheel-backed candidate; fall back only when the pick has no wheels either._withWheels = [t for t in _others if _windows_rocm_index_url(t) is not None]_candidates = _withWheels or (@@ -1770,8 +1820,8 @@ def _detect_windows_gfx_arch() -> str | None:)if _candidates:_other = _candidates[0]- # Not always device 1: on gfx1036,gfx1010,gfx1200 it is device 2, and- # saying "mask 1" would expose the gfx1010 the wheels do not target.+ # Not always device 1: on gfx1036,gfx803,gfx1200 it is device 2, and+ # saying "mask 1" would expose the gfx803 the wheels do not target._other_idx = tokens.index(_other)_safe_print(f" multiple AMD GPUs detected ({', '.join(_distinct)}); "@@ -1931,7 +1981,7 @@ def _detect_windows_gfx_arch() -> str | None:return _pickif _names and not _pick:# No arch means CPU-only torch; name the adapter instead of failing silently.- # RDNA 1 / Polaris is not an unknown card: naming an override there+ # Polaris is not an unknown card: naming an override there# sends the user after a fix that does not exist (#8529, #8458)._unsupported = _unsupported_gfx_arch_from_gpu_name(_names[_sel])if _unsupported:@@ -2009,6 +2059,10 @@ _WIN_GPU_NAME_ARCH_TABLE: "list[tuple[str, str]]" = [r"RX 6550|RX 6500|RX 6450|RX 6400|RX 6300|PRO W6400|PRO W6500|PRO W6300","gfx1034",), # Navi 24+ # RDNA 1, multi-arch index. Names from LLVM + libdrm amdgpu.ids.+ (r"Radeon Pro V520|Radeon Pro 5600M", "gfx1011"),+ (r"RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700", "gfx1010"),+ (r"RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300", "gfx1012"),]@@ -2022,21 +2076,11 @@ def _gfx_arch_from_gpu_name(name: str) -> "str | None":return None-# GPU name -> gfx arch for AMD generations Unsloth's ROCm wheels do NOT cover: RDNA 1-# and Polaris 10/20/30 (unslothai#8529, #8458). Deliberately SEPARATE from-# _WIN_GPU_NAME_ARCH_TABLE: nothing here may ever route to a wheel index. AMD's TheRock-# ships RDNA 1 wheels, but not on the repo.amd.com indexes routed here, and never gfx803.-# Every (?!0) guard stops "RX 570" swallowing "RX 5700", so each row is correct on its-# own regardless of order. Names from LLVM's AMDGPU tables plus libdrm amdgpu.ids/pci.ids-# for the Navi 10/14 professional parts LLVM omits; nothing is guessed, so Polaris 11/12-# (RX 460/550/560, a different die) is left out.+# GPU name -> gfx arch for AMD generations no ROCm wheel covers: Polaris 10/20/30+# (unslothai#8529, #8458). Deliberately SEPARATE from _WIN_GPU_NAME_ARCH_TABLE: nothing+# here may ever route to a wheel index. The (?!0) guards stop "RX 570" swallowing+# "RX 5700"; Polaris 11/12 (RX 460/550/560, a different die) is left out._UNSUPPORTED_GPU_NAME_ARCH_TABLE: "list[tuple[str, str]]" = [- (r"Radeon Pro V520|Radeon Pro 5600M", "gfx1011"), # RDNA 1- (- r"RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700",- "gfx1010",- ), # RDNA 1 (Navi 10)- (r"RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300", "gfx1012"), # RDNA 1 (Navi 14)(r"RX 4[78]0(?!0)|RX 5[789]0(?!0)|Radeon Pro WX 7100|Radeon Pro WX 5100","gfx803",@@ -2321,7 +2365,9 @@ def _rocm_miscomputing_host() -> bool:def _windows_rocm_index_url(gfx_arch: str | None) -> str | None:"""Return the AMD pip index URL for the given GPU arch, or None if unsupported."""- arch_family = _GFX_TO_AMD_INDEX_ARCH.get(gfx_arch or "")+ if _is_windows_multiarch_gfx(gfx_arch):+ return _ROCM_WINDOWS_MULTIARCH_INDEX_BASE+ arch_family = _GFX_TO_AMD_INDEX_ARCH.get(_bare_gfx(gfx_arch))if arch_family is None:return Nonereturn _index_url_join(_ROCM_WINDOWS_INDEX_BASE, arch_family)@@ -5722,6 +5768,18 @@ def _ensure_rocm_torch() -> None:# now resolves elsewhere (dGPU added, or the #7776 repick) would keep the old family# forever. setup.ps1 force-reinstalls every run, so this only bites standalone# `studio update`. Act only on a family read back positively, never on a guess.+ # A per-family build has no kernels for a multi-arch card: its device pack decides.+ if (+ _torch_already_rocm+ and _win_rocm_pin is None+ and _is_windows_multiarch_gfx(gfx_arch)+ and not _multiarch_device_pack_installed(gfx_arch)+ ):+ _safe_print(+ f" installed ROCm torch has no {gfx_arch} device pack -- reinstalling from "+ "AMD's multi-arch index"+ )+ _torch_already_rocm = Falseif _torch_already_rocm and _win_rocm_pin is None:_want = (_GFX_TO_AMD_INDEX_ARCH.get(gfx_arch or "") or "").lower()_have = _installed_rocm_wheel_family()@@ -5740,12 +5798,16 @@ def _ensure_rocm_torch() -> None:f" {gfx_arch or 'pinned ROCm index'} (Windows) -- installing torch from "f"{_strip_index_url_credentials(index_url)}")- _torch_pkg, _vision_pkg, _audio_pkg = _WINDOWS_ROCM_TORCH_PKG_SPECS.get(- gfx_arch, ("torch", "torchvision", "torchaudio")- )+ _torch_pkg, _vision_pkg, _audio_pkg = _windows_rocm_torch_pkg_specs(gfx_arch)_rocm_trio = [_torch_pkg, _vision_pkg, _audio_pkg]if _is_win_arm64_interpreter():_rocm_trio = [_torch_pkg, _vision_pkg]+ if _is_windows_multiarch_gfx(gfx_arch):+ # Not _bare_gfx(): a local of that name below shadows it (UnboundLocalError).+ _safe_print(+ f" {(gfx_arch or '').split(':')[0].lower()} is RDNA 1: AMD's multi-arch index, pinned to "+ f"{_ROCM_MULTIARCH_TORCH_VERSION}+{_ROCM_MULTIARCH_TAG} (torch, torchvision, torchaudio)"+ )# Nonfatal: a transient AMD-index failure must not abort the install.# --force-reinstall resolves before uninstalling, so a failed index keeps the# existing build intact; let the user retry.diff --git a/studio/setup.ps1 b/studio/setup.ps1index 8ae20394588..48a4b7ee52a 100644--- a/studio/setup.ps1+++ b/studio/setup.ps1@@ -4175,6 +4175,13 @@ $archFamilyMap = @{"gfx1030" = "gfx103X-all""gfx90a" = "gfx90a"; "gfx908" = "gfx908" # MI200/MI100}+# RDNA 1: AMD multi-arch index (unslothai#11614). Keep in sync with _ROCM_MULTIARCH_* in studio/install_python_stack.py.+$multiArchGfx = @("gfx1010", "gfx1011", "gfx1012")+$MultiArchIndexBase = if ($env:UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR) { $env:UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR.TrimEnd('/') } else { "https://repo.amd.com/rocm/whl-multi-arch" }+$MultiArchTag = "rocm7.14.1"+$MultiArchTorchVersion = "2.11.0"+$MultiArchTorchvisionVersion = "0.26.0"+$MultiArchTorchaudioVersion = "2.11.0"# True when any of the three masks is set. Mirrors _visible_devices_pinned(): ANY value@@ -4221,17 +4228,17 @@ function Resolve-ShadowingGfxPick {param([AllowNull()][string]$Picked, [AllowNull()][string[]]$AllArches)if (-not $Picked) { return $Picked }# Only arches in $archFamilyMap have an AMD Windows wheel index.- function Test-GfxHasWheels { param([AllowNull()][string]$Arch) return [bool]($Arch -and $archFamilyMap.ContainsKey($Arch)) }+ function Test-GfxHasWheels { param([AllowNull()][string]$Arch) return [bool]($Arch -and ($archFamilyMap.ContainsKey($Arch) -or $multiArchGfx -contains $Arch)) }# A selected device is honoured verbatim; never repick over the user.if (Test-VisibleDevicesPinned) { return $Picked }if ($script:ShadowingIntegratedGfx -notcontains $Picked) { return $Picked }$distinctArches = @($AllArches | Select-Object -Unique)if ($distinctArches.Count -lt 2) { return $Picked }- # Deposing a supported APU for a discrete card with no Windows wheels (gfx1036 + an- # older gfx1010) resolves to no index and drops the host to CPU, worse than the+ # Deposing a supported APU for a discrete card with no Windows wheels (gfx1036 + a+ # gfx803) resolves to no index and drops the host to CPU, worse than the# shadowing itself. So prefer a wheel-backed discrete card, and fall back to an# unsupported one only when the pick has no wheels either: taking the first- # non-integrated arch instead sent gfx90c,gfx1010,gfx1200 to CPU torch despite the+ # non-integrated arch instead sent gfx90c,gfx803,gfx1200 to CPU torch despite the# supported gfx1200. Mirrors _dedup_pick()'s `_withWheels or (...)`.$pickedHasWheels = Test-GfxHasWheels $Picked$others = @($AllArches | Where-Object { $script:ShadowingIntegratedGfx -notcontains $_ })@@ -4241,8 +4248,8 @@ function Resolve-ShadowingGfxPick {else { @() }$discreteArch = $candidates | Select-Object -First 1if (-not $discreteArch) { return $Picked }- # Not always device 1: on gfx1036,gfx1010,gfx1200 the pick is device 2, and- # naming 1 would expose the gfx1010 the wheels do not target.+ # Not always device 1: on gfx1036,gfx803,gfx1200 the pick is device 2, and+ # naming 1 would expose the gfx803 the wheels do not target.$discreteIdx = [array]::IndexOf(@($AllArches), $discreteArch)if ($discreteIdx -lt 0) { $discreteIdx = 1 }substep "multiple AMD GPUs detected ($($distinctArches -join ', ')); installing for the discrete $discreteArch instead of the integrated $Picked" "Cyan"@@ -4469,18 +4476,11 @@ if (-not $HasNvidiaSmi) {} catch {}}- # GPU name -> gfx arch for AMD generations Unsloth's ROCm wheels do NOT cover: RDNA 1- # and Polaris 10/20/30 (unslothai#8529). Kept apart from $nameArchTable on purpose: it- # only WORDS a message, never selects a wheel index or a prebuilt. AMD's TheRock ships- # RDNA 1 wheels, but not on the repo.amd.com indexes routed here, and never gfx803.- # The (?!0) guards stop "RX 570" swallowing an "RX 5700". Names from LLVM's AMDGPU- # tables plus libdrm amdgpu.ids/pci.ids for the Navi 10/14 professional parts LLVM- # omits; nothing is guessed, so Polaris 11/12 (RX 460/550/560, a different die) is- # left out.+ # GPU name -> gfx arch for AMD generations no ROCm wheel covers: Polaris 10/20/30+ # (unslothai#8529). Kept apart from $nameArchTable on purpose: it only WORDS a message,+ # never selects a wheel index or a prebuilt. The (?!0) guards stop "RX 570" swallowing+ # an "RX 5700"; Polaris 11/12 (RX 460/550/560, a different die) is left out.$unsupportedNameArchTable = @(- @{ P = "Radeon Pro V520|Radeon Pro 5600M"; A = "gfx1011" } # RDNA 1- @{ P = "RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700"; A = "gfx1010" } # RDNA 1 (Navi 10)- @{ P = "RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300"; A = "gfx1012" } # RDNA 1 (Navi 14)@{ P = "RX 4[78]0(?!0)|RX 5[789]0(?!0)|Radeon Pro WX 7100|Radeon Pro WX 5100"; A = "gfx803" } # Polaris 10/20/30)$script:ROCmUnsupportedGfxArch = $null@@ -4494,7 +4494,7 @@ if (-not $HasNvidiaSmi) {if (-not $script:ROCmGfxArch) {# 1. Manual override: set UNSLOTH_ROCM_GFX_ARCH=gfx1151 before running.if ($env:UNSLOTH_ROCM_GFX_ARCH) {- $script:ROCmGfxArch = $env:UNSLOTH_ROCM_GFX_ARCH.Trim().ToLower()+ $script:ROCmGfxArch = ($env:UNSLOTH_ROCM_GFX_ARCH.Trim().ToLower() -split ':')[0] # drop HIP feature suffixes (gfx1010:xnack-)$ROCmGpuLabel = "AMD ROCm ($script:ROCmGfxArch)"substep "gfx arch from UNSLOTH_ROCM_GFX_ARCH env override: $script:ROCmGfxArch" "Cyan"}@@ -4513,6 +4513,9 @@ if (-not $HasNvidiaSmi) {@{ P = "RX 6950|RX 6900|RX 6850|RX 6800|RX 6750|RX 6700|PRO W6800|PRO W6900"; A = "gfx1030" } # RDNA 2 (Navi 21) -- gfx103X family@{ P = "RX 6650|RX 6600|PRO W6600|PRO W6650"; A = "gfx1032" } # RDNA 2 (Navi 23) -- gfx103X family@{ P = "RX 6550|RX 6500|RX 6450|RX 6400|RX 6300|PRO W6400|PRO W6500|PRO W6300"; A = "gfx1034" } # RDNA 2 (Navi 24) -- gfx103X family+ @{ P = "Radeon Pro V520|Radeon Pro 5600M"; A = "gfx1011" } # RDNA 1 (Navi 12) -- multi-arch index+ @{ P = "RX 5700|RX 5600|Radeon Pro 5600 XT|Radeon Pro 5700|Radeon Pro W5700"; A = "gfx1010" } # RDNA 1 (Navi 10) -- multi-arch index+ @{ P = "RX 5500|RX 5300|Radeon Pro W5500|Radeon Pro W5300"; A = "gfx1012" } # RDNA 1 (Navi 14) -- multi-arch index)function Get-GfxArchFromGpuName {param([AllowNull()][string]$Name, [object[]]$Table)@@ -4702,10 +4705,11 @@ $_rocmWheelArches = @("gfx1151", "gfx1150", "gfx1152", # RDNA 3.5 (Strix Halo/Point, Krackan Point)"gfx1103", "gfx1102", "gfx1101", "gfx1100", # RDNA 3"gfx1036", "gfx1035", "gfx1034", "gfx1033", "gfx1032", "gfx1031", "gfx1030", # RDNA 2 (RX 6000)+ "gfx1012", "gfx1011", "gfx1010", # RDNA 1 (RX 5000): AMD's multi-arch index (unslothai#11755)"gfx90a", "gfx908" # MI200 / MI100)# "AMD gets GPU wheels here", NOT "an AMD GPU is present": $HasROCm / $ROCmGfxArch are true on-# unmapped arches (Vega, RDNA1) too, and those install CPU torch.+# unmapped arches (Vega, Polaris) too, and those install CPU torch. Must include $multiArchGfx.$AmdHasGpuWheels = [bool]($script:ROCmGfxArch -and ($_rocmWheelArches -contains $script:ROCmGfxArch))# Mirrors the Intel scan in install.ps1 so setup does not report "none (chat-only)" right after@@ -8404,6 +8408,7 @@ if ($PinnedTorchIndexUrl) {# AMD's arch-specific pip index (repo.amd.com/rocm/whl/{arch}/); wheels bundle their runtime.$ROCmGfxArch = $script:ROCmGfxArch$ROCmIndexUrl = $null+$script:ROCmMultiArch = $false# Also on a name-inferred gfx: the wheels bundle the runtime, so no HIP SDK is needed.if (-not $TorchIndexPinned -and ($HasROCm -or $ROCmGfxArch) -and $CuTag -eq "cpu") {$amdIndexBase = if ($env:UNSLOTH_ROCM_WINDOWS_MIRROR) { $env:UNSLOTH_ROCM_WINDOWS_MIRROR.TrimEnd('/') } else { "https://repo.amd.com/rocm/whl" }@@ -8448,11 +8453,18 @@ if (-not $TorchIndexPinned -and ($HasROCm -or $ROCmGfxArch) -and $CuTag -eq "cpu$ROCmTorchSpec = if ($ROCmGfxArch -and $torchFloorMap.ContainsKey($ROCmGfxArch)) { $torchFloorMap[$ROCmGfxArch] } else { "torch" }$ROCmVisionSpec = if ($ROCmGfxArch -and $torchvisionFloorMap.ContainsKey($ROCmGfxArch)) { $torchvisionFloorMap[$ROCmGfxArch] } else { "torchvision" }$ROCmAudioSpec = if ($ROCmGfxArch -and $torchaudioFloorMap.ContainsKey($ROCmGfxArch)) { $torchaudioFloorMap[$ROCmGfxArch] } else { "torchaudio" }- if ($archFamily) {+ $script:ROCmMultiArch = [bool]($ROCmGfxArch -and $multiArchGfx -contains $ROCmGfxArch)+ if ($script:ROCmMultiArch) {+ $ROCmIndexUrl = "$MultiArchIndexBase/"+ $ROCmTorchSpec = "torch[device-$ROCmGfxArch]==$MultiArchTorchVersion+$MultiArchTag"+ $ROCmVisionSpec = "torchvision==$MultiArchTorchvisionVersion+$MultiArchTag"+ $ROCmAudioSpec = "torchaudio==$MultiArchTorchaudioVersion+$MultiArchTag"+ substep "$ROCmGfxArch is RDNA 1 -- AMD multi-arch index, pinned to $MultiArchTorchVersion+$MultiArchTag (torch, torchvision, torchaudio)" "Cyan"+ } elseif ($archFamily) {$ROCmIndexUrl = "$amdIndexBase/$archFamily/"} elseif ($ROCmGfxArch) {substep "[WARN] AMD GPU ($ROCmGfxArch) not in supported arch list -- falling back to CPU-only PyTorch" "Yellow"- substep " Supported: gfx1200/1201 (RDNA 4), gfx1150/1151/1152 (RDNA 3.5), gfx1100-1103 (RDNA 3), gfx1030-1036 (RDNA 2), gfx90a, gfx908" "Yellow"+ substep " Supported: gfx1200/1201 (RDNA 4), gfx1150/1151/1152 (RDNA 3.5), gfx1100-1103 (RDNA 3), gfx1030-1036 (RDNA 2), gfx1010-1012 (RDNA 1, AMD multi-arch index), gfx90a, gfx908" "Yellow"} else {substep "[WARN] AMD GPU detected (HIP SDK present) but GPU arch could not be read -- falling back to CPU-only PyTorch" "Yellow"substep " Arch detection requires hipinfo to report gcnArchName. Re-install the HIP SDK if this is unexpected." "Yellow"@@ -8601,13 +8613,15 @@ $WinArm64IndexArgs = if ($WinArm64Venv) {$ROCmCpuFallback = $falseif ($ROCmIndexUrl) {substep "installing PyTorch (AMD ROCm, $ROCmGfxArch)..."- if ($ROCmTorchSpec -ne "torch") {+ if ($script:ROCmMultiArch) {+ substep " pinned $ROCmTorchSpec $ROCmVisionSpec $ROCmAudioSpec (AMD multi-arch index, one release tag)" "Cyan"+ } elseif ($ROCmTorchSpec -ne "torch") {substep " enforcing $ROCmTorchSpec $ROCmVisionSpec $ROCmAudioSpec (known _grouped_mm bug in older wheels)" "Cyan"}# Release preservation: keep UNSLOTH_KEPT_TORCH unless it conflicts with a >=2.11 floor.$_rocmKeptActive = $false$_rocmOrigTorch = $ROCmTorchSpec; $_rocmOrigVision = $ROCmVisionSpec; $_rocmOrigAudio = $ROCmAudioSpec- if ($env:UNSLOTH_KEPT_TORCH -match '^\d+\.\d+(\.\d+)?$') {+ if (-not $script:ROCmMultiArch -and $env:UNSLOTH_KEPT_TORCH -match '^\d+\.\d+(\.\d+)?$') {$_keptMinor = [int](($env:UNSLOTH_KEPT_TORCH -split '\.')[1])if (-not ($ROCmTorchSpec -match 'torch>=2\.11' -and $_keptMinor -lt 11)) {$ROCmTorchSpec = "torch==$($env:UNSLOTH_KEPT_TORCH)"@@ -8663,7 +8677,7 @@ if ($ROCmIndexUrl) {while ($true) {# Built here, not in the verbose branch (a splat assigned there is unset on the other path).$_rocmTrio = @($ROCmTorchSpec, $ROCmVisionSpec, $ROCmAudioSpec)- if ($WinArm64NoAudio) { $_rocmTrio = @($ROCmTorchSpec, $ROCmVisionSpec) }+ if ($WinArm64NoAudio -or -not $ROCmAudioSpec) { $_rocmTrio = @($ROCmTorchSpec, $ROCmVisionSpec) }if ($script:UnslothVerbose) {Fast-Install @_rocmTrio @rocmForce --index-url $ROCmIndexUrl | ForEach-Object { Redact-InstallOutput "$_" } | Out-Host$torchInstallExit = $LASTEXITCODEdiff --git a/tests/studio/install/test_cuda_repair.py b/tests/studio/install/test_cuda_repair.pyindex 532e09ddee2..661e8515531 100644--- a/tests/studio/install/test_cuda_repair.py+++ b/tests/studio/install/test_cuda_repair.py@@ -2331,7 +2331,7 @@ class TestTheDelegatedRocmRepairKeepsTheArm64Exception:def test_the_windows_rocm_install_drops_torchaudio_on_arm64(self):source = inspect.getsource(stack_mod._ensure_rocm_torch)- block = source[source.index("_WINDOWS_ROCM_TORCH_PKG_SPECS.get") :][:1200]+ block = source[source.index("_windows_rocm_torch_pkg_specs(") :][:1200]# The interpreter's arch, not the machine's: an emulated x64 venv installs win_amd64.assert ("_is_win_arm64_interpreter()" in block@@ -2343,7 +2343,7 @@ class TestTheDelegatedRocmRepairKeepsTheArm64Exception:def test_x64_windows_still_asks_for_all_three(self):source = inspect.getsource(stack_mod._ensure_rocm_torch)- block = source[source.index("_WINDOWS_ROCM_TORCH_PKG_SPECS.get") :][:1200]+ block = source[source.index("_windows_rocm_torch_pkg_specs(") :][:1200]assert "_rocm_trio = [_torch_pkg, _vision_pkg, _audio_pkg]" in blockdiff --git a/tests/studio/install/test_missing_kernel_arch_routing_9396.py b/tests/studio/install/test_missing_kernel_arch_routing_9396.pyindex fcc7d288bcc..769233ca503 100644--- a/tests/studio/install/test_missing_kernel_arch_routing_9396.py+++ b/tests/studio/install/test_missing_kernel_arch_routing_9396.py@@ -163,6 +163,8 @@ def test_no_nameable_arch_is_left_without_kernels():for arch in nameableif arch not in stack_mod._GENERIC_ROCM_WHEEL_GFXand not stack_mod._generic_rocm_wheel_lacks_kernels(arch)+ # RDNA 1 routes on Windows only (#11755), by design.+ and arch not in stack_mod._WINDOWS_MULTIARCH_GFX}assert stranded == set(), strandeddiff --git a/tests/studio/install/test_rdna1_multiarch_windows_route_11614.py b/tests/studio/install/test_rdna1_multiarch_windows_route_11614.pynew file mode 100644index 00000000000..7a49a1df628--- /dev/null+++ b/tests/studio/install/test_rdna1_multiarch_windows_route_11614.py@@ -0,0 +1,333 @@+# SPDX-License-Identifier: AGPL-3.0-only+# Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0+"""RDNA 1 on Windows installs from AMD's multi-arch index (unslothai/unsloth#11614).++gfx1010/1011/1012 route there in every spelling and nothing else does; the trio is pinned+to one release tag below the Windows torch ceiling; the name tables claim RDNA 1 as+supported; the PowerShell installers carry the same arches and tag.+"""++import importlib.util+import re+import sys+from pathlib import Path++import pytest++PACKAGE_ROOT = Path(__file__).resolve().parents[3]+_STACK_PY = PACKAGE_ROOT / "studio" / "install_python_stack.py"+_INSTALL_PS1 = PACKAGE_ROOT / "install.ps1"+_SETUP_PS1 = PACKAGE_ROOT / "studio" / "setup.ps1"+_HARDWARE_PY = PACKAGE_ROOT / "studio" / "backend" / "utils" / "hardware" / "hardware.py"+++def _load_stack_module():+ spec = importlib.util.spec_from_file_location(+ "studio_install_python_stack_rdna1_route", _STACK_PY+ )+ assert spec is not None and spec.loader is not None+ mod = importlib.util.module_from_spec(spec)+ sys.modules[spec.name] = mod+ spec.loader.exec_module(mod)+ return mod+++stack_mod = _load_stack_module()++_RDNA1 = ["gfx1010", "gfx1011", "gfx1012"]+_SPELLINGS = _RDNA1 + [a.upper() for a in _RDNA1] + [f"{a}:xnack-" for a in _RDNA1]+++class TestPackageSpecs:+ @pytest.mark.parametrize("arch", _SPELLINGS)+ def test_specs_are_pinned_to_one_tag_with_the_device_extra(self, arch):+ torch_spec, vision_spec, audio_spec = stack_mod._windows_rocm_torch_pkg_specs(arch)+ bare = arch.lower().split(":")[0]+ tag = stack_mod._ROCM_MULTIARCH_TAG+ assert (+ torch_spec == f"torch[device-{bare}]=={stack_mod._ROCM_MULTIARCH_TORCH_VERSION}+{tag}"+ )+ assert vision_spec == f"torchvision=={stack_mod._ROCM_MULTIARCH_TORCHVISION_VERSION}+{tag}"+ assert audio_spec == f"torchaudio=={stack_mod._ROCM_MULTIARCH_TORCHAUDIO_VERSION}+{tag}"++ def test_the_pin_is_a_release_tag_not_a_nightly(self):+ """A nightly tag (rocmX.Y.ZaYYYYMMDD) moves under users; the stable index is dated+ by release only."""+ assert re.fullmatch(r"rocm\d+\.\d+\.\d+", stack_mod._ROCM_MULTIARCH_TAG)++ def test_the_pin_sits_inside_the_windows_torch_window(self):+ """install.ps1 applies torch<2.12.0 everywhere else on Windows; the multi-arch index+ also serves 2.12.0, so the pin must stay the newest release under that ceiling."""+ major, minor, _ = (int(x) for x in stack_mod._ROCM_MULTIARCH_TORCH_VERSION.split("."))+ assert (major, minor) < (2, 12)+ assert (+ stack_mod._ROCM_MULTIARCH_TORCHAUDIO_VERSION == stack_mod._ROCM_MULTIARCH_TORCH_VERSION+ )++ def test_other_arches_keep_their_specs(self):+ assert (+ stack_mod._windows_rocm_torch_pkg_specs("gfx1201")+ == stack_mod._WINDOWS_ROCM_TORCH_PKG_SPECS["gfx1201"]+ )+ assert stack_mod._windows_rocm_torch_pkg_specs("gfx1034") == (+ stack_mod._WINDOWS_ROCM_TORCH_PKG_SPECS.get(+ "gfx1034", ("torch", "torchvision", "torchaudio")+ )+ )+ assert stack_mod._windows_rocm_torch_pkg_specs("gfx9999") == (+ "torch",+ "torchvision",+ "torchaudio",+ )+ assert stack_mod._windows_rocm_torch_pkg_specs(None) == (+ "torch",+ "torchvision",+ "torchaudio",+ )+++class TestIndexResolution:+ @pytest.mark.parametrize("arch", _SPELLINGS)+ def test_rdna1_resolves_to_the_multiarch_index(self, arch, monkeypatch):+ monkeypatch.delenv("UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR", raising = False)+ assert (+ stack_mod._windows_rocm_index_url(arch) == stack_mod._ROCM_WINDOWS_MULTIARCH_INDEX_BASE+ )++ def test_the_default_base_is_amds_stable_multiarch_index(self):+ assert (+ stack_mod._ROCM_WINDOWS_MULTIARCH_INDEX_BASE+ == "https://repo.amd.com/rocm/whl-multi-arch"+ )++ def test_rdna2_still_resolves_to_its_family(self, monkeypatch):+ monkeypatch.delenv("UNSLOTH_ROCM_WINDOWS_MIRROR", raising = False)+ monkeypatch.setattr(stack_mod, "_ROCM_WINDOWS_INDEX_BASE", "https://repo.amd.com/rocm/whl")+ assert (+ stack_mod._windows_rocm_index_url("gfx1034")+ == "https://repo.amd.com/rocm/whl/gfx103X-all/"+ )++ def test_polaris_still_resolves_to_nothing(self):+ assert stack_mod._windows_rocm_index_url("gfx803") is None++ @pytest.mark.parametrize("arch", _RDNA1)+ def test_the_two_card_picker_counts_rdna1_as_having_wheels(self, arch):+ """_dedup_pick decides "has wheels" by asking the resolver, so an RX 5700 XT next to+ an iGPU is no longer deposed to CPU torch."""+ assert stack_mod._is_windows_multiarch_gfx(arch)+ assert stack_mod._windows_rocm_index_url(arch) is not None+++_RDNA1_NAMES = [+ ("AMD Radeon RX 5700 XT", "gfx1010"),+ ("AMD Radeon RX 5600 XT", "gfx1010"),+ ("AMD Radeon Pro W5700", "gfx1010"),+ ("AMD Radeon Pro V520", "gfx1011"),+ ("AMD Radeon RX 5500 XT", "gfx1012"),+ ("AMD Radeon RX 5300M", "gfx1012"),+]+++class TestNameTables:+ @pytest.mark.parametrize("name,expected", _RDNA1_NAMES)+ def test_python_table_resolves_rdna1(self, name, expected):+ assert stack_mod._gfx_arch_from_gpu_name(name) == expected+ assert stack_mod._unsupported_gfx_arch_from_gpu_name(name) is None++ @pytest.mark.parametrize(+ "name", ["AMD Radeon RX 570", "AMD Radeon RX 580", "AMD Radeon RX 550"]+ )+ def test_polaris_is_not_swallowed_by_the_rdna1_rows(self, name):+ assert stack_mod._gfx_arch_from_gpu_name(name) is None++ @staticmethod+ def _ps_rows(path, header):+ src = path.read_text(encoding = "utf-8")+ start = src.index(header)+ i = src.index("(", start)+ depth = 0+ while True:+ if src[i] == "(":+ depth += 1+ elif src[i] == ")":+ depth -= 1+ if depth == 0:+ break+ i += 1+ return re.findall(+ r'@\{\s*P\s*=\s*"([^"]+)"\s*;\s*A\s*=\s*"(gfx[0-9a-z]+)"\s*\}', src[start : i + 1]+ )++ @pytest.mark.parametrize("path", [_INSTALL_PS1, _SETUP_PS1], ids = lambda p: p.name)+ @pytest.mark.parametrize("name,expected", _RDNA1_NAMES)+ def test_powershell_tables_agree(self, path, name, expected):+ supported = self._ps_rows(path, "$nameArchTable = @(")+ unsupported = self._ps_rows(path, "$unsupportedNameArchTable = @(")+ hit = next((a for p, a in supported if re.search(p, name, re.IGNORECASE)), None)+ assert hit == expected, f"{path.name}: {name!r} -> {hit!r}"+ assert not any(+ re.search(p, name, re.IGNORECASE) for p, _ in unsupported+ ), f"{path.name} still calls {name!r} unsupported"++ @pytest.mark.parametrize("name,expected", _RDNA1_NAMES)+ def test_backend_table_agrees(self, name, expected):+ import ast++ tree = ast.parse(_HARDWARE_PY.read_text(encoding = "utf-8"))+ rows = None+ for node in tree.body:+ targets = (+ [node.target] if isinstance(node, ast.AnnAssign) else getattr(node, "targets", [])+ )+ if any(getattr(t, "id", "") == "_GPU_NAME_GFX_TABLE" for t in targets):+ rows = ast.literal_eval(node.value)+ assert rows, "_GPU_NAME_GFX_TABLE not found"+ hit = next((a for p, a in rows if re.search(p, name, re.IGNORECASE)), None)+ assert hit == expected+++class TestPowerShellMirrorsThePin:+ """install.ps1 and setup.ps1 install torch themselves (the python stack only repairs),+ so they carry the same route. Read as text: the parity is the point."""++ @pytest.mark.parametrize("path", [_INSTALL_PS1, _SETUP_PS1], ids = lambda p: p.name)+ def test_same_arches_and_same_tag(self, path):+ src = path.read_text(encoding = "utf-8")+ assert "$multiArchGfx = @(" in src, f"{path.name}: no $multiArchGfx list"+ block = src[src.index("$multiArchGfx = @(") :]+ block = block[: block.index(")") + 1]+ archs = set(re.findall(r'"(gfx[0-9a-z]+)"', block))+ assert archs == set(stack_mod._WINDOWS_MULTIARCH_GFX), f"{path.name}: {archs}"+ assert (+ f'"{stack_mod._ROCM_MULTIARCH_TAG}"' in src+ ), f"{path.name}: tag differs from install_python_stack.py"+ assert f'"{stack_mod._ROCM_MULTIARCH_TORCH_VERSION}"' in src+ assert f'"{stack_mod._ROCM_MULTIARCH_TORCHVISION_VERSION}"' in src+ assert (+ f'$MultiArchTorchaudioVersion = "{stack_mod._ROCM_MULTIARCH_TORCHAUDIO_VERSION}"' in src+ )+ assert "https://repo.amd.com/rocm/whl-multi-arch" in src+ assert "nightly.repo.amd.com" not in src, f"{path.name} still names the nightly index"+++class TestTheWindowsRepairSiteRunsForRdna1:+ """The `studio update` repair in _ensure_rocm_torch reaches the multi-arch trio for a+ gfx1010 host whose venv holds a CPU torch. Exercised end to end because the message+ there once called _bare_gfx(), a name the function later rebinds as a local, and no+ test ran that line."""++ def test_a_gfx1010_host_on_cpu_torch_installs_the_multiarch_trio(self, monkeypatch):+ from unittest.mock import MagicMock, patch++ _mark = stack_mod._TORCH_PROBE_MARKER+ probe = MagicMock(returncode = 0, stdout = _mark + "2.10.0+cpu||" + chr(10))+ pip_try = MagicMock(return_value = True)+ monkeypatch.delenv("UNSLOTH_ROCM_TORCH_INSTALLED", raising = False)+ monkeypatch.delenv("UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR", raising = False)+ with (+ patch.object(stack_mod, "IS_WINDOWS", True),+ patch.object(stack_mod, "IS_MACOS", False),+ patch.object(stack_mod, "_TORCH_BACKEND", ""),+ patch.object(stack_mod, "_explicit_rocm_torch_index_url", return_value = None),+ patch.object(stack_mod, "_explicit_unknown_family_torch_index_url", return_value = None),+ patch.object(stack_mod, "_has_usable_nvidia_gpu", return_value = False),+ patch.object(stack_mod, "_detect_windows_gfx_arch", return_value = "gfx1010"),+ patch.object(stack_mod, "_installed_rocm_wheel_family", return_value = None),+ patch.object(stack_mod, "_install_bnb_windows_rocm", return_value = True),+ patch.object(stack_mod, "pip_install_try", pip_try),+ patch("subprocess.run", return_value = probe),+ ):+ stack_mod._ensure_rocm_torch()+ assert pip_try.call_count == 1+ args = " ".join(str(a) for a in pip_try.call_args.args)+ assert "whl-multi-arch" in args+ assert (+ f"torch[device-gfx1010]=={stack_mod._ROCM_MULTIARCH_TORCH_VERSION}+{stack_mod._ROCM_MULTIARCH_TAG}"+ in args+ )++ @pytest.mark.parametrize("pack_missing,installs", [(True, 1), (False, 0)])+ def test_a_per_family_rocm_torch_without_the_device_pack_is_replaced(+ self, pack_missing, installs, monkeypatch+ ):+ # Standalone `studio update` after the GPU became RDNA 1: a gfx103X ROCm build is+ # importable but has no gfx1010 kernels, and the per-family check has no RDNA 1 key.+ from unittest.mock import MagicMock, patch++ _mark = stack_mod._TORCH_PROBE_MARKER+ probe = MagicMock(returncode = 0, stdout = _mark + "2.10.0+rocm7.2|7.2.0|" + chr(10))+ pip_try = MagicMock(return_value = True)+ monkeypatch.setattr(stack_mod, "_TORCH_RUNTIME_PROBE", None)+ monkeypatch.delenv("UNSLOTH_ROCM_TORCH_INSTALLED", raising = False)+ monkeypatch.delenv("UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR", raising = False)+ with (+ patch.object(stack_mod, "IS_WINDOWS", True),+ patch.object(stack_mod, "IS_MACOS", False),+ patch.object(stack_mod, "_TORCH_BACKEND", ""),+ patch.object(stack_mod, "_explicit_rocm_torch_index_url", return_value = None),+ patch.object(stack_mod, "_explicit_unknown_family_torch_index_url", return_value = None),+ patch.object(stack_mod, "_has_usable_nvidia_gpu", return_value = False),+ patch.object(stack_mod, "_detect_windows_gfx_arch", return_value = "gfx1010"),+ patch.object(stack_mod, "_installed_rocm_wheel_family", return_value = "gfx103x-all"),+ patch.object(+ stack_mod, "_multiarch_device_pack_installed", return_value = not pack_missing+ ),+ patch.object(stack_mod, "_install_bnb_windows_rocm", return_value = True),+ patch.object(stack_mod, "pip_install_try", pip_try),+ patch("subprocess.run", return_value = probe),+ ):+ stack_mod._ensure_rocm_torch()+ assert pip_try.call_count == installs+ if installs:+ assert "torch[device-gfx1010]" in " ".join(str(a) for a in pip_try.call_args.args)++ def test_the_device_pack_check_reads_the_distribution(self, monkeypatch):+ from importlib import metadata++ def absent(name):+ raise metadata.PackageNotFoundError(name)++ monkeypatch.setattr(metadata, "distribution", absent)+ assert stack_mod._multiarch_device_pack_installed("GFX1010:xnack-") is False+ seen = []+ monkeypatch.setattr(metadata, "distribution", lambda name: seen.append(name) or object())+ assert stack_mod._multiarch_device_pack_installed("GFX1010:xnack-") is True+ assert seen == ["amd-torch-device-gfx1010"]+++class TestRdna1CountsAsCoveredEverywhereItIsRouted:+ """Two gates outside the route itself decided RDNA 1 was uncovered: the backend's+ repairability check and setup.ps1's pre-Intel "AMD gets GPU wheels" gate."""++ @pytest.mark.parametrize("name,expected", _RDNA1_NAMES)+ def test_the_backend_can_repair_an_rdna1_card_on_windows(self, name, expected, monkeypatch):+ import importlib.util as _ilu++ spec = _ilu.spec_from_file_location("hardware_rdna1_route", _HARDWARE_PY)+ hw = _ilu.module_from_spec(spec)+ spec.loader.exec_module(hw)+ monkeypatch.setattr(hw.platform, "system", lambda: "Windows")+ assert hw._rocm_supported_gfx_from_gpu_name(name) == expected+ assert hw._amd_device_can_establish_a_mismatch({"name": name}) is True+ assert hw._amd_device_can_establish_a_mismatch({"gfx": expected}) is True+ monkeypatch.setattr(hw.platform, "system", lambda: "Linux")+ assert hw._rocm_supported_gfx_from_gpu_name(name) is None+ assert hw._amd_device_can_establish_a_mismatch({"gfx": expected}) is False++ def test_setup_counts_rdna1_as_having_wheels(self):+ src = _SETUP_PS1.read_text(encoding = "utf-8")+ block = src[src.index("$_rocmWheelArches = @(") :]+ block = block[: block.index("\n)") + 2]+ listed = set(re.findall(r'"(gfx[0-9a-z]+)"', block))+ assert set(stack_mod._WINDOWS_MULTIARCH_GFX) <= listed, sorted(+ set(stack_mod._WINDOWS_MULTIARCH_GFX) - listed+ )++[email protected]("ps1", [_INSTALL_PS1, _SETUP_PS1], ids = lambda p: p.name)+def test_the_gfx_override_drops_hipinfo_feature_suffixes(ps1):+ # hipinfo prints gfx1010:xnack-; copied into UNSLOTH_ROCM_GFX_ARCH it must still route.+ src = ps1.read_text(encoding = "utf-8")+ reads = re.findall(r"=\s*\(?\$env:UNSLOTH_ROCM_GFX_ARCH\.Trim\(\)\.ToLower\(\)[^\n]*", src)+ assert reads and all("-split ':'" in r for r in reads), readsdiff --git a/tests/studio/install/test_rdna1_unsupported_message_8529.py b/tests/studio/install/test_rdna1_unsupported_message_8529.pyindex ad822f75bdb..11a9ecd354d 100644--- a/tests/studio/install/test_rdna1_unsupported_message_8529.py+++ b/tests/studio/install/test_rdna1_unsupported_message_8529.py@@ -18,8 +18,9 @@ raw probe output. The supported-card fixtures (RX 9070 XT, RX 6800 XT) are hereto prove the new lookup cannot reach a card that has wheels, and the RTX 4090 toprove it cannot reach a non-AMD one.-CPU fallback is the correct outcome on RDNA 1 and every test below re-asserts it:-this change is about wording, never about routing.+Since unslothai/unsloth#11614 the Windows installers route RDNA 1 to AMD's multi-arch+index, so on the Windows copies the "not covered" wording is exercised with Polaris+(RX 580, gfx803, #8458). The Linux copies (install.sh, setup.sh) still decline RDNA 1."""import ast@@ -107,6 +108,15 @@ _RDNA1_NAMES = [("AMD Radeon Pro 5700 XT", "gfx1010"),]+# The generation that still has no wheels anywhere: Polaris 10/20/30 (#8458).+_POLARIS_FIXTURES = [+ ("AMD Radeon RX 580", "gfx803"),+ ("AMD Radeon RX 580 Series", "gfx803"),+ ("AMD Radeon RX 570", "gfx803"),+ ("AMD Radeon RX 480", "gfx803"),+ ("AMD Radeon Pro WX 7100", "gfx803"),+]+# Cards the supported table owns, plus a non-AMD one._NOT_RDNA1_NAMES = ["AMD Radeon RX 9070 XT",@@ -129,8 +139,16 @@ _NOT_RDNA1_NAMES = [class TestUnsupportedNameLookup:@pytest.mark.parametrize("name,expected", _RDNA1_NAMES)- def test_rdna1_names_resolve_to_their_arch(self, name, expected):+ def test_rdna1_names_resolve_in_the_supported_table_on_windows(self, name, expected):+ """The behavioural half, inverted since #11614: RDNA 1 routes on Windows, so the+ Windows name table owns it and the messaging table must not claim it."""+ assert stack_mod._gfx_arch_from_gpu_name(name) == expected+ assert stack_mod._unsupported_gfx_arch_from_gpu_name(name) is None++ @pytest.mark.parametrize("name,expected", _POLARIS_FIXTURES)+ def test_polaris_names_resolve_to_their_arch(self, name, expected):assert stack_mod._unsupported_gfx_arch_from_gpu_name(name) == expected+ assert stack_mod._gfx_arch_from_gpu_name(name) is None@pytest.mark.parametrize("name", _NOT_RDNA1_NAMES)def test_supported_and_non_amd_names_are_not_claimed(self, name):@@ -139,12 +157,6 @@ class TestUnsupportedNameLookup:def test_empty_name_is_not_claimed(self):assert stack_mod._unsupported_gfx_arch_from_gpu_name("") is None- @pytest.mark.parametrize("name,_expected", _RDNA1_NAMES)- def test_rdna1_still_gets_no_supported_arch(self, name, _expected):- """The behavioural half: RDNA 1 must keep falling through to CPU torch.- If this ever passes an arch back, the installer would try to route it."""- assert stack_mod._gfx_arch_from_gpu_name(name) is None-def test_no_unsupported_arch_can_reach_a_wheel_index(self):"""The scope guard. An arch in this table with an index-family entry wouldturn a messaging row into an installation change."""@@ -209,8 +221,8 @@ class TestExplicitIndexPinIsHonoured:def test_the_python_warning_drops_the_cpu_claim_when_pinned(self):with patch.dict(os.environ, {"UNSLOTH_TORCH_INDEX_URL": "https://example/gfx1010"}):- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])- assert "gfx1010" in out, "the card is still named"+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])+ assert "gfx803" in out, "the card is still named"assert self._CPU_CLAIM not in out, f"a pinned index still gets the CPU-only verdict:\n{out}"@pytest.mark.parametrize(@@ -230,7 +242,7 @@ class TestExplicitIndexPinIsHonoured:for _k in ("UNSLOTH_TORCH_INDEX_URL", "UNSLOTH_TORCH_INDEX_FAMILY"):if _k not in env:os.environ.pop(_k, None)- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert (self._CPU_CLAIM in out), f"a blank pin ({env}) was read as a pin, dropping the CPU-only warning:\n{out}"@@ -240,7 +252,7 @@ class TestExplicitIndexPinIsHonoured:with patch.dict(os.environ, {}, clear = False):for _v in ("UNSLOTH_TORCH_INDEX_URL", "UNSLOTH_TORCH_INDEX_FAMILY"):os.environ.pop(_v, None)- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert self._CPU_CLAIM in out@pytest.mark.parametrize("path", [_INSTALL_PS1, _SETUP_PS1, _SETUP_SH], ids = lambda p: p.name)@@ -313,8 +325,8 @@ class TestPythonStackWindowsArm64:ARM64 throw applies to it: setup.ps1 rejects the variable there."""def test_arm64_gets_a_source_build_note_instead_of_the_setter(self):- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"], arm64 = True)- assert "gfx1010" in out, "the card is still named"+ _arch, out = _wmi_detect(["AMD Radeon RX 580"], arm64 = True)+ assert "gfx803" in out, "the card is still named"assert ("UNSLOTH_LLAMA_CPP_BACKEND" not in out), f"ARM64 is still told to set the variable setup.ps1 throws on:\n{out}"@@ -322,7 +334,7 @@ class TestPythonStackWindowsArm64:def test_x64_still_gets_the_setter(self):"""Positive control: the guard must not silence the advice everywhere."""- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert "UNSLOTH_LLAMA_CPP_BACKEND" in out@pytest.mark.parametrize(@@ -367,21 +379,29 @@ class TestPythonStackWindowsArm64:class TestWindowsWmiMessage:- def test_rdna1_adapter_still_yields_no_arch(self):- """CPU fallback unchanged. This is the assertion that keeps the fix honest."""- arch, _out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ def test_rdna1_adapter_now_yields_its_arch(self):+ """Since #11614 the reporter's card routes: the WMI path infers gfx1010 and the+ multi-arch index takes it from there. No "not covered" message for it."""+ arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ assert arch == "gfx1010"+ assert "does not cover" not in out++ def test_polaris_adapter_still_yields_no_arch(self):+ """CPU fallback unchanged where nothing routes. This is the assertion that keeps+ the wording fix honest."""+ arch, _out = _wmi_detect(["AMD Radeon RX 580"])assert arch is None- def test_rdna1_adapter_is_named_with_its_arch(self):- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])- assert "gfx1010" in out- assert "AMD Radeon RX 5700 XT" in out+ def test_polaris_adapter_is_named_with_its_arch(self):+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])+ assert "gfx803" in out+ assert "AMD Radeon RX 580" in out- def test_rdna1_adapter_is_not_told_to_set_the_override(self):- """The defect proper. Setting UNSLOTH_ROCM_GFX_ARCH=gfx1010 lands on the+ def test_polaris_adapter_is_not_told_to_set_the_override(self):+ """The defect proper. Setting UNSLOTH_ROCM_GFX_ARCH=gfx803 lands on theunmapped-arch path and returns CPU anyway, so instructing it is an errandwith no ending. The variable may still be NAMED, to say it cannot help."""- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert "Set UNSLOTH_ROCM_GFX_ARCH to your GPU's arch" not in outassert "gfx1200" not in outassert "no UNSLOTH_ROCM_GFX_ARCH value changes that" in out@@ -519,11 +539,22 @@ class TestUnsupportedTableParity:for where, parsed in rows.items():assert parsed, f"{where}: parsed an empty unsupported table (moved or renamed?)"+ _LINUX_COPIES = ("install.sh", "studio/setup.sh")+@pytest.mark.parametrize("name,expected", _RDNA1_NAMES)- def test_all_copies_agree_on_rdna1(self, name, expected):- answers = {where: fn(name) for where, fn in _all_copies().items()}+ def test_linux_copies_still_name_rdna1(self, name, expected):+ """Linux keeps the message: the multi-arch route is Windows-only until it has+ been run on bare-metal Linux (#11614)."""+ answers = {w: fn(name) for w, fn in _all_copies().items() if w in self._LINUX_COPIES}assert set(answers.values()) == {expected}, f"{name!r} resolves inconsistently: {answers}"+ @pytest.mark.parametrize("name,_expected", _RDNA1_NAMES)+ def test_windows_copies_no_longer_claim_rdna1(self, name, _expected):+ """The Windows copies route RDNA 1, so a claim here would print "not covered"+ at a card that is about to get wheels."""+ answers = {w: fn(name) for w, fn in _all_copies().items() if w not in self._LINUX_COPIES}+ assert set(answers.values()) == {None}, f"{name!r} is still called unsupported: {answers}"+@pytest.mark.parametrize("name", _NOT_RDNA1_NAMES)def test_no_copy_claims_a_supported_card(self, name):answers = {where: fn(name) for where, fn in _all_copies().items()}@@ -1275,7 +1306,7 @@ class TestVulkanAdvice:"""Source-text assertions cannot tell a live branch from a dead one, and thePython copy's message is not readable line by line. Drive the real Windowspath and read what it actually printed."""- arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ arch, out = _wmi_detect(["AMD Radeon RX 580"])assert arch is None, "routing must be unchanged; this is a wording fix"assert needle in out, f"the printed advice is missing {what} ({needle!r})"@@ -1283,7 +1314,7 @@ class TestVulkanAdvice:"""This branch is Windows-only, so its setter has to be pasteable intoPowerShell. Read the live output, not the source: the message is built fromimplicitly-joined fragments and no single source line carries it."""- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert _PWSH_SETTER in out, f"the printed advice is not pasteable into PowerShell:\n{out}"assert (_POSIX_ASSIGNMENT not in out@@ -1298,7 +1329,7 @@ class TestVulkanAdvice:because that list is also used for the per-line source scan where a timingphrase legitimately lives on a different line than the variable."""- _arch, out = _wmi_detect(["AMD Radeon RX 5700 XT"])+ _arch, out = _wmi_detect(["AMD Radeon RX 580"])assert "install time" in out, (f"the printed advice names the Vulkan variable but never says when to "f"set it:\n{out}"@@ -1424,8 +1455,10 @@ class TestPolarisRow:def test_polaris_patterns_do_not_swallow_rdna1(self, name, expected):"""The collision this row is one keystroke away from: "RX 570" is a prefixof "RX 5700" and "RX 550" of "RX 5500". Re-assert every RDNA 1 name still- resolves to its own arch now that a Polaris row exists."""- assert stack_mod._unsupported_gfx_arch_from_gpu_name(name) == expected+ resolves to its own arch (in the Windows supported table since #11614) and is+ not claimed by the Polaris row."""+ assert stack_mod._gfx_arch_from_gpu_name(name) == expected+ assert stack_mod._unsupported_gfx_arch_from_gpu_name(name) is None@pytest.mark.parametrize("name,_expected", _RDNA1_NAMES)def test_the_polaris_pattern_is_correct_on_its_own(self, name, _expected):diff --git a/tests/studio/install/test_rocm_arch_table_parity.py b/tests/studio/install/test_rocm_arch_table_parity.pyindex b5cf86861b6..61043829671 100644--- a/tests/studio/install/test_rocm_arch_table_parity.py+++ b/tests/studio/install/test_rocm_arch_table_parity.py@@ -506,8 +506,16 @@ class TestGpuNameArchParity:"""Every arch a name table can produce must be routable to an AMD wheelindex, else detection succeeds and the install still lands on CPU torch."""families = stack_mod._GFX_TO_AMD_INDEX_ARCH+ # RDNA 1 is Windows-only (multi-arch index, #11614); Linux tables must not produce it.+ multiarch = stack_mod._WINDOWS_MULTIARCH_GFX+ linux_copies = ("install.sh", "studio/setup.sh")for where, rows in _name_tables().items():for arch in {arch for _, arch in rows}:+ if arch in multiarch and not where.startswith(linux_copies):+ assert (+ stack_mod._windows_rocm_index_url(arch) is not None+ ), f"{where}: {arch} has no Windows route"+ continueassert arch in families, f"{where}: {arch} has no entry in _GFX_TO_AMD_INDEX_ARCH"def test_every_documented_gpu_resolves_somewhere(self):diff --git a/tests/studio/install/test_rocm_support.py b/tests/studio/install/test_rocm_support.pyindex 1a19895278b..e240a24151a 100644--- a/tests/studio/install/test_rocm_support.py+++ b/tests/studio/install/test_rocm_support.py@@ -4631,16 +4631,16 @@ class TestDetectWindowsGfxArch:assert result == "gfx1036"def test_unsupported_discrete_does_not_depose_a_supported_igpu(self, monkeypatch):- # A supported APU next to a discrete card with no Windows wheels (gfx1010 is absent- # from _GFX_TO_AMD_INDEX_ARCH): preferring the dGPU purely for being discrete+ # A supported APU next to a discrete card with no Windows wheels (gfx803, Polaris, is absent+ # from _GFX_TO_AMD_INDEX_ARCH; gfx1010 routes since #11755): preferring the dGPU purely for being discrete# resolves to no index and falls back to CPU, worse than the shadowing itself.monkeypatch.delenv("HIP_VISIBLE_DEVICES", raising = False)monkeypatch.delenv("ROCR_VISIBLE_DEVICES", raising = False)monkeypatch.delenv("CUDA_VISIBLE_DEVICES", raising = False)- assert stack_mod._windows_rocm_index_url("gfx1010") is None+ assert stack_mod._windows_rocm_index_url("gfx803") is Nonemock_result = MagicMock()mock_result.returncode = 0- mock_result.stdout = b"gcnArchName : gfx1036\ngcnArchName : gfx1010\n"+ mock_result.stdout = b"gcnArchName : gfx1036\ngcnArchName : gfx803\n"with patch("shutil.which", return_value = "/usr/bin/hipinfo"):with patch("subprocess.run", return_value = mock_result):result = stack_mod._detect_windows_gfx_arch()@@ -4654,14 +4654,14 @@ class TestDetectWindowsGfxArch:monkeypatch.delenv("ROCR_VISIBLE_DEVICES", raising = False)monkeypatch.delenv("CUDA_VISIBLE_DEVICES", raising = False)assert stack_mod._windows_rocm_index_url("gfx1013") is None- assert stack_mod._windows_rocm_index_url("gfx1010") is None+ assert stack_mod._windows_rocm_index_url("gfx803") is Nonemock_result = MagicMock()mock_result.returncode = 0- mock_result.stdout = b"gcnArchName : gfx1013\ngcnArchName : gfx1010\n"+ mock_result.stdout = b"gcnArchName : gfx1013\ngcnArchName : gfx803\n"with patch("shutil.which", return_value = "/usr/bin/hipinfo"):with patch("subprocess.run", return_value = mock_result):result = stack_mod._detect_windows_gfx_arch()- assert result == "gfx1010"+ assert result == "gfx803"def test_cuda_visible_devices_also_pins_the_igpu(self, monkeypatch):# HIP honours CUDA_VISIBLE_DEVICES with the same semantics as its own masks, so a@@ -4765,14 +4765,14 @@ class TestDetectWindowsGfxArch:assert self._hipinfo_pick(["gfx1036:xnack-", "gfx1200:xnack-"]) == "gfx1200"def test_prefers_a_wheel_backed_discrete_over_an_unsupported_one(self, monkeypatch):- # gfx1010 has no Windows wheel index, so stopping at the first non-integrated+ # gfx803 (Polaris) has no Windows wheel index (gfx1010 routes since #11755), so stopping at the first non-integrated# token dropped a host with a perfectly good gfx1200 to CPU torch.for _m in ("HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES"):monkeypatch.delenv(_m, raising = False)- assert stack_mod._windows_rocm_index_url("gfx1010") is None- assert self._hipinfo_pick(["gfx1036", "gfx1010", "gfx1200"]) == "gfx1200"+ assert stack_mod._windows_rocm_index_url("gfx803") is None+ assert self._hipinfo_pick(["gfx1036", "gfx803", "gfx1200"]) == "gfx1200"# Same when the iGPU itself has no wheels: still prefer the supported card.- assert self._hipinfo_pick(["gfx1013", "gfx1010", "gfx1200"]) == "gfx1200"+ assert self._hipinfo_pick(["gfx1013", "gfx803", "gfx1200"]) == "gfx1200"def test_pinning_a_wheelless_gpu_says_why_torch_will_be_cpu(self, monkeypatch, capsys):# The pin is honoured, but silently installing CPU torch while another enumerated@@ -4781,7 +4781,7 @@ class TestDetectWindowsGfxArch:monkeypatch.delenv("HIP_VISIBLE_DEVICES", raising = False)monkeypatch.delenv("ROCR_VISIBLE_DEVICES", raising = False)monkeypatch.setenv("CUDA_VISIBLE_DEVICES", "1,0")- assert self._hipinfo_pick(["gfx1010", "gfx1036"]) == "gfx1010"+ assert self._hipinfo_pick(["gfx803", "gfx1036"]) == "gfx803"out = capsys.readouterr().outassert "no AMD Windows wheels" in outassert "gfx1036" in out@@ -4800,10 +4800,10 @@ class TestDetectWindowsGfxArch:def test_advisory_names_the_selected_gpus_real_index(self, monkeypatch, capsys):# Not always device 1: here it is device 2, and naming 1 would expose the- # gfx1010 the installed wheels do not target.+ # gfx803 the installed wheels do not target.for _m in ("HIP_VISIBLE_DEVICES", "ROCR_VISIBLE_DEVICES", "CUDA_VISIBLE_DEVICES"):monkeypatch.delenv(_m, raising = False)- assert self._hipinfo_pick(["gfx1036", "gfx1010", "gfx1200"]) == "gfx1200"+ assert self._hipinfo_pick(["gfx1036", "gfx803", "gfx1200"]) == "gfx1200"out = capsys.readouterr().outassert "HIP_VISIBLE_DEVICES 2" in outassert "HIP_VISIBLE_DEVICES 1" not in outdiff --git a/tests/studio/install/test_unsupported_arch_routing_guards_8529.py b/tests/studio/install/test_unsupported_arch_routing_guards_8529.pyindex 81eb82c402b..dc0b28e26f3 100644--- a/tests/studio/install/test_unsupported_arch_routing_guards_8529.py+++ b/tests/studio/install/test_unsupported_arch_routing_guards_8529.py@@ -66,8 +66,13 @@ def _load_stack_module():stack_mod = _load_stack_module()-# The four arches the messaging table owns. Nothing here may produce an index.-_UNSUPPORTED_ARCHES = ["gfx803", "gfx1010", "gfx1011", "gfx1012"]+# The arch the messaging table owns on every platform. Nothing here may produce an index.+_UNSUPPORTED_ARCHES = ["gfx803"]+# RDNA 1 (#11614): routed on Windows, still unrouted on Linux.+_RDNA1_ARCHES = ["gfx1010", "gfx1011", "gfx1012"]+_RDNA1_ARCH_INPUTS = (+ _RDNA1_ARCHES + [a.upper() for a in _RDNA1_ARCHES] + [f"{a}:xnack-" for a in _RDNA1_ARCHES]+)# The same arches as the installers may actually receive them.# UNSLOTH_ROCM_GFX_ARCH is user-typed (so any case), and a gcnArchName copied out of hipinfo/rocminfo carries the target@@ -78,6 +83,8 @@ _UNSUPPORTED_ARCH_INPUTS = (+ [a.upper() for a in _UNSUPPORTED_ARCHES]+ [f"{a}:xnack-" for a in _UNSUPPORTED_ARCHES])+# What Linux must still leave on the CPU index: Polaris and RDNA 1 alike.+_LINUX_UNROUTED_ARCH_INPUTS = _UNSUPPORTED_ARCH_INPUTS + _RDNA1_ARCH_INPUTS# Arches that MUST route, so that "no index" cannot pass for the right answer when the table has been renamed, emptied# or parsed wrong. gfx1030 is RDNA 2 (RX 6800 XT) and gfx1100 is RDNA 3 (RX 7900 XTX); both ship AMD wheels today.@@ -145,6 +152,51 @@ class TestPythonIndexResolversAreAskedDirectly:assert arch not in stack_mod._GFX_TO_AMD_INDEX_ARCH+_MULTIARCH_HOST = "repo.amd.com/rocm/whl-multi-arch"+++class TestRdna1RoutesOnWindowsOnly:+ """#11614: the RDNA 1 arches reach AMD's multi-arch index, and only from+ the Windows resolver. They are deliberately NOT keys of the per-family map: that map+ is one URL leaf per family on repo.amd.com, and the multi-arch index selects the+ device through the `torch[device-gfxNNNN]` extra instead."""++ @pytest.mark.parametrize("arch", _RDNA1_ARCH_INPUTS)+ def test_windows_resolver_names_the_multiarch_index(self, arch):+ url = stack_mod._windows_rocm_index_url(arch)+ assert url is not None and _MULTIARCH_HOST in url, f"{arch} routed to {url!r}"+ assert "repo.amd.com/rocm/whl/" not in url++ @pytest.mark.parametrize("arch", _RDNA1_ARCH_INPUTS)+ def test_the_platform_wrapper_agrees_on_windows(self, arch):+ with patch.object(stack_mod, "IS_WINDOWS", True):+ url = stack_mod._amd_arch_index_url(arch)+ assert url is not None and _MULTIARCH_HOST in url, f"{arch} routed to {url!r}"++ @pytest.mark.parametrize("arch", _RDNA1_ARCH_INPUTS)+ def test_linux_still_leaves_rdna1_on_cpu_torch(self, arch):+ with patch.object(stack_mod, "IS_WINDOWS", False):+ url = stack_mod._amd_arch_index_url(arch)+ assert url is None, f"{arch} was routed on Linux to {url!r}; that path is unmeasured"++ @pytest.mark.parametrize("arch", _RDNA1_ARCHES)+ def test_rdna1_is_not_a_per_family_key(self, arch):+ assert arch not in stack_mod._GFX_TO_AMD_INDEX_ARCH+ assert arch in stack_mod._WINDOWS_MULTIARCH_GFX++ def test_the_mirror_override_is_honoured(self, monkeypatch):+ """Air-gapped hosts mirror the multi-arch index like they mirror repo.amd.com/rocm/whl."""+ monkeypatch.setenv(+ "UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR", "https://mirror.example/whl-multi-arch"+ )+ monkeypatch.setattr(+ stack_mod, "_ROCM_WINDOWS_MULTIARCH_INDEX_BASE", "https://mirror.example/whl-multi-arch"+ )+ assert (+ stack_mod._windows_rocm_index_url("gfx1010") == "https://mirror.example/whl-multi-arch"+ )++# ── install.sh's case table, executed under sh ───────────────────────────────@@ -190,7 +242,7 @@ class TestInstallShIndexFamilyRuns:its three call sites treat a non-zero return as "no AMD wheels, use CPU". An armadded there is invisible to every Python-side assertion, so run the real case."""- @pytest.mark.parametrize("arch", _UNSUPPORTED_ARCH_INPUTS)+ @pytest.mark.parametrize("arch", _LINUX_UNROUTED_ARCH_INPUTS)def test_no_unsupported_arch_yields_a_family(self, arch):rc, out = _run_sh_index_family(arch)assert rc != 0 and out == "", (@@ -282,7 +334,7 @@ class TestInstallShIndexSelectorRuns:the selector itself, with the arch pinned the way a user of an uncovered card istold to pin it."""- @pytest.mark.parametrize("arch", _UNSUPPORTED_ARCH_INPUTS)+ @pytest.mark.parametrize("arch", _LINUX_UNROUTED_ARCH_INPUTS)def test_no_unsupported_arch_leaves_the_cpu_index(self, arch):url, err = _run_sh_get_torch_index_url(arch)assert url.endswith(@@ -988,9 +1040,20 @@ def test_the_five_unsupported_tables_agree_on_every_name():for source, got in answers.items():assert len(got) == len(names), f"{source}: {len(got)} answers for {len(names)} names"+ # Since #11755 only RDNA 1 names may disagree (Windows routes, Linux declines).+ _windows_sources = {"install_python_stack.py", "install.ps1", "setup.ps1"}+ _rdna1 = stack_mod._WINDOWS_MULTIARCH_GFXdisagreements = []for i, name in enumerate(names):seen = {src: got[i] for src, got in answers.items()}+ linux_answer = seen["install.sh"]+ if linux_answer in _rdna1:+ for src, got_arch in seen.items():+ expected = "" if src in _windows_sources else linux_answer+ if got_arch != expected:+ disagreements.append((name, seen))+ break+ continueif len(set(seen.values())) > 1:disagreements.append((name, seen))assert not disagreements, "the unsupported-arch tables have drifted apart:\n" + "\n".join(diff --git a/tests/studio/test_amd_name_arch_r9700.ps1 b/tests/studio/test_amd_name_arch_r9700.ps1index 474db48d1e0..707d3340739 100644--- a/tests/studio/test_amd_name_arch_r9700.ps1+++ b/tests/studio/test_amd_name_arch_r9700.ps1@@ -80,7 +80,7 @@ $otherNames = @(@{ N = "ATI Radeon 9700 PRO"; A = $null },@{ N = "ATI Radeon 9800 PRO"; A = $null },@{ N = "AMD Radeon R9 Fury X"; A = $null },- @{ N = "AMD Radeon RX 5700 XT"; A = $null },+ @{ N = "AMD Radeon RX 5700 XT"; A = "gfx1010" }, # RDNA 1 routes on Windows since unslothai#11614@{ N = "AMD Radeon Pro WX 9100"; A = $null },@{ N = "AMD Instinct MI300X"; A = $null },@{ N = "NVIDIA GeForce RTX 4090"; A = $null },diff --git a/tests/studio/test_rdna1_unsupported_message_8529.ps1 b/tests/studio/test_rdna1_unsupported_message_8529.ps1index 367bc04d601..0d47bf9ac7d 100644--- a/tests/studio/test_rdna1_unsupported_message_8529.ps1+++ b/tests/studio/test_rdna1_unsupported_message_8529.ps1@@ -4,8 +4,10 @@# Behavioural test for the RDNA 1 "detected but not covered by ROCm" wording in# install.ps1 and studio/setup.ps1 (issue #8529). The reporter's card is an RX 5700 XT# (Navi 10, gfx1010). AMD's Windows torch indexes are gfx103X/110X/1150/1151/120X only,-# so CPU torch is correct and stays; the bug was telling them to install the HIP SDK or-# set UNSLOTH_ROCM_GFX_ARCH, neither of which can succeed on gfx1010.+# so CPU torch was correct; the bug was telling them to install the HIP SDK or set+# UNSLOTH_ROCM_GFX_ARCH. Since unslothai#11614 the Windows installers route RDNA 1 to AMD's+# multi-arch index, so RDNA 1 lives in the supported table and Polaris (gfx803)+# is what the unsupported wording is exercised with.## The Python suite evaluates the table with Python's `re`; this runs it under the .NET# engine that ships it, the only place -match semantics are real. Fixtures are raw WMI@@ -52,27 +54,27 @@ foreach ($file in @("install.ps1", "studio/setup.ps1")) {}# --- the reporter's card, and the rest of RDNA 1 ---------------------------- Check "RX 5700 XT -> gfx1010" ((Resolve-Unsupported "AMD Radeon RX 5700 XT") -eq 'gfx1010')- Check "RX 5700 -> gfx1010" ((Resolve-Unsupported "AMD Radeon RX 5700") -eq 'gfx1010')- Check "RX 5600 XT -> gfx1010" ((Resolve-Unsupported "AMD Radeon RX 5600 XT") -eq 'gfx1010')- Check "Radeon Pro 5600 XT -> gfx1010" ((Resolve-Unsupported "AMD Radeon Pro 5600 XT") -eq 'gfx1010')- Check "Radeon Pro V520 -> gfx1011" ((Resolve-Unsupported "AMD Radeon Pro V520") -eq 'gfx1011')- Check "Radeon Pro 5600M -> gfx1011" ((Resolve-Unsupported "AMD Radeon Pro 5600M") -eq 'gfx1011')- Check "RX 5500 XT -> gfx1012" ((Resolve-Unsupported "AMD Radeon RX 5500 XT") -eq 'gfx1012')+ Check "RX 5700 XT no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5700 XT"))+ Check "RX 5700 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5700"))+ Check "RX 5600 XT no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5600 XT"))+ Check "Radeon Pro 5600 XT no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro 5600 XT"))+ Check "Radeon Pro V520 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro V520"))+ Check "Radeon Pro 5600M no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro 5600M"))+ Check "RX 5500 XT no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5500 XT"))# The professional boards LLVM's table omits, mapped from libdrm data/amdgpu.ids read# against pci.ids, which files 7312/7310 under Navi 10 and 7340/7341/7347/734f under# Navi 14.- Check "Radeon Pro W5700 -> gfx1010" ((Resolve-Unsupported "AMD Radeon Pro W5700") -eq 'gfx1010')- Check "Radeon Pro W5700X -> gfx1010" ((Resolve-Unsupported "AMD Radeon Pro W5700X") -eq 'gfx1010')- Check "Radeon Pro W5500 -> gfx1012" ((Resolve-Unsupported "AMD Radeon Pro W5500") -eq 'gfx1012')- Check "Radeon Pro W5500M -> gfx1012" ((Resolve-Unsupported "AMD Radeon Pro W5500M") -eq 'gfx1012')- Check "Radeon Pro W5300M -> gfx1012" ((Resolve-Unsupported "AMD Radeon Pro W5300M") -eq 'gfx1012')- Check "RX 5300 -> gfx1012" ((Resolve-Unsupported "AMD Radeon RX 5300") -eq 'gfx1012')- Check "RX 5300M -> gfx1012" ((Resolve-Unsupported "AMD Radeon RX 5300M") -eq 'gfx1012')+ Check "Radeon Pro W5700 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro W5700"))+ Check "Radeon Pro W5700X no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro W5700X"))+ Check "Radeon Pro W5500 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro W5500"))+ Check "Radeon Pro W5500M no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro W5500M"))+ Check "Radeon Pro W5300M no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro W5300M"))+ Check "RX 5300 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5300"))+ Check "RX 5300M no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon RX 5300M"))# The Mac Pro MPX boards, pci.ids 7319 and 731b under Navi 10. The only Navi 10# retail parts whose name carries neither "RX 5700" nor a W prefix.- Check "Radeon Pro 5700 XT -> gfx1010" ((Resolve-Unsupported "AMD Radeon Pro 5700 XT") -eq 'gfx1010')- Check "Radeon Pro 5700 -> gfx1010" ((Resolve-Unsupported "AMD Radeon Pro 5700") -eq 'gfx1010')+ Check "Radeon Pro 5700 XT no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro 5700 XT"))+ Check "Radeon Pro 5700 no longer unsupported (routes on Windows, #11614)" ($null -eq (Resolve-Unsupported "AMD Radeon Pro 5700"))# The W-series that DOES have wheels: "W5700" must not be read out of "W7500".Check "PRO W7500 unclaimed" ($null -eq (Resolve-Unsupported "AMD Radeon PRO W7500"))Check "PRO W6500 unclaimed" ($null -eq (Resolve-Unsupported "AMD Radeon PRO W6500"))@@ -123,8 +125,14 @@ foreach ($file in @("install.ps1", "studio/setup.ps1")) {}return $null}- Check "RX 5700 XT gets no supported arch" ($null -eq (Resolve-Supported "AMD Radeon RX 5700 XT"))- Check "RX 5500 XT gets no supported arch" ($null -eq (Resolve-Supported "AMD Radeon RX 5500 XT"))+ # #11614: RDNA 1 is in the supported table now.+ Check "RX 5700 XT -> gfx1010 (supported)" ((Resolve-Supported "AMD Radeon RX 5700 XT") -eq 'gfx1010')+ Check "RX 5600 XT -> gfx1010 (supported)" ((Resolve-Supported "AMD Radeon RX 5600 XT") -eq 'gfx1010')+ Check "Radeon Pro W5700 -> gfx1010 (supported)" ((Resolve-Supported "AMD Radeon Pro W5700") -eq 'gfx1010')+ Check "Radeon Pro V520 -> gfx1011 (supported)" ((Resolve-Supported "AMD Radeon Pro V520") -eq 'gfx1011')+ Check "RX 5500 XT -> gfx1012 (supported)" ((Resolve-Supported "AMD Radeon RX 5500 XT") -eq 'gfx1012')+ Check "RX 570 still gets no supported arch" ($null -eq (Resolve-Supported "AMD Radeon RX 570"))+ Check "RX 580 still gets no supported arch" ($null -eq (Resolve-Supported "AMD Radeon RX 580"))Check "RX 9070 XT still maps to gfx1201" ((Resolve-Supported "AMD Radeon RX 9070 XT") -eq 'gfx1201')# No arch may appear in both tables: one routes to a wheel index, the other@@ -405,33 +413,37 @@ Invoke-Expression (Get-AssignmentSource $installPath '$unsupportedNameArchTable'# block's own `$ROCmUnsupportedGfxArch = $row.A` land in that function's scope, so every# "claims nothing" case would pass without the guard existing at all.$guardCases = @(- # The reporter's host: one RDNA 1 card, nothing else. The verdict must still be reached.- @{ N = "lone RX 5700 XT is still named gfx1010"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT"); E = 'gfx1010' }- # The mixed host: adapter 0 is the 5700, adapter 1 has wheels. Stay quiet and keep the+ # Since unslothai#11614 the uncovered card is Polaris (RX 580); RDNA 1 is a covered peer.+ # The reporter's host: one uncovered card, nothing else. The verdict must still be reached.+ @{ N = "lone RX 580 is still named gfx803"+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580"); E = 'gfx803' }+ # The mixed host: adapter 0 is the 580, adapter 1 has wheels. Stay quiet and keep the# arch-unknown arm, which points at the override that really does work there.- @{ N = "RX 5700 beside an RX 7900 XTX claims nothing"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT", "AMD Radeon RX 7900 XTX"); E = $null }+ @{ N = "RX 580 beside an RX 7900 XTX claims nothing"+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon RX 7900 XTX"); E = $null }@{ N = "RX 580 beside an RX 9070 XT claims nothing"L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon RX 9070 XT"); E = $null }- # Two uncovered cards are still an uncovered host.- @{ N = "RX 5700 XT beside an RX 580 is still named"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT", "AMD Radeon RX 580"); E = 'gfx1010' }+ # An RDNA 1 peer is a covered peer now.+ @{ N = "RX 580 beside an RX 5700 XT claims nothing (RDNA 1 routes, #11614)"+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon RX 5700 XT"); E = $null }+ # And the RX 5700 XT itself never reaches this table any more.+ @{ N = "lone RX 5700 XT is not called unsupported"+ L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT"); E = $null }# A peer we cannot map is not a covered peer; it is the unknown the arm already handles.- @{ N = "RX 5700 XT beside an unmappable Radeon is still named"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT", "AMD Radeon Graphics"); E = 'gfx1010' }+ @{ N = "RX 580 beside an unmappable Radeon is still named"+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon Graphics"); E = 'gfx803' }# The amd-smi paths never enter the WMI scan, so the peer list is empty there.@{ N = "an empty peer list does not suppress the verdict"- L = "AMD Radeon RX 5700 XT"; A = @(); E = 'gfx1010' }+ L = "AMD Radeon RX 580"; A = @(); E = 'gfx803' }# Under a mask the peers no longer speak for the named card, but both label sources take# adapter 0, so the label is only the SELECTED card when there is nothing else to pick.- @{ N = "a masked lone RX 5700 XT is still named"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT"); M = "0"; E = 'gfx1010' }+ @{ N = "a masked lone RX 580 is still named"+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580"); M = "0"; E = 'gfx803' }@{ N = "a mask beside a second adapter claims nothing"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT", "AMD Radeon RX 7900 XTX"); M = "1"; E = $null }+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon RX 7900 XTX"); M = "1"; E = $null }# Even two uncovered peers: the arch named would still be adapter 0's, not the pinned one.@{ N = "a mask beside a second uncovered adapter claims nothing"- L = "AMD Radeon RX 5700 XT"; A = @("AMD Radeon RX 5700 XT", "AMD Radeon RX 580"); M = "1"; E = $null }+ L = "AMD Radeon RX 580"; A = @("AMD Radeon RX 580", "AMD Radeon RX 570"); M = "1"; E = $null })$guardSource = $guardBlocks[0].Extent.Textforeach ($case in $guardCases) {diff --git a/tests/test_windows_amd_gpu_scan_fallback.py b/tests/test_windows_amd_gpu_scan_fallback.pyindex aa0506af4ee..35548e6a5fb 100644--- a/tests/test_windows_amd_gpu_scan_fallback.py+++ b/tests/test_windows_amd_gpu_scan_fallback.py@@ -410,7 +410,8 @@ def test_a_mask_suppresses_the_handoff(tmp_path, var):resolves nothing rather than borrowing the 780M's arch. The installer scans without the maskand forwards that very arch, and taking it would install for a GPU the mask hides from theruntime entirely (ROCR filters below HIP, so masked devices never reach enumeration)."""- adapters = [(_R780M, 0), ("AMD Radeon RX 5700 XT", 0)]+ # RX 580 (gfx803): the RX 5700 XT routes since #11755.+ adapters = [(_R780M, 0), ("AMD Radeon RX 580", 0)]assert _run(tmp_path, adapters, env = {var: "1", HANDOFF: "gfx1103"})["arch"] is None@@ -488,10 +489,8 @@ def test_the_installer_skips_a_disabled_adapter(tmp_path):"""A disabled Radeon listed first used to win here, and a mapped arch installs ROCm wheelsright there, so the dead card got the wheels and the live unsupported one went to nothing.Setup filters this adapter out, so forwarding its arch also made the two disagree."""- out = _run_installer_scan(- tmp_path, [("AMD Radeon RX 9070 XT", 22), ("AMD Radeon RX 5700 XT", 0)]- )- assert out["label"] == "AMD Radeon RX 5700 XT"+ out = _run_installer_scan(tmp_path, [("AMD Radeon RX 9070 XT", 22), ("AMD Radeon RX 580", 0)])+ assert out["label"] == "AMD Radeon RX 580"assert out["arch"] is None, "the active card is unsupported, so this host belongs on CPU"