Repository navigation
Large-head attention: comment every constexpr, check fp fusion at the _launch helper - #17891
Merged
Merged
Conversation
… _launch helper #17817 added unsloth/kernels/large_head_attention.py. Its backward and TMA kernels left 23 tl.constexpr parameters uncommented, and its launches go through a _launch helper whose callers pass enable_fp_fusion = True, which test_every_launch_requests_fp_fusion could not see. Both lint tests failed on main. Add the comments, and register _launch as a launch helper (its kernel / kernel.fn subscripts as forwarding sites) so each _launch call is checked for enable_fp_fusion instead.
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis 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: Didn't find any major issues. Chef's kiss. 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". |
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
Two kernel lint tests in
Repo tests (CPU, rest)have failed onmainsince #17817 addedunsloth/kernels/large_head_attention.py(Gemma-4 large-head attention kernels):The forward kernel follows the constexpr convention, but the backward, TMA and
_tma_tilesignatures do not. On fp fusion the kernels are fine. Every launch goes through a_launch(kernel, grid, tile, *args, **kwargs)helper, and all three callers passenable_fp_fusion = True. The lint only sees thekernel[...]/kernel.fn[...]subscripts inside the helper. That is the same shape aslayernorm.py's andrms_layernorm.py's helpers, which the test already handles.Changes
unsloth/kernels/large_head_attention.py: a short comment on each of the 23 constexpr parameters (head dim, rows per program or step, which gradient a pass stores)._tma_tilegets one parameter per line, soROWSandHALFcarry their own comments. Comments only, no code change.tests/test_triton_fp_fusion.py: registerlarge_head_attention.py's_launchin_LAUNCH_HELPERS, and itskernel/kernel.fnsubscripts in_NOT_LAUNCHES, as for the two layernorm files. Each_launch(...)call is now checked forenable_fp_fusiondirectly.Verification
tests/test_triton_constexpr_comments.py tests/test_triton_fp_fusion.py tests/test_large_head_attention.py tests/test_block_compile.py: 94 passed, 102 skipped (CUDA-only). Onmain, the two lint tests fail.enable_fp_fusion = Truefrom the forward_launchcall givesTriton launches without enable_fp_fusion: ['large_head_attention.py:787:_launch'].