Skip to content

[Feat] [RUBIN] muse_spark: Serve one request at TP8 with verify_mk and the one-request components - #76

Draft
rohithrr9 wants to merge 8 commits into
sgl-project:mainfrom
rohithrr9:muse-spark/sm107-c1
Draft

rohithrr9 wants to merge 8 commits into
sgl-project:mainfrom
rohithrr9:muse-spark/sm107-c1

Conversation

@rohithrr9

@rohithrr9 rohithrr9 commented Nov 20, 2026 •

Copy link
Copy Markdown

Motivation

This pull request adds the one-request decode path for Muse Spark Open at TP8 = EP8 on Rubin (sm_107): verify_mk, which runs TensorRT-LLM's Muse Spark decode megakernel (target layers 1-60 as one persistent kernel) on SGLang's one-request target-verify step, the plugin's one-request components around it (host ingest, step graphs, commit, sampling and draft pieces) and a set of one-request step optimizations. With #39 they serve the model at one running request per server on two Rubin nodes.

Stacked on #39. It extends three of #39's components (draft_attn, verify_logits_gather, softmax_split) and uses its registry, so its branch carries #39's commits and the diff on this page includes them until #39 merges; this pull request's own change is the last commit. Draft until #39 lands.

Authorship and credit

Rohith Rachala (@rohithrr9): the verify_mk host runner for TensorRT-LLM's Muse Spark megakernel (NVIDIA/TensorRT-LLM, Apache-2.0), the one-request step optimizations, the port into this repository and the measurements on Rubin (below).

The other components were added from the work of Rohan Varma (@nvrohanv) in NVIDIA's out-of-tree plugin (muse_vr_plugin): the new one-request components and their kernels, and the plugin's later versions merged into the existing components (see Modifications). The commit carries Co-authored-by: Rohan Varma <rohanv@nvidia.com>.

All contributions are NVIDIA's; source headers carry the NVIDIA copyright line. The commit also carries an AI-assistant trailer.

Modifications

One commit on #39: 94 files, +49,610 / -393, under sgl_nvidia_mega/muse_spark/ and test/unit/ apart from NOTICE, pyproject.toml and .pre-commit-config.yaml; 30,833 of the lines are the copied TensorRT-LLM tree. Everything is opt-in (MUSE_VR_* switches) and off by default; the one-request pieces refuse, or step aside on, every other batch.

  • muse_spark/sm107/verify_mk/ (MUSE_VR_VERIFY_MK=1): the host runner. It hooks SGLang's install_megakernel, binds the kernel to SGLang's KV cache, TP group and weights (layer facades, workspaces), and refuses the forwards it does not cover, which then run stock. A compare mode (MUSE_VR_VERIFY_MK_COMPARE=N) checks N eager verify forwards layer by layer against the stock layers. The kernel also writes the DFlash taps of layers 1-60; when every capture is a kernel tap, the text model returns the taps' buffer itself (their concatenation), so no tap copies run.
  • muse_spark/sm107/trtllm_ab93b78/: TensorRT-LLM's kernel and host code at NVIDIA/TensorRT-LLM ab93b785a476f01d2f1e1907c930780fc6d7832e, unchanged apart from four files marked "Modified by NVIDIA": SGLang's paged KV cache as a build option (MSO_MK_SG_KV=1; the default build is TensorRT-LLM's), a pinned-memory fallback, and TensorRT-LLM's SM-stable CTA roles made exact as a build option (MSO_MK_I2B_SMID=2: each CTA claims its logical index with atomics at entry), which the served build uses. sm107/README.md lists what is copied and what is left out.
  • New components from the plugin's one-request line: host_ingest, req_bcast, token_count_fill, embed_gather, step_graphs, eager_commit, selector_fused, selector_proj_overlap, rust_treecore and graph_meta_par (parallel graph metadata, MUSE_VR_GRAPH_META_PAR), with the kernels batch_copy, dflash_commit, draft_gemv_push, pull_gather_rows, selector_fused, sparse_final, verify_topk_fast and final_norm_split.
  • The plugin's later one-request versions, 3-way merged into main's and [Feat] [NVIDIA] muse_spark: Add the Muse Spark Open kernel half as opt-in hooks on SGLang's forward #39's copies (new paths behind new switches; existing defaults unchanged): ar_norm_residual, ctx_proj_overlap, draft_attn, draft_boundary, final_norm (with its split, MUSE_VR_FINAL_NORM_SPLIT), pull_bounded, verify_attn, verify_topk_sample, and the ops draft_ar_norm, draft_attn, draft_gemv, draft_qk, full_verify_attn and swa_verify_attn.
  • One-request step optimizations, each behind its own switch: the logits gather over multimem with a fused argmax (MUSE_VR_VERIFY_LOGITS_GATHER_MULTIMEM, MUSE_VR_VERIFY_LOGITS_GATHER_ARGMAX), the split softmax captured in the step graphs (MUSE_VR_SOFTMAX_SPLIT_STEP_GRAPHS), the step graphs' simulated-acceptance fold, Triton accept and late launch (MUSE_VR_STEP_GRAPHS_SIM_FOLD, MUSE_VR_STEP_GRAPHS_ACCEPT_TRITON, MUSE_VR_STEP_GRAPHS_LAUNCH_LATE), the layer-0 input-norm table and its stream (MUSE_VR_INPUT_NORM_L0_TABLE, MUSE_VR_INPUT_NORM_L0_TABLE_STREAM), the drafter's layer-0 table (MUSE_VR_DRAFT_L0_TABLE) and token-count reuse (MUSE_VR_TOKEN_COUNT_FILL_REUSE).
  • components/__init__.py registers the new components in the plugin's order. The loader takes verify_mk from muse_spark/sm107, and on GB300 from muse_spark/sm103, which [Feat] [GB300] muse_spark: Run verify_mk on GB300 (sm103) #61 adds with the same loader lines. sgl_compat maps SGLang's megakernel runtime module. NOTICE, the pyproject package data and the pre-commit exclusion cover the copied tree.
  • Tests: test/unit/test_muse_spark_sm107_verify_mk.py (install, refusals, binding, launches, the taps and the packed capture, the compare mode and the loader, on CPU stand-ins) and test_muse_spark_sm107_verify_mk_i2b.py (the SM-stable claim protocol, checked as a model over the interleavings).

SGLang this depends on. The measured runs use SGLang 306ccf6 with sgl-project/sglang#48950, #48947, #48948 and #48949 ported onto it (as #39's), plus two small SGLang changes not yet proposed upstream: in dflash_worker_v2.py, the draft block carries no device token count when no draft layer reads one, and the verify input is built with one torch.cat; in cuda_graph_buffer_registry.py, an unsharded token count that is in range is copied directly. draft_boundary pins those two files as changed, so it steps aside on other SGLang builds until the changes are upstream; the other components pin the image's files, and for the measured build their pinned digests were extended by the build's own (pins only, as for #39).

Tested against: SGLang 306ccf6f57bcd6efc9edc626e39a9673e22cb9d6 with the changes above, on Rubin (sm_107), with #39 and this pull request's tree (the last commit). The unit suite passes on a CUDA-less host apart from the cases that fail on main in the same environment.

Accuracy Tests

Baseline: SGLang 306ccf6 as released in the image, with the plugin installed and no Mega switch set. Candidate: #39 and this pull request with the one-request settings, on the SGLang build above. Both: Muse-Spark-Open-816B-A42B-NVFP4 with the DFlash2 draft (8 draft tokens), TP8 = EP8 over two nodes of 4 Rubin GPUs, one running request, real draft acceptance. Comparison rule: an exact two-sided McNemar test on per-question correctness; p < 0.05 is a difference, otherwise on par.

Model / hardware / configuration Test Native SGLang baseline Mega candidate Difference / variation Verdict and evidence
Muse Spark NVFP4 + DFlash2 / 2 x 4 Rubin (sm_107) / TP8 = EP8, one request GSM8K, all 1,319 test questions: zero-shot chat ("Please reason step by step, and put your final answer within \boxed{}."), temperature 0, max 4,096 tokens; answer = last \boxed{}, else last number 0.9469 (1,249 / 1,319) 0.9394 (1,239 / 1,319) -0.76 pt; per question 42 baseline-only against 32 candidate-only correct, exact McNemar p = 0.30 On par (no significant difference)

The baseline's result is from an earlier run and read the same on two node pairs. The candidate's 1,319 replies were byte-identical on SGLang 306ccf6 as released (where draft_boundary steps aside) and on the measured build.

Speed Tests and Profiling

Same model and topology. Workload: an agentic multi-turn benchmark (coding-agent conversations) at one concurrent request; per arm a warm-up server that runs the workload for 10 minutes, then a fresh server and a 1-hour run. Measurement-only override: synthetic draft acceptance (accept length 4.05) in both arms. Relative change, candidate over baseline:

Model / hardware / configuration Test Native SGLang baseline Mega candidate Difference / variation Verdict and evidence
Muse Spark NVFP4 + DFlash2 / 2 x 4 Rubin (sm_107) / TP8 = EP8, one request Agentic multi-turn, 1 h: p90 per-user output speed 1.00 1.74 +73.9 % Faster
same same: total token throughput per GPU (prompt + generated) 1.00 1.08 +8.1 % Faster
same same: 1 / p90 end-to-end latency per output token 1.00 1.23 +22.8 % Faster

The arms differ in more than this pull request, so these are recipe-to-recipe numbers: the candidate also runs #39, the plugin's one-request settings and the SGLang changes above. The baseline's 1-hour run is from an earlier day on another node pair; a 10-minute baseline run on the candidate's nodes was within 1 % of the earlier baseline's 10-minute run. verify_mk and every component the candidate's settings switch on engaged on all 8 ranks (install records). Being faster, the candidate gets further into the conversations within the hour, so the prompt mixes differ.

Not measured here: more than one running request (verify_mk and the one-request components refuse those forwards, which run SGLang's own path; the unit tests cover the refusals), and GB300 (#61).

Checklist

  • pre-commit run --all-files passes.
  • Tests under test/ cover the change. [verify_mk has CPU tests; the ported one-request components have none yet. The unit suite passes apart from the cases that fail on main in the same environment.]
  • Required SGLang bindings passed normal SGLang CI and are merged, or no binding change is needed. [No: see "SGLang this depends on".]
  • The tested SGLang and Mega SHAs and integration run link are named above. [SHAs above; no integration run link: the runs are on our own Rubin nodes.]
  • Accuracy and performance E2E results against the matched baseline are attached for each affected supported model/hardware configuration.
  • Required E2E cases ran on the appropriate hardware; missing coverage is listed explicitly. [Rubin at one request only; see "Not measured here".]
  • A new model adds one line to .github/CODEOWNERS that names its owner. [Not a new model.]

Review and Merge Process

  1. The lint and Check PR title checks must pass.
  2. Ask a code owner from .github/CODEOWNERS to review.
  3. Merge with "Squash and merge": the PR title becomes the commit title on main.

🤖 Generated with Claude Code

wenscarl and others added 8 commits November 13, 2026 12:08
…t-in hooks on SGLang's forward

Adds NVIDIA's fused kernels for Muse Spark Open (MuseSparkForConditionalGeneration) under
sgl_nvidia_mega/muse_spark/:

- the spec, plan and runtime skeleton for the target-verify step, registered through the same
  interface as deepseek_v41;
- the components, as hooks on SGLang's own forward: each is opt-in (MUSE_VR_* switches, off by
  default), pins the SGLang sources it hooks by sha256 and steps aside if they moved, and declares
  the SGLang names it reads (SGLANG_READS) for test/unit/test_contract.py;
- verify_mk (MUSE_VR_VERIFY_MK=1, off by default): TensorRT-LLM's sm_107 decode megakernel on the
  one-request target-verify step, vendored from NVIDIA/TensorRT-LLM
  ab93b785a476f01d2f1e1907c930780fc6d7832e;
- the vendored SGLang pull-request files the components bind, the license texts, NOTICE paragraphs,
  SPDX and copyright headers, and the code owners.

The host-side runtime half stays out of this repository.

Co-authored-by: Rohan Varma <rohanv@nvidia.com>
Co-authored-by: Rohith Rachala <rrachala@nvidia.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NOTICE: keep both new paragraphs (the Kimi K3.1 DCP top-k merge adapted from SGLang, and the TensorRT-LLM copy
verify_mk runs).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
test_binding_limit made a new positions buffer for each of its five bindings and dropped the previous one. Bindings
are keyed by buffer address, so on the CI runner a freed buffer's address came back for a later binding, matched an
earlier one, and the fifth binding was taken instead of refused. The test now holds every buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Rubin's (sm_107) verify_mk code moves to its architecture's folder, as the other models keep their GB300 code in
<model>/sm103: components/verify_mk -> sm107/verify_mk and components/vendor/trtllm_ab93b78 -> sm107/trtllm_ab93b78
(git mv; the files change only in their imports and paths). The component loader imports verify_mk from sm107
(components.MODULES). The TensorRT-LLM part of components/vendor/README.md moves to sm107/README.md, and NOTICE,
pyproject.toml's package data and the pre-commit exclude follow the new paths. The test moves to
test_muse_spark_sm107_verify_mk.py, imports the real sm107 package before its stand-ins (so it also passes on its
own), and checks the loader's choice. No behavior change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
verify_mk (TensorRT-LLM's Rubin decode megakernel on the one-request verify step: its host runner and the copied
TensorRT-LLM tree in muse_spark/sm107, 35.4k lines, 33.4k of them the TensorRT-LLM copy) moves to its own pull request
on main; it needs nothing of the components here. This pull request keeps every component.

- Removed: muse_spark/sm107/ and test/unit/test_muse_spark_sm107_verify_mk.py, the registry's verify_mk entry and its
  module path, sgl_compat's alias of SGLang's megakernel runtime module, and the NOTICE paragraph, package data and
  pre-commit exclusion of the TensorRT-LLM copy (those four files match the branch's base on main again).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-scope operations

The plugin's later fix to the two MoE-LD-W kernels, ported as is. The CTA abort flag (g_abort) was set with a C++ volatile
store in fail(), polled with a C++ volatile load in aborted() and reset by thread 0 with a plain store at kernel start. Every
access is now an explicit strong operation at CTA scope on the shared state space, in both files:
- aborted(): ld.relaxed.cta.shared.u32 (one load, as before);
- fail(): atom.relaxed.cta.shared.exch.b32 after the error-word atomicOr (failure path only);
- the kernel-start reset by thread 0: st.relaxed.cta.shared.u32 (abort_reset()).
The setter and the pollers are then morally strong and do not form a data race under the PTX ISA memory consistency model.
Every other use of the flag goes through aborted() and fail(), and the flag's values and the points where it is read or
written are unchanged, so outputs are unchanged on every path.

Co-authored-by: Rohan Varma <rohanv@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d the one-request components

Stacked on sgl-project#39: it extends sgl-project#39's draft_attn, verify_logits_gather and softmax_split and uses its registry. Everything is
opt-in and off by default; the one-request pieces refuse, or step aside on, every other batch.

- verify_mk (MUSE_VR_VERIFY_MK=1): TensorRT-LLM's Muse Spark decode megakernel (target layers 1-60 as one persistent
  kernel) on SGLang's one-request target-verify step at TP8 = EP8. muse_spark/sm107/verify_mk is the host runner: it
  hooks SGLang's install_megakernel, binds the kernel to SGLang's KV cache, TP group and weights (layer facades,
  workspaces), refuses the forwards it does not cover (they run stock) and has a compare mode that checks forwards layer
  by layer against the stock layers. The kernel also writes the DFlash taps of layers 1-60, and when every capture is a
  kernel tap the text model returns the taps' buffer itself (their concatenation), so no tap copies run.
  muse_spark/sm107/trtllm_ab93b78 is TensorRT-LLM's kernel and host code at ab93b785a476f01d2f1e1907c930780fc6d7832e,
  unchanged apart from four files marked "Modified by NVIDIA" (SGLang's paged KV cache as a build option, SM-stable CTA
  roles as a build option); sm107/README.md lists what is copied.
- The plugin's one-request components, ported from its one-request TP8 line: new host_ingest, req_bcast,
  token_count_fill, embed_gather, step_graphs, eager_commit, selector_fused, selector_proj_overlap, rust_treecore and
  graph_meta_par, with the kernels batch_copy, dflash_commit, draft_gemv_push, pull_gather_rows, selector_fused,
  sparse_final, verify_topk_fast and final_norm_split; the plugin's later versions 3-way merged into ar_norm_residual,
  ctx_proj_overlap, draft_attn, draft_boundary, final_norm, pull_bounded, verify_attn, verify_topk_sample and the ops
  draft_ar_norm, draft_attn, draft_gemv, draft_qk, full_verify_attn and swa_verify_attn (new paths behind new switches;
  the existing defaults are unchanged).
- One-request step optimizations, each behind its own switch: multimem logits gather with a fused argmax
  (verify_logits_gather), the split softmax captured in the step graphs, the step graphs' simulated-acceptance fold,
  Triton accept and late launch, the layer-0 input-norm table (and its stream), the drafter's layer-0 table, token-count
  reuse, parallel graph metadata and the final-norm split.
- components/__init__.py registers them in the plugin's order; the loader takes verify_mk from muse_spark/sm107 (and on
  GB300 from muse_spark/sm103, which a separate pull request adds with the same loader lines); sgl_compat maps SGLang's
  megakernel runtime module; NOTICE, the pyproject package data and the pre-commit exclusion cover the copied tree.
- test/unit/test_muse_spark_sm107_verify_mk.py: install, refusals, binding, launches, the taps and the packed capture,
  the compare mode and the loader on CPU stand-ins; test_muse_spark_sm107_verify_mk_i2b.py: the SM-stable claim
  protocol.

Co-authored-by: Rohan Varma <rohanv@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rohithrr9 added a commit to rohithrr9/sgl-nvidia-mega that referenced this pull request Nov 23, 2026
verify_mk runs TensorRT-LLM's Muse Spark decode megakernel on SGLang's one-request verify step (target layers 1-60,
TP8 = EP8); its Rubin (sm_107) form is sgl_nvidia_mega/muse_spark/sm107 (sgl-project#76). This adds the GB300 (sm_103a) port in
the same per-hardware layout, sgl_nvidia_mega/muse_spark/sm103, on top of sgl-project#76, whose loader lines already cover it (the
verify_mk entry, MODULES / ARCH_MODULES, SGLang's megakernel runtime alias, the pre-commit exclusion). Every device
other than compute capability 10.3 loads what it loads today.

- sm103/trtllm_ab93b78: TensorRT-LLM's megakernel and replicated-experts host code (NVIDIA/TensorRT-LLM
  ab93b785a476f01d2f1e1907c930780fc6d7832e) with sm_103a as the build target: one CTA per SM of GB300's 152
  (MSO_MK_CTAS=152), TensorRT-LLM's 212 QKV runs kept (MSO_MK_QKV_RUNS=212), and every launch planned for 212 CTAs
  and folded onto 152 by fold.py (added; MUSE_VR_VERIFY_MK_FOLD_SPREAD=1 moves the second o_proj unit of a
  sliding-window host CTA to an attention CTA, so no CTA runs two). Dev-only builds (MUSE_VR_VERIFY_MK_BUILD):
  single-lever variations of the served build and their combinations, an expert-weight L2 prefetch prototype
  (MSO_MK_XPF) and the stamped twin (per-unit timelines, MUSE_VR_VERIFY_MK_STAMPS). Changed TensorRT-LLM blocks are
  marked verify_mk; pre-commit skips the directory.
- sm103/verify_mk: the host runner (Rubin's sm107/verify_mk, importing the sm103 kernel). As on Rubin, outside the
  compare mode the kernel writes the DFlash taps of layers 1-60, and when every capture is a kernel tap the text model
  returns the taps' buffer itself (their concatenation), so no copy runs before the LM head.
- pyproject.toml ships the copy's license and stage headers; NOTICE names the copy.
- Tests: test_muse_spark_sm103_verify_mk.py (the verify_mk contracts on the sm103 copy, the taps and the packed capture,
  and the loader: its choice, and a build without the Rubin folder) and test_muse_spark_sm103_verify_mk_fold.py (the
  212-to-152 fold of the served build's plans).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants