Enable non-contiguous quantize_4bit tests for the MPS backend#1994
Merged
matthewdouglas merged 1 commit intoJul 9, 2026
Merged
Conversation
The TestNonContiguousInputs 4-bit tests were gated to CUDA only when added in bitsandbytes-foundation#1859 to cover the raw-pointer bug (bitsandbytes-foundation#1342, bitsandbytes-foundation#1690) that only affected the CUDA kernels. The MPS backend handles non-contiguous inputs correctly via its reshape/contiguous code paths. Verified locally that non-contiguous inputs produce bit-identical results to their contiguous equivalents on MPS across fp4/nf4, fp16/bf16/fp32, and blocksizes 64/128/256 (quantize + roundtrip). Enable the existing regression coverage on MPS. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XmxFGTVQTNPPhyN8wjsgJu
|
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. |
e56da9e
into
bitsandbytes-foundation:main
83 of 84 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.
Summary
The
TestNonContiguousInputs4-bit tests (test_quantize_4bit_non_contiguousandtest_quantize_4bit_roundtrip_non_contiguous) were gated to CUDA only when added in #1859, which fixed the raw-pointer bug (#1342, #1690) that affected the CUDA kernels specifically. The MPS backend already handles non-contiguous inputs correctly via itsreshape/contiguouscode paths, so this coverage can safely be extended to it.This change relaxes the skip guard on those two tests to also run on
mps.Verification
Ran locally on Apple Silicon (macOS, MPS). Non-contiguous inputs produce bit-identical results to their contiguous equivalents across every parametrization —
fp4/nf4,fp16/bf16/fp32, and blocksizes64/128/256, for both quantize and the quantize→dequantize roundtrip:Notes
cpuandcudabackends, so these MPS-only tests are skipped there and run only on developer machines with MPS.🤖 Generated with Claude Code