[Cute,Sm100] allow for zero length sequences in hdim 256 kernels#2568
Merged
Conversation
Johnsonms
approved these changes
May 16, 2026
Collaborator
|
PR fixes the bug. Before patch (b11 baseline):
After patch (jshah/hdim256-varlen-zero-lengths, commit 75db52f):
|
ussoewwin
added a commit
to ussoewwin/flash-attention
that referenced
this pull request
May 21, 2026
…ero-len (Dao-AILab#2568), varlen batch search (Dao-AILab#2556)
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.
We add support for zero-length Q and KV sequences for varlen mode in the sm100 hdim 256 kernels. Changes are as follows:
Forward: have softmax execute one dummy iteration to not hang for zero-length K. We also add row sum check for zero or NaN to not output NaN in this case.
Backward dQ: for guarding work tile per-iteration, check also that trip count is non-zero. If it is zero, write zero as the output.
Backward dKV: zero-length Q and K was nominally supported but the write zero logic was broken and yielded IMA; now fixed in the PR.