Skip to content

[None][perf] Kimi-K3 GB300 serving optimizations (router overlap, routed-latent AR quant, ctx shared-expert AR overlap) - #21211

Closed
viraatc wants to merge 3 commits into
NVIDIA:feat/k3_26.08from
viraatc:viraatc/k3-gb300-pubstack
Closed

viraatc wants to merge 3 commits into
NVIDIA:feat/k3_26.08from
viraatc:viraatc/k3-gb300-pubstack

Conversation

@viraatc

@viraatc viraatc commented Oct 28, 2026 •

Copy link
Copy Markdown

Description

Kimi-K3 serving optimizations for GB300 on top of feat/k3_26.08. Each feature is opt-in through an environment variable and is off by default, so default behavior is unchanged.

Feature Switch What it does
MoE router overlap KIMI_K3_ROUTER_OVERLAP=1 With multi-stream active, the router GEMM runs on the auxiliary stream concurrently with the latent down projection. Same kernels, same numerics. It stays off where the base's own latent-down overlap already runs.
Routed-latent all-reduce quant K3_PUB_AR_QUANT=1 (K3_PUB_AR_QUANT_MAX_M) Folds the FP8 1x128 activation quant into the MNNVL all-reduce + RMSNorm epilogue for decode-sized messages, so the standalone quantize kernel of the up projection is skipped (SM100/103 DeepGEMM path; the Rubin MXFP8 path is unchanged).
Context shared-expert all-reduce overlap K3_PUB_CTX_SHARED_AR_OVERLAP=1 (_MIN_TOKENS, _CHUNKS) Chunks the shared-expert all-reduce in large context steps and overlaps it with compute.

Updated for feat/k3_26.08 at e8a5275c4f (merge commit). Two features of the first revision are dropped because the base now ships an equivalent:

  • TRTLLM_MLA_TRITON_CTX_K (Triton MLA context-K kernel): the base now builds the context K with its own mla_context_k Triton kernel at every K-build site.
  • K3_PUB_GENGAP_ADMIT (host-sync-free KDA replay-slot / DFlash slot reset and batched seed on GEN admit): the base now does these resets without a host sync and has its own batched replay seed.

Test Coverage

  • The three features above are in tensorrt_llm/_torch/models/modeling_kimi_linear.py only. With every switch unset, the code path equals the base.
  • The benchmarked code is the first commit, on the previous base 45c5ae4150. The merged revision has not been re-run on GPU yet.

PR Checklist

  • All features default off; no behavior change without the switches.
  • Commits signed off (DCO).

All features are opt-in through environment variables and default off.

- DFlash disaggregated GEN admit (K3_PUB_GENGAP_ADMIT=1): admitting a
  request on a GEN server no longer stalls the host behind the running
  decode step, and batches the per-layer KDA replay-slot reset/relocate/seed
  work instead of launching many tiny kernels.
- MoE router overlap (KIMI_K3_ROUTER_OVERLAP=1): with multi-stream active,
  the router GEMM runs on the auxiliary stream concurrently with the latent
  down projection. Same kernels, same numerics.
- Routed-latent all-reduce quant (K3_PUB_AR_QUANT=1): folds the FP8 1x128
  activation quant into the MNNVL all-reduce + RMSNorm epilogue for
  decode-sized messages (K3_PUB_AR_QUANT_MAX_M).
- MLA context-K Triton kernel (TRTLLM_MLA_TRITON_CTX_K=1): fused Triton path
  for building the context K in MLA.
- Context shared-expert all-reduce overlap (K3_PUB_CTX_SHARED_AR_OVERLAP=1):
  chunks and overlaps the shared-expert all-reduce in large context steps
  (K3_PUB_CTX_SHARED_AR_OVERLAP_MIN_TOKENS, _CHUNKS).

Signed-off-by: Viraat Chandra <[email protected]>
Resolve conflicts with "Kimi K3 on Rubin: second performance preview".

- modeling_kimi_linear.py: keep the new base forward path; re-apply
  KIMI_K3_ROUTER_OVERLAP, K3_PUB_AR_QUANT and
  K3_PUB_CTX_SHARED_AR_OVERLAP on top of it, still opt-in.
- mla.py: take base. Base now builds the MLA context K with its own
  Triton kernel (mla_context_k) at every K-build site, so drop
  TRTLLM_MLA_TRITON_CTX_K, mla_ctx_k_triton.py and its test.
- mamba_cache_manager.py, dflash.py: take base. Base now resets the KDA
  replay slots and the DFlash ctx_len slots without a host sync, and
  has its own batched replay seed, so drop K3_PUB_GENGAP_ADMIT.

Signed-off-by: Viraat Chandra <[email protected]>
@viraatc viraatc changed the title [None][perf] Kimi-K3 GB300 serving optimizations (DFlash host gap, router overlap, AR quant, MLA ctx-K Triton, B15) [None][perf] Kimi-K3 GB300 serving optimizations (router overlap, routed-latent AR quant, ctx shared-expert AR overlap) Oct 29, 2026
@viraatc
viraatc marked this pull request as ready for review November 3, 2026 22:32
@viraatc
viraatc requested a review from a team as a code owner November 3, 2026 22:32
@viraatc viraatc closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant