Add packed attention workspace estimates - #32321
Draft
Ti-Tai Wang (titaiwangms) wants to merge 1 commit into
Draft
Add packed attention workspace estimates#32321Ti-Tai Wang (titaiwangms) wants to merge 1 commit into
Ti-Tai Wang (titaiwangms) wants to merge 1 commit into
Conversation
Add route-aware Level-1 estimates and Level-2 workspace declarations for PackedAttention and PackedMultiHeadAttention while preserving the shared runtime recipes and dynamic allocation fallback. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c04148cc-7ace-4cf4-b981-0ddc92334e78
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
注册 for free
to join this conversation on GitHub.
Already have an account?
登录 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.
Summary
Add MatMulNBits-equivalent operator-side workspace estimation for CUDA
PackedAttentionandPackedMultiHeadAttention:CUDA device properties, and the EP's resolved attention options.
WorkspaceInputShapemetadata and constructed kernel state.
workspace bytes and layouts.
Level 1 is log-only, matching the current MatMulNBits pilot. This PR does not
add #32071-specific planner APIs or change runtime
GetScratchBuffer()behavior.Route aggregation
Runtime routes are mutually exclusive, so the estimate uses:
Route reachability is evaluated conservatively for every runtime shape up to
the supplied maximum geometry. This is necessary because Flash/MEA thresholds
and attention-bias alignment gates are not monotonic when moving from a maximum
shape to a smaller runtime shape. Unfused fallback is always retained, and a
failure to size any included route makes the estimate unavailable rather than
silently underestimating.
Shape and zero semantics
malformed geometry, and checked-arithmetic overflow produce no estimate.
WorkspaceInputShapedoes not carry max-shape provenance, so zero-shapedframework hints are conservatively treated as unavailable.
an empty requirements list.
Planner integration
preallocation opt-in is added.
chilo-ms's multi-slot planner extension before planned workspace can be used.
Build boundaries
The framework adapters and kernel overrides are excluded from:
DISABLE_CONTRIB_OPSbuildsThe graph-free workspace recipes remain available to the shared BERT attention
infrastructure where required.
Validation
geometry coverage
DISABLE_CONTRIB_OPSand CUDA-minimal compile-guard probesDependency
This is a stacked follow-up to #32312. The base should change to
mainafter#32312 merges.
Tracking: #29775