Skip to content

[None][feat] Run the Muse modeling_v2 composition with a TRTLLM DFlash drafter - #20812

Merged
zheyuf merged 6 commits into
NVIDIA:feat/musespark-open-agentxfrom
zheyuf:musespark-open/mv2-trtllm-drafter
Oct 28, 2026
Merged

zheyuf merged 6 commits into
NVIDIA:feat/musespark-open-agentxfrom
zheyuf:musespark-open/mv2-trtllm-drafter

Conversation

@zheyuf

@zheyuf zheyuf commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

@coderabbitai summary

Description

In disaggregated serving the generation worker's drafter needs the prompt's draft KV. Since #20806 it is transferred with the target's KV, but only for a TRTLLM drafter, whose context lives in the KV cache. The Muse Spark Open modeling_v2 composition (#20770, #20844) accepted only the VANILLA drafter, whose private arena is not transferred, so 1P1D lost acceptance (coding AL 4.13 aggregated vs 3.91).

This PR:

  • Lets the drafter's two window-attention kernels read and append the context through a page table. The result is bitwise equal to the dense call; without a table the generated code is unchanged.
  • Splits the DFlash worker's prepare into named stages (store, commit, lengths, inputs). The composition's context_kv_fork and verify_fold call them instead of copying the worker's rules. This removes two copies that had drifted:
    • the dummy slot was not emptied after a commit, so a CUDA-graph padding row could store onto another request's page;
    • the fold skipped the unified cache's allocation check.
  • Runs the fast paths over pages: 47 of the 48 sm103 TEP4 paths, dropping only drafter_window_compact.
  • Makes AUTO resolve to TRTLLM under modeling_v2.

Usage: give both workers the same speculative_config; nothing else. attention_backend: VANILLA keeps the previous behavior.

Vera Rubin: AUTO now also runs Xiao's VR paths over pages. This is untested on VR hardware. GB300 ran the R200-geometry kernels, and the sm107 windowed commit is covered by a unit test only.

Results on GB300 (Muse Spark Open NVFP4, TEP4, RadixArk DFlash 2, K=7, T=1 rejection sampling), with the composition on both workers and no env:

  • 1P1D AL (coding / stream / 8K prefix):
    • this PR: 4.101 / 4.061 / 3.924;
    • before: 3.911 / 3.886 / 3.652, so this PR is +4.5% to +7.4%;
    • aggregated: 4.12-4.15 / 4.03-4.08 / 3.89-3.92. Every paired CI vs aggregated includes 0.
  • Aggregated AL 4.127 vs 4.105 with the VANILLA drafter; GSM8K 0.976.
  • Decode step vs the VANILLA drafter: c1 +0.18 ms (8.93 vs 8.75 ms, +1.2% per request); c16-c64 within 0.6%. With attention_backend: VANILLA, step time is unchanged.

Test Coverage

  • New: test_modeling_v2_drafter_context.py, on l0_gb300_musespark. Its 11 cases cover:
    • both window ops over pages vs their dense call, bitwise, reading and appending, at each split geometry;
    • the fork's commit emptying the dummy slot, including the sm107 windowed commit;
    • the block decode over a real KVCacheManagerV2 unified cache vs the VANILLA arena, bitwise;
    • the plan over pages keeping every fast path but the window compaction.
  • Updated: test_dflash_draft_kv.py, test_dflash_dummy_slot.py.
  • Both MuseSpark lists pass as CI runs them. The DFlash and KV cache unit tests match the previous version of this PR.

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-compatible or api-breaking. For api-breaking, include BREAKING in 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

@zheyuf
zheyuf force-pushed the musespark-open/mv2-trtllm-drafter branch 3 times, most recently from 6009ea9 to 935a207 Compare October 28, 2026 03:58
@zheyuf

zheyuf commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81069 [ run ] triggered by Bot. Commit: 935a207 Link to invocation

… paged context

The drafter's window-attention ops, dflash_window_attention and its
multi-request form, read the DFlash context from a VANILLA drafter's dense
per-slot arena. A TRTLLM drafter keeps that context in the KV cache
manager's pages instead, which is what lets disaggregated serving transfer
it with the target's KV.

Given a page table, both ops now read and append the context through it:
the caches are pools of pages and each request's batch index names its
table row. The kernels see a pool as one space of rows, so a paged call
differs from a dense one only in which row a column maps to, and on the
same values the two are bitwise equal.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
… of its prepare

prepare_1st_drafter_inputs stored the step's context K/V, committed it
(lengths, dummy slot, window compaction), read the lengths the drafter
attends with the allocation clamp, and built the drafter's inputs, all
inline. A fast path that schedules part of that elsewhere -- the Muse
modeling_v2 composition stores the context on a side stream, for one --
had to copy those rules, and every worker change then had to be made
twice.

Name each stage as a worker method: _store_step_context,
_commit_context (_advance_ctx_len, then _settle_context: the window
compaction and _drafter_context_lengths), _empty_dummy_slot and
_drafter_inputs. The built-in prepare is those stages in order: the
same operations on the same operands, so its results are unchanged.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
…Flash worker

The verify fold and the context-K/V fork carry their own copies of the
DFlash worker's context commit, and the copies have drifted from the
worker:

- After every length update the worker empties the dummy slot, which
  CUDA-graph padding rows share: they attend no context, and their next
  context K/V starts inside the padding request's own pages. The fork's
  commit kernel and the fold's store did not, so the dummy slot's length
  grew by the padding rows' accepted counts every step. Over the KV
  cache manager's pages a padding row then stores past the padding
  request's pages, onto page 0 of another request.
- On a unified target/draft KV cache the worker checks the drafter's
  block against the request's allocation before clamping the lengths it
  advertises; the fold clamped without the check.

Rather than patch the copies again, both now run the worker's stages:
the fold stores and commits with _store_step_context and
_commit_context, the fork's side chain stores with _store_step_context,
and the fork's commit kernel keeps only the part it fuses, the zeroing of
the masked rows, before the worker's _commit_context. Over a windowed
arena that drafter_window_compact compacts, the side stream advances the
lengths and the prepare settles the context after the join, where the
compaction ran before; the sm107 windowed commit still advances and
compacts in its one launch, then applies the worker's dummy-slot rule and
reads its lengths. The drafter's inputs are the worker's _drafter_inputs.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81069 [ run ] completed with state SUCCESS. Commit: 935a207
/LLM/main/L0_MergeRequest_PR pipeline #66779 completed with status: 'SUCCESS'

CI Report

Link to invocation

…drafter context

The musespark_open TEP composition required the VANILLA DFlash attention
backend, so a TRTLLM drafter, whose context lives in the KV cache
manager's pages, dropped every fast path, the target's included, and
`modeling_v2: require` refused to start. Disaggregated serving needs that
drafter: only then is the drafter's context transferred with the target's
KV.

The plan now admits either layout. A paged context is never windowed, so
over pages the plan keeps every path but the window compaction (47 of
the 48 sm103 TEP4 paths) and says so in its log line. Every path that
touches the drafter's context reads it where the worker keeps it:

- the block decode hands each layer's view of the manager's pool and the
  worker's one page table to the window ops;
- the context-K/V fork's side chain decodes this step's page table at the
  fork point, which the worker then skips, and stores with the worker's
  own store; its commit is the worker's alone, since the drafter's block
  append overwrites the rows past the accepted count before anything
  reads them;
- the verify fold takes the fork's paged steps.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
The Muse Spark Open modeling_v2 composition now runs over a paged
drafter context, so AUTO no longer pins VANILLA under modeling_v2: it
follows the checkpoint rule as on any other deployment, and a
disaggregated deployment then gets the drafter whose context is
transferred with the target's KV. Only a disaggregated worker with
TRTLLM_DISAGG_SHARED_DRAFT_KV=0 still gets VANILLA.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
…seSpark pre-merge stage

Pre-merge CI on feat/musespark-open-agentx runs only the MuseSpark stages,
so the tests of the composition over a TRTLLM drafter's paged context did
not run on this branch. They need a GPU and none is cpu_only, so they go
to l0_gb300_musespark.

Signed-off-by: Zheyu Fu <zheyuf@nvidia.com>
@zheyuf
zheyuf force-pushed the musespark-open/mv2-trtllm-drafter branch from 935a207 to 8af51a7 Compare October 28, 2026 08:08
@zheyuf

zheyuf commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@zheyuf
zheyuf marked this pull request as ready for review October 28, 2026 08:09
@zheyuf zheyuf added the api-compatible Accepted LLM API contract change that is backwards-compatible label Oct 28, 2026
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81143 [ run ] triggered by Bot. Commit: 8af51a7 Link to invocation

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #81143 [ run ] completed with state SUCCESS. Commit: 8af51a7
/LLM/main/L0_MergeRequest_PR pipeline #66843 completed with status: 'SUCCESS'

CI Report

Link to invocation

@zheyuf
zheyuf merged commit ff0697b into NVIDIA:feat/musespark-open-agentx Oct 28, 2026
15 of 19 checks passed
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.

2 participants