Skip to content

[None][feat] Muse Spark Open modeling_v2 TEP target: low-latency optimizations for GB300 and Vera Rubin - #20625

Draft
xwang233 wants to merge 34 commits into
NVIDIA:feat/musespark-openfrom
xwang233:mso-ll/adapt-v2
Draft

xwang233 wants to merge 34 commits into
NVIDIA:feat/musespark-openfrom
xwang233:mso-ll/adapt-v2

Conversation

@xwang233

@xwang233 xwang233 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Adds a modeling_v2 target for Muse Spark Open 816B-A42B NVFP4 with DFlash2 speculative decoding, plus the
executor seams it needs.

  • The target serves GB300 (sm103) and Vera Rubin (sm107) at TEP8 and TEP4. It is selected only through
    modeling_v2 (off by default), and a fixed set of fast paths is chosen by GPU architecture and tensor-parallel size.
  • Inside the target, a broad set of optimizations shortens the decode and speculative-decoding step: fused and
    persistent kernels, lower-latency collectives, PDL chaining, and reduced host overhead.
  • Changes in shared paths (PyTorch executor hooks, CUDA-graph runner, DFlash worker, and the built-in Muse Spark
    Open model) are off unless explicitly opted in, so other models and the built-in path are unaffected.
  • setup.py ships the target's head-sampler CUDA sources so an installed wheel can JIT-compile them.

This branch also carries three modeling_v2 infrastructure PRs from main that the target depends on
(#20077, #19977, #20143), unchanged.

Test Coverage

  • accuracy/modeling_v2/test_musespark_open.py::TestModelingV2MuseSparkOpenNvfp4Tep4::test_dflash2_gsm8k_and_acceptance: builds the target under modeling_v2="require" at TEP4 with the DFlash2 drafter and checks GSM8K and the mean acceptance length. Run on GB300; listed in l0_gb300_multi_gpus.yml.
  • GSM8K and GPQA-Diamond on GB300 and Vera Rubin show no accuracy drop against the built-in model.

PR Checklist

  • Please check this after reviewing the above items as appropriate for this PR.

🤖 Generated with Claude Code

WeiHaocheng and others added 30 commits October 16, 2026 16:43
…rgs (NVIDIA#20077)

Signed-off-by: Fred Wei <[email protected]>
(cherry picked from commit d7882af)

Conflict resolved in tensorrt_llm/_torch/pyexecutor/model_loader.py: the
upstream import hunk also carries `from ..locality_domain.policy import
LocalityDomainPolicy`, which this branch does not have; only the
modeling_v2_resolve import was kept.

Signed-off-by: Xiao Wang <[email protected]>
…A#19977)

Signed-off-by: Fred Wei <[email protected]>
Co-authored-by: Claude Fable 5.1 <[email protected]>
(cherry picked from commit 92ba55a)

Conflicts resolved (modify/delete) by taking the upstream deletion of
tests/unittest/_torch/modeling_v2/moe/test_modeling_v2_noaux_tc_op.py and
tests/unittest/_torch/modeling_v2/quantization/test_modeling_v2_{fp4,mxfp8}_quantize.py;
the "modify" side is upstream 16df7ea (NVIDIA#19727, not on this branch), which
added a 3-line CUDA-usability assert to each. The tests live on at their new
per-target paths added by this commit.

Signed-off-by: Xiao Wang <[email protected]>
…-Flash-Next-NVFP4 (NVIDIA#20143)

Signed-off-by: Wanli Jiang <[email protected]>
(cherry picked from commit 7dc9012)

Conflict resolved in tests/integration/defs/.test_durations (the file diverged
wholesale between this branch and upstream): kept this branch's version and
applied only the upstream change, i.e. renamed the four
accuracy/test_modeling_v2_{deepseek_v3,gpt_oss}.py keys to
accuracy/modeling_v2/test_{deepseek_v3,gpt_oss}.py in place.

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

Route MuseSparkOpenOmniForCausalLM in modeling_v2 and add the target
models/musespark_open/muse_spark_open_816b_a42b_nvfp4__sm_103__tep8.

Router index: one router line. The checkpoint publishes
MuseSparkForConditionalGeneration (model_type muse_spark); the config
loader's open-format branch writes MuseSparkOpenOmniForCausalLM in its
place, so that is the key. With modeling_v2 off, the default, the
resolver returns before reading the table.

routing.route() claims one deployment and raises NoTarget with the facts
otherwise: sm_103; the Muse-Spark-Open-816B-A42B flat-config shape (62
layers, hidden 8192, 128/16 heads of width 64, 256 experts top-8 at
expert width 4096, vocab 202048, 2048-token sliding window, a NoPE
full-attention layer every fourth layer); tep8 (8 ranks of
tensor-parallel attention and expert-parallel MoE, no attention DP, pp1,
cp1); and DFlash at max_draft_len 1..7 or no speculation. Quantization
is not a criterion: the open-format translation drops the inline
quantization_config and route() sees only the pretrained config.

The target runs the built-in modules, so its kernels are the built-in
implementation's:
- modeling.py: the shell subclasses the built-in
  MuseSparkOpenOmniForConditionalGeneration, so the module tree, the
  weights, the class-level engine preferences and the DFlash draft path
  are the built-in model's. Its core MuseSparkOpenTep8ModelingV2 adopts
  the built-in text model in place (once; the built-in constructor's
  re-entry guard is honoured) and selects PrefillTarget or DecodeTarget
  per step on num_contexts. PrefillTarget runs the built-in text-model
  forward; DecodeTarget writes out the built-in forward's decode path
  over the built-in modules (without the prefill sequence-parallel
  split, which needs context rows), as the place where decode ops are
  later swapped in.
- weights.py: loads through the built-in loader.

Tests (host-only, cpu_only, listed in l0_cpu.yml): routing (the claimed
deployment with and without DFlash 1..7, the published open-format
config.json through load_pretrained_config, the inherited class
contracts, 20 foreign deployments each declining under auto and raising
under require with the fact named, a config without the flat fields);
core and targets (adopt, per-step selection, prefill reaches the
built-in forward and decode does not, decode equals the built-in
forward's layer calls and output on CPU stand-ins over 24 cases, the
forwards' parameters, the shell's single adoption and its loader);
isolation (only the router line references the family).

Signed-off-by: Xiao Wang <[email protected]>
…dowed DFlash context arena

Add tensorrt_llm/_torch/pyexecutor/runtime_hooks.py. A model may declare
`runtime_hooks` (a RuntimeHooks instance); `runtime_hooks_of(model)`
returns it, or the all-off DEFAULT_RUNTIME_HOOKS when the model declares
none. Every hook is off by default, and every engine call site runs its
original statement when the hook is off or declines, so models that
declare nothing see no change.

Two hooks are defined:
- step_input_stager: a StepInputStagerSource that may open a
  StepInputStager window for a decode step. While the window is open, the
  decoder runner, the TRTLLM attention metadata and the speculative
  metadata route their host-to-device input writes (token and position
  ids, KV lengths, prompt lengths, block offsets and the overlap
  scheduler's previous-step outputs) through the stager, which records
  them and issues them as one launch at `end`. A stager that declines a
  write issues what it recorded and declines the rest of the window, so
  the preparation continues natively in its original order. When the
  stager also wrote the CUDA graph's static inputs, the graph runner skips
  its own copy of input ids and position ids for that replay.
- sampler_store_writer: a SamplerStoreWriter that the speculative sampler
  uses to store a step's outputs and copy the store to the host in one
  launch. instantiate_sampler binds it once when the model declares it;
  when it returns None the sampler stores and copies as before.

DFlash gains an opt-in windowed dense (VANILLA) context arena
(TRTLLM_DFLASH_WINDOWED_CTX_ARENA=1). When every draft layer applies a
finite sliding window, read from the drafter config, the arena keeps only
the window plus one step of accepted tokens per slot instead of
max_seq_len tokens. Unset, the arena is unchanged.

Tests: tests/unittest/_torch/executor/test_runtime_hooks.py covers the
default, the declaration forms and each engine call site with the hook
off, accepting and declining; test_dflash_windowed_ctx_arena.py covers
the window lookup and the arena bound.

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

Replace the tep8 scaffold target with
models/musespark_open/muse_spark_open_816b_a42b_nvfp4__sm_103__tep, which
serves Muse-Spark-Open-816B-A42B NVFP4 on sm_103 with attention
tensor-parallel and the experts expert-parallel over the same ranks
(TEP), at any tensor-parallel size of that layout.

Routing (routing.py) reads three facts: the GPU (sm_103), the model shape
from the flat config, and the parallel layout (TEP: no attention DP, pp1,
cp1). It no longer reads the speculative-decoding config or the GPUs per
node; which fast paths a deployment runs is the target's decision at
construction.

The target (modeling.py) still subclasses the built-in model and adopts
its text model, with PrefillTarget running the built-in forward and
DecodeTarget writing out the decode path over the built-in modules.
dispatch.compose decides the fast paths once, when the model is built:
TARGET_PATHS names a fixed composition per tensor-parallel size together
with the GPU topology it is written for (all fast paths at TP8 on two
4-GPU trays; the subset whose output is bitwise the built-in model's at
TP4 on one tray), for DFlash with seven draft tokens on an NVFP4
checkpoint. A deployment without a composition runs the built-in modules
through the target, and under modeling_v2="require" it is an error. A
missing public precondition of a planned fast path is an error in every
mode; there are no per-path switches. Over a windowed drafter context
arena the paths written for a full-length arena are left out.

Each fast path's host code is a package under kernels/<path>/ (attention
prep and split-KV decode, sliding-window paged decode, post-attention
all-reduce hop, MoE prologue and persistent/replicated experts, sharded
projections, dense GEMMs, embedding, sampler and drafter paths) and its
op entries are under ops/<category>/. layers.py composes them into the
built-in decoder layers, drafter.py and spec_worker.py carry the DFlash
draft and verify paths, and runtime.py builds the RuntimeHooks the model
declares under a composition (step-input staging and the sampler store
writer). The head sampler's CUDA sources under ops/spec/_head_sampler are
compiled at first use with torch.utils.cpp_extension.

modeling_v2 core: _router_index records the mode each target class was
resolved under and exports resolved_mode(), which a target reads at
construction; the README lists the targets.

Signed-off-by: Xiao Wang <[email protected]>
Move the target tests to
tests/unittest/_torch/modeling_v2/models/musespark_open/muse_spark_open_816b_a42b_nvfp4__sm_103__tep
and add tests for what the target now contains:
- routing over GPU, model shape and parallel layout, with and without
  speculative decoding, and the isolation test on the renamed target;
- dispatch and composition: the per-TP compositions, their topology and
  preconditions, plan agreement across the TP group, and the composed
  decoder layers, attention and decode forward against the built-in
  modules;
- each fast path's installer and op entries under kernels/ and ops/
  (attention, all-reduce, communication, embedding, GEMM, MoE, runtime and
  speculative-decoding ops), the drafter worker and spec worker, and the
  runtime hooks the target declares;
- launch-schedule and SASS audits of the decode step.

GPU tests skip on hosts without the required GPUs. The 4-rank
post-attention all-reduce hop test is added to l0_gb300_multi_gpus.yml.
The modeling_v2 stale-claim audit now also rejects calendar dates and
absolute machine paths, and scans the CUDA sources a target compiles.

Signed-off-by: Xiao Wang <[email protected]>
setup.py ships the .cu, .cuh and .h sources under the musespark_open TEP
target's ops/spec/_head_sampler as package data, so an installed wheel can
compile the head sampler at first use with torch.utils.cpp_extension.

Signed-off-by: Xiao Wang <[email protected]>
…low the attention module and long kernel symbols

The paged decode attention entry point lives in the target's attention module,
the persistent-experts compose test loads the decode-forward harness from its
new directory, and the schedule audit maps kernel symbols that the DSL shortens.

Signed-off-by: Xiao Wang <[email protected]>
…th per-(SM, TP) compositions

Serve the musespark_open modeling_v2 target on Vera Rubin (sm107) as well as
sm103, with each GPU architecture getting its own fast-path compositions.

Compositions and routing:
- routing accepts compute capability (10, 7) as well as (10, 3).
- TARGET_PATHS is keyed by (SM, tensor-parallel size) (dispatch.CompositionKey)
  instead of the tensor-parallel size alone, so an architecture can serve a
  different set of fast paths without changing another's. (103, 8) keeps every
  fast path; (107, 8) serves every fast path but attention_output_into_hop,
  whose producer check names only the sm103 o_proj kernel; (103, 4) and
  (107, 4) serve the bitwise TEP4 set.
- The shell reads the device's compute capability once at construction and
  passes it to require_served / compose, as the router passes it to route. An
  architecture without an entry has no composition: the built-in forward under
  modeling_v2="auto", an error naming the architecture under "require". The
  compose log line and the unserved reason name the SM.
- Topology descriptions say "node of 4 in one NVLink domain" instead of naming
  one product; the Topology objects and their check are unchanged.

Built-in fused kernels on sm107 (public path, opt-in):
- Five built-in gates accepted only (10, 3): the BF16x3 router, the fused
  finalize all-reduce workspace (TP4 IPC and TP8 fabric), the sharded
  pool/unpool projections, FinalizeIpcWorkspace._prepare and the cluster
  residual boundary. They now go through one per-arch helper,
  fused_kernels_supported(capability): sm103 yes, sm107 only with
  MUSESPARK_OPEN_SM107_FUSED_KERNELS=1, any other GPU no. It is an opt-in
  rather than a widening because two of these kernels are on by default on
  sm103, so widening them would change the built-in model's default
  arithmetic on sm107. Default behaviour on every GPU is unchanged.
- The sm107 compositions take the opt-in as a composition precondition
  (dispatch.SM107_FUSED_KERNELS): their paths build on these kernels and their
  bitwise paths reproduce the boundary's arithmetic, so an sm107 deployment
  without it fails compose naming the switch.

Arch gates:
- The fused hop, direct hop, drafter hop, finalize transport, direct
  pool/unpool workspaces, head gather and the full-attention split-KV /
  prep-fold kernels accept (10, 3) or (10, 7), and their refusal messages say
  so instead of "SM103 only".
- The head sampler extension is built for the device's arch-specific target
  (sm_103a or sm_107a) instead of a fixed sm_103a.
- pool_gather_fp4quant / pool_gather_route pass flashinfer's
  RMSNormFP4QuantKernel the device's SM number, read once when the kernel
  object is built, instead of a fixed 103. flashinfer uses it only to choose
  the cluster size, so the geometry the subclasses assert is unchanged.
- catalog: add Arch.SM_107. No op's ARCHS names it; certification comes from
  running each op's cells on an sm107 device.

Tests: the dispatch tests cover the (SM, TP) keys, the shell's single
capability read and the opt-in precondition; GPU tests gated on sm103 also
run on sm107, and their skip reasons no longer name a single GPU model.

Signed-off-by: Xiao Wang <[email protected]>
…attention_output_into_hop on sm107 TEP8

Give the kernels whose configuration was chosen on sm103 a table per device
compute capability, each read once from the device, and serve
attention_output_into_hop in the (107, 8) composition.

- dense_gemms: a kernel table per compute capability. sm103 keeps its table;
  sm107 gets one measured there the same way: the direct kernel at two or
  four outputs per CTA for QKV and the unpooler slice at small row counts,
  and flashinfer's split-K for the attention output projection where it is
  faster than cuBLAS there. The pooler keeps the sm103 cells. install records
  the capability on the plan, so producer policies can key on it; a device
  without a table is refused at install.
- drafter_fixed_gemms: SPLITK_TACTICS stays the sm103 table and
  SM107_SPLITK_TACTICS lists the same shapes with tactics chosen on sm107;
  tactic_for reads the device's table once.
- persistent_experts: OPTIONS stays the sm103 configuration and OPTIONS_BY_SM
  lists what each compute capability changes; sm107 runs eight weight-pipeline
  stages, bit-identical to six. Other devices are refused.
- attention_output_into_hop: the direct transport's validated producers and
  the o_proj kernel families that store straight into the slot are per
  compute capability. sm103 keeps cuBLAS's 8-row o_proj kernel; sm107 takes
  flashinfer's split-K and direct kernels, which the dense GEMM plan names for
  o_proj there. _build_direct_publish keys on the plan's capability, and
  verify_direct_publish warms the plan's own kernel so a flashinfer kernel
  compiles outside the producer-check capture.
- With those producers, the (107, 8) composition serves every fast path.

Tests: per-arch dense GEMM plans and tactic bands, the direct-publish producer
families on both archs, the sm107 TEP8 composition and shell including
attention_output_into_hop, and the split-KV long-context over-budget seed
list kept per compute capability (the split count follows the SM count).

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

Several fast paths declined any decode step larger than one request's K=7
verify block, so a server running more than one request fell back to the
built-in ops. Raise their row caps to what their kernels already support,
bitwise against the built-in ops:

- preattn_prep: up to 512 rows (64 requests at K=7). Every (row, head)
  program is independent and reads its own row and position, so a step of
  several requests is rows with their own positions. The swa_block and
  full_attention_prep_append mixins keep their own one-sequence, 8-row limits
  and above them decline to the prep followed by the built-in attention.
- split_sampler: up to 128 rows, the shipped fused sampler's single-CTA
  1024-thread range, which the two kernels reproduce; above that the shipped
  sampler switches block size, so the cap stops there. The lm_head_inbox slot
  keeps 8 rows (INBOX_ROWS), TargetHead owns a 128-row states scratch in both
  modes, and the library name carries the device arch (sm103a / sm107a) so
  builds for two archs never overwrite each other in one build root.
- sampler_store: up to 512 store slots. SampleStoreWriter.record_store builds
  its descriptor table a column at a time with numpy instead of a per-slot
  Python loop (StepStaging.extend), reuses the per-store descriptor layout
  across steps and the previous table for a steady slot list, checks the
  store tensors only when they change, and reuses one event per host-ring
  turn. The descriptors are the per-slot loop's, so the bits are unchanged.
- replicated_embedding: calls of up to 576 ids (a 64-request K=7 step plus one
  row per request for the drafter). The gather kernel is batch-agnostic, and
  the sharded partials are one owner row plus zero rows, so the bits stay the
  sharded path's.

Tests: new cells at the raised row counts compared bit for bit (or token for
token and state word for state word for the sampler) with the built-in ops,
routing tests one row above each cap, a descriptor-equivalence test for the
sample store, and the head-sampler poller built for the device arch.

Signed-off-by: Xiao Wang <[email protected]>
…code over a windowed context arena

drafter_block_decode was listed among the fast paths that address the
drafter's context arena by absolute column, so a windowed arena dropped it
and, through depends_on, drafter_hops and drafter_pdl_chain. The written-out
block decode reads only the physical length the built-in prepare hands it
and appends and attends relative to it, so it composes over either arena.
FULL_CONTEXT_ARENA_PATHS now holds only context_kv_fork and verify_fold; at
TEP8 a windowed plan keeps the block decode, the drafter hops and the
drafter PDL chain.

New GPU test on the published DFlash 2 drafter: the block decode over the
DFlash worker's windowed context arena (the built-in compaction run between
steps) is bitwise the same decode over a full-length arena fed the same
tokens, for a request that crosses the window and one that starts past it,
over steps of full, partial and single acceptances, eagerly and under
CUDA-graph replay.

Signed-off-by: Xiao Wang <[email protected]>
… load before the inbox allocation

HeadGatherWorkspace loaded the head sampler library and allocated the
multicast inbox in one try block with a single agreement at the end. The
allocation is itself a collective, so a rank whose load failed skipped it
and waited in the agreement while its peers waited in the allocation, and
the group hung. The load now has its own agreement before the allocation,
so a failed load raises on every rank.

Signed-off-by: Xiao Wang <[email protected]>
…okens in 128-token calls

FinalizeIpcWorkspace.finalize_chunked serves any token count as consecutive
calls of the existing fused finalize + all-reduce kernel, at most 128 tokens
each, written into one output. A token's result depends only on its own
slots, so every row is bitwise what a single call over its chunk returns.
All chunks are validated before the first launch.

The new opt-in MUSESPARK_OPEN_FUSED_FINALIZE_AR_CHUNKED (default off) lets the
MoE use it for batches of 129..512 tokens, i.e. decode steps of up to 64
requests at eight rows each; larger batches keep the unfused finalize and the
NCCL all-reduce. A workspace wrapper without finalize_chunked leaves such
batches on the unfused path. With the switch off nothing changes.

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

MUSESPARK_OPEN_LARGE_NORM_GATE (default off) now serves every batch above
128 tokens with the CuTe DSL rmsnorm_gate kernel, which is bitwise the
unfused per-head RMSNorm and sigmoid gate at any token count, instead of only
batches of 512 tokens or more. Batches of 129..511 tokens (decode steps of 17
to 63 requests at eight rows each) previously had no fused arm. At up to 128
tokens and with the switch off nothing changes.

Signed-off-by: Xiao Wang <[email protected]>
…with an NCCL all-gather

The sharded drafter fc takes its width from the mapping (FC_SHARD_WORLDS =
(4, 8)) instead of a fixed eight. TP8 keeps the fabric projection gather and
its 8-row bound. TP4 shards fc 4-way (2048 output rows per rank) and joins
the slices with the built-in NCCL all-gather along the columns, which takes
any row count, so batched decode steps and prefill chunks are sharded too.
ShardedFc records the width and the row bound (None for any).

Tests: TP4 cells of the one-GPU stand-in gather at 8..2048 rows, the install
fields at TP4 and TP8, and a four-rank test of the real all-gather at
1..8192 rows, eager and under CUDA-graph replay, against the built-in
projection within the existing GEMM band and bitwise against the gathered
slices.

Signed-off-by: Xiao Wang <[email protected]>
…n the TEP4 compositions

Both TP4 compositions, (103, 4) and (107, 4), now include drafter_fc_shard.
Its sharded projection can move a draft token in the last bf16 place; the
target model verifies every draft.

Signed-off-by: Xiao Wang <[email protected]>
… tests on SM107 when opted in

The finalize all-reduce parity, stress and lifecycle tests and the BF16x3
router test skipped every device but SM103. They now run wherever the
built-in model would use those kernels: SM103, or SM107 with
MUSESPARK_OPEN_SM107_FUSED_KERNELS=1 (fused_kernels_supported).

Signed-off-by: Xiao Wang <[email protected]>
…9..512 tokens

prepare_moe_inputs runs the router (and its routing) on the main stream and
the pool projection with the pre-expert quantization on the auxiliary stream
for batches of up to 128 tokens. The new opt-in
MUSESPARK_OPEN_LARGE_PREPARE_OVERLAP (default off) extends that to 512 tokens,
i.e. decode steps of up to 64 requests at eight rows each. The same kernels
run on the same inputs, so the outputs are bitwise the serial ones. With the
switch off nothing changes.

Signed-off-by: Xiao Wang <[email protected]>
…al messages and a test line to the line limit

Signed-off-by: Xiao Wang <[email protected]>
…A for decode on sm107

The attention fast paths (swa_paged_decode, swa_block, full_attention_prep_append,
full_attention_split_kv, full_attention_prep_fold) look up flashinfer's trtllm-gen FMHA
library in each layer's FMHA manager: the sliding-window paths take its KV-pool page bound,
and the full-attention paths intercept its decode call. The public library list admits
that library on SM100/SM103 only, so on sm107 every path composed but declined on every
decode step and all layers served the built-in attention.

At install time the core now reads the architecture the composition was decided for and,
on sm107, puts a DecodeTrtllmGenFmha in front of every target layer's FMHA libraries. It
offers the generation phase only and defers to the library's own request checks, so
generation-only steps select it, while prefill and mixed steps keep the public selection
(the thop attention) as before. sm103 is unchanged: its public list already holds the
library. The public availability gate is unchanged, and the drafter's attention keeps the
public selection. The two library lookups now accept the subclass.

Tests: a host-only test of the per-arch selection, the generation-only offer through the
manager's selection, the lookups and the core's call per plan; an 8-rank GPU test that the
composed attention paths serve decode steps (kernels counted, no library decline, fold
census). The decode-forward harness adopts for the device's architecture like the shell.

Signed-off-by: Xiao Wang <[email protected]>
…all-site attention with the decode FMHA selection

The call-site test adopts one built-in attention directly, without the core, so on
sm107 its FMHA manager held no trtllm-gen library and the decode step declined to the
built-in attention. It now applies the per-arch decode FMHA selection the core makes
for the device.

Signed-off-by: Xiao Wang <[email protected]>
… its row cap in the decode-forward harness

The harness expected preattn_prep to stand down above 8 rows, but its cap is
_PREATTN_PREP_MAX_ROWS, so every arm with it failed its call count at 9 and 16 rows.
The widest width now reads the cap.

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

The full-attention split-KV CuTe kernel and its prep fold serve a tep4 rank
(32 query / 4 KV heads) as two pairs of KV heads on grid y; each CTA computes
the tep8 build's tile on its pair's slice of the operand, the pool and the
partials. The tep4 build stages 512 page ids per CTA (two passes) for SMs / 2
splits per pair. The install picks the build per rank shape (tep8, tep4, else
refused); combine_norm_gate and the fold's widths and gate view follow the
rank's head counts. The tep8 build, its keys and its bits are unchanged.

The (103, 4) composition gains swa_paged_decode, swa_block,
full_attention_split_kv, full_attention_prep_fold and drafter_block_decode.

Tests: the split-KV and prep-fold cells at the tep4 rank shape, the
sliding-window decode entries and the drafter window attention cells at a
tep4 rank, and the (103, 4) composition.

Signed-off-by: Xiao Wang <[email protected]>
…sm103 TEP4 owner-only window

persistent_experts and bf16_routed_experts no longer need replicated_experts:
without it, ring_buddy.install(windows=1) runs the stacked calls over the
rank's own expert block (64 experts at TP4) with owner-only ids, replicating
nothing. ring_buddy_assign takes the ring size (8 ranks of 32-expert blocks,
or 4 ranks of 64-expert blocks with 64-bit presence words), and ring_buddy
derives it from the mapping. A third window is refused at TP4.

The next_qkv_prefetch hook moves from the ring-buddy stacked forward to an
outermost experts-forward wrapper, so it no longer depends on
replicated_experts.

The (103, 4) composition gains persistent_experts and bf16_routed_experts.

Signed-off-by: Xiao Wang <[email protected]>
… drafter hops, PDL chain and LM-head inbox at sm103 TEP4

Measured sm103 TP4 tables for dense_gemms (sharded and replicated
pooler/unpooler) and drafter_fixed_gemms. Both tables are keyed by
(compute capability, TP size): dense_gemms.kernel_steps and
fixed_low_m_gemm.splitk_tactics look the pair up and refuse a pair without
a measured table. The drafter's fixed-tactic call sites default to the
device's TP8 table, so an sm107 drafter keeps its own tactics.

The drafter hops request the MNNVL one-shot all-reduce by name on one tray,
the PDL chain runs on the TP4 fixed-GEMM tactics, and the LM-head inbox is
validated for 4 and 8 ranks.

The (103, 4) composition gains dense_gemms, drafter_fixed_gemms,
drafter_hops, drafter_pdl_chain and lm_head_inbox. Under a windowed drafter
arena the drafter hops and the PDL chain stay, with the drafter block
decode, as at TEP8.

Tests: the TP4 kernel tables and their install, the TP4 tactic table and
its install (sm103 only), the drafter hops at four ranks, the inbox at four
ranks, and the drafter worker install tests on a TP8 mapping.

Signed-off-by: Xiao Wang <[email protected]>
…prologue and finalize transport at sm103 TEP4

Generalize the sharded-projection and communication fast paths over the
tensor-parallel size: the projection inbox, the pool/unpool gathers (two
vectors of each of the four ranks' slices per thread at TP4), the router
shard and routed gather (64-expert blocks at EP4, block loops unrolled at
compile time), and the finalize transport on the single-tray IPC workspace,
where it adds a slot's warp sums flat in the built-in TP4 kernel's order.

Built-in model (public path, behind the existing opt-in): with
MUSESPARK_OPEN_SHARDED_PROJECTIONS=1 the pool/unpool projections are also
column-sharded at single-node TP4/EP4. With the switch off nothing changes.

The (103, 4) composition gains projection_gathers, boundary_early_release,
capture_fold, moe_prologue and finalize_transport.

Tests: the gathers, the MoE prologue and the finalize transport at four
ranks on one tray as well as eight over two; the router shard
microbenchmark per EP size; the unpool direct negative control at TP8 and,
with the late consumer alone, on one tray; the TP4 host placement
reference after the captured chain; and the TP8 stand-ins carry the TP size
the gathers and the unpool boundary now read off the mapping.

Signed-off-by: Xiao Wang <[email protected]>
…sized router shard and the preattn_prep row cap

- test_modeling_v2_pool_direct_route reads the TP8 expert count from
  pool_direct_route (LOCAL_EXPERTS) now that router_shard sizes its shard per
  expert-parallel size (local_experts(ranks)).
- The schedule harness expects preattn_prep up to its own row cap
  (_PREATTN_PREP_MAX_ROWS), as the decode-forward harness does, now that it
  serves decode steps of several requests.

Signed-off-by: Xiao Wang <[email protected]>
… prefetch drops of the served QKV kernel table

The decode-forward and schedule harnesses derived the rows at which
early_release drops the next-QKV prefetch, and at which qkv_prefetch forks,
from the default (sm103) dense-GEMM kernel table. dense_gemms.install serves
the table of the device's compute capability, and on sm107 QKV runs the
direct kernel at 3 rows, so no prefetch is dropped there and the harness
expected 5 l2_prefetch launches per forward too few. Both harnesses now read
the QKV kernels from the device's table.

Signed-off-by: Xiao Wang <[email protected]>
@yuxianq

yuxianq commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

@yihwang-nv, could you help to review this PR as trt-llm-torch-attention-devs? Thanks~

Assignment explanation
Componentsmodules/attention (25%); fmha/orchestration (20%); modules/qk-rope-gating (8%); modules/mla (10%); runtime/kv-cache/layout-io (8%); backends/trtllm (5%); runtime/parallelism (5%); integration/attention-tests (7%); unmapped (12%)
Tagsalgorithm:dense (100%); representation:mla (50%); representation:gqa (30%); representation:mha (10%); representation:mqa (10%); phase:decode (85%); phase:prefill (15%); features:paged-kv (25%); features:speculative-decoding (25%); features:qk-norm (20%); features:rope (15%); features:quantization (15%); context:llm (100%)
PR effort13 points — Visible additions optimize an existing built-in model, supporting feature classification. Coupled full/windowed attention fusion, split-KV reduction, drafter KV/collective scheduling, and metadata staging warrant the 13-point architecture anchor. Unrelated MoE/sampler volume and catalog relocation do not drive the score.
ImportanceImportant — The added full_attention_prep_fold integration describes moving normalization/cache preparation into split-KV decode, full_attention_split_kv merges partials in the norm-gate, and attention_forward temporarily replaces FMHA globals. These are sensitive attention numerical, cache-write, and execution-order contracts.
Retained GitHub review requestslitaotju: preserve direct code-owner review request; yuxianq: preserve direct code-owner review request; schetlur-nv: preserve other-group coverage: NVIDIA/trt-llm-multi-gpu-ci-review, NVIDIA/trt-llm-oss-compliance, NVIDIA/trt-llm-runtime-devs, NVIDIA/trt-llm-devs, NVIDIA/trt-llm-models-devs, NVIDIA/trt-llm-noncommitted-api-review-committee, NVIDIA/trt-llm-disagg-devs, NVIDIA/trt-llm-qa-function, NVIDIA/trt-llm-usage-telemetry-devs
Affinity (0–1)0.413 component/tag match; 0.310 after PIC preference
Outstanding points at selection41 → 54 (+13)
Points already reserved on this PR0
Effective weight1
Completed review points (preceding 168 hours)23
Combined points after assignment77
Demand-derived target64.00 points (soft share)
Additional fair share before assignment0.00 points
Share explanationWhole PR / qualification or coverage constraint exceeds a soft share; assignment is allowed.
Selection ruleaffinity with 0.3-share guard
Assignment scope (yihwang-nv)all

Affinity and workload are snapshots at selection, not live counters. Existing reservations on this PR are counted once.

@yuxianq
yuxianq requested a review from yihwang-nv October 19, 2026 20:20
…nd with GSM8K and acceptance length

Replace the target's unit and module tests with one whole-model accuracy
test. TestModelingV2MuseSparkOpenNvfp4Tep4 builds the target under
modeling_v2="require" at TEP4 with the DFlash2 drafter and seven draft
tokens, and checks GSM8K against the model's DFlash floor and the mean
acceptance length.

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

This branch has not been deployed

No deployments
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.

4 participants