Repository navigation
Unsloth Studio (AMD): floor torch at 2.11 on the gfx103X-all and gfx110X-all families too - #11834
Conversation
…all too The torch 2.11 floor for the _grouped_mm bug named five arches, and install.ps1 keeps a venv's existing torch release unless the arch has a floor, so a gfx103X-all venv that once got 2.10.0+rocm7.13.0 kept it through every update. That build access-violates in _grouped_mm on an RX 6500 XT (clean venv, torch alone), and unsloth-zoo probes _grouped_mm at import, so `import unsloth` dies. gfx103X-all and gfx110X-all join the allowlist in all four installers: the python repair map pins the rocm7.2 trio for gfx1030-1036 and gfx1100-1103, the PowerShell floor maps carry the same arches, the allowlist literals and install.sh's two constraint arms carry the two leaves. gfx908 / gfx90a stay bare (no Windows wheels, unmeasured, Linux floors them via rocm7.2). Every family index serves 2.11.0+rocm7.13.0 on both platforms, so the floor resolves. Fixes unslothai#11814.
…red leaf move to CDNA The backend explicit-request case, the fast-path probe and the hermeticity table each used gfx1030 / gfx1102 / gfx1103 as "an arch outside the 2.11 pin table"; those are in it now, so gfx90a / gfx908 play that part, and the gfx1103 reroute test asserts the floored trio it now installs. The no-version shell test greps the widened case arm.
LeoBorcherding
left a comment
There was a problem hiding this comment.
Codex findings, via a mirror
Codex does not answer on this repository, so it ran against a copy of this pull request's commits at LeoBorcherding/unsloth-staging-review#16. It looked at a76f506d3a there, which is this PR's 0b687bed6 replayed onto main f9bffe265. Nothing was reviewed or resolved on the copy: the findings are here, in Codex's words, to be worked through on this pull request.
1 finding, inline below where the line is on this diff.
| # gfx103X-all / gfx110X-all (#11814): the kept-release rule in install.ps1 honours a | ||
| # venv's existing torch minor unless the arch has a floor, so a bare spec here left an | ||
| # older 2.10.0+rocm7.13.0 venv on the _grouped_mm crash through every update. | ||
| "gfx1030": _ROCM_TORCH_PKG_SPECS["rocm7.2"], |
There was a problem hiding this comment.
P2 Apply the new floor to installed Windows ROCm builds
When install_python_stack.py runs directly without the preceding PowerShell installer, a gfx103X/gfx110X venv already containing the affected matching-family 2.10.0+rocm... build never uses these new specs: _ensure_rocm_torch() sets _torch_already_rocm from the HIP marker, finds that _installed_rocm_wheel_family() matches, and skips the install block at lines 5728-5752 without checking _torch_below_211. Thus the newly mapped arches remain on the crashing build in this supported invocation path; the matching-family branch should mark a sub-2.11 build stale before deciding not to reinstall.
Codex's original comment: https://github.com/LeoBorcherding/unsloth-staging-review/pull/16#discussion_r4098331189
LeoBorcherding
left a comment
There was a problem hiding this comment.
Codex findings, via a mirror
Codex does not answer on this repository, so it ran against a copy of this pull request's commits at LeoBorcherding/unsloth-staging-review#16. It looked at 239f2bfcac there, which is this PR's 72a8e8c6e replayed onto main 1ecc01a30. Nothing was reviewed or resolved on the copy: the findings are here, in Codex's words, to be worked through on this pull request.
1 finding, inline below where the line is on this diff.
| _ROCM_GFX_TORCH211_LEAVES: frozenset[str] = frozenset( | ||
| {"gfx120x-all", "gfx1151", "gfx1150", "gfx1152"} | ||
| {"gfx120x-all", "gfx1151", "gfx1150", "gfx1152", "gfx103x-all", "gfx110x-all"} | ||
| ) |
There was a problem hiding this comment.
P2 Enforce the upper bound on installed family wheels
When a gfx103X/gfx110X environment already contains a per-arch 2.12+ build, the standalone Python updater does not apply the new <2.12.0 ceiling: _rocm_pin_family_mismatch() accepts any per-arch release >=2.11, the unpinned repair predicate only detects versions below 2.11, and the Windows path skips installation for an already-ROCm matching family. This matters once the previously bare family index publishes 2.12 (the exact future scenario the ceiling is intended to guard against), because install_python_stack.py will retain that unvalidated build rather than downgrade it to the supported 2.11 line.
Codex's original comment: https://github.com/LeoBorcherding/unsloth-staging-review/pull/16#discussion_r4099718970
…xes from the gfx override, reinstall a per-family build on a now-RDNA 1 host - test_other_arches_keep_their_specs compares gfx1034 against _WINDOWS_ROCM_TORCH_PKG_SPECS; unslothai#11834 pinned the gfx103X family, so bare names no longer apply. - setup.ps1 and install.ps1 drop a ":xnack-" style suffix from UNSLOTH_ROCM_GFX_ARCH before routing, as the Python resolver already does. - A standalone studio update on a venv holding a per-family ROCm torch reinstalls from the multi-arch index when the card is RDNA 1 and its amd-torch-device pack is missing.
…10X-all families too (unslothai#11834) * Unsloth Studio (AMD): floor torch at 2.11 on gfx103X-all and gfx110X-all too The torch 2.11 floor for the _grouped_mm bug named five arches, and install.ps1 keeps a venv's existing torch release unless the arch has a floor, so a gfx103X-all venv that once got 2.10.0+rocm7.13.0 kept it through every update. That build access-violates in _grouped_mm on an RX 6500 XT (clean venv, torch alone), and unsloth-zoo probes _grouped_mm at import, so `import unsloth` dies. gfx103X-all and gfx110X-all join the allowlist in all four installers: the python repair map pins the rocm7.2 trio for gfx1030-1036 and gfx1100-1103, the PowerShell floor maps carry the same arches, the allowlist literals and install.sh's two constraint arms carry the two leaves. gfx908 / gfx90a stay bare (no Windows wheels, unmeasured, Linux floors them via rocm7.2). Every family index serves 2.11.0+rocm7.13.0 on both platforms, so the floor resolves. Fixes unslothai#11814. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Floor follow-ups: the tests that used gfx103X / gfx110X as the unfloored leaf move to CDNA The backend explicit-request case, the fast-path probe and the hermeticity table each used gfx1030 / gfx1102 / gfx1103 as "an arch outside the 2.11 pin table"; those are in it now, so gfx90a / gfx908 play that part, and the gfx1103 reroute test asserts the floored trio it now installs. The no-version shell test greps the widened case arm. * Trim comments on the gfx103X/gfx110X torch floor * Drop two restating comments on the gfx103X/gfx110X floor --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Han <[email protected]>
…700 XT from AMD's multi-arch index (unslothai#11755) * Windows installers: route RDNA 1 (gfx1010/1011/1012) to AMD's multi-arch 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 #1356 / #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. * Expect the RX 5700 XT to resolve in the Windows name tables now that it routes * Drop a torchaudio built against another torch after the multi-arch install 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. * Pin that a lone RDNA 1 host takes the Vulkan llama.cpp route * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Run the stale-torchaudio cleanup on every path that ends with the multi-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. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Give the Windows final step the last word on torchaudio in a multi-arch 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. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Stop removing torchaudio: 2.11 works beside the multi-arch torch 2.12 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. * RDNA 1 on Windows: install from AMD's stable multi-arch index, not the 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. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Windows AMD trio: pass the three specs plainly again, and anchor the 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. * Windows repair site: do not call _bare_gfx() where the function shadows 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. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * RDNA 1 route: count it as covered in the two gates outside the route, 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. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments in RDNA 1 multi-arch route * Drop RDNA 1 from comments that still call it unroutable on Windows * RDNA 1 route: follow unslothai#11834's gfx1034 specs, strip HIP suffixes from the gfx override, reinstall a per-family build on a now-RDNA 1 host - test_other_arches_keep_their_specs compares gfx1034 against _WINDOWS_ROCM_TORCH_PKG_SPECS; unslothai#11834 pinned the gfx103X family, so bare names no longer apply. - setup.ps1 and install.ps1 drop a ":xnack-" style suffix from UNSLOTH_ROCM_GFX_ARCH before routing, as the Python resolver already does. - A standalone studio update on a venv holding a per-family ROCm torch reinstalls from the multi-arch index when the card is RDNA 1 and its amd-torch-device pack is missing. * Pin the RDNA 1 repair and override fixes with tests, fix the gfx1034 spec test The gfx1034 update described in b3efb0c was not in that commit; the test still expected bare package names that main no longer returns. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Trim comments on the RDNA 1 multi-arch route --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Daniel Han <[email protected]>
Fixes #11814. Part of the AMD/Windows work under #11614.
The bug
install.ps1keeps a venv's existing torch release on reinstall (Get-PreviousTorchPin: "existing install has torch 2.10.0 -- keeping it") unless the arch has a ROCm floor to veto it. The torch 2.11 floor for the_grouped_mmbug only named five arches (gfx1200, gfx1201, gfx1150, gfx1151, gfx1152), so a gfx103X-all venv that gottorch 2.10.0+rocm7.13.0at an earlier install kept it through every later run. On that buildtorch._grouped_mmaccess-violates insidetorch_hip.dll, and because unsloth-zoo's import-time MoE patches probe it,import unslothdies the same way. Unsloth Studio still boots (the import happens in the training worker), so the user sees a healthy app whose every training job ends in a native crash.Measured on an RX 6500 XT (gfx1034), Windows 11, clean venvs with nothing but torch:
torch._grouped_mmon two small bf16 tensorswhl/gfx103X-allException Code: 0xC0000005intorch_hip.dllatat::cuda::_grouped_mmwhl-multi-arch,device-gfx1034The per-branch env this was found in is exactly the trap: created in August on 2.10.0, reinstalled from a 2026-09-23 main, still on 2.10.0,
import unsloth-> 0xC0000005.The change
gfx103X-all and gfx110X-all join the 2.11 allowlist in every installer, so the floor is
torch>=2.11.0,<2.12.0with the matching torchvision / torchaudio companions for every RDNA 2 and RDNA 3 arch the Windows installers route, and the family leaf is recognised by the stale / mismatch checks:studio/install_python_stack.py:_ROCM_GFX_TORCH211_LEAVESgainsgfx103x-allandgfx110x-all;_WINDOWS_ROCM_TORCH_PKG_SPECSgains gfx1030 to gfx1036 and gfx1100 to gfx1103 on therocm7.2trio.install.ps1andstudio/setup.ps1: the three*FloorMaptables carry the same eleven arches; the$_pinGfx211list andTest-RocmGfx211Leafcarry the two leaves.install.sh: bothTORCH_CONSTRAINTarms (the family reroute and the final leaf case) carry the two leaves, so the parity tests keep all four installers on one set.gfx908 and gfx90a stay bare on purpose: no Windows wheels on their family indexes, unmeasured, and Linux reaches them through the rocm7.2 index which is floored on its own.
Why the floor is safe to widen now: every family index involved serves
torch 2.11.0+rocm7.13.0for both win_amd64 and linux_x86_64 (read offrepo.amd.com/rocm/whl/<family>/torch/on 2026-09-24), so the floor resolves everywhere it applies. Auv pip install --dry-runof the floored trio againstgfx103X-allresolves to 2.11.0+rocm7.13.0 / 0.26.0+rocm7.13.0 / 2.11.0+rocm7.13.0.What a user on the bad build sees after this: the next
install.ps1orstudio updaterun says the kept 2.10.0 is outside the floor and reinstalls the trio at 2.11.0 once; a venv already on 2.11.0 per-arch is left alone (the stale check answers "not stale" for2.11.0+rocm7.13.0on those leaves, and "stale" for a 2.10 build).Measured end to end
Two identical copies of the trapped venv (torch 2.10.0+rocm7.13.0, gfx103X-all), each given to one installer as its
UNSLOTH_STUDIO_HOME,install.ps1 --local --verbosefrom the repo root, only the RX 6500 XT visible, stdout captured:main(beab871)existing install has torch 2.10.0+rocm7.13.0 -- keeping it (set UNSLOTH_TORCH_UPGRADE=1 to get the newest release)enforcing torch>=2.11.0,<2.12.0 (known _grouped_mm bug in older wheels), no "keeping it"Same venv, same host, same index; the only difference is the floor.
setup.ps1later in the same run prints the same floor with the full trio (enforcing torch>=2.11.0,<2.12.0 torchvision>=0.26.0,<0.27.0 torchaudio>=2.11.0,<2.12.0), so both Windows installers agree.Tests
tests/studio/install/test_windows_amd_torch_floor_11814.py: every Windows-routed RDNA arch pins the 2.11 trio in the python repair map; both PowerShell installers carry the same keys with the same specs in all three maps; every such arch's family leaf is in the 2.11 allowlist; the two PowerShell allowlist literals name the same leaves as python; gfx908 / gfx90a stay bare. 39 passed.tests/python/test_cross_platform_parity.pyandtests/studio/install/test_rocm_arch_table_parity.py: the expected allowlist gains the two leaves (these compare install.sh, install.ps1, setup.ps1 and the python module against each other).tests/studio/install/test_rocm_support.py: the pin-mismatch table and the no-reinstall test use gfx90a / gfx908 as the unfloored fixture instead of gfx110X-all, and assert the new behaviour for gfx103X-all / gfx110X-all (a 2.10 per-arch build is a mismatch, a 2.11 per-arch build is not); the install.sh literal check carries the new arm.tests/studio/test_setup_pin_stale.ps1: same fixture move; new checks that a 2.10 build on the two leaves is stale and a 2.11 build is not. All checks pass, as doestests/studio/test_previous_torch_pin.ps1.test_rocm_support.pyon this Windows host: 49 failures, the identical 49 on a pristineorigin/maincheckout run back to back (Linux-only harness cases: dpkg,set -eprobes, awk/heredoc), none touched by this change.