Repository navigation
Unsloth Studio installer (AMD/Windows): install PyTorch for RX 5000 to 9000 cards from AMD's multi-arch index - #11846
Conversation
…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.
a529be5 to
dac2526
Compare
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.
|
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
|
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.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
…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]>
Implements the Windows half of #11815. Stacked on #11755 (the RDNA 1 route this generalises): the diff against
mainincludes that PR until it merges, the diff againstfix/installer-rdna1-multiarch-indexis 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):_ROCM_MISCOMPUTING_GFX, unmeasured on this build)Same constants, same three installers as #11755:
_WINDOWS_MULTIARCH_GFX/$multiArchGfxbecome the set above, the messages stop saying "RDNA 1", and$_rocmWheelArchesinsetup.ps1counts gfx1153.The per-family map is not removed. Two things still use it:
UNSLOTH_ROCM_WINDOWS_MIRRORset, noUNSLOTH_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:$_familyMirrorPinnedin both installers;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-archleaf, so an explicitUNSLOTH_TORCH_INDEX_URLpin 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
2.11.0+rocm7.13.0; the multi-arch index is one ROCm release ahead and publishes 2.12.0 as well._grouped_mmaccess-violates, soimport unslothcrashes #11814 trap (a venv held on a sub-2.11 build) cannot happen on this route. (Unsloth Studio (AMD): floor torch at 2.11 on the gfx103X-all and gfx110X-all families too #11834 floors the family route separately, for family mirrors and for Linux.)Measured
RX 6500 XT (gfx1034), Windows 11, the multi-arch trio in a clean venv:
AMD Radeon RX6500 XT gfx1034 4080 MiB, HIP 7.14.60850torch._grouped_mm, bf16RX 5700 XT (gfx1010): the fresh-install and desktop numbers in #11755, same index, same tag.
Fresh per-branch install from this branch (
install.ps1 --localvia the supervisor, thensetup.ps1), only the RX 6500 XT visible: the venv holdstorch 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 logsHardware 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
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.ps1counts 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 ontorch[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.pyfails 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 dotest_rdna1_unsupported_message_8529.ps1,test_amd_name_arch_r9700.ps1,test_setup_pin_stale.ps1andtest_torch_flavor.ps1.Follow-ups, not in this PR
torch[device-gfx1034,device-gfx1010]), which would install one torch that serves both cards and retire the Unsloth Studio (AMD/ROCm): a second AMD GPU the installed PyTorch cannot run is still offered for training, and the installer never warns #11569 situation. The installers still pick one arch; wiring the host list through is its own change.torch.cuda.get_arch_list()on the multi-arch torch lists every device the base wheel knows, not the installed pack. Nothing in the installers reads it that way today; noted so nobody starts.