Skip to content

Mock torch.version.hip in CUDA override tests - #2114

Open
kudomcho wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
kudomcho:fix/rocm-cuda-override-tests
Open

kudomcho wants to merge 1 commit into
bitsandbytes-foundation:mainfrom
kudomcho:fix/rocm-cuda-override-tests

Conversation

@kudomcho

@kudomcho kudomcho commented Oct 29, 2026 •

Copy link
Copy Markdown

Summary

  • test_override and test_override_invalid_format test CUDA-specific BNB_CUDA_VERSION behavior but didn't mock torch.version.hip
  • On ROCm hosts, get_cuda_bnb_library_path() sees is_hip=True and checks BNB_ROCM_VERSION instead, so the CUDA override is silently ignored — test_override gets libbitsandbytes_rocm120 instead of libbitsandbytes_cuda110, and test_override_invalid_format never hits the validation path
  • Fix: patch torch.version.hip to None in both tests, matching the pattern already used by test_version_selection and test_rocm_override

Test plan

  • All 9 test_cuda_setup_evaluator tests pass on gfx1200 (ROCm 6.3/6.4)
  • Pre-commit hooks pass
  • Verify no regression on CUDA (the mock is None which matches CUDA's native value, so behavior is identical)

test_override and test_override_invalid_format test CUDA-specific
BNB_CUDA_VERSION behavior but did not mock torch.version.hip. On ROCm
hosts, get_cuda_bnb_library_path() sees is_hip=True and checks
BNB_ROCM_VERSION instead, causing the CUDA override to be ignored.
Patch torch.version.hip to None so these tests exercise the CUDA path
regardless of the host platform.

Co-Authored-By: Claude <noreply@anthropic.com>

This branch has not been deployed

No deployments
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