Use native block tables for 128-token XQA pages - #32127
Merged
Baiju Meswani (baijumeswani) merged 1 commit intoAug 17, 2026
Merged
Conversation
Baiju Meswani (baijumeswani)
requested review from
Tianlei Wu (tianleiwu)
and
a balanced review from Copilot
and removed request for
Copilot
August 17, 2026 06:51
Copilot started reviewing on behalf of
Baiju Meswani (baijumeswani)
August 17, 2026 06:51
View session
Copilot started reviewing on behalf of
Baiju Meswani (baijumeswani)
August 17, 2026 06:51
View session
Contributor
There was a problem hiding this comment.
Pull request overview
Optimizes CUDA PagedAttention by passing native 128-token block tables directly to XQA.
Changes:
- Skips page-table allocation and expansion for 128-token blocks.
- Adds debug telemetry distinguishing native and expanded paths.
- Adds parity tests and documentation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
onnxruntime/contrib_ops/cuda/bert/paged_attention.cc |
Conditionally allocates expansion scratch. |
onnxruntime/contrib_ops/cuda/bert/paged_attention_impl.cu |
Passes native tables directly to XQA. |
onnxruntime/contrib_ops/cuda/bert/attention_data.h |
Renames expansion scratch field. |
onnxruntime/contrib_ops/cuda/bert/attention_kernel_options.h |
Adds page-table debug state. |
onnxruntime/contrib_ops/cuda/bert/attention_kernel_options.cc |
Prints the selected table mode. |
onnxruntime/test/python/transformers/test_paged_attention.py |
Tests native/expanded parity and dispatch. |
docs/contrib_ops/cuda/paged_attention.md |
Documents the optimized path. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Baiju Meswani (baijumeswani)
deleted the
baijumeswani/xqa-native-page-table
branch
August 17, 2026 16:43
Contributor
Author
|
Thank you for the review. |
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.
Avoid expanding the PagedAttention block table when its block size already matches XQA’s 128-token page size.
For 128-token blocks, the existing block table is passed directly to XQA. Larger block sizes continue using the existing expanded page-table path.
This removes an unnecessary temporary allocation and conversion kernel from each eligible XQA invocation.