Repository navigation
amd: require bitsandbytes>=0.50.0 in the amd extra (fixes ROCm 4-bit NaNs) - #7535
Conversation
The comment credited bnb PR #1887 as "the ROCm 4-bit GEMV fix" for every AMD GPU. #1887 decouples blocksize from warp size and fixes a hardcoded warp size of 32 in kgemm_4bit_inference_naive, which is a CDNA problem by construction. The RDNA-side work is #1979 (fused 4-bit SIMT GEMM) and #2012 (RDNA3/4 workgroup resonance). All three first ship in 0.50.0, so the >=0.50.0 floor is unchanged; only the justification was wrong.
|
Correcting a comment, not the floor. The comment credited bitsandbytes#1887 as "the ROCm 4-bit GEMV fix" that makes bnb All three land in 0.50.0 and none are in 0.49.2, so the floor holds either way — 0.50.0 remains the first PyPI release with the complete ROCm 4-bit path. My gfx1200 run was exercising bitsandbytes#1979 and bitsandbytes#2012, not bitsandbytes#1887. I should also be straight that I never verified the "every AMD GPU" part. I confirmed 0.50.0 works on gfx1200; I never ran 0.49.2 to watch it fail. That phrasing came from The original phrasing still lives in On sourcing, since bare numbers were the wrong way to cite this: all three are AMD's own ROCm work in bitsandbytes, authored by sstamenk, and the 0.50.0 release notes say it plainly: "Stability and performance improvements bring AMD ROCm support out of preview; it is now considered stable." That page is the citation I should have led with. Edited: the bnb references above were bare |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3c18196304
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| "bitsandbytes>=0.50.0 ; ('linux' in sys_platform) and (platform_machine == 'AMD64' or platform_machine == 'x86_64' or platform_machine == 'aarch64')", | ||
| "bitsandbytes>=0.50.0 ; (sys_platform == 'win32') and (platform_machine == 'AMD64' or platform_machine == 'x86_64')", |
There was a problem hiding this comment.
Update the AMD installer fallback floor too
This only raises the floor for the amd extra, but the AMD installer fallback paths still allow the broken range: install.sh falls back to bitsandbytes>=0.49.1 and Studio uses _BNB_ROCM_PYPI_FALLBACK = "bitsandbytes>=0.49.1" (install.sh:351-352, studio/install_python_stack.py:448, studio/install_python_stack.py:2176-2183). When the continuous-release wheel path is unavailable or bypassed, those supported AMD install flows can still resolve 0.49.1/0.49.2 and reintroduce the ROCm 4-bit NaNs this change is trying to prevent, so the fallback floor should be bumped in the same patch.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 82bde5b. Both AMD installer fallbacks floored at 0.49.1, so a host that could not reach the continuous-release_main URL (or ran with it bypassed) fell back to a range that still NaNs at 4-bit decode on ROCm.
Raised to >=0.50.0 in both places:
- install.sh
_install_bnb_rocmPyPI fallback _BNB_ROCM_PYPI_FALLBACKin studio/install_python_stack.py, which is the path Studio and the Windows installers use
Verified the floor is real rather than nominal: the PyPI 0.50.0 manylinux_2_24_x86_64 wheel ships libbitsandbytes_rocm{64,70,71,714,72}.so and the win_amd64 wheel ships libbitsandbytes_rocm{714,72}.dll, the same ROCm set as the continuous-release wheel, and bnb #1887 merged 2026-03-09, after 0.49.2 (2026-02-16) and before 0.50.0 (2026-07-24).
Added TestAmdBnbFloorParity in tests/python/test_cross_platform_parity.py so the amd extra, the install.sh fallback and the Studio fallback cannot drift apart again, plus a check that no installer floors bitsandbytes in the 0.49.x range. Also corrected two comments that said to drop the pre-release pin once 0.50 shipped, and the hardcoded 0.50.0.dev0 metadata version, since the rolling wheel now reports 0.50.1.dev0.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36b0da5327
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| fi | ||
| run_install_cmd "$_label (pypi fallback)" "$_venv_py" -m pip install \ | ||
| --force-reinstall --no-cache-dir --no-deps "bitsandbytes>=0.49.1" | ||
| --force-reinstall --no-cache-dir --no-deps "bitsandbytes>=0.50.0" |
There was a problem hiding this comment.
Stop reporting the repaired fallback as broken
When the pre-release wheel download fails, _install_bnb_rocm still tells the user that the PyPI fallback leaves “4-bit decode broken on ROCm,” even though this changed requirement now selects the first fixed release. The Studio path emits the same stale warning in install_python_stack.py before installing _BNB_ROCM_PYPI_FALLBACK, so successful fallback installs are incorrectly reported as unusable; update both messages with the new floor.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in d568476. Raising the floor made both messages false: the fallback now installs the first release that carries the fix, so telling the user 4-bit decode is broken would send them chasing a problem they do not have.
Both now name the spec instead of asserting brokenness:
- install.sh:
falling back to PyPI $_BNB_ROCM_PYPI_FALLBACK, which carries the ROCm 4-bit fix - studio/install_python_stack.py: the same wording, interpolating
_BNB_ROCM_PYPI_FALLBACK
Also pulled the shell spec into a _BNB_ROCM_PYPI_FALLBACK variable in install.sh, matching the Python constant, so the message and the install argument cannot drift from each other again. Verified the expansion under /bin/sh, since install.sh is POSIX sh rather than bash.
TestAmdBnbFloorParity now asserts the install.sh variable form and that neither installer still claims 4-bit decode is broken on the fallback path. Same change on the pip branch in #7581.
One scope note: on aarch64 the message is still optimistic, but that predates this PR and is not something the floor can fix. Neither the PyPI 0.50.0 aarch64 wheel nor the continuous-release aarch64 wheel ships any libbitsandbytes_rocm*.so, only cpu and cuda variants, so aarch64 ROCm has no 4-bit path at any version. Tracking that separately rather than widening this PR.
|
@codex review |
|
Codex Review: Didn't find any major issues. Another round soon, please! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: efe912096b
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| rm -f "$_bnb_log" | ||
| step "warning" "$_label (pre-release) failed (exit code $_bnb_rc)" "$C_WARN" >&2 | ||
| substep "[WARN] bnb pre-release install failed; falling back to PyPI (4-bit decode broken on ROCm)" "$C_WARN" | ||
| substep "[WARN] bnb pre-release install failed; falling back to PyPI $_BNB_ROCM_PYPI_FALLBACK, which carries the ROCm 4-bit fix" "$C_WARN" |
There was a problem hiding this comment.
Keep the fallback warning accurate on aarch64
On Linux aarch64, when the pre-release installation fails, this now claims the PyPI fallback carries the ROCm fix even though the 0.50.0 aarch64 wheel contains no ROCm binary, so the resulting bitsandbytes installation still cannot provide the advertised AMD 4-bit path. Fresh evidence is the explicit aarch64 installer branch above combined with the reviewed commit's own stated aarch64 wheel limitation; retain a broken/unsupported warning for that architecture rather than applying the x86_64 message universally.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and fixed in 2d22562. I had flagged the aarch64 gap as out of scope on the previous round; you are right that once the message asserts the fix is present, the gap stops being pre-existing background and becomes a false claim this PR introduced.
Confirmed the premise directly rather than from the release notes: the PyPI 0.50.0 manylinux_2_24_aarch64 wheel contains no libbitsandbytes_rocm*.so, only libbitsandbytes_cpu.so plus the CUDA variants. The continuous-release_main aarch64 wheel is the same, so the success path was misleading too, not just the fallback.
Both installers are now arch-aware:
_bnb_rocm_arch_has_binaryin install.sh and_bnb_rocm_arch_has_binary()in studio/install_python_stack.py- the "carries the ROCm 4-bit fix" clause is dropped on aarch64
- after either install path, aarch64 gets
bitsandbytes ships no ROCm kernels on this arch; 4-bit QLoRA needs a source buildwith the AMD docs link, matching the existing gfx906 notice
Checked the shell under /bin/sh for both $_ARCH values and confirmed the pypi-fallback exit code is still propagated through the new warning call, and the Python helper for x86_64, AMD64, aarch64, arm64 and ARM64. Regression test added as test_aarch64_is_not_told_it_has_a_rocm_backend. Same change on the pip branch in #7581.
Left the aarch64 marker in the amd extra alone: trimming it would diverge from #7278 and is a packaging decision beyond this PR.
|
@codex review |
|
Codex Review: Didn't find any major issues. Keep it up! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
What
Bump the
amdextra'sbitsandbytesfloor from>=0.49.1to>=0.50.0, on both marker lines. One file, +4/-2.Why
bnb
<=0.49.2NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix (bnb PR #1887) merged after 0.49.2 and first ships in 0.50.0, on PyPI since 2026-07-24, so the old floor could still resolve the broken range. Apip install 'unsloth[amd]'from a main checkout succeeds and silently corrupts 4-bit generation and training output on Linux ROCm.#7278 made this change on the
piprelease branch. This is the same change onmain, so the development branch stops shipping the broken floor and the two branches agree.What inherits it
Five ROCm extras pull
unsloth[amd]and carry no bnb spec of their own, so they pick up the new floor:rocm702-torch280,rocm72-torch291,rocm711-torch291,rocm72-torch2100,rocm711-torch2100. That propagation is intended.Nothing else moves. The other bnb pins on main (
bitsandbytes==0.45.5,>=0.45.5,!=0.46.0,!=0.48.0) belong to CUDA-era extras likecu118-torch211, and the URL-pinned continuous-release wheels belong to theintelgpu*extras, which inherithuggingfacenotorchrather thanamd. I checked for a URL-versus-specifier conflict on the same package and there is none.Why a version floor rather than a URL pin
maincan carry direct URL requirements, and theintelgpu*extras do. I used a floor anyway: it matches whatpipmust do (PyPI rejects direct URLs in uploaded metadata), it avoids depending on a rollingcontinuous-release_mainartifact, and PyPI 0.50.0 now ships the ROCm binaries the markers select —libbitsandbytes_rocm{64,70,71,714,72}.soon manylinux x86_64 andlibbitsandbytes_rocm{72,714}.dllon win_amd64. Keeping the two branches identical also means the extras can be diffed for drift, which is how thepipbranch's missing extra went unnoticed for weeks.Verification
Built the metadata from this branch and read it: the
amdextra emitsbitsandbytes>=0.50.0on both marker lines and no0.49.xbitsandbytes requirement survives anywhere.Runtime evidence carries over from #7278 — bnb 0.50.0 on ROCm torch 2.11.0+rocm7.13.0, Radeon RX 9060 XT (gfx1200), NF4 and FP4,
compress_statisticson and off, batches 1/2/8/64. All 16 combinations produced finite output, relative error against an fp16 reference 0.090-0.096 (nf4) and 0.111-0.112 (fp4), with batch=1 in line with every other batch size.Known limitation, unchanged by this PR
The Linux marker includes
aarch64, but bitsandbytes ships no ROCm binary in its aarch64 wheel at any version — 0.50.0 and the continuous-release build both carry onlylibbitsandbytes_cpu.soplus CUDA variants. So the extra installs on aarch64 and yields a bnb with no AMD backend. That predates this change and is identical onpip; worth trimming, but not here, since diverging the marker would break parity with #7278.Follow-up in this PR (installer fallback floors)
Codex was right that raising the extra alone left the two AMD installer fallback paths on the old floor, so the pre-release wheel URL being unreachable would still resolve into the broken range. Both are now
>=0.50.0:install.sh_install_bnb_rocmPyPI fallback_BNB_ROCM_PYPI_FALLBACKinstudio/install_python_stack.py, which is the path Studio and both PowerShell installers use (install.ps1andstudio/setup.ps1carry no bitsandbytes spec of their own, they delegate to the stack script)Checked that the floor is real rather than nominal: the PyPI 0.50.0
manylinux_2_24_x86_64wheel shipslibbitsandbytes_rocm{64,70,71,714,72}.soand thewin_amd64wheel shipslibbitsandbytes_rocm{714,72}.dll, the same ROCm set as the continuous-release wheel. bnb #1887 merged 2026-03-09, after 0.49.2 (2026-02-16) and before 0.50.0 (2026-07-24).TestAmdBnbFloorParityintests/python/test_cross_platform_parity.pynow holds theamdextra, theinstall.shfallback and the Studio fallback to one floor, and asserts no installer floors bitsandbytes in the 0.49.x range.Two comments were stale and are corrected: they told the reader to drop the pre-release pin once bnb 0.50 shipped on PyPI, which has now happened, and they hardcoded the pre-release wheel's metadata version as
0.50.0.dev0when the rolling artifact now reports0.50.1.dev0.The same change on the
pipbranch is #7581.The aarch64 limitation noted above is worth restating with evidence: the continuous-release aarch64 wheel contains no
libbitsandbytes_rocm*.soeither, only cpu and cuda variants, so that install succeeds and the PyPI fallback never fires. Unchanged by this PR, but it means aarch64 in theamdextra marker promises a 4-bit path that does not exist at any bitsandbytes version.