Skip to content

[None][feat] Muse Spark Open modeling_v2 TEP target: mid-high-concurrency optimizations for GB300 - #20770

Merged
Tabrizian merged 13 commits into
NVIDIA:feat/musespark-open-agentxfrom
xwang233:mso-hc/agentx-tep
Oct 22, 2026
Merged

Tabrizian merged 13 commits into
NVIDIA:feat/musespark-open-agentxfrom
xwang233:mso-hc/agentx-tep

Conversation

@xwang233

@xwang233 xwang233 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Extends the Muse Spark Open modeling_v2 TEP target (added in c9e4756 on this branch) from the low-latency points to mid-high concurrency on GB300 (sm103) at TEP4. The changes come as 11 feature commits on top of this branch, plus 2 commits that fix unit tests failing on this branch.

The modeling_v2 target, at TEP4 on sm103. These paths are always on inside the target and selected by GPU architecture and tensor-parallel size; TEP8 and the single-request decode step are unchanged.

  • Multi-request decode steps (up to 128 requests per step):
    • decode prep with the K/V append folded in;
    • a page-split multi-request FMHA;
    • a batched dense-GEMM chain with PDL.
  • Wider collectives:
    • a router GEMM for multi-request calls;
    • a two-shot MoE all-reduce;
    • a wide post-attention hop;
    • projection gathers and publish;
    • a two-shot expert finalize.
  • Expert balance: hot expert replicas across the tray.
  • Large context steps: sequence-parallel prefill and a one-launch context pre-attention prep.
  • DFlash drafter: multi-request window attention, draft top-k exchange and a wide split verify sampler.

Shared paths: opt-in, off by default. With the variable unset, behaviour is unchanged.

  • KVCacheV2Scheduler:
    • TRTLLM_SCHED_PREFILL_DECODE_INTERVAL: admits new context requests on one pass in N while decoding;
    • TRTLLM_SCHED_SHORTEST_PREFILL_FIRST (and TRTLLM_SCHED_SPF_MAX_WAIT_PASSES): shortest uncached prefill first, with aging.
  • KV cache manager v2 host tier:
    • TRTLLM_KV_HOST_TIER_DROP_PAGE_CACHE: drops the checkpoint and drafter page cache at startup;
    • TRTLLM_KV_HOST_TIER_COLLAPSE: collapses host-tier mappings into huge pages.
  • Built-in Muse Spark Open model: MUSESPARK_OPEN_LARGE_FINALIZE_SPARSE turns on a sparse-slot expert finalize for large batches.

Measured gains of the shared-path opt-ins. Muse Spark Open on GB300 at TEP4, AgentX traces. x = p10 per-user output throughput, y = total throughput per GPU.

  • Prefill-decode interval + shortest-prefill-first (KVCacheV2Scheduler), measured together on a 256k-token AgentX trace with a running-batch cap, one-hour runs:
    • c32: x +11.0 %, y −1.2 %, TTFT p90 +1.3 s;
    • c16: x +13.1 %, y −1.4 %, TTFT p90 +1.4 s.
    • On the 1M-token AgentX trace, the interval raises x by about 10 % at c48 and 17 % at c32 in the steady-state window.
    • The share of shortest-prefill-first on its own is unclear.
  • Host-tier page-cache drop + huge-page collapse (KV cache manager v2): the end-to-end gain is unclear. x and y move by about 1 % or less, within run-to-run variation. What it does remove is a startup stall that slows 1.4–5 % of requests by 3–14 % at the median.
  • Sparse-slot expert finalize (built-in model): prefill steps are 10.4 ms (4.4 %) faster on 8k-token chunks and 4–5 ms faster on 3–6k-token chunks; decode steps are unchanged. The end-to-end gain is unclear (about 1 % or less).

Unit-test fixes for this branch.

  • The target's op entries drop their CELLS lists. No op-level test drives them, so they certified nothing and failed test_modeling_v2_claims.py::test_every_entry_with_cells_has_a_test_that_drives_them.
  • api_stability: musespark is added to the serve CLI reference choices of --reasoning_parser and --tool_parser. This is the same change as [None][test] Add musespark parsers to the trtllm-serve CLI stability reference #20761; the two merge cleanly in either order.
  • chat_tokenization: the model type is no longer resolved for rendering. The renderer does not read it, and resolving it loaded the checkpoint config even with the Harmony adapter disabled (test_router.py::test_gpt_oss_router_respects_disable_harmony_adapter).
  • test_kv_cache_v2_scheduler.py: the connector mock gets capacity_only=False, as on main.
  • test_ragged_spec_sampler.py: the spec metadata stub gets rng_accept_slot.

Tests. In line with c9e4756, the modeling_v2 target is covered by the e2e accuracy test rather than unit tests. The shared-path changes have unit tests.

Test Coverage

  • accuracy/modeling_v2/test_musespark_open.py::TestModelingV2MuseSparkOpenNvfp4Tep4::test_dflash2_gsm8k_and_acceptance (on this branch, l0_gb300_multi_gpus.yml): GSM8K and mean acceptance length under modeling_v2="require" at TEP4.
  • Unit tests:
    • tests/unittest/_torch/executor/kv_cache/test_kv_cache_v2_scheduler.py;
    • tests/unittest/_torch/executor/kv_cache/test_host_tier_memory.py;
    • tests/unittest/_torch/modeling/test_musespark_open_finalize_dispatch.py;
    • tests/unittest/_torch/modeling/test_musespark_open_moe_finalize.py.
  • AgentX end to end on GB300: the 7 kept TEP4/TEP8 points were re-run from an image built from this code, with no code overlay.

PR Checklist

  • 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

…hortest-prefill-first context admission

Add two context admission policies to KVCacheV2Scheduler for decode-heavy
aggregated serving. Both are off by default; with neither set, scheduling is
unchanged.

- TRTLLM_SCHED_PREFILL_DECODE_INTERVAL=N admits new context requests on at
  most one scheduling pass in N while generation requests are running, so a
  stream of long prefills does not stall every decode step. An admission the
  executor did not run is withdrawn and retried on the next pass, and every
  context request keeps aging while it waits.
- TRTLLM_SCHED_SHORTEST_PREFILL_FIRST=1 tries pending first-chunk context
  requests in order of their uncached prompt length. A request that has waited
  TRTLLM_SCHED_SPF_MAX_WAIT_PASSES passes (default 128) without context tokens
  goes first, and prefills that have already started are protected from
  preemption by a later first chunk.

The interval is not meant to be combined with batch_wait.

Signed-off-by: Xiao Wang <[email protected]>
…d huge-page collapse at startup

The host tier is anonymous memory advised for transparent huge pages. Where
its huge-page faults fall back to base pages, the kernel later collapses and
migrates those ranges while the server runs, and whatever touches them waits.
Two opt-in helpers move that work to startup. Both are off by default, need no
privileges, and log and ignore failures.

- TRTLLM_KV_HOST_TIER_DROP_PAGE_CACHE=1: before the KV cache managers are
  built, drop this node's page cache of the checkpoint and draft-model files
  (posix_fadvise DONTNEED), so the host tier is allocated from memory the
  cache no longer holds.
- TRTLLM_KV_HOST_TIER_COLLAPSE=1: after KV cache manager v2 has created its
  host tier, collapse the new mappings into huge pages (madvise MADV_COLLAPSE).

Signed-off-by: Xiao Wang <[email protected]>
…arge batches

MUSESPARK_OPEN_LARGE_FINALIZE_SPARSE=1 (default off) finalizes MoE batches of
160 tokens or more with a kernel that visits only the expert slots local to
the rank, instead of the whole top-k tile of every token. Above one wave of
programs the tile kernel's working set dominates; the sparse kernel loads and
normalizes only the local rows. The result is rounding-different from the
tile kernel (slot-order sum), within the documented tolerance.

Signed-off-by: Xiao Wang <[email protected]>
…p and PDL norm-gate at sm103 TEP4

- multi_request_prep_append: one kernel that applies the QK norm and RoPE to
  every row of a multi-request decode step and appends its keys and values to
  the paged FP8 cache, replacing the built-in preprocess on those steps. It can
  also issue the o_proj weight's L2 prefetch.
- preattn_prep launches a 16-row program per head above 512 rows and serves
  context steps.
- rmsnorm_gate_pdl: the attention norm-gate as a PDL-launched Triton kernel so
  the output projection can launch behind it; norm_gate gains the matching
  entry points.

Signed-off-by: Xiao Wang <[email protected]>
…ecode attention at sm103 TEP4

- multi_request_split_kv: a CuTe DSL decode FMHA for steps of two or more
  requests on the full-attention layers. It takes the served E4M3 Q and the
  device FMHA scales, splits each request's KV over CTAs by its length, and
  combines the partials with a chunk and warp count that follow the batch
  size. Single-request steps keep the 8-row kernel.
- decode_kv_splits: an over-subscribed KV split for the built-in decode FMHA
  on steps of 9..64 requests.

Signed-off-by: Xiao Wang <[email protected]>
…n and wide projection gathers at sm103 TEP4

- batch_dense_gemms: on multi-request decode steps, the o_proj L2 prefetch
  issued from the decode prep, the PDL norm-gate up to 128 rows, and the QKV
  projection through flashinfer's TGV GEMM at the row counts where cuBLAS's
  pick does not split K.
- wide_projection_gathers: split-K QKV and pool/unpool slice GEMMs on 9..32-row
  decode steps, with the weight load issued before the dependency wait.
- dense_gemms / dense_gemm / projection_gathers: the tables and entry points
  these paths use.

Signed-off-by: Xiao Wang <[email protected]>
… projection publish and MoE all-reduce at sm103 TEP4

- post_attn_hop_wide: the post-attention all-reduce hop for 9..1024-row decode
  steps, one-shot up to 24 rows and two-shot above, refused before its
  collective build when the group cannot agree on the transport.
- projection_publish: the pool / unpool slices published from the GEMM
  epilogue on 33..448-row decode steps, with an FP4-quantizing publish; it
  refuses an uncertified cuBLAS producer or an unbuildable transport.
- wide_moe_allreduce: the MoE output all-reduce of 129..1024-row decode steps
  on the MNNVL two-shot, widening the built-in router/pool overlap on its armed
  steps.

Signed-off-by: Xiao Wang <[email protected]>
…nalize and hot expert copies at sm103 TEP4

- router_gemm: router logits of 9..512-row decode steps as a BF16x3 split-K
  CuTe GEMM with a tree sum of the split partials.
- finalize_two_shot: the fused expert finalize + two-shot all-reduce of
  72..512-row decode steps.
- hot_replicas / hot_replica_assign: per-step placement of hot NVFP4 expert
  copies from census tables of served routing, so the busiest rank touches
  fewer experts; the wide window reuses the owner window's GEMM tactics.
- early_expert_ids, moe_prologue, pool_into_route: the hooks these paths use.

Signed-off-by: Xiao Wang <[email protected]>
…context steps at sm103 TEP4

context_sequence_parallel shards context steps of 1024 rows or more (4608 or
more when eager) across the TP ranks: every row is embedded before sharding,
the NVFP4 expert input is gathered, the BF16 finalize follows the built-in
finalize's dispatch, and the MNNVL all-reduce workspace is grown before CUDA
graph capture.

Signed-off-by: Xiao Wang <[email protected]>
…fter paths at sm103 TEP4

- Drafter window attention and the split sampler for block decodes of up to
  128 requests (1024 rows), with a geometry table per row count.
- wide_draft_topk / draft_rank_topk: each rank's own top-k keys exchanged for
  draft steps from 33 rows.
- ctx_window_compact / drafter_window_compact: in-place compaction of the
  drafter's windowed context arena.
- context_kv_fork and verify_fold over the windowed drafter arena; dflash
  accept and context KV commit for multi-request steps; the head sampler
  library is named by its sources' digest.

Signed-off-by: Xiao Wang <[email protected]>
… to 128 requests on the multi-request paths

Route the sm103 TEP4 target's decode steps of 2..128 requests (up to 1024 rows)
and its large context steps through the multi-request fast paths: dispatch
arms each path on its row band, the layer and attention forwards call them,
and the composition and dispatch tests list each sm103-TEP4-only path once.
Smaller TP sizes and single-request steps keep their existing compositions.

Signed-off-by: Xiao Wang <[email protected]>
…rives

The target's entries ship without op-level tests, so their CELLS lists
certified nothing and failed the claims gate that requires every declared
cell list to be driven by a test.

Signed-off-by: Xiao Wang <[email protected]>
- api_stability: add musespark to the serve CLI reference choices of
  --reasoning_parser and --tool_parser.
- chat_tokenization: do not resolve the model type for rendering; the
  renderer does not read it, and resolving it loaded the checkpoint
  config even with the Harmony adapter disabled.
- test_kv_cache_v2_scheduler: give the connector mock capacity_only=False,
  as on main, so prepare_resources drives the connector hooks.
- test_ragged_spec_sampler: give the spec metadata stub rng_accept_slot.

Signed-off-by: Xiao Wang <[email protected]>
@xwang233 xwang233 added the api-compatible Accepted LLM API contract change that is backwards-compatible label Oct 21, 2026
@xwang233

Copy link
Copy Markdown
Collaborator Author

/bot run

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79687 [ run ] triggered by Bot. Commit: 284a2db Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #79687 [ run ] completed with state SUCCESS. Commit: 284a2db
/LLM/main/L0_MergeRequest_PR pipeline #65608 completed with status: 'FAILURE'

CI Report

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

CI Agent Failure Analysis

Link to invocation

@nvpohanh

Copy link
Copy Markdown
Collaborator

[by Claude Code] @eopXD Could you review this PR? Thanks!

@Tabrizian
Tabrizian merged commit 57e20ee into NVIDIA:feat/musespark-open-agentx Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-compatible Accepted LLM API contract change that is backwards-compatible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants