Fix GQA fusion to produce present key/value#2634
Merged
gramalingam merged 1 commit intomainfrom Oct 15, 2025
Merged
Conversation
Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR improves GQA (Grouped Query Attention) fusion by modifying the attention operation to output present key-value pairs in addition to the attention result. The change ensures that both past and present key-value states are properly handled in the fused operation.
- Modified the pattern function to return present key and value tensors alongside the attention output
- Updated the rewrite function to specify 3 outputs for the attention operation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2634 +/- ##
=======================================
Coverage 70.38% 70.38%
=======================================
Files 222 222
Lines 26288 26288
Branches 2629 2629
=======================================
Hits 18503 18503
Misses 6865 6865
Partials 920 920 ☔ View full report in Codecov by Sentry. |
gramalingam
approved these changes
Oct 15, 2025
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.
Output present key value from the Attention op because past key value is provided. Previously the Attention op created would consume past key/value but not produce present key/value, which is not correct for ORT.
Replaces #2632