Commit Graph
40 Commits
Author SHA1 Message Date
minke.yu b081dd3d23 Merge branch 'main' into dsv41-pd 2026-09-22 14:56:35 +08:00
Cheng Wan 970e946e4f Retire the per-runner parallel record (#40343) 2026-09-21 12:26:40 -07:00
abing c2059c4fb2 run pass llm cp
(cherry picked from commit 1d85394563d96cf22d5d84f15c0e9043582419e4)
2026-09-20 22:07:23 +08:00
Baizhou Zhang ed183d45ac [CP V1 Deprecation 4/5] Canonicalize prefill CP API names (#36229) 2026-09-08 16:03:36 -07:00
Baizhou Zhang b6c31b155c [CP V1 Deprecation 3/5] Remove generic prefill CP v1 runtime (#36228) 2026-09-06 21:53:53 -07:00
Cheng Wan aaf9a95763 [Config] Round 6.5: a namespace declares what it derives, next to what it derives it from (#38113)
Fifth of five; stacked on #38049. The split gave every namespace a file, but
only for the half an operator types. This is the other half.

## The parallel quotients are declared, not written out

`attn_tp_size` and its five siblings were sixty lines of near-identical
properties in the runtime context, a file away from the leaves they are
quotients of, so reading `parallel.py` told you what you could set and nothing
about what that decides.

They are declared in `Parallel` now, in the same class as those leaves. They
carry no annotation, so they are not dataclass fields and
`collect_input_fields` never puts them on the record -- the same mechanism that
already keeps `_NS_PATH` off it. That is the right exclusion: a quotient has no
operator input to preserve, and the record is what crosses a process boundary,
where a stamped width is one an elastic scale-up will not refresh.

## A quotient is a value in the bag, like every other derived one

`_derived_width` answered from a stamp or, failing that, a live process group.
The group read could never disagree with the stamp:

- `initialize_model_parallel` stamps all six as its last statement,
  unconditionally;
- an elastic scale-up restamps `attn_dp_size` through
  `update_dp_attention_post_scale` -- the comment claiming it does *not* was
  wrong;
- no hardware backend builds groups of its own;
- `multimodal_gen`, which has its own `initialize_model_parallel` and does not
  stamp, never reads a quotient.

So a built group was always already stamped, and the group read goes -- and with
it the last reason for a quotient to be resolved on every read.

Every input to `derive_parallel_widths` is a record field. `dcp_enabled` is
`decode_context_parallel_size > 1`, not a fact about a built group; it was
spelled `_DCP is not None`, which is a longer way to say the same thing. So the
six are fixed once the configuration is fixed -- the same test every other
`Derived(fn=...)` in this PR passes. They are declared the same way and computed
the same way: once, at publish, into ordinary bag leaves.

What remains is override -> stamp -> published leaf. The stamp stays above the
leaf because an elastic scale-up restamps `attn_dp_size`; the override stays on
top because that is how a test names a width.

## One answer for the config-derived predicates

`enable_mamba_extra_buffer` and its lazy variant, `is_ep_joiner`,
`is_ep_scale_joiner`, `is_startup_weight_load_overlap`: each existed as a
`ServerArgs` member for the resolution pipeline and, for most of them, again as
a `runtime_context` function for readers after publish. Three places to keep
saying the same thing.

A `Derived(fn=...)` is a pure function of the published configuration, so
`publish` computes it once and stores it as an ordinary bag leaf -- a plain
attribute load, which is what a read inside compiled model code needs. The
function is handed the whole resolved config rather than the bag it lands in,
because a derivation is free to span namespaces and the mamba one does: it
reads `memory.disable_radix_cache` alongside its own `exec.mamba` strategy,
which is why it could never have been a method on either bag.

The pre-publish helpers stay -- resolution needs the predicate before there is
a bag to read -- and three readers keep them, because they run before their own
process publishes: `initialize_dp_attention`, which the weight-cache daemon
calls while building its groups thirty lines before its `publish`, and
`PortArgs.init_new`, a factory handed the record that already reads eighteen
other fields off it.

## Notes for a reviewer

**Overriding a leaf does not move its quotient.** `override(tp_size=2)` leaves
`attn_tp_size` where the published config put it, because nothing is recomputed
on read. A test states a topology by publishing a config -- which is what a
real process does -- or by naming the width it wants, `override(attn_tp_size=2)`.
Six tests say it that way now. This is the price of having one answer computed
once, and it is the same price every other derived value in the config already
carries.

A caller that reads a quotient without publishing or overriding now gets an
explicit error naming the field, instead of a default that an uninitialised
group happened to supply. One fixture was in that state --
`TestMlaWriteDoorsUnderDcp` built a bare pool and asked whether DCP was on --
and it publishes a config now, which is what the process it stands in for
does.

Eighteen sites read these predicates without calling them. That is correct --
they are properties -- but it is worth saying they were checked, because a
census that assumes otherwise reports eighteen always-true conditions.

## The skill that documents this subsystem is updated with it

`.claude/rules/modify-component-must-read.md` points at
`.claude/skills/sglang-runtime-context/SKILL.md` before anyone touches these
files, so a stale sentence there is a wrong instruction rather than a stale
note. Four of its load-bearing statements stopped being true across this series
and are corrected here: `NS(...)` is no longer how a field states its namespace
(the declaring class is); the DCP degrade rule is gone, because the quotients
are not live reads; `mamba_extra_buffer_enabled()` and the other predicate
functions it named as the shape to copy no longer exist; and the
namespace-coverage ratchet is described in terms of the marker. The docstring of
`test_server_args_namespaces.py` said the same thing and is fixed too.

The consequence a test author actually trips over is stated there as well:
overriding a leaf no longer moves its quotient, so a topology is stated by
publishing a config or by naming the width.

## Verification

A full registered-unit sweep (648 files) against this stack's merge-base:
19 failures on both sides, the same 19 -- AMD `gfx950`, `modelopt`,
`cuda_vmm`, `weight_checker` and friends, none of them config. The narrower 139-file config sweep used earlier in this series
does not contain the files this change reaches -- `test_kv_index_translator`
never names `get_parallel()`, it constructs an object that does -- which is why
the baseline differential over everything is what is quoted here.
2026-09-06 21:44:24 -07:00
Yuwei AnandClaude Fable 5 ff5578eb4e [1/N][Mix] Mixed Chunk Prefill Base (#36288)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-27 12:59:56 -07:00
Cheng WanandClaude Opus 5 ca1d7ed8e6 config: a parallel leaf with no live counterpart is read bare (#36620)
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-27 12:56:11 -07:00
weireweireandweireweire 4d5d506486 Publish gated DSV4 DFLASH-family target-prefill read completion (#35947)
Co-authored-by: weireweire <20922698+weireweire@users.noreply.github.com>
2026-08-26 21:33:08 -07:00
Cheng Wan ae5feb4b9c config: stop handing the record to code that does not read it (#36252) 2026-08-26 05:02:17 -07:00
Cheng Wan 8005df61d3 config: spell the parallel config tier at the call site (#36250) 2026-08-26 03:00:28 -07:00
Cheng Wan f2ab6e306b config: the alias form of the runner-side instance read
The previous batch counted `self.server_args.X` and called the runner surface
done. It was not: the same read spelled through a local alias --
`server_args = model_runner.server_args` (or `sa = kvc.server_args`, `args = ...`)
followed by `server_args.leaf` -- is the same process-global read wearing a
local name, and the AST census counts **57 of them** across eleven files that
the grep never saw. Census per function, following the alias.

52 were leaves and go to their bag (`spec` 11, `schedule` 9, `memory` 7,
`exec.graph` 5, `exec.moe` 5, `parallel` 4, `disagg` 4, `model` 3,
`exec.mamba` 2, `exec.overlap` 2). Five were not leaves:
three derived members on the eager runner --
`max_speculative_num_draft_tokens` and `enable_mamba_extra_buffer` already had
accessors, and `max_prefill_buffer_tokens` gets one (all its inputs are `schedule`
leaves plus the configured PP size, so it derives from the bags and follows a
post-publish override; `TestDerivedPredicatesAgreeAcrossTiers` pins it against
the member over a 48-case matrix) -- plus `get_attention_backends()`, which the
same commit routes through `attention_backends()`, and a dict that merely shares
the name (`server_args_dict.items`). That dict is the one read left behind.

`build_attention_backends` also stops resolving the pair from the record: it
runs after publish, so it asks `attention_backends()` like every other consumer.
The draft override on the runner still wins first.

`dispatch_event_loop`'s three PP checks read the *configured* PP size, not the
live topology: the MLX runner stub never initializes torch.distributed, so the
live property asserts before the MLX event loop can start (a Codex catch). The
configured leaf answers the same value wherever the live groups exist.

`flashinfer_gdn_prefill_default`'s guard is the one read here that asks what the
*operator* named rather than what the config resolved to, and the bag leaf now
answers exactly that: the per-runner auto-default is stamped on the runner and
deliberately never recorded process-wide, so nothing writes that leaf after
launch and reading it back cannot mistake another runner's default for a flag.

Three test doubles injected a `SimpleNamespace`/`MagicMock` record for exactly
these reads and now publish instead (pool configurator, cache registry, GDN
prefill policy) -- the fixture publishes what the case configures and hands the
published instance to the whole-object contracts that still take one.

The functions this sweep partially converted stop mixing sources (review
catches): the flash-attention constructor's remaining seed reads
(`speculative_eagle_topk`, `speculative_algorithm`, both deterministic gates)
read their bags next to the leaves already converted;
`_should_disable_scheduler_metadata_precompute` reads the parallel config
leaves itself instead of taking the record (its alias binding was the last
use); and the autotune gates (`disable_flashinfer_autotune`, deterministic,
`flashinfer_autotune_skip_ops`) join the moe leaves the same function already
reads from the bags. The pool-configurator fixture drops a parameter nothing
published or read.
2026-08-15 00:39:03 -07:00
McZyWu 197832bcf5 [Kimi-K3][NPU] Support Kimi-K3 on NPU (#33465) 2026-08-12 21:20:14 +08:00
ybyang 9d4be40124 Fix DSpark + DeepSeek V4 prefill CP compatibility (#33865) 2026-08-10 23:26:29 -07:00
Khoa PhamandClaude Opus 5 ce1b9f88b6 config: derive the runner's DCP topology from its ParallelState (#34133)
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 01:18:24 -07:00
Zhangheng 1480687cff [CP]: Support CP V2 Strategy for dsv4 (#33532) 2026-08-07 14:03:27 -07:00
f46d5f25b4 [4/N][CP] Support interleave strategy for cp v2 (#30482)
Co-authored-by: Xinyuan Tong <xinyuantong.cs@gmail.com>
Co-authored-by: Baizhou Zhang <sobereddiezhang@gmail.com>
2026-07-30 01:45:32 -07:00
Liangsheng Yin 2625fdfe6b [Fix] Count multi-layer draft-extend replays in the fwd-occupancy device timer (#32867) 2026-07-30 00:21:34 -07:00
ef6c07008b Support DCP for Kimi Linear model (#32612)
Co-authored-by: Julien Lin <jullin@nvidia.com>
Co-authored-by: kpham-sgl <khoa.pham@radixark.ai>
2026-07-28 22:59:58 -07:00
Baizhou Zhang 7a03d30149 Support MiMo V2.5 with zigzag context parallelism (#29972) 2026-07-19 02:36:40 -07:00
YC Yen-Ching Tseng c68392c535 [AMD] Fix DeepSeek MLA prefill shape mismatch on HIP eager fallback (missing mha_companion_layers) (#31675) 2026-07-19 01:40:41 -07:00
Khoa PhamandClaude Opus 4.8 7a896215e7 [CP] Migrate MLA prefill CP (DeepSeek V3) to CP-v2 zigzag strategy (#31619)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-17 22:37:53 -07:00
Liangsheng Yin 76dc427806 [Spec] Single-source num_tokens_per_req derivation and access (#31013) 2026-07-14 18:41:08 -07:00
Liangsheng Yin c0f1f7e062 [Spec] Rename num_tokens_per_bs to num_tokens_per_req (#30977) 2026-07-13 13:47:53 -05:00
Liangsheng Yin dda61b476e [style] Extract init-static values in forward path (#30708) 2026-07-09 19:35:00 -07:00
Baizhou Zhang fa278a762c Fix FA3 prefill CP NaNs (#30439) 2026-07-07 20:16:09 -07:00
669fd4b8a5 [PP] Fix start_layer_id with pp in get kv_buffer_shape (#29887)
Co-authored-by: ybyang <10629930+whybeyoung@users.noreply.github.com>
Co-authored-by: Shangming Cai <csmthu@gmail.com>
2026-07-07 14:54:38 +08:00
Zaili Wang cb06c4e6ce [CPU] Fix model failures on Xeon (#29497) 2026-07-02 13:20:18 +08:00
Augusto Yao ea8f4e9f3f [feature] implement dcp for deepseek_v2 (#14194) 2026-06-25 15:15:04 -07:00
jiayisunx d717e926c1 fix(runner): prevent eager token buffer under-allocation (#28894) 2026-06-25 14:37:19 +08:00
Lianmin ZhengandYinghai Lu 7e63feee6f Add scheduler metrics extension hooks (#29207)
Co-authored-by: Yinghai Lu <yinghai@meta.com>
2026-06-24 15:50:05 -07:00
Lianmin ZhengandCheng Wan d6aacd2801 Handle input-embed-only batches in eager runner (#29121)
Co-authored-by: Cheng Wan <54331508+ch-wan@users.noreply.github.com>
2026-06-24 10:33:52 -07:00
Lianmin Zheng ecab3f322e Revert "Improve MFU metrics for prefill and verify timing" (#29079) 2026-06-23 15:46:22 -07:00
YAMY 93015a9e6b fix(runner): autotune flashinfer MoE on a decode-shaped buffer (#29069) 2026-06-23 13:31:47 -07:00
Lianmin ZhengandPranjal Shankhdhar b60185c41c Improve MFU metrics for prefill and verify timing (#29000)
Co-authored-by: Pranjal Shankhdhar <pranjal.ssh@gmail.com>
2026-06-23 12:26:56 -07:00
Mohammad Miadh Angkad 643ee748c6 [PP] Pass DSA topk through PP warmup proxy buffers (#28785) 2026-06-21 23:55:39 +08:00
Cheng Wan 6fdcb9934c fix(runner): size eager static buffers for prefill budget and MLP-sync autotune (#28677) 2026-06-19 13:23:26 -07:00
Cheng Wan 2aa7b58aa7 refactor(runner): reuse a prepared static buffer for every dummy run (#28740) 2026-06-19 13:16:07 -07:00
Cheng WanandClaude Opus 4.8 856b0dc74b refactor(runner): move kernel warmup into the shared runner lifecycle (warmup()) (#28739)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 13:13:13 -07:00
Cheng WanandClaude Opus 4.8 d705a91de1 refactor(runner): add EagerRunner, own the eager path, polymorphic dispatch (#28386)
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 13:05:43 -07:00