amd: raise the installer bitsandbytes fallback floors to 0.50.0

This commit is contained in:
Daniel Han 2026-07-28 22:09:01 +00:00
commit 2da5678c0c
3 changed files with 58 additions and 7 deletions

View file

@ -818,3 +818,49 @@ class TestPipNoIndexScrubParity:
text = SETUP_PS1.read_text(encoding = "utf-8")
assert "'PIP_NO_INDEX'" in text
assert "'PIP_INDEX_URL'" in text
class TestAmdBnbFloorParity:
"""bitsandbytes <= 0.49.2 NaNs at 4-bit decode shape on every AMD GPU; the ROCm
4-bit GEMV fix (bnb #1887) first ships on PyPI in 0.50.0. The install.sh PyPI
fallback and the Studio stack fallback are the two ways a supported AMD flow
resolves bitsandbytes when the pre-release wheel URL is unreachable, so neither
may float back into the broken range."""
FLOOR = "0.50.0"
PYPROJECT = REPO_ROOT / "pyproject.toml"
def test_install_sh_pypi_fallback_floor(self):
text = INSTALL_SH.read_text(encoding = "utf-8")
assert f'"bitsandbytes>={self.FLOOR}"' in text, (
f"install.sh _install_bnb_rocm PyPI fallback must floor at {self.FLOOR}"
)
def test_stack_py_pypi_fallback_floor(self):
text = STACK_PY.read_text(encoding = "utf-8")
assert f'_BNB_ROCM_PYPI_FALLBACK = "bitsandbytes>={self.FLOOR}"' in text, (
f"install_python_stack.py PyPI fallback must floor at {self.FLOOR}"
)
def test_amd_extra_floor_when_present(self):
"""The amd extra is not on this branch yet (#7278). Assert it only once it is,
so the extra and the two installer fallbacks cannot drift apart later."""
text = self.PYPROJECT.read_text(encoding = "utf-8")
amd = re.search(r"^amd = \[(.*?)^\]", text, re.S | re.M)
if amd is None:
pytest.skip("pyproject.toml has no amd extra on this branch")
specs = re.findall(r'"(bitsandbytes[^"]*)"', amd.group(1))
assert specs, "the amd extra must pin bitsandbytes"
for spec in specs:
assert spec.startswith(f"bitsandbytes>={self.FLOOR}"), (
f"amd extra bitsandbytes floor must be >={self.FLOOR}, got {spec!r}"
)
def test_no_installer_still_allows_the_broken_range(self):
for path in (INSTALL_SH, INSTALL_PS1, SETUP_PS1, STACK_PY, self.PYPROJECT):
text = path.read_text(encoding = "utf-8")
for line in text.splitlines():
if "bitsandbytes>=0.49" in line and not line.lstrip().startswith(("#", "//")):
raise AssertionError(
f"{path.name} still floors bitsandbytes in the broken ROCm range: {line.strip()!r}"
)