[None][perf] Fuse MiniMax-M3 prefill projections#16852
Draft
peihu-nv wants to merge 4 commits into
Draft
Conversation
Add warp-specialized selector kernels for up to 128 allocated blocks and emit a head-major backing during pure prefill so the selector-to-K2Q handoff is zero-copy. Keep mixed and decode batches Q-major and cover routing, strides, ties, forcing, and CUDA graph replay. Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
Add an opt-in MiniMax-M3 path that packs Q, K, V, index-Q, and index-K into one MXFP8 projection and consumes the packed result with a horizontal prefill producer. The producer normalizes and applies RoPE to the main and index tensors, converts the outputs to FP8, inserts K, V, and index-K directly into their caches, and returns compact Q and index-Q tensors. Keep the option disabled for decode and mixed workers while decode behavior is evaluated separately. Signed-off-by: peihengh <259410613+peihu-nv@users.noreply.github.com>
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
Prerequisite
Description
MiniMax-M3 currently projects main Q/K/V and index-Q/index-K separately, then
runs separate normalization, RoPE, quantization, and paged-cache insertion
steps. For long-context prefill, those extra projections and producer launches
are visible in both the critical path and the Nsight Systems trace.
This PR adds an opt-in MiniMax-M3 prefill path that:
MiniMax-M3 TP sharding and replication geometry;
Q/K/index-Q/index-K normalization and RoPE, converts the outputs to FP8, and
directly inserts main K/V plus index-K into their paged caches; and
paths, avoiding intermediate producer tensors and cache-write launches.
The prototype is disabled by default through
fuse_qkv_index_projection=False. It currently targets pure disaggregatedprefill workers. Decode and mixed workers should leave the option disabled
while their packed-projection behavior is evaluated separately; unsupported
prefill geometry, dtype, and layout combinations retain the compatibility
path.
The completed matched GB300 NVL72 2P8D prefill-isolation A/B used TP2/EP2
attention-DP on the 2-GPU CTX worker, TP8/EP8 attention-DP on the 8-GPU GEN
worker, concurrency 256, exact 8K input, and configured 1-token output. The
baseline was Slurm job
2490293; the candidate was2490294, with the packedoption enabled only on CTX and disabled on GEN in both runs. Both completed
2,560/2,560 requests:
The client JSON recorded two output tokens per request despite the configured
random_osl=1; this was identical for both variants and does not affect therelative A/B comparison. The result isolates the prefill benefit; decode
remains explicitly out of scope for this opt-in path.
Test Coverage
2488228 passed.
0-7, including weights, scales, sharding, and replication.
(2090/2090 modules per rank).
gates passed in Slurm job 2488379 with the fused projection enabled.
2,560/2,560 requests with exact 8K input and concurrency 256. Enabling the
packed projection only on CTX improved total token throughput by 8.36% and
mean TTFT by 7.69%.
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.