Skip to content

Unsloth Studio installer (AMD/Windows): install PyTorch for RX 5000 to 9000 cards from AMD's multi-arch index - #11846

Merged
danielhanchen merged 30 commits into
unslothai:mainfrom
LeoBorcherding:feat/windows-amd-multiarch-all-11815
Sep 29, 2026
Merged

danielhanchen merged 30 commits into
unslothai:mainfrom
LeoBorcherding:feat/windows-amd-multiarch-all-11815

Conversation

@LeoBorcherding

@LeoBorcherding LeoBorcherding commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Implements the Windows half of #11815. Stacked on #11755 (the RDNA 1 route this generalises): the diff against main includes that PR until it merges, the diff against fix/installer-rdna1-multiarch-index is this change alone.

What changes

Every Windows RDNA arch installs from AMD's stable multi-arch index, https://repo.amd.com/rocm/whl-multi-arch/, with the exact trio #11755 pins (torch[device-gfxNNNN]==2.11.0+rocm7.14.1, torchvision==0.26.0+rocm7.14.1, torchaudio==2.11.0+rocm7.14.1):

routed here now stays on its repo.amd.com family
gfx1010 / 1011 / 1012 (already, #11755) gfx1033 (Van Gogh: in _ROCM_MISCOMPUTING_GFX, unmeasured on this build)
gfx1030 / 1031 / 1032 / 1034 / 1035 / 1036 gfx908 / gfx90a (CDNA, unmeasured)
gfx1100 / 1101 / 1102 / 1103
gfx1150 / 1151 / 1152 / 1153 (1153 is new: no per-family index exists for it)
gfx1200 / 1201

Same constants, same three installers as #11755: _WINDOWS_MULTIARCH_GFX / $multiArchGfx become the set above, the messages stop saying "RDNA 1", and $_rocmWheelArches in setup.ps1 counts gfx1153.

The per-family map is not removed. Two things still use it:

  • a host that mirrors the family layout (UNSLOTH_ROCM_WINDOWS_MIRROR set, no UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR) keeps the family route for every arch that has a family. RDNA 1 and gfx1153 have none, so a family mirror changes nothing for them. Python: _windows_family_mirror_pinned() / _windows_routes_multiarch(); PowerShell: $_familyMirrorPinned in both installers;
  • the stale / mismatch classifiers still read the family off the installed rocm-sdk-libraries-<family> name, unchanged.

Specs follow the index that was chosen, not the arch: _windows_rocm_torch_pkg_specs_for(index_url, gfx) gives the multi-arch trio on the multi-arch URL (by identity with the configured base, or by its /whl-multi-arch leaf, so an explicit UNSLOTH_TORCH_INDEX_URL pin naming it works too) and the per-arch ABI pin or bare names otherwise. That is what stops the trio from ever naming a build the index does not serve.

Why

Measured

RX 6500 XT (gfx1034), Windows 11, the multi-arch trio in a clean venv:

result
device AMD Radeon RX6500 XT gfx1034 4080 MiB, HIP 7.14.60850
fp16 512x512 matmul, max abs err 0.0312
torch._grouped_mm, bf16 ok, max abs err vs bmm 0.030 (the per-family 2.10.0+rocm7.13.0 build access-violates here, #11814)
Qwen3.5-0.8B 16-bit LoRA, 3 steps eager 0.0366650596 0.0366650596 0.0281518754 (nightly 10.2: 0.0366736986 / 0.0281048398)
Qwen3-1.7B QLoRA, 3 steps eager 0.0209153276 0.0209153276 0.0192414559 (nightly 10.2: 0.0209153481 / 0.0192406885)

RX 5700 XT (gfx1010): the fresh-install and desktop numbers in #11755, same index, same tag.

Fresh per-branch install from this branch (install.ps1 --local via the supervisor, then setup.ps1), only the RX 6500 XT visible: the venv holds torch 2.11.0+rocm7.14.1, amd-torch-device-gfx1034 2.11.0+rocm7.14.1, rocm-sdk-device-gfx1034 7.14.1, torchvision 0.26.0+rocm7.14.1, torchaudio 2.11.0+rocm7.14.1, bitsandbytes 0.50.3.dev0; the Unsloth Studio backend starts from it and logs Hardware detected: ROCm (HIP 7.14.60850) -- AMD Radeon RX6500 XT. The same two rows on that venv: Qwen3.5-0.8B LoRA 0.0366812907 0.0366812907 0.0281528644, Qwen3-1.7B QLoRA 0.0209153276 0.0209153276 0.0192414559; the QLoRA row is identical to the clean-venv run above and the LoRA row agrees to the 5th decimal.

Not measured: RDNA 3, RDNA 3.5 and RDNA 4 on this index. The device packs are the same build and the same shape, and the route is byte-for-byte the one RDNA 1 and RDNA 2 run, but nobody has run it on those cards yet. That is the one thing this PR waits for before it leaves draft; the ask is on #11815, #10657 and #9932.

Tests

  • New tests/studio/install/test_windows_multiarch_all_11815.py: the arch set is exactly RDNA 1 to 4 minus gfx1033; every arch resolves to the multi-arch index with the pinned trio in every spelling; gfx1033 and CDNA keep their family; a family mirror keeps the family route where one exists and changes nothing for RDNA 1 / gfx1153; a multi-arch mirror wins over a family mirror; a patched family base counts as a family mirror (what existing tests do); both PowerShell installers carry the same arch set and the family-mirror rule; setup.ps1 counts every routed arch as having wheels.
  • test_rdna1_multiarch_windows_route_11614.py, test_rocm_support.py::TestWindowsRocmIndexUrl, test_unsupported_arch_routing_guards_8529.py: the RDNA 2 to 4 expectations move from the family leaf to the multi-arch index, with the family leaf asserted under a family mirror.
  • test_rocm_support.py::TestEnsureRocmTorch::test_wheel_family_change_forces_a_reinstall: the swapped-card repair now lands on torch[device-gfx1200] on the multi-arch index.
  • test_cuda_repair.py: the two repair-site tests anchor on _windows_rocm_torch_pkg_specs_for.

On this host test_rocm_support.py fails the identical set of Linux-only harness cases as the base branch, run back to back; everything else in the installer test tree passes, as do test_rdna1_unsupported_message_8529.ps1, test_amd_name_arch_r9700.ps1, test_setup_pin_stale.ps1 and test_torch_flavor.ps1.

Follow-ups, not in this PR

LeoBorcherding and others added 19 commits September 23, 2026 20:31
…rch nightly index

RDNA 1 has no family on repo.amd.com, so every Windows installer put an RX 5700 XT
on CPU torch and said so (unslothai#8529). AMD's multi-arch nightly index carries per-card
kernel packs for it: `torch[device-gfx1010]` resolves torch plus the gfx1010 pack.
With that torch, unslothai#11615 and the zoo's unslothai#1356 / unslothai#1316, the card trains (unslothai#11614).

install_python_stack.py, install.ps1 and setup.ps1 now route gfx1010 / gfx1011 /
gfx1012 to that index, pinned to one tag (a nightly moves), with torchvision on
the same tag and no torchaudio (none is published for it). The three RDNA 1 rows
move from the "not covered" name tables to the routed ones on the Windows copies;
the backend's copy follows. Linux is unchanged: nothing has run that route on
bare-metal Linux, and WSL2's GPU driver refuses RDNA 1 outright.

Tests: the unslothai#8529 suites now exercise the "not covered" wording with Polaris (RX
580, gfx803), which still owns it everywhere; the routing guards keep RDNA 1
banned on Linux and assert the Windows route; the parity test accepts a
multi-arch device as routable on the Windows copies only; a new file pins the
package specs, the index, the name tables and the PowerShell mirrors.
…stall

The multi-arch index publishes no torchaudio, so the one left by an earlier CPU
or per-family pass is linked against a torch that is gone and throws a Windows
"Entry Point Not Found" dialog when anything imports it. Seen on the first fresh
install from this branch: torch 2.12.0+rocm10.2 next to torchaudio
2.11.0+rocm7.13. Remove it after the multi-arch pass; a torchaudio carrying the
pinned tag, should AMD publish one, stays.
…ti-arch torch

setup.ps1 and install.ps1 install the pair themselves and set the marker that
makes the python repair return early, so the cleanup there never ran on a
fresh install (seen: torchaudio 2.11.0+rocm7.13.0 still present after the
multi-arch pass). Do it in the two PowerShell installers right after their
trio lands, and in the python marker shortcut when the installed torch carries
the multi-arch tag.
…ch venv

The dependency pass re-resolves torchaudio 2.11.0 on every run: torch-stoi and
descript-audiotools require it unconditionally and nothing exists for the pinned
torch (AMD's index lists no torchaudio for the tag, PyPI stops at 2.11.0). The
cleanups that run right after the trio install therefore lose to step 8. Run it
once more at the end of the Windows flow, after every with-deps step.
Measured on the RX 5700 XT venv the installer built: torchaudio 2.11.0 next to
torch 2.12.0+rocm10.2 imports, resamples, computes a mel spectrogram and loads
torch-stoi, with no dialog. The dependency pass installs it (torch-stoi and
descript-audiotools require it; PyPI stops at 2.11.0 and AMD's index has none),
and taking it out again only lost audio features. The pinned trio still lists no
torchaudio, which is what the index needs; the rest is left to the resolver.
…e nightly

repo.amd.com/rocm/whl-multi-arch publishes the same per-device packaging as the
nightly, on release tags: torch 2.11.0+rocm7.14.1 with the gfx1010/1011/1012 device
packs, torchvision 0.26.0 and torchaudio 2.11.0 on the same tag. Measured on an
RX 5700 XT: resolves in one go, fp16 matmul correct, Triton unchanged (buffer ops
still need unslothai#11615), and the 3-step LoRA/QLoRA rows on Qwen3.5-0.8B and Qwen3-1.7B
match the nightly to the fourth decimal.

So the route pins that release instead of a nightly date: the index also serves
2.12.0, which sits on the <2.12.0 window the rest of the Windows install applies,
so 2.11.0 is the newest release inside it. torchaudio goes back into the trio and
the empty-audio-slot handling ($RocmNoAudio, the trio filter) goes away.
…repair tests on the helper

torchaudio is back in the multi-arch trio, so the empty-slot filter on install.ps1's
three ROCm trio commands has nothing to filter; the plain form is what the pr5940
follow-up tests read. The two cuda_repair tests looked for the inline
_WINDOWS_ROCM_TORCH_PKG_SPECS.get in _ensure_rocm_torch, which now calls
_windows_rocm_torch_pkg_specs; they anchor on that call.
…ws it

_ensure_rocm_torch binds a local named _bare_gfx further down, so the multi-arch
message calling the module helper raised UnboundLocalError on the Windows repair
path for a gfx1010 host with a CPU torch. Inline the bare-arch spelling there and
run that site in a test.
… and move the

wheel-less fixtures to Polaris

The backend's repairability check and setup.ps1's pre-Intel "AMD gets GPU wheels" gate
both read a list that still omitted gfx1010-1012, so a 5700 XT on Windows could not
establish a torch mismatch and lost to an Intel Arc on a mixed host. The backend gains
a Windows-only extension of the supported set (Linux still declines RDNA 1); setup.ps1's
list gains the three arches.

Tests that used the RX 5700 XT / gfx1010 as the card with no Windows wheels move to
Polaris (RX 580 / gfx803); the Linux-only parity tests learn that RDNA 1 names are
unsupported on the Linux copies and routed on the Windows copies.
…le multi-arch index

repo.amd.com/rocm/whl-multi-arch has a per-device kernel pack for every RDNA arch at
the release tag unslothai#11755 pins (2.11.0+rocm7.14.1, torchvision 0.26.0, torchaudio 2.11.0
on the same tag). The per-family Windows indexes stop one ROCm release earlier, an
exact pin has nothing for the kept-release rule to keep (unslothai#11814), and per-device packs
are smaller than family bundles. So the RDNA 1 route becomes the route for RDNA 1
through 4 (gfx1153 included, gfx1033 and CDNA stay on their family), in the python
repair and both PowerShell installers.

The family map stays: a host mirroring the family layout (UNSLOTH_ROCM_WINDOWS_MIRROR,
no multi-arch mirror) keeps the family route for arches that have one, and the
stale/mismatch classifiers still read families off the installed runtime. The trio is
derived from the index that was chosen, so it can never name a build the index does
not serve.

Measured on an RX 6500 XT (gfx1034) and, via unslothai#11755, an RX 5700 XT (gfx1010).
RDNA 3 / 3.5 / 4 are the same build and shape, unmeasured; draft until someone runs it.

Part of unslothai#11815.
@LeoBorcherding
LeoBorcherding force-pushed the feat/windows-amd-multiarch-all-11815 branch from a529be5 to dac2526 Compare September 24, 2026 21:02
@LeoBorcherding LeoBorcherding changed the title Unsloth Studio (AMD/Windows): install every RDNA arch from AMD's stable multi-arch index Unsloth Studio (AMD/Windows): install PyTorch for every Radeon RX 5000 to 9000 card from AMD's multi-arch index Sep 25, 2026
@LeoBorcherding LeoBorcherding changed the title Unsloth Studio (AMD/Windows): install PyTorch for every Radeon RX 5000 to 9000 card from AMD's multi-arch index Unsloth Studio installer (AMD/Windows): install PyTorch for RX 5000 to 9000 cards from AMD's multi-arch index Sep 25, 2026
Bare torchvision from repo.amd.com/rocm/whl-multi-arch carries no GPU
kernels: torchvision.ops.nms raised hipErrorInvalidDeviceFunction on a
gfx1151 (Radeon 8060S, Windows 11). torchvision[device-gfxNNNN] pulls
amd-torchvision-device-gfxNNNN, which resolves for every routed arch.
The installers route gfx1153 to the multi-arch index, but the backend's
supported set stopped at gfx1152, so a gfx1153 host left on CPU torch
never qualified for the mismatch repair. Add a parity test against
_WINDOWS_MULTIARCH_GFX, and correct the _index_is_multiarch docstring:
explicit unknown-family pins are installed verbatim and never reach it.
The multi-arch build names no rocm-sdk-libraries family, so the Windows
repair's family comparison reads None and never reinstalls after a card
swap, leaving torch with no kernels for the new GPU. Check the installed
amd-torch-device / amd-torchvision-device packs for the routed arch
instead. Legacy per-family installs are left to the family check.
@danielhanchen

danielhanchen commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Review record for #11846, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#232.

Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found.

Round 1: reviewed mirror 6a4e71daf (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/install_python_stack.py (on the mirror)

@@ -2364,9 +2432,14 @@ 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."""
-    if _is_windows_multiarch_gfx(gfx_arch):
-        return _ROCM_WINDOWS_MULTIARCH_INDEX_BASE
+    """Return the AMD pip index URL for the given GPU arch, or None if unsupported.
+
+    Every RDNA arch resolves to AMD's multi-arch index (one URL for every device on it; the
+    device is selected by the `torch[device-gfxNNNN]` extra, not by the path), unless a
+    family-only mirror is pinned and the arch has a family; CDNA and gfx1033 go to their
+    repo.amd.com family."""
+    if _windows_routes_multiarch(gfx_arch):
+        return _ROCM_WINDOWS_MULTIARCH_INDEX_BASE.rstrip("/") + "/"

P2 Badge Preserve query credentials in the multi-arch mirror URL

When UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR uses query-string authentication, this appends the slash after the query rather than to the URL path; for example, https://mirror/whl-multi-arch?token=abc becomes ...?token=abc/, changing the credential and causing the standalone Windows ROCm install/repair to fail. The previous implementation returned the configured base verbatim, and the family-index path already uses _index_url_join specifically to preserve query tokens, so this route should apply equivalent path-aware URL handling.

Useful? React with 👍 / 👎.

Accepted on the mirror

Reply from danielhanchen:

Fixed in 47d0aa4: the slash now goes on the path before any ? or #, as _index_url_join splits, so https://m/whl-multi-arch?token=abc resolves to https://m/whl-multi-arch/?token=abc. Plain URLs are unchanged; test added (fails without the fix).

Round 2: reviewed mirror 02acc1851 (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on studio/install_python_stack.py (on the mirror)

@@ -329,33 +353,77 @@ def _is_windows_multiarch_gfx(gfx_arch: "str | None") -> bool:
     return _bare_gfx(gfx_arch) in _WINDOWS_MULTIARCH_GFX
 
 
+def _windows_family_mirror_pinned() -> bool:
+    """A host that mirrors the per-family layout and not the multi-arch one keeps the family
+    route for arches that have a family; a multi-arch mirror, or no mirror, routes there."""
+    if os.environ.get("UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR"):
+        return False
+    if os.environ.get("UNSLOTH_ROCM_WINDOWS_MIRROR"):
+        return True
+    return _ROCM_WINDOWS_INDEX_BASE.rstrip("/") != _ROCM_WINDOWS_FAMILY_INDEX_DEFAULT
+
+
+def _windows_routes_multiarch(gfx_arch: "str | None") -> bool:
+    """Whether the Windows install of `gfx_arch` goes to the multi-arch index: it has a
+    device pack there, and no family-only mirror claims an arch that has a family."""
+    if not _is_windows_multiarch_gfx(gfx_arch):
+        return False
+    if _bare_gfx(gfx_arch) in _GFX_TO_AMD_INDEX_ARCH and _windows_family_mirror_pinned():
+        return False
+    return True
+
+
 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."""
+    """Whether the venv carries AMD's torch and torchvision kernel packs for this card."""
     try:
         from importlib import metadata
-        metadata.distribution(f"amd-torch-device-{_bare_gfx(gfx_arch)}")
-        return True
+        names = {
+            (d.metadata["Name"] or "").strip().lower().replace("_", "-")
+            for d in metadata.distributions()
+        }
     except Exception:
         return False
+    gfx = _bare_gfx(gfx_arch)
+    return {f"amd-torch-device-{gfx}", f"amd-torchvision-device-{gfx}"} <= names
 
 
 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"torchvision[device-{gfx}]=={_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):
+def _index_is_multiarch(index_url: "str | None") -> bool:
+    """The multi-arch index, by identity with the configured base or by its leaf. An explicit
+    UNSLOTH_TORCH_INDEX_URL pin never gets here: unknown-family pins install verbatim."""
+    if not index_url:
+        return False
+    _u = index_url.rstrip("/")
+    return _u == _ROCM_WINDOWS_MULTIARCH_INDEX_BASE.rstrip("/") or _u.split("?")[0].endswith(
+        "/whl-multi-arch"

P2 Badge Normalize URL paths before classifying multi-arch mirrors

Although the slash placement was fixed, an authenticated UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR is still misclassified here: for a base such as https://m/whl-multi-arch?token=abc, _windows_rocm_index_url() now correctly returns https://m/whl-multi-arch/?token=abc, but neither comparison matches because one URL lacks the path slash and the query-stripped URL ends in /whl-multi-arch/. Consequently _windows_rocm_torch_pkg_specs_for() selects the per-family range specs instead of the required device-gfx* extras, so standalone repair/install from a query-authenticated multi-arch mirror omits the device packs and leaves ROCm unusable.

Useful? React with 👍 / 👎.

Accepted on the mirror

Reply from danielhanchen:

Fixed in b7f3ea0: _index_is_multiarch now compares path parts only (query and fragment stripped, trailing slash normalised), so the token mirror's resolved URL gets the device-extra trio. Test extended to assert torch[device-gfx1151]; it fails without the fix.

Round 3: reviewed mirror 78741ad3f (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] on install.ps1 (on the mirror)

@@ -10647,13 +10654,15 @@ main()
             "gfx1103" = "torchaudio>=2.11.0,<2.12.0"
         }
         $archFamily = if ($ROCmGfxArch -and $archFamilyMap.ContainsKey($ROCmGfxArch)) { $archFamilyMap[$ROCmGfxArch] } else { $null }
-        $ROCmMultiArch = [bool]($ROCmGfxArch -and $multiArchGfx -contains $ROCmGfxArch)
+        # A family-layout mirror (and no multi-arch mirror) keeps the family route for arches that have one.
+        $_familyMirrorPinned = [bool]($env:UNSLOTH_ROCM_WINDOWS_MIRROR) -and -not [bool]($env:UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR)
+        $ROCmMultiArch = [bool]($ROCmGfxArch -and $multiArchGfx -contains $ROCmGfxArch -and -not ($archFamily -and $_familyMirrorPinned))
         if ($ROCmMultiArch) {
             $ROCmIndexUrl = "$MultiArchIndexBase/"

P2 Badge Place the PowerShell slash before mirror query tokens

When UNSLOTH_ROCM_WINDOWS_MULTIARCH_MIRROR uses query-string authentication and one of the newly routed RDNA 2–4 architectures is detected, this route reaches $ROCmIndexUrl = "$MultiArchIndexBase/"; because the base still contains ?token=..., both this installer and studio/setup.ps1:8480 produce a URL such as https://mirror/whl-multi-arch?token=abc/, altering the credential and preventing wheel installation. Fresh evidence beyond the earlier fixed comment is that only the Python resolver now inserts the slash before ?/#; both PowerShell paths still append it afterward, so they need the same path-aware joining.

Useful? React with 👍 / 👎.

Rejected on the mirror

Reply from danielhanchen:

Not changing: the PowerShell installers never support a query-token mirror on any route. The family path on main builds "$amdIndexBase/$archFamily/" the same way in both install.ps1 and setup.ps1, so this is a pre-existing, unsupported configuration rather than something this PR introduces. The Python repair path did handle it on main, which is why that side was fixed.

Round 4: reviewed mirror 78741ad3f (no equivalent commit found on this PR)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 78741ad3f0

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 78741ad3f (no equivalent commit found on this PR).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Sep 29, 2026
danielhanchen added a commit to Datta0/unsloth-staging-3 that referenced this pull request Sep 29, 2026
unslothai#11755 landed on main with a device-pack repair keyed on the RDNA 1 set.
With every RDNA arch routed here it now checks both the torch and
torchvision packs, follows _windows_routes_multiarch so a family-mirror
host does not reinstall every update, and a migrated venv's orphaned
family runtime no longer triggers the family check.
Appending the index slash after the whole URL put it inside a ?token=
query on an authenticated mirror. Split on ? / # first, as
_index_url_join does for the family indexes; plain URLs are unchanged.
_index_is_multiarch compared whole URLs, so https://m/whl-multi-arch?token=x
never matched its own resolved form (.../whl-multi-arch/?token=x) and the
repair installed the trio without device extras. Compare path parts only.
@danielhanchen
danielhanchen marked this pull request as ready for review September 29, 2026 18:22
@danielhanchen
danielhanchen self-requested a review as a code owner September 29, 2026 18:22
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@danielhanchen
danielhanchen merged commit f00582a into unslothai:main Sep 29, 2026
76 of 81 checks passed
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Nov 16, 2026
…device lists (unslothai#17904)

Fixes unslothai#17874

## What changed

On Windows, AMD's multi-arch index ships PyTorch GPU kernels per exact
chip (`torch[device-gfxNNNN]`; the `amd-torch-device-gfx1030` wheel
carries only `torch_gfx1030.kpack`). When the installer can only read
the GPU's marketing name (driver-only hosts, no HIP SDK), the name table
decides which chip's kernels get installed. Since unslothai#11846 moved Windows
RDNA onto that index, the table's coarse RDNA 2 grouping gave several
cards kernels for a different chip, and a few other rows were wrong or
missing.

Every row was checked against AMD-maintained and upstream sources, not
against the other copies of the table:

- device id to marketing name: libdrm
[`amdgpu.ids`](https://gitlab.freedesktop.org/mesa/drm/-/blob/main/data/amdgpu.ids)
(maintained by AMD) and [pci.ids](https://pci-ids.ucw.cz/)
- chip to gfx target: Linux
[`kfd_device.c`](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_device.c),
Mesa
[`amd_family.c`](https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/amd/common/amd_family.c),
TheRock
[`therock_amdgpu_targets.cmake`](https://github.com/ROCm/TheRock/blob/main/cmake/therock_amdgpu_targets.cmake),
[LLVM AMDGPUUsage](https://llvm.org/docs/AMDGPUUsage.html)
- integrated GPUs: amd.com product pages

### Wrong chip (fixed)

| GPU | die | before | after |
|---|---|---|---|
| RX 6700S, RX 6800S, RX 6750 GRE 10GB | Navi 23 | gfx1030 | gfx1032 |
| RX 6700, 6700 XT, 6750 XT, 6750 GRE 12GB, 6700M, 6800M, 6850M XT |
Navi 22 | gfx1030 | gfx1031 |
| Ryzen Z2 Extreme (Zen 5 + RDNA 3.5, 16 CU) | Strix Point | gfx1103 |
gfx1150 |
| Ryzen AI 5 330 / Radeon 820M / Krackan Point 2 (Windows) | Krackan 2 |
gfx1152 or none | gfx1153 |

The RX 6750 GRE is one name on two dies (amdgpu.ids 73DF Navi 22 for
12GB, 73FF Navi 23 for 10GB). TheRock names gfx1153 "AMD Radeon 820M
iGPU", and AMD ships a Windows gfx1153 device pack; Linux keeps its
existing Krackan Point 2 handling (no Linux gfx1153 wheel), so the
gfx1153 row is only in the Windows and Python copies.

### Recognised now (previously CPU torch on driver-only hosts)

RX 7400, RX 7300, Radeon Pro W7400, Steam Machine (gfx1102); RX 9050
(gfx1200); Radeon AI PRO R9600D (gfx1201); Radeon 6550S (gfx1034);
Radeon Pro V620 (gfx1030).

### Deliberately left unmapped

Radeon 680M / 660M / 610M (RDNA 2 iGPUs) stay on CPU torch: ROCm
training on RDNA 2 APUs is unmeasured and gfx1033 computes wrong answers
(`studio/ROCM_RDNA2_APU.md`); a test pins this. "Radeon 840M" ships on
both Krackan (gfx1152) and Krackan 2 (gfx1153) per amdgpu.ids 1114 /
1902, so the name alone cannot tell them apart; it keeps gfx1152 and
hipinfo still decides when present.

All six copies change together (`install.ps1`, `studio/setup.ps1`,
`studio/install_python_stack.py`,
`studio/backend/utils/hardware/hardware.py`, `install.sh`,
`studio/setup.sh`). On Linux every moved arch still resolves to the same
wheel family, and the Krackan Point 2 lspci / cpuinfo paths are
unchanged.

## Validation

- Sweep of all 113 AMD-maintained RDNA names in amdgpu.ids through the
table: 9 resolved to the wrong chip before, 0 now; the 6 unmatched names
are the deliberate iGPUs above, the Steam Deck (gfx1033, kept off ROCm),
and two server parts.
- `tests/studio/install/test_rocm_arch_table_parity.py`: the sourced
arches are now checked in every copy; the gfx1031 spoof exemption is
removed; the RDNA 2 iGPUs are pinned unmapped.
- `tests/studio/install/test_windows_amd_name_detection.py`: a WMI name
resolves to its own `torch[device-gfxNNNN]` pack, gfx1153 included.
- `tests/studio/test_amd_name_arch_r9700.ps1`: the same names through
PowerShell's own `-match`.
- 25 of these tests fail on the merge base and pass here; 0 fail only on
this branch. Installer shell and PowerShell suites pass on both sides.

---------

Co-authored-by: Josh <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Daniel Han <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants