[None][perf] Avoid paged MSA K/V materialization during prefill#16857
Draft
peihu-nv wants to merge 1 commit into
Draft
[None][perf] Avoid paged MSA K/V materialization during prefill#16857peihu-nv wants to merge 1 commit into
peihu-nv wants to merge 1 commit into
Conversation
Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
Collaborator
Author
|
/bot run |
Collaborator
|
PR_Github #61667 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #61667 [ run ] completed with state
|
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.
@coderabbitai summary
Description
The MSA sparse-prefill path currently calls
.contiguous()on paged K/Vviews before FMHA. For a valid HND cache view, the tensor is already packed
within each page and satisfies the SM100 TMA requirements; only the outer page
stride is non-contiguous because the cache pool is coalesced. Materializing
the full tensor is unnecessary in that case.
This change adds a guarded zero-copy path to the pinned MSA dependency:
inner row/head strides, base address, and outer page alignment satisfy the
kernel contract;
layouts;
3rdparty/MSAsource during wheelconstruction, applies the downstream patch there, and packages that staged
source through
TRTLLM_MSA_PACKAGE_DIR;This draft intentionally scopes activation to TensorRT-LLM's staged wheel
build. Source/editable-import activation can be reviewed independently.
Performance
The original matched GB300 CTX-only qualification used 8K prompts:
Nsight Systems also showed that the candidate removed 3,648 FP8 copy kernels
and 54.293 GiB of copied data per prefill.
Build design
The MSA submodule remains pinned at
e2ebe7656649f619af0ad1d457b534283034655e.The wheel builder copies it into a disposable build directory, applies the
TRT-owned patch, and packages that staged source. This follows the downstream
patch model used for DeepEP while keeping the checked-out submodule clean.
Test Coverage
test_build_wheel.py.behavior, and strided-versus-packed numerical equivalence.
therefore opened as a draft.
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
Update tava architecture diagram if there is a significant design change in PR.
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
To see a list of available CI bot commands, please comment
/bot help.