Enable bounded non-windowed GQA workspace estimation - #32696
Open
Chi Lo (chilo-ms) wants to merge 1 commit into
Open
Chi Lo (chilo-ms) wants to merge 1 commit into
Chi Lo (chilo-ms) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The new kernel-declaration test disables every backend route compatible with its model and will fail.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Open (2)
What changed in this PR
Adds bounded Level-2 workspace estimation for non-windowed CUDA GroupQueryAttention.
Changes:
- Adds a session-configured total-sequence-length bound.
- Models one-sided cache alias preservation.
- Adds estimator, aggregation, declaration tests, and documentation.
| File | Description |
|---|---|
group_query_attention.h |
Stores the configured bound. |
group_query_attention.cc |
Parses and applies the bound. |
group_query_attention_workspace_estimate.h |
Extends estimator configuration. |
group_query_attention_workspace_estimate.cc |
Builds non-windowed bounds. |
group_query_attention_workspace_bounds.h |
Adds past-capacity and alias metadata. |
group_query_attention_workspace_bounds.cc |
Aggregates partial-alias workspace routes. |
group_query_attention_workspace_estimate_test.cc |
Tests estimation and declaration behavior. |
onnxruntime_session_options_config_keys.h |
Defines the new session option. |
attention_workspace_estimation.md |
Documents non-windowed estimation. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| GTEST_SKIP() << "A CUDA device is required to construct the CUDA kernel."; | ||
| } | ||
|
|
||
| ScopedEnvironmentVariables scoped_env_vars{{{"ORT_ENABLE_XQA", "0"}}}; |
Comment on lines
+512
to
+514
| /// Optional positive upper bound for the total_sequence_length scalar of non-windowed CUDA | ||
| /// GroupQueryAttention nodes. The scalar value is unavailable during workspace declaration, | ||
| /// so callers must provide a sound bound when it may exceed the past-cache capacity. |
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.


Description
Follow-up to #32617 for non-windowed CUDA
GroupQueryAttentionworkspace estimation.ep.cuda.gqa_workspace_max_total_sequence_lengthas an explicit positive bound for the runtimetotal_sequence_lengthscalar used by Level-2 declaration;MayInplaceconservatively by including the valid one-sided past/present alias case and its full past-tensor preservation buffer; andThe Level-1 node adapter remains unavailable for non-windowed inputs because it cannot access session configuration. This PR changes estimation and declaration only; it does not consume a planned workspace root or change runtime allocation topology.
Validation
git diff --checkpassed.group_query_attention_workspace_estimate_test.cc.onnxruntime_providers_cuda_utCMake dependency cycle/module-loading setup when internal tests are enabled.Tracks #29775.