[WebNN] Support more features for GQA#27234
Open
Honry wants to merge 3 commits intomicrosoft:mainfrom
Open
Conversation
Add support for GroupQueryAttention with: - do_rotary=true (cos_cache/sin_cache inputs) - Packed QKV (optional key/value inputs) - Optional past_key/past_value for prefill mode - Remove fp16->fp32 casting workaround Add ApplyRotaryEmbedding helper function. Fix decode stage by using qkv_sequence_length instead of has_past_key to distinguish prefill vs decode, and use runtime seqlens_k instead of static past_sequence_length for rotary position calculation.
Contributor
Author
guschmue
previously approved these changes
Feb 5, 2026
Contributor
|
/azp run Linux QNN CI Pipeline,Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline |
|
Azure Pipelines successfully started running 4 pipeline(s). |
Contributor
|
run 'lintrunner -a' to make the CI happy |
Contributor
|
Hmm, linter issues. I can't tell what it's complaining about though: - emscripten::val input,// Shape: [batch_size, sequence_length, num_heads, head_size]
- emscripten::val cos_cache,// Shape: [max_sequence_length, head_size / 2]
- emscripten::val sin_cache,// Shape: [max_sequence_length, head_size / 2]
- emscripten::val position_ids,// Shape: [batch_size, sequence_length] or [1]
+ emscripten::val input,// Shape: [batch_size, sequence_length, num_heads, head_size]
+ emscripten::val cos_cache,// Shape: [max_sequence_length, head_size / 2]
+ emscripten::val sin_cache,// Shape: [max_sequence_length, head_size / 2]
+ emscripten::val position_ids,// Shape: [batch_size, sequence_length] or [1] |
auto-merge was automatically disabled
February 6, 2026 01:29
Head branch was pushed to by a user without write access
Contributor
Author
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.
Add support for GroupQueryAttention with:
Add ApplyRotaryEmbedding helper function.
Fix decode stage by using qkv_sequence_length to distinguish prefill vs decode, and use runtime seqlens_k instead of static past_sequence_length for rotary position calculation.