[Cute,Fwd,Sm100] support irregular qhead / kvhead ratios#2186
Merged
tridao merged 1 commit intoDao-AILab:mainfrom Mar 20, 2026
Merged
[Cute,Fwd,Sm100] support irregular qhead / kvhead ratios#2186tridao merged 1 commit intoDao-AILab:mainfrom
tridao merged 1 commit intoDao-AILab:mainfrom
Conversation
433e654 to
0645a6b
Compare
tridao
reviewed
Mar 17, 2026
tridao
reviewed
Mar 17, 2026
Member
|
Do we have tests that hit this code path? I guess we set |
tridao
approved these changes
Mar 18, 2026
Member
|
LGTM, we can merge when it's ready |
76c2e8c to
438670d
Compare
438670d to
074ec36
Compare
Member
|
Thank you! |
zhuochenKIDD
pushed a commit
to zhuochenKIDD/flash-attention
that referenced
this pull request
Mar 25, 2026
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.
This PR enables the Pack GQA optimization for attention head group sizes which don't divide
m_block_sizeby using cp.async to load Q. Previously,pack_gqawould be set to false in the SM100 interface whenevernheads / nheads_kvdoes not divide128.This offers significant speedup for autoregressive sampling in certain LLM models (e.g. GLM 4.7):
Note: we disable paired CTA when using cp.async to load Q because there is no pre-MMA barrier construct to wait on both CTAs to finish loading before continuing.
Correctness
Updated
test_flash_attn_fast.pyto cover MQA, which invokes the irregular GQA path. All tests continue to pass.Perf Regression
Running
bench_sm90.pyon a B200, perf stays consistent across various problem sizes.