Repository navigation
Document that last_pos_per_query is inclusive in flash attention. - #1058
Merged
Merged
Conversation
copybara-service
Bot
force-pushed
the
test_999310118
branch
from
October 14, 2026 13:46
25118e2 to
927a69a
Compare
The masks in SingleFlashAttentionRowVector and DoubleFlashAttentionRowVector keep keys in [pos, last_pos] (mask_size = last_pos + 1 - pos), and all callers pass the index of the last attended key (e.g. tiled_attention.cc uses the query's own position, vit.cc uses num_tokens - 1). The ComputeQKMacroTile doc block said "(exclusive)" and the public header comment was unclear. Comment-only change, no behavior change. PiperOrigin-RevId: 999337547
copybara-service
Bot
force-pushed
the
test_999310118
branch
from
October 14, 2026 13:54
927a69a to
2c9669b
Compare
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.
Document that last_pos_per_query is inclusive in flash attention.
The masks in SingleFlashAttentionRowVector and
DoubleFlashAttentionRowVector keep keys in [pos, last_pos]
(mask_size = last_pos + 1 - pos), and all callers pass the index of the
last attended key (e.g. tiled_attention.cc uses the query's own position,
vit.cc uses num_tokens - 1). The ComputeQKMacroTile doc block said
"(exclusive)" and the public header comment was unclear. Comment-only
change, no behavior change.