Add BNB_ROCM_VERSION and ROCM_VERSION for ROCm/PyTorch version mismatch#1878
Merged
matthewdouglas merged 2 commits intobitsandbytes-foundation:mainfrom Feb 20, 2026
Merged
Conversation
When PyTorch is built with a different ROCm version than the system (e.g. torch+rocm7.0 on ROCm 7.2), bitsandbytes fails to find the native library because the build uses hipconfig (system) while runtime uses torch.version.hip (PyTorch). - Add BNB_ROCM_VERSION env var (runtime): override which ROCm library is loaded, analogous to BNB_CUDA_VERSION. Takes priority when both BNB_ROCM_VERSION and BNB_CUDA_VERSION are set on ROCm. - Add ROCM_VERSION CMake cache variable (build): override the version shortcode in the output library name (e.g. -DROCM_VERSION=70 produces libbitsandbytes_rocm70.so on a 7.2 system). - Update diagnostics and error messages to mention BNB_ROCM_VERSION; align _print_hip_runtime_diagnostics with _print_cuda_runtime_diagnostics. - Reject BNB_CUDA_VERSION on ROCm with a clear error pointing to BNB_ROCM_VERSION. - Add ROCm tests: default path, override, rejection of BNB_CUDA_VERSION, and both vars set (ROCM wins). Fixes ROCm#82.
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
746cd64
into
bitsandbytes-foundation:main
84 of 85 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When PyTorch is built with a different ROCm version than the system (e.g. torch+rocm7.0 on ROCm 7.2), bitsandbytes fails to find the native library because the build uses
hipconfig(system) while runtime usestorch.version.hip(PyTorch).Add
BNB_ROCM_VERSIONenv var (runtime): override which ROCm library is loaded, analogous toBNB_CUDA_VERSION. Takes priority when bothBNB_ROCM_VERSIONandBNB_CUDA_VERSIONare set on ROCm.Add
ROCM_VERSIONCMake cache variable (build): override the version shortcode in the output library name (e.g.-DROCM_VERSION=70produceslibbitsandbytes_rocm70.soon a 7.2 system).Update diagnostics and error messages to mention
BNB_ROCM_VERSION; align_print_hip_runtime_diagnosticswith_print_cuda_runtime_diagnostics.Reject
BNB_CUDA_VERSIONon ROCm with a clear error pointing toBNB_ROCM_VERSIONif the latter is not set.Add ROCm tests: default path, override, rejection of
BNB_CUDA_VERSION, and both vars set (ROCM wins).Fixes Bug when there is a mismatch between Torch and ROCm version ROCm/bitsandbytes#82.