Repository navigation
Large head attention follow-ups: compiled kill switch, 4-bit shard self check, forced float32 skip - #14188
Conversation
…led code agrees with eager
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1179583ba0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| dtype = p.dtype | ||
| if dtype not in (torch.float16, torch.bfloat16): | ||
| dtype = getattr(getattr(p, "quant_state", None), "dtype", None) |
There was a problem hiding this comment.
Use quant-state dtype for float-packed 4-bit weights
When a 4-bit parameter uses floating bnb_4bit_quant_storage that differs from its compute dtype (for example, fp16 storage with bf16 compute), p.dtype is a supported half type, so this branch never reads quant_state.dtype and self-checks the storage dtype instead. Compiled bf16 attention then finds no (device, torch.bfloat16) verdict and permanently falls back to SDPA; detect quantized parameters first and use their logical compute dtype regardless of the packed storage dtype.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in feed2c1: the self check now takes the dtype from the quant state whenever a parameter has one, so float16 storage with bfloat16 compute checks bfloat16. Added test_patch_self_checks_the_compute_dtype_of_float_packed_4bit, which fails on the previous head.
|
@codex review |
|
Codex Review: Didn't find any major issues. Delightful! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
# Conflicts: # tests/test_large_head_attention.py
[skip ci]
## Summary The `Core zoo` cells in `consolidated-tests-ci.yml` keep hitting their 25 minute job cap after the tests have already passed. In one cancelled cell: - the zoo `pytest -n 4` step ran from 08:41 to 09:03 and passed (3015 passed, 620 skipped), - the job was then cancelled at 25:17 during `test_apply_fused_lm_head` and the pip cache save. The comment above the cap assumed a ~7.6 min zoo suite. It now takes up to about 23 minutes on a busy runner, so the cap cancels cells that have already passed. Today that cancelled Core zoo cells on #14152, #14165, #14188, #14192, #14199 and #14207, and on staging runs. Each one needs a manual rerun before the PR can merge. This raises the cap to 35 minutes, the same as `consolidated`. Hung tests are still bounded: `PYTEST_TIMEOUT: 300` in the step still names the culprit per test. ## Tests The workflow-parsing tests (`git grep -l consolidated-tests-ci -- tests`): 158 passed, 3 skipped. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Summary
Follow-ups for the head-dim 512 attention kernel (#13869) and one test gap from #13888. The default path is unchanged except where noted.
_enabled()was anlru_cache. Dynamo warns when it traces through that wrapper, and it re-reads the environment there, so compiled code could disagree with eager after the variable changed at runtime. It now reads the value once into a module-level holder that both paths share._enabled.cache_clear()still resets it.quant_state._unsloth_forced_float32(zoo's Gemma-4 float32 path) run attention in float32 on plain SDPA and never reach this router, so the patch now returns before the fp16 self check and autotune at load.test_rms_layernorm_backward_leaves_shared_grad_alonenow sets_SAVE_OUTPUTand asserts the backward-from-output path runs. Before, itssave_output = Truecases never exercised that path.Tests (GPU)
tests/test_large_head_attention.py: 3 new tests (compiled vs eager kill switch, 4-bit-only shard self check, forced float32 skip). They fail on main and pass here.tests/test_norm_backward_grad_alias.py: 52 passed.Not run here: a real Gemma-4 load for items 2 and 3, or any timing. The kernel itself is unchanged.