Repository navigation
[Refactor] Let the remaining placement consumers read the parallel context - #42348
Merged
Merged
Conversation
ch-wan
requested review from
Alisehen,
AniZpZ,
BBuf,
Duyi-Wang,
Edwardf0t1,
FlamingoPg,
Fridge003,
HaiShaw,
OrangeRedeng,
Qiaolin-Yu,
Ying1123,
alphabetc1,
b8zhong,
hanming-lu,
hnyls2002,
huangtingwei9988,
hzh0425,
ispobock,
jybsuper,
kkHuang-amd,
lifuhuang,
merrymercy,
mickqian,
mmangkad,
stmatengss,
xiezhq-hermann,
yhyang201,
yizhang2077,
yuan-luo and
yushengsu-thu
as code owners
October 3, 2026 05:21
The exemption sat in the shared check, so it also applied to text attention. A language-only instance still forwards its text layers, and their output projections shard over attention TP and reduce over the TP group just the same, so exempting them hid the case the check exists for. It also missed a worker that holds a tower it never forwards: a PD decode instance embeds nothing, and most models build their tower unconditionally, so such an instance would refuse to start over a reduction it never reaches. The multimodal encoder sites say so, and `multimodal_encoder_runs_here` answers for all three: encoder disaggregation, language-model-only, and a decode instance. Text attention is checked on every worker.
CI's suite collection refuses a registered test file without one: the pytest-style tests in it would silently skip under `python3 file.py`.
Constructing the text attentions reaches a rotary embedding that falls back to a module the CPU runner does not have, so the test states only the refused layout for them. The accepted layouts are covered by the checks above, which build real layers on the CPU.
An encoder-disaggregated language instance was exempted outright, but adaptive dispatch sends only some requests to the encoder instance and forwards the tower for the rest, so that layout still has to hold. The message now names the width that narrowed the attention TP group instead of suggesting attention context parallelism be dropped where none is configured.
ch-wan
force-pushed
the
cheng/refactor/placement-consumers-read-context
branch
from
October 3, 2026 21:58
890617c to
f290646
Compare
This was referenced Oct 3, 2026
4 tasks done
4 of 5 tasks
4 tasks done
3 tasks done
TamirBaydasov
added a commit
to TamirBaydasov/sglang
that referenced
this pull request
Oct 5, 2026
No textual conflicts. sgl-project#40591 is still not in main (dsa_npu_indexer.py calls the v1 npu_quant_lightning_indexer), so the indexer-shard trap is not live. Checked the eight files both sides touched. sgl-project#42481 drops make_stages and the _stage_* fields from DeepseekV2DecoderLayer; nothing on this branch uses them. sgl-project#42348's handle_deprecated_dp_attention change still leaves attn_dp_size set before our DCP nesting check reads it. sgl-project#42041's ForwardBatch change is gated on upstream CP metadata, not DCP. Local CPU tests (test/registered/dcp, test_npu_dcp, test_server_args): the same 5 failures before and after the merge; none are new. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 of 5 tasks
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 19, 2026
…-project#42348 Pre-existing red, A/B-proven: at 73a335b (before this batch) `test_nvfp4_smallm_dispatch.py` reported 2 failures — `test_false_launch_result_falls_back_once` and `test_jit_or_launch_exception_falls_back_once` — with a node list byte-identical to this branch's pre-fix run, so nothing here introduced them. Both are stale-stub, not code bugs: * upstream 10edb05 (sgl-project#42348, "Let the remaining placement consumers read the parallel context") moved the CUTLASS launch's `{ep,tp}_{size,rank}` reads from `quant_info` onto `MoeRunnerConfig`, whose properties resolve over the layer placement. The fallback test builds a bare `SimpleNamespace` runner config, so the launch blew up with AttributeError before reaching the small-M fallback it is asserting on. Added the four placement fields (mirroring the copies the quant_info stub already carried — the small-M *gate* still validates those). * the same refactor made `_cutlass_moe_tune_max_num_tokens()` read `get_disagg()`, which raises "config namespace 'disagg' not published" in a bare unit-test process. Patched `get_disagg` to a PD-decode namespace, following the in-tree convention (`test_fused_draft_placement.py:183`), so the real helper still runs; its decode branch needs no other bag. Post-state (CPU, .venv2, CUDA_VISIBLE_DEVICES=9): 21 passed / 51 subtests (was 19 passed, 2 failed / 51 subtests). (cherry picked from commit 4af5c9861ef94db5b090d5983ee1950f33911b08)
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 21, 2026
…nfig, and never let it fail a forward _smallm_ineligibility_reason (fork-local, e787ec6) still read moe_tp_size / moe_ep_rank / moe_ep_size from FlashInferCutlassMoeQuantInfo after upstream 10edb05 (sgl-project#42348) deleted those fields and rewired its own consumers onto MoeRunnerConfig. The reads sit outside the try/except that guards the JIT launch, so any call reaching them raised AttributeError out of _run_flashinfer_cutlass and took down a scheduler process. The branch is unreachable at EP>1 today only because the load-time gate refuses the workspace, so the fault is latent, not absent: enable small-row MoE and the first forward crashes. - retarget the three reads to runner_config.*, already a parameter here and what this file's CUTLASS launches read (moe_* are properties over the layer) - wrap the eligibility decision: a raise now degrades to CUTLASS and warns once per distinct text (the shared dedupe set keeps a per-layer fault from repeating every forward) instead of propagating - test_nvfp4_smallm_dispatch.py builds a REAL FlashInferCutlassMoeQuantInfo in both fixtures; the old SimpleNamespace carried the deleted attributes and so satisfied the dangling reads. Red/green: 19F at HEAD, 25P/57sub here. New pins for the placement source and the degrade-on-raise contract. Verdicts are unchanged for every configuration reachable today: same topology numbers, and the new fallback reason only fires where the call used to raise.
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 21, 2026
…at states its layer Three CUDA-gated tests built FlashInferCutlassMoeQuantInfo(moe_ep_size=2). That field is gone upstream since 10edb05 (sgl-project#42348), so each raises TypeError in setUpClass-adjacent code on real SM120 hardware -- invisible here, because the class is skipUnless(is_sm120_supported()) and a CPU run only executes the three metadata tests. MoeRunnerConfig is now where both the small-row gate and the CUTLASS launch read placement, so give those configs the layer stub the fused funcs expect (16 routed experts over EP2, TP1), the same idiom test_moe_runner_config_placement.py uses. No behavior change: the placement values match the ones the deleted quant-info field carried, so every case keeps its intended verdict.
detain
added a commit
to detain/sglang
that referenced
this pull request
Oct 21, 2026
…ment leftovers (gate retarget + degrade-not-raise, MAX_EP door default-off, 3 hardware-broken tests), record both run scripts going PCIe-IPC-live with the corrected needle table and the 3 stale comment blocks, and the A/B harness re-pin + 4 arms asserting on non-existent log strings Entry 244 = fea818f / 96a6d58 / c1323ca. One root cause, three sites: upstream 10edb05 deleted moe_tp_size/moe_ep_rank/moe_ep_size from FlashInferCutlassMoeQuantInfo and a fork gate, a unit fixture and a CUDA-gated kernel test all kept reading them. Severity corrected against my own earlier note -- SGLANG_NVFP4_MOE_SM120 defaults True, so any EP1 SM120 host loading an NVFP4 checkpoint builds a workspace and the first <=16-token MoE forward raised AttributeError out of a fused func and killed a scheduler; skynet2 escaped only because EP4 refuses the workspace. Entry 245 = /root/run_sglang_qwenflashnext9{,c}.sh (not in git): 9.sh change 14 exports SGLANG_ENABLE_PCIE_IPC_ALLREDUCE=1 (first-ever boot for either arm), 9c.sh now FOUR deltas, plus the corrected needle table, five needle-string traps, and the three comment-only corrections (change count 6 -> 14, +30.2% -> same-code +28.51% against 6,192,832, HiCache/L3 PARKED on both arms). Functional streams md5-identical across the comment edits. Entry 246 = /root/ab_harness (not in git): arms 33/34/35 pulled off the advisory NEEDLE 0 bound, and four arms (21/22/36/38) whose positive needles reference strings that do not exist anywhere in the tree -- left un-rebound on purpose, they need a real boot. base/ is stale vs the parked-L3 script. Header synced to 246 / tip c1323ca; CAVEATS gains the moved CPU pins (test_nvfp4_smallm_dispatch.py 21P/51sub -> 28P/66sub measured in the PROD venv, test_nvfp4_moe_sm120.py 3P/15S unchanged but now hardware-correct, kernels_namespace still 76P, rust untouched) and a BEHAVIOR WATCH bullet for the first PCIe-IPC boot. Entries 242/243 annotated in place; NO upstream merge in this batch and no sgl-project#45151 port claim (it is entry 232).
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack (oldest at bottom):
Motivation
Placement values (ranks, widths, process groups) are threaded through constructors and stored as copies, so a reader cannot tell which copy is authoritative and a copy can go stale. This is the last batch of consumers that were still handed placement instead of reading it where they run.
It also makes one latent class of bug loud: several layers shard their weights over the attention-TP group but all-reduce over the full TP group. The two groups differ only when attention DP or attention CP makes attention TP narrower than TP, and there the reduction mixes ranks that hold other requests.
Modifications
Consumers read their own placement.
MoeRunnerConfigcarries the layer it belongs to, and the FlashInfer CUTLASS (standard and MXFP4) and HPC-Ops fused funcs read the MoE placement off it. Seven quant-info producers stop copying four fields on every apply. The layer is the single address: DWDP'sbind_full_expert_weightsupdates it alone, and the CompressedTensors MXINT4 scheme follows that bind instead of recording the deployment rank at construction.get_dp_tp_group()replaces six inline copies of "the attention-TP group under attention DP, otherwise the TP group".LoRAInfodrops fields thatfully_shardedbeing always false made dead.A layer that shards over attention TP must reduce over it.
reject_attn_tp_shard_with_tp_reducerefuses such a layer at construction, before weights load, naming both group widths and the ways out. It coversVisionAttentionand the CLIP, PhiMoE, Step3 and MoonViT layers that reduce over TP, and the Qwen3-VL and MiniMax-VL layers that reduce over attention TP only under attention DP. IQuest-Q1 is checked only when its attention owns the reduction (reduce_results=True): the decoder now returns partial outputs to its attention boundary. EXAONE-MoE already delegates its attention reduction to that boundary on currentmain, so it is not gated. Each site keeps a TODO: the real fix is to reduce over the attention-TP group so these models can run those layouts.Most models build their multimodal tower unconditionally, and several kinds of worker hold one they never forward: an encoder-disaggregated language instance, a language-model-only instance, and a PD decode instance, which embeds nothing. The encoder sites say they are encoders and
multimodal_encoder_runs_hereanswers for all three, so none of them is refused over a reduction it never reaches. Adaptive dispatch is the exception on the first: it keeps the requests it does not send to the encoder and forwards the tower for them, so that layout is still checked. Text attention is checked on every worker, including a language-only one, where its output projection runs just the same.The MiMo audio encoder is exempt for now, with a TODO: it shards over attention TP and reduces over TP, and refusing it would refuse MiMo-V2.5's documented
--tp 8 --attn-dp-size 2deployment.Deprecation.
--dp-size Nunder DeepSeek context parallelism still means N attention-DP groups and now logs a deprecation warning; it will be rejected after 2026-12-31.ServerArgs.resolved_dictkeeps reporting the deprecatedenable_dp_attentionfor clients that read it from/server_info, so--enable-dp-attentionbeside--attn-dp-sizeis redundant rather than rejected and a config read back resolves to the same layout.Compatibility
Two deliberate changes in observable behaviour:
--attn-dp-sizebetween 1 and--tp-size, or with--attn-cp-sizegreater than 1, on a worker that forwards its tower; and PhiMoE text attention at the same widths; an IQuest-Q1 attention that owns its reduction is checked too.--attn-dp-sizeequal to--tp-sizeand--mm-enable-dp-encoderare unaffected. No cookbook recipe is affected: the deployments documented for these models either set--attn-dp-sizeequal to--tp-sizeor are MiMo, which is exempt for now./server_inforeportsenable_dp_attentionagain. It had becomefalseunder attention DP when--attn-dp-sizereplaced the flag; it now reports whether an attention-DP width is configured, as before, until the flag is removed after 2026-12-31.dp_sizekeeps its new meaning of replicas, so a client counting DP ranks should readdp_size * attn_dp_size.Accuracy Tests
The results below precede the landing rebase. That rebase retains upstream DeepSeek-V4 HIP validation, conditions the IQuest-Q1 gate on ownership of the reduction, and removes the obsolete EXAONE-MoE gate/test after its boundary migration. Tests and benchmarks were not rerun for landing.
H200, this PR vs its base.
--moe-runner-backend flashinfer_cutlass--tp 2--tp 2 --ep-size 2--tp 2--moe-runner-backend flashinfer_mxfp4--tp 2--tp 2 --ep-size 2--tp 2,--tp 2 --attn-dp-size 2Greedy output is not deterministic for these models, so each configuration was run several times on the base: every difference seen against this PR is reproduced between base runs alone. A probe on the kernel boundary shows the FlashInfer CUTLASS call receives identical
tp_size/tp_rank/ep_size/ep_rankper rank on both sides in all four MoE configurations.Qwen3-VL-2B with a real image answers identically to the base, md5-for-md5, at
--tp 2,--tp 2 --attn-dp-size 2, and with--mm-enable-dp-encoder; Kimi-K2.5's MoonViT encoder likewise. DeepSeek CP resolution warns exactly once per deprecated spelling and rejects replicas combined with attention DP before warning./server_inforeports the same layout for both spellings, and every readback re-resolves to the same layout.test/registered/unitat this PR's head, compared with its base: no new failures.Not exercised. Five of the nine quant producers that stopped copying placement have no checkpoint here or need Blackwell (ModelOpt FP8 and NVFP4, CompressedTensors NVFP4 and MXINT4, SM120 CUTLASS); their kwargs are unchanged and were read from the same layer before. The gated layers in MiniMax-VL, Step3, PhiMoE and IQuest-Q1 have no checkpoint either, so the check on them is covered by unit tests against the layer classes rather than a server. DWDP's full-expert bind is covered by a unit test that runs the fused func, not by a DWDP deployment.
Speed Tests and Profiling
Not applicable.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): 🚫 Run #37156874006
Latest PR Test (Extra): 🚫 Run #37156873918
Latest PR Test (AMD ROCm 10): 🚫 Run #37156873959