Skip to content

pip: raise the AMD installer bitsandbytes fallback floors to 0.50.0 - #7581

Closed
danielhanchen wants to merge 8 commits into
pipfrom
bnb-rocm-fallback-floor-pip
Closed

danielhanchen wants to merge 8 commits into
pipfrom
bnb-rocm-fallback-floor-pip

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

What

Raise the two AMD ROCm bitsandbytes PyPI fallback floors on the pip branch from >=0.49.1 to >=0.50.0, and add a regression test that locks them there.

  • install.sh _install_bnb_rocm, the PyPI fallback used when the continuous-release_main wheel URL is unreachable
  • _BNB_ROCM_PYPI_FALLBACK in studio/install_python_stack.py, which is the path Studio and both PowerShell installers use (install.ps1 and studio/setup.ps1 carry no bitsandbytes spec of their own, they delegate to the stack script)

Why

bitsandbytes <= 0.49.2 NaNs at decode shape on every AMD GPU. The ROCm 4-bit GEMV fix is bnb #1887, merged 2026-03-09, after 0.49.2 (2026-02-16) and before 0.50.0 (2026-07-24), so 0.50.0 is the first PyPI release that carries it. Both fallbacks still allowed the broken range, which is the one thing they exist to prevent: they fire precisely when the pre-release URL cannot be reached, and a host that cannot reach GitHub is also the host most likely to be sitting behind a lagging PyPI mirror that still offers 0.49.x as its newest.

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, so the fallback lands on a bitsandbytes that actually has ROCm kernels.

This is the pip branch counterpart to the same change on main (#7535), so the two branches do not drift.

Test

TestAmdBnbFloorParity in tests/python/test_cross_platform_parity.py asserts both installer floors, and that no installer or pyproject.toml line floors bitsandbytes in the 0.49.x range. The amd extra does not exist on this branch yet (#7278 adds it), so the extra assertion skips until it lands and then holds it to the same floor.

tests/python/test_cross_platform_parity.py  64 passed, 1 skipped
tests/python/test_install_python_stack.py   22 passed

Not changed

The continuous-release_main pre-release wheel stays first in line. Its ROCm binary coverage is identical to 0.50.0 today, so it could be dropped, but that would delete the force_pip and BNB_ROCM_VERSION plumbing built around it and rewrite the tests that cover it. Separate change if wanted.

The comments claiming the pre-release wheel's embedded metadata version is 0.50.0.dev0 were stale; the rolling artifact now reports 0.50.1.dev0, so they now say 0.50.x.dev0.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 75c89eaeb5

ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: aff62c8591

ℹ️ 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".

_BNB_ROCM_PYPI_FALLBACK = "bitsandbytes>=0.49.1"
# First PyPI release carrying bnb #1887. Keep in step with the install.sh
# fallback (and the amd extra, once it lands here).
_BNB_ROCM_PYPI_FALLBACK = "bitsandbytes>=0.50.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Try the PyPI bnb fallback on Windows ROCm

For Windows AMD installs where the GitHub continuous-release wheel is blocked, this new fallback floor is never reached: _ensure_rocm_torch() handles IS_WINDOWS earlier and returns after _install_bnb_windows_rocm(), whose failure path only warns. That leaves the PowerShell flows with ROCm torch but no working bitsandbytes instead of trying the now-fixed bitsandbytes>=0.50.0 fallback; please wire this fallback into the Windows failure path too.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, and fixed in 0f3833e (and on main in #7535 as b56b5f5). The Windows branch of _ensure_rocm_torch() returns right after _install_bnb_windows_rocm(), whose failure path only printed a warning, so a blocked GitHub URL left Windows ROCm with ROCm torch and no usable bitsandbytes.

Worth noting why this could not be wired up before: the two comments at those call sites said the PyPI wheel ships only CUDA DLLs and fails on ROCm, which was true and is why there was no fallback. Raising the floor to 0.50.0 is what makes the fallback viable, so those comments were stale in the same way the earlier warning strings were. Verified against the artifact rather than the release notes: bitsandbytes-0.50.0-py3-none-win_amd64.whl contains libbitsandbytes_rocm714.dll and libbitsandbytes_rocm72.dll alongside the CUDA ones.

_install_bnb_windows_rocm() now tries the pre-release wheel, falls back to _BNB_ROCM_PYPI_FALLBACK, and only returns False when both fail. The BNB_ROCM_VERSION DLL-suffix detection and the hipInfo.exe PATH fix-up still run afterwards, so the fallback wheel gets the same handling as the pre-release one; that mattered, since the PyPI wheel ships rocm714/rocm72 and bnb's HIP auto-detect can mismatch either.

Tests: test_no_op_when_win_amd64_url_missing asserted the old no-fallback behaviour and is now wrong, so it is replaced by test_falls_back_to_pypi_when_win_amd64_url_missing, plus test_falls_back_to_pypi_when_prerelease_install_fails and test_returns_false_only_when_both_paths_fail. Full run: 519 passed, 2 skipped across test_rocm_support.py, test_pr5940_followups.py, test_cross_platform_parity.py and test_install_python_stack.py.

@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

1 similar comment
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: ec8ec8e9c7

ℹ️ 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".

@danielhanchen

Copy link
Copy Markdown
Member Author

Closing as already landed, not as rejected: every change here is on pip now.

Checked each distinctive addition against origin/pip rather than going by the title:

install.sh:328                  _BNB_ROCM_PYPI_FALLBACK="bitsandbytes>=0.50.0"
install_python_stack.py:452     _BNB_ROCM_PYPI_FALLBACK = "bitsandbytes>=0.50.0"
install.sh                      _bnb_rocm_arch_has_binary        present
install.sh                      _warn_bnb_no_rocm_binary         present
install.sh                      "which carries the ROCm 4-bit fix"  present
install.sh                      "0.50.x.dev0" comment fix        present
test_cross_platform_parity.py   TestAmdBnbFloorParity            present
test_cross_platform_parity.py   test_amd_extra_floor_when_present present
test_rocm_support.py            test_falls_back_to_pypi_when_win_amd64_url_missing      present
test_rocm_support.py            test_falls_back_to_pypi_when_prerelease_install_fails   present

The branch is 64 commits behind pip and shows CONFLICTING; resolving it would produce no net change, so there is nothing left to merge.

On the red check: Repo tests (CPU) here is not caused by this PR, which touches no pyproject.toml. It fails on two assertions in tests/python/test_torchcodec_torch_compat.py:

FAILED test_pyproject_declares_torch210_audio_extra_with_python_gate
FAILED test_torch210_extras_bundle_audio_torch210

pip's pyproject.toml has zero occurrences of audio-torch210 while the test that requires it has four, so the branch inherits a pre-existing failure. Worth a separate fix on pip, either porting the extra from main or gating the test on the branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant