Skip to content

Fix the red test on main from the #7578 / #7580 merge interaction - #7590

Merged
danielhanchen merged 1 commit into
mainfrom
fix-bnb-bind-assertion-alias
Jul 29, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
fix-bnb-bind-assertion-alias

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

main is red at 7b068090b: tests/python/test_bitsandbytes_kernel_readiness.py::test_the_ctypes_binds_are_gated_on_the_same_verdict fails.

My fault, and it is a merge interaction rather than either change being wrong. #7578 and #7580 landed 32 seconds apart and touch neighbouring lines in unsloth/kernels/utils.py, so git merged them cleanly and the runtime behaviour is correct:

266: if bnb is None or not native_kernels_ready(bnb, DEVICE_TYPE):   # from #7578
273:     cdequantize_blockwise_fp32 = bnb_functional.lib.cdequantize_blockwise_fp32   # from #7580

What did not compose is the source-text assertion #7578 added. It looked for the literal bnb.functional.lib under that guard, and #7580 renamed the binding to bnb_functional.lib so it survives a half-imported bitsandbytes. Neither PR could see the conflict on its own branch.

Anchored on lib.cdequantize_blockwise_fp32 instead. That still pins the ctypes binds to the guard, which is the whole point of the test, and it no longer breaks when the module alias changes.

Verification

  • tests/python/test_bitsandbytes_kernel_readiness.py: 10 passed.
  • Full tests/python on merged main under the CI shape (torch 2.10.0+cpu, bitsandbytes 0.50.0, no GPU): this was the only new failure. The other two red items are pre-existing and unrelated (test_negative_control_no_tokenizers, plus a pydantic collection error in my scratch env).
  • The merged runtime is fine, confirmed on a B200 before this change: ALLOW_BITSANDBYTES True, get_ptr real, 109 Linear4bit modules, 10/10 steps, generation clean.

Test-only change.

#7578 and #7580 landed within a minute of each other and compose correctly in
kernels/utils.py, but the source-text assertion #7578 added does not: it looked for
the literal "bnb.functional.lib" under the guard, and #7580 renamed that binding to
"bnb_functional.lib" to survive a half-imported bitsandbytes. Git merged both cleanly
because they touch different lines, so the break only shows at test time.

Match "lib.cdequantize_blockwise_fp32" instead. That still pins the binds to the guard,
which is what the test is for, and no longer breaks when the module alias changes.
@danielhanchen
danielhanchen merged commit f4f36a0 into main Jul 29, 2026
15 checks passed
@danielhanchen
danielhanchen deleted the fix-bnb-bind-assertion-alias branch July 29, 2026 04:35
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.

2 participants