Repository navigation
[None][fix] Muse modeling_v2: half-window early expert ids on Vera Rubin, and context_kv_fork under KV cache estimation - #21364
Merged
zheyuf merged 2 commits intoOct 31, 2026
Conversation
…_v2 pool_direct_route The early-id publication loop `for half in cutlass.range_constexpr(2)` rebound the placement flag `half = self.place == PLACE_HALF`, so `_placed_expert` saw the row-half index instead of the flag. On Vera Rubin TEP4 with half_window_experts (max_batch_size <= 8), the 8-row (single-request, K=7) CUDA-graph decode steps published verify rows 0-3 with two-window expert ids: an expert the half window moves to the ring successor got an out-of-window local id, no rank computed it, and finalize dropped its term. Rename the flag to `place_half`. GB300 (no pool_into_route / early_expert_ids at TEP4) and TEP8 (PLACE_BALANCE3) never read the flag on this path and are unaffected. On VR TEP4 B8 at concurrency 1 the fix raises AL by 3.1% (720 paired requests) and makes the full plan byte-identical to the plan without early_expert_ids. Signed-off-by: Zheyu Fu <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ext is bound to a replaced KV cache manager With KV cache estimation on (TRTLLM_SKIP_KV_CACHE_ESTIMATION=0, what the AgentX plugin sets for DFlash workers), the final executor's first decode warmup step forked the context-K/V side chain while the DFlash context was still bound to the probe KV cache manager's pool. The built-in `_lazy_init_ctx_buffers` then rebinds to the real manager and the fork raised "the DFlash context arena was rebuilt while a forked side chain was writing the previous one", killing the server at startup. `ContextKvFork.plan()` now declines to fork while the unified context is bound to a manager other than the step's; the built-in rebinds on that step and the fork resumes on the next. In steady state the condition is false, so the fork is unaffected. Signed-off-by: Zheyu Fu <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
zheyuf
requested review from
Wanli-Jiang,
WeiHaocheng and
litaotju
as code owners
October 30, 2026 22:37
Collaborator
Author
|
/bot run --disable-fail-fast |
Collaborator
|
PR_Github #81768 [ run ] triggered by Bot. Commit: |
Collaborator
|
PR_Github #81768 [ run ] completed with state |
1 task done
Tabrizian
added a commit
to Tabrizian/TensorRT-LLM
that referenced
this pull request
Nov 10, 2026
…become dispatch levers Ports the MuseSpark GB300 decode kernel stack onto feat/musespark-open-agentx and replaces the environment switches it carried with dispatch levers. EVERY LEVER IS DEFAULT OFF. This is the port; it changes no behaviour until a lever is knobbed on. Proved rather than asserted: a verifier rebuilds FAST_PATHS, DEPENDS_ON and both compositions by AST and resolves them with an EMPTY environment -- the resolved path sets are identical to the base at all ten deployments (44 paths at TEP8, 54/53 at TEP4), and each lever is then shown to turn on by its own knob. WHAT IS IN. 18 of the 25 patches in the source set: staged-router-gemm, moe-expert-balance (2), decode-g1 (parts 1-5), decode-kernel-stack (3), kernel-stack-2 (parts 1-5), tep8-decode-stack-v2, and context-fmha-v2. decode-g1/6 is omitted as 100% redundant -- 51daa26 (NVIDIA#21364) is already in the base and git apply --reverse of its hunk succeeds. The rest are not kernel changes (http-keep-alive, context-kv-retire-v2, torch-memory-reserve), already upstream (serving-stats-off-loop, merged as NVIDIA#21907), not free (context-scheduler-aging buys x +7.9..9.0% with y -1.0..-1.2%), or inapplicable (router-held-placement: the GB300 e2e point is all-agg, so there is no router to configure). Substantial redundancy was found and dropped rather than re-landed: NVIDIA#21377 and NVIDIA#21580 had already built the widened TP8 finalize transport and left it pinned at TP8_MAX_TOKENS = 16, so that layer collapses to a reader that unpins it. NOT LANDED, reported rather than approximated. kernel-stack-2/4's three gathers.py hunks need a TP8 kernel table (TP8_WIDE_KERNELS / WIDE_KERNELS_BY_SM_TP) that appears in the patches only as context -- it is in no patch and no public commit. decode-kernel-stack/3's eight EARLY_LOADS hunks have no host class, because NVIDIA#21754 moved SwaBlockMultiAttention out of the sm103 tree. THREE DEFECTS THIS PORT INTRODUCED, each found by running the code after static checks passed: 1. weights._ring_buddy_row_cap called max_rows_for with two arguments against a one-argument signature, on the unconditional replicated_experts install path. Every TP8 deployment would have raised TypeError at load_weights. 2. moe_prologue declared _wide_direct: bool as a class attribute, shadowing projection_gathers' transport object (default None) through the MRO. Every 8-row decode step raised AttributeError("'bool' object has no attribute 'is_armed'") at warmup, inside attention_output_into_hop, which is served by default at TP8. 3. pool_into_route called _wide_router_shard with four arguments against five. Latent, behind a default-off lever. THIRD-PARTY LICENSING. multi_instance_context_kernel.py derives from the CUTLASS CuTe DSL Blackwell FMHA example (v4.8.0) and declares that derivation with the full BSD-3-Clause notice in-file, matching 51 existing files in this repository and the sm107 sibling added in 736cfdc. CUTLASS is already attributed in ATTRIBUTIONS-Python.md and both per-arch CPP files, so no attribution file changes. MEASURED. With every lever off the branch is indistinguishable from its base on GB300 TEP8 decode (11.67 vs 11.93 ms at bs3, 12.26 vs 12.28 at bs4), which is a correctness result -- the port does not disturb the default path -- and says nothing about what the levers are worth. Non-bitwise levers still need their acceptance, drift and step-time gates before any of them ships on by default. Signed-off-by: Iman Tabrizian <[email protected]>
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
Two fixes in the Muse Spark Open modeling_v2 TEP target, both found while validating DFlash2 acceptance length (AL) on Vera Rubin (R200, SM107) at the
feat/musespark-open-agentxtipc55183f44.1.
pool_direct_routedrops half-window experts on single-request decode steps (VR TEP4, max_batch_size <= 8)Cause. In
ops/comm/pool_direct_route.py, the early expert-id publication loopfor half in cutlass.range_constexpr(2)rebinds the placement flaghalf = self.place == PLACE_HALF._placed_expert(..., half)branches on that value while the kernel is traced, so:half = 0and uses the two-window formula;Rows 4-7 and the own-row
local_idsstore seehalf = 1and are correct only by accident.Fix. Rename the flag to
place_halfand pass it to both_placed_expertcalls.Where it fires. The bug needs all of the following:
half_window_expertsin the plan (max_batch_size <= 8), together withearly_expert_idsandpool_into_route;So it fires on every decode step at
max_batch_size1, and on one-request steps otherwise (concurrency 1, ramp-up and tail). The disagg GEN TEP4 withmax_batch_size <= 8is affected the same way.It does not fire on:
pool_into_routenorearly_expert_idsand usespool_gather_route;PLACE_BALANCE3);max_batch_size > 8(PLACE_OWNER; the differing ids are out of window either way).2.
context_kv_forkcrashes server startup when KV cache estimation is onCause. With
TRTLLM_SKIP_KV_CACHE_ESTIMATION=0(what the AgentX plugin sets for DFlash workers), the estimation pass builds a probe KV cache manager and then the real one. On the final executor's first decode warmup step, the fork's side chain launched while the DFlash context was still bound to the probe manager's pool. The built-in_lazy_init_ctx_buffersthen rebound the context, and the worker raised:Every modeling_v2 server with the DFlash drafter on unified target/draft KV (the TRTLLM drafter backend) died at startup.
Fix.
ContextKvFork.plan()returnsNonewhile the unified context is bound to a manager other than the step's. On that step the built-in path rebinds the context, and the fork resumes on the next step. In steady state the condition is false.Test Coverage
No new unit test. Fix 1 needs SM107 at TEP4 with the half-window plan, which pre-merge CI does not run. Validation was done on Vera Rubin (Hecate, 4x R200 per node) with the tip Python on a VR image whose C++ matches the tip:
Fix 2 (startup).
Fix 1, accuracy. Agg TEP4 K7, modeling_v2 require, rejection sampling, SPEED-Bench coding 80 prompts, T=1, top_p 0.95, concurrency 1, 9 x 80 paired requests:
early_expert_ids: 720/720 AL completions and 1319/1319 GSM8K completions. The tip is 0/720.AL vs the InferenceX golden (SPEED-Bench coding, c32, golden K7 = 4.05). With this PR, every K7 agg and disagg config measured gives 4.107-4.128:
The tip at max_batch_size 1 gives 4.008, with all 7 passes below golden.
Performance. Same-node A/B with alternating tip / this PR servers, forced acceptance 3.05 (AgentX throughput mode), agg TEP4. Fix 1 adds the previously dropped expert work on single-request steps, about +0.35% per such decode step:
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.🤖 Generated with Claude Code