[TRTLLM-14703][fix] 1st cherrypick [combine MR99+MR100+MR102 on latest feat (with MR100 dispatch wiring)], 2nd cherrypick [deferred-finalize scales fix, fused-epilogue batch gate, hardening] - #17088
Merged
Conversation
Collaborator
Author
|
/bot run |
Collaborator
|
PR_Github #62879 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #62879 [ run ] completed with state
|
…R100 dispatch wiring) Signed-off-by: Tao Li <tali@nvidia.com> Signed-off-by: Michal Guzek <mguzek@nvidia.com>
…ed-epilogue batch gate, hardening Signed-off-by: Michal Guzek <mguzek@nvidia.com>
Signed-off-by: Michal Guzek <mguzek@nvidia.com>
moraxu
force-pushed
the
feat/kimi_k3_tekit_picks
branch
from
July 31, 2026 16:47
bb62b67 to
575d7f3
Compare
…uff E402 Signed-off-by: Michal Guzek <mguzek@nvidia.com>
2 tasks
brnguyen2
added a commit
that referenced
this pull request
Aug 1, 2026
Catch-up merge (TRTLLM-14810): main @ e34d3d4 into feat/kimi_k3 @ 7003910 (= ff8360e + PR #17088 cherry-picks). 13 textual conflicts resolved per the TRTLLM-14810 resolution plan; K3 stays on the V1 compatibility cache managers (V2 port tracked as TRTLLM-14769). Signed-off-by: Brian Nguyen <brnguyen@nvidia.com>
brnguyen2
added a commit
that referenced
this pull request
Aug 1, 2026
…-scale params Main migrated mnnvlAllreduceKernels.h from nvinfer1::DataType to tensorrt_llm::DataType (tllmDataType.h); the expert-scale-factor additions merged from #17088 still referenced nvinfer1. Rename the scaleDType member and kernel-dispatch comparisons to the new enum (identical enumerator names/values). Signed-off-by: Brian Nguyen <brnguyen@nvidia.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
Description
Cherry-picks two internal (squash-merged) MRs onto
feat/kimi_k3. Each commit's original MR description follows verbatim.NOTE: The third commit bb62b67 is just pre-commit application.
Commit
574265eecd— [None][perf] Kimi K3: combine MR99+MR100+MR102 on latest feat (with MR100 dispatch wiring)Goal
Combine the three pending Kimi K3 perf MRs on top of the latest
feat/golden_prairie(493ca9d724, which already includes MR !97 /tali/k3-night-opt-0726), make the combination actually functional, and validate performance + accuracy with the in-repo sweep scripts (examples/kimi_k3/perf_sweep/). This MR supersedes merging !99 / !100 / !102 individually.Contents (cherry-picks + one fix)
rosong) — fused down-proj+MXFP8-quant kernel, fused MoE finalize + MNNVL AR + RMSNorm, MoE TP4+EP4 measurement notes. Cherry-picked as260d001385.sephw) — FP8 KDA fused prefill QKV (packedqkvg_projreuse in_forward_prefill). Cherry-picked as301e885a9c.sephw) — KDA decode kernel selection heuristic (SM103 compact-heads selector). Cherry-picked as042194de21, plus a new wiring commitbb3f29d984: as pushed, !100 only addedshouldUseCompactHeads()and tests —invokeKdaDecodestill used the legacyH==2rule and the compact launcher was pinned todispatch_kda_decode_layout<true, 2>(its own dispatch tests fail on SM103, and naive wiring would be silently wrong for H≠2 becausekFixedHeadsis baked into the static-layout path). The wiring commit adds the SM103-exclusive selector call and instantiates the compact path for every supported head count.Analysis notes (activation conditions, overlap with the !97 optimizations, expected per-config gains):
agent-runs/0726-1455-mr-analysis/mr-analysis-report.mdin the project workspace. Key expectations on this baseline: !99's fused finalize+AR+RMSNorm is the main additive piece (TEP-only, decode ≤16 tokens); !99's down-proj fusion is inert under defaultKIMI_K3_FP8_WEIGHT_READ=1; !102 is prefill/TTFT-only and inert at TEP16 (recipe setsKIMI_K3_FP8_WEIGHT_READ_KDA=0); DEP16 is expected ~unchanged.Validation plan (in flight)
submit_perf_sweep.sh(tep16 / tep8 / dep16-lo / dep16-hi, simultaneous submission) vs the !97 baseline sweepsubmit_acc_sweep.sh(band 96.5±0.5; main numerics change = !99's bf16 finalize accumulation)Results + recipe recommendations will be posted as a comment when the runs complete.
Commit
2e4c343922— [TRTLLM-14703][fix] Kimi K3: unblock574265eecd- deferred-finalize scales fix, fused-epilogue batch gate, hardeningGoal
Unblock
574265eecd(stacked MR: targets its source branchtali/k3-feat-3mrs-0726). Fixes the two blockers from the574265eecdclose-out — the tep8 GSM8K=0.00 hard blocker and the tep16 c4/c8 decode regression — plus merge-safety hardening identified during review.Root cause (tep8 GSM8K=0.00)
With separated routing (
TLLM_TRTLLMGEN_FORCE_SEPARATED_ROUTING=1, tep8-only recipe), the fp4/mxfp4 block-scale MoE runners consume the caller'stopk_weightsthroughexpert_weights_ptrand the routing cubin treats the weights buffer as input-only, so the locally allocatedexpert_weightstensor is never written — yet thedo_finalize=Falsepath returned it. The Kimi fused finalize+MNNVL AR+RMSNorm epilogue then applied uninitialized memory as per-(token,k) routing scales: silent garbage, no crash. tep16 (in-kernel routing) and dep16 (fusion gated off) were unaffected, matching their ~97 scores.Contents (oldest first)
f1828a58ed[fix] Return host topk_weights from the block-scale MoE runners when do_finalize=False (bothmxFp4BlockScaleMoe.cppandfp4BlockScaleMoe.cpp; the nvfp4 file has the same latent defect reachable upstream via EPLB) + backend-level regression test.43981ead8b[perf] Gate the fused finalize+AR+RMSNorm to decode batch <= 2 (measured-win region; c4 attribution confirmed by the partial no-fusion A/B) and exposeTLLM_K3_FUSED_MOE_FINALIZE_AR_RMS_MAX_TOKENSfor rebuild-free sweeps.74ecff544b[chore] Sweep containers:PYTHONNOUSERSITE=1(user-site torch 2.13 ABI poisoning) + guardedHF_HOMEfor the acc sweep.63f58901ca[fix] MNNVL fused-finalize input validation + TP{2,4,8,16}/bf16-fp16 capability gating with graceful fallback + rejection tests.bb67ec734d[fix] dsv3 fused A-GEMM dense-layout/16-byte-alignment enforcement (silent wrong-memory hazard) + tests.ddc3d2368c[test] Off-SM103 KDA selector test expects legacy compact dispatch (test was wrong at574265eecdhead; fails on H100/B200 runners).6eb7751ae6[fix] mx MoE runner fake signature: missing trailingtune_max_num_tokens/use_dp(TypeError under FakeTensorMode).6750f6d5d2[chore] Env-knob safe parsing (clamp [0,16], fail-fast on non-integer) +W4A8_NVFP4_FP8regression-test coverage.7d1fa67c24[test] Supported layer shape for the fp8-activation deferred-scale test param (the fp8-act cubins ship no configs for the small default shape); clean skip when a shape has no kernel config.ed059bf872[chore] Point the GSM8K acc sweep at the local dataset snapshot via--dataset_path(offline compute nodes; the hub-id load path needs a materialized arrow cache the snapshot does not provide).4f1cfd7e24[chore] Give the perf-sweep benchmark client the same cache redirects as the server (flashinfer creates HOME-based dirs and HOME is unwritable in the client container).9f9cb9493f[chore] Trim the fused-finalize bound's code comment to the knob's contract; the motivating sweep numbers and kernel-mechanism analysis moved to the internal GitLab MR discussion.57d1a4b91d+0679fd508bprecommit and its revert: the hook run reformatted only pre-existing code (none of this MR's own hunks — 97% of it the one-time whole-file reformat ofmodeling_kimi_linear.py), so it was reverted to keep the MR diff reviewable. Net diff of the pair is empty; the whole-file formatter pass stays deferred to upstreaming, as listed above.Deferred by review (separate MR): tactic-independent deferred GEMM2 capacity + fake row-math package (torch.compile-only; needs its own hardening), whole-file formatter churn.
Validation matrix (complete)
Metric of record for perf rows: tps/user = 1000 / median TPOT (ms). Rows 3-11 were initially scored against the !97 baseline sweep
TRTLLM-sweep-Jul-26-commit-82f9780e; rows 13-14 re-measure the baseline same-moment because that comparison proved unreliable (see verdict). Concurrency 3 is deliberate: it straddles the batch<=2 fusion gate.103-realHF_HOME-> shared cache..._MAX_TOKENS=16..._MAX_TOKENS=0493ca9d724wheel vs MR, simultaneous launchRows 0–2 are prerequisites; rows 3–5 are the first wave (decides the fix); rows 6–7 decide TP8 fusion gating; rows 8–11 are full-qualification regression coverage; rows 12–14 resolve baseline comparability.
Verdict
493ca9d724) wheel launched at the same moment, the branch measures c1 +1.1%, c2/c3/c4 parity within noise (-1.5..-3%), c8 +3.7%, c16 +0.2% at tep16; tep8 shows no regression and the fusion is neutral there.Test Coverage
See the "Validation plan" / "Validation matrix" sections above: GB300 unit tests (deferred-scale regression, KDA dispatch, packed prefill, MNNVL rejection, dsv3 A-GEMM), GSM8K accuracy at tep8/tep16/dep16, and tep/dep perf sweeps.
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.