Skip to content

python3Packages.bitsandbytes: 0.47.0 -> 0.48.1, support rocm#443210

Merged
SuperSandro2000 merged 3 commits intoNixOS:masterfrom
06kellyjac:maintenance/python3Packages.bitsandbytes/rocm_support
Oct 16, 2025
Merged

python3Packages.bitsandbytes: 0.47.0 -> 0.48.1, support rocm#443210
SuperSandro2000 merged 3 commits intoNixOS:masterfrom
06kellyjac:maintenance/python3Packages.bitsandbytes/rocm_support

Conversation

@06kellyjac
Copy link
Copy Markdown
Member

@06kellyjac 06kellyjac commented Sep 15, 2025

Added support for ROCm since the 0.47.0 update bitsandbytes-foundation/bitsandbytes#1683

Made some small refactors to make more consistent with other packages following off torch.cuda*

All the ROCm stuff is in one drv, I'm not sure I recognise the need for the split between cuda-common-redist, cuda-native-redist, and cuda-redist.

Maybe needs an assert that cudaSupport and rocmSupport are exclusive? 🤷

For testing:

{
  pkgs ? import ./. { config = { rocmSupport = true; }; },
}:
pkgs.python3Packages.bitsandbytes

Ran a package that wanted bitsandbytes with ROCm locally (invokeai, still testing other stuff) and at least doesn't complain on launch anymore.

cc: @bcdarwin

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@06kellyjac 06kellyjac requested a review from bcdarwin September 15, 2025 17:09
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. 6.topic: python Python is a high-level, general-purpose programming language. labels Sep 15, 2025
@LunNova
Copy link
Copy Markdown
Member

LunNova commented Sep 15, 2025

Maybe needs an assert that cudaSupport and rocmSupport are exclusive? 🤷

Could copy what torch does to mark broken. Not sure it's really needed since this depends on torch and in most cases you'll see the error that torch can't build for CUDA and ROCm at the same time.

Comment thread pkgs/development/python-modules/bitsandbytes/default.nix Outdated
@06kellyjac 06kellyjac force-pushed the maintenance/python3Packages.bitsandbytes/rocm_support branch from a102cfe to 0edafbb Compare September 15, 2025 19:30
@06kellyjac
Copy link
Copy Markdown
Member Author

Added the suggestion + broken packages part. Also included the other passthru parts and the platform section.

One other thing I haven't mentioned is I trimmed out the CUDA part of the GPU targets bit. Potentially we'd need that for cuda too but the CMake does some bits and pieces around capabilities and I'm not sure what I'm doing with that so just dropped it.


I've also added myself to the maintainer list since if I'm adding all this extra nix I should at least help maintain it.
If we can get a thumbs up from @bcdarwin before any merge that'd be ideal. 🙂

@LunNova
Copy link
Copy Markdown
Member

LunNova commented Sep 15, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 443210
Commit: 0edafbb832169673951b2af947af0bd61b98a155


x86_64-linux

✅ 24 packages built:
  • python312Packages.bitsandbytes
  • python312Packages.bitsandbytes.dist
  • python312Packages.kserve
  • python312Packages.kserve.dist
  • python312Packages.mmcv
  • python312Packages.mmcv.dist
  • python312Packages.mmengine
  • python312Packages.mmengine.dist
  • python312Packages.torchao
  • python312Packages.torchao.dist
  • python312Packages.torchrl
  • python312Packages.torchrl.dist
  • python312Packages.unsloth
  • python312Packages.unsloth.dist
  • vllm (python312Packages.vllm)
  • vllm.dist (python312Packages.vllm.dist)
  • python313Packages.bitsandbytes
  • python313Packages.bitsandbytes.dist
  • python313Packages.mmcv
  • python313Packages.mmcv.dist
  • python313Packages.mmengine
  • python313Packages.mmengine.dist
  • python313Packages.torchao
  • python313Packages.torchao.dist

@06kellyjac 06kellyjac force-pushed the maintenance/python3Packages.bitsandbytes/rocm_support branch from 0edafbb to 480f7a5 Compare October 9, 2025 08:18
@06kellyjac 06kellyjac changed the title python3Packages.bitsandbytes: support rocm python3Packages.bitsandbytes: 0.47.0 -> 0.48.1, support rocm Oct 9, 2025
@nixpkgs-ci nixpkgs-ci Bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. and removed 10.rebuild-darwin: 11-100 This PR causes between 11 and 100 packages to rebuild on Darwin. labels Oct 9, 2025
@06kellyjac
Copy link
Copy Markdown
Member Author

Updated to latest & adjusted for cmake 4.

Also after adding a few more libraries to their cmake config so they're actually resolved properly I didn't need to set ROCM_HOME.
I'll throw a PR upstream at some point.

Only remaining annoyance with their cmake config is some code is built with g++ when it's been set to lang hip

bitsandbytes> [ 16%] Building CXX object CMakeFiles/bitsandbytes.dir/csrc/common.cpp.o
bitsandbytes> [ 33%] Building CXX object CMakeFiles/bitsandbytes.dir/csrc/pythonInterface.cpp.o
bitsandbytes> [ 50%] Building HIP object CMakeFiles/bitsandbytes.dir/csrc/kernels.hip.o
bitsandbytes> [ 83%] Building HIP object CMakeFiles/bitsandbytes.dir/csrc/ops.hip.o
bitsandbytes> [ 83%] Building CXX object CMakeFiles/bitsandbytes.dir/csrc/cpu_ops.cpp.o
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> make[2]: *** [CMakeFiles/bitsandbytes.dir/build.make:79: CMakeFiles/bitsandbytes.dir/csrc/common.cpp.o] Error 1
bitsandbytes> make[2]: *** Waiting for unfinished jobs....
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> make[2]: *** [CMakeFiles/bitsandbytes.dir/build.make:107: CMakeFiles/bitsandbytes.dir/csrc/pythonInterface.cpp.o] Error 1
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> g++: error: language hip not recognized
bitsandbytes> make[2]: *** [CMakeFiles/bitsandbytes.dir/build.make:93: CMakeFiles/bitsandbytes.dir/csrc/cpu_ops.cpp.o] Error 1

Just setting C and CXX is a simple fix

@06kellyjac
Copy link
Copy Markdown
Member Author

06kellyjac commented Oct 9, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 443210
Commit: 480f7a5408df92d909aa6f8cd2fb76d982a14540


x86_64-linux

✅ 26 packages built:
  • python312Packages.bitsandbytes
  • python312Packages.bitsandbytes.dist
  • python312Packages.mmcv
  • python312Packages.mmcv.dist
  • python312Packages.mmengine
  • python312Packages.mmengine.dist
  • python312Packages.torchao
  • python312Packages.torchao.dist
  • python312Packages.unsloth
  • python312Packages.unsloth.dist
  • python313Packages.bitsandbytes
  • python313Packages.bitsandbytes.dist
  • python313Packages.kserve
  • python313Packages.kserve.dist
  • python313Packages.mmcv
  • python313Packages.mmcv.dist
  • python313Packages.mmengine
  • python313Packages.mmengine.dist
  • python313Packages.torchao
  • python313Packages.torchao.dist
  • python313Packages.torchrl
  • python313Packages.torchrl.dist
  • python313Packages.unsloth
  • python313Packages.unsloth.dist
  • python313Packages.vllm
  • python313Packages.vllm.dist

aarch64-linux

❌ 6 packages failed to build:
  • python313Packages.mmcv
  • python313Packages.mmcv.dist
  • python313Packages.mmengine
  • python313Packages.mmengine.dist
  • python313Packages.torchao
  • python313Packages.torchao.dist
✅ 14 packages built:
  • python312Packages.bitsandbytes
  • python312Packages.bitsandbytes.dist
  • python312Packages.mmcv
  • python312Packages.mmcv.dist
  • python312Packages.mmengine
  • python312Packages.mmengine.dist
  • python312Packages.torchao
  • python312Packages.torchao.dist
  • python312Packages.unsloth
  • python312Packages.unsloth.dist
  • python313Packages.bitsandbytes
  • python313Packages.bitsandbytes.dist
  • python313Packages.unsloth
  • python313Packages.unsloth.dist

Error logs: `aarch64-linux`
python313Packages.mmengine
@nix {"action":"setPhase","phase":"installCheckPhase"}
no Makefile or custom installCheckPhase, doing nothing
Running phase: pythonCatchConflictsPhase
@nix {"action":"setPhase","phase":"pythonCatchConflictsPhase"}
Running phase: pythonRemoveBinBytecodePhase
@nix {"action":"setPhase","phase":"pythonRemoveBinBytecodePhase"}
Running phase: pythonImportsCheckPhase
@nix {"action":"setPhase","phase":"pythonImportsCheckPhase"}
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: mmengine
Running phase: pytestCheckPhase
@nix {"action":"setPhase","phase":"pytestCheckPhase"}
Executing pytestCheckPhase
pytest flags: -m pytest --deselect=tests/test_visualizer/test_vis_backend.py::TestAimVisBackend --deselect=tests/test_visualizer/test_vis_backend.py::TestDVCLiveVisBackend --deselect=tests/test_fileio/test_backends/test_petrel_backend.py::TestPetrelBackend -k not\ \(test_fileclient\)\ and\ not\ \(test_http_backend\)\ and\ not\ \(test_misc\)\ and\ not\ \(test_dump\)\ and\ not\ \(test_deepcopy\)\ and\ not\ \(test_copy\)\ and\ not\ \(test_lazy_import\)\ and\ not\ \(test_lazy_module\)
============================= test session starts ==============================
platform linux -- Python 3.13.7, pytest-8.4.1, pluggy-1.6.0
rootdir: /build/source
configfile: pytest.ini
testpaths: tests
plugins: hypothesis-6.136.9, hydra-core-1.3.2, anyio-4.10.0, typeguard-4.4.4
python313Packages.torchao
@nix {"action":"setPhase","phase":"pythonRemoveBinBytecodePhase"}
Running phase: pythonImportsCheckPhase
@nix {"action":"setPhase","phase":"pythonImportsCheckPhase"}
Executing pythonImportsCheckPhase
Check whether the following modules can be imported: torchao
Error in cpuinfo: failed to parse the list of possible processors in /sys/devices/system/cpu/possible
Error in cpuinfo: failed to parse the list of present processors in /sys/devices/system/cpu/present
Error in cpuinfo: failed to parse both lists of possible and present processors
pythonImportsCheckPhase completed in 1 minutes 12 seconds
Running phase: pytestCheckPhase
@nix {"action":"setPhase","phase":"pytestCheckPhase"}
Executing pytestCheckPhase
pytest flags: -m pytest -k not\ \(test_on_dummy_distilbert\)\ and\ not\ \(test_gptq_mt\)\ and\ not\ \(test_quantize_per_token_cpu\)\ and\ not\ \(test_smooth_linear_cpu\)\ and\ not\ \(test_int8_weight_only_quant_with_freeze_0_cpu\)\ and\ not\ \(test_int8_weight_only_quant_with_freeze_1_cpu\)\ and\ not\ \(test_int8_weight_only_quant_with_freeze_2_cpu\)\ and\ not\ \(test_save_load_int4woqtensors_2_cpu\)\ and\ not\ \(test_save_load_int8woqtensors_0_cpu\)\ and\ not\ \(test_save_load_int8woqtensors_1_cpu\) --numprocesses=4
============================= test session starts ==============================
platform linux -- Python 3.13.7, pytest-8.4.1, pluggy-1.6.0
rootdir: /build/source
plugins: hypothesis-6.136.9, xdist-3.8.0
4 workers [5118 items]                                                 
ssssssssssssssssssssssssssssssssssssssssssssssssssssss.sssssssssss.ss.ss [  1%]
s.sss.ss.s.sssssssssss.ssssssss.ssssssssssssssssssssssss........ssssssss [  2%]

My aarch64-linux machine is pretty weak & crashed

@nixpkgs-ci nixpkgs-ci Bot added the 12.approvals: 1 This PR was reviewed and approved by one person. label Oct 9, 2025
Copy link
Copy Markdown
Member

@SuperSandro2000 SuperSandro2000 left a comment

Choose a reason for hiding this comment

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

LGTM but didn't test


brokenConditions = lib.attrsets.filterAttrs (_: cond: cond) {
"CUDA and ROCm are mutually exclusive" = cudaSupport && rocmSupport;
"CUDA is not targeting Linux" = cudaSupport && !stdenv.hostPlatform.isLinux;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
"CUDA is not targeting Linux" = cudaSupport && !stdenv.hostPlatform.isLinux;
"CUDA is only available for Linux" = cudaSupport && !stdenv.hostPlatform.isLinux;

@SuperSandro2000 SuperSandro2000 added this pull request to the merge queue Oct 16, 2025
@nixpkgs-ci nixpkgs-ci Bot added 12.approvals: 2 This PR was reviewed and approved by two persons. and removed 12.approvals: 1 This PR was reviewed and approved by one person. labels Oct 16, 2025
Merged via the queue into NixOS:master with commit c86eb5f Oct 16, 2025
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: python Python is a high-level, general-purpose programming language. 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. 12.approvals: 2 This PR was reviewed and approved by two persons.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants