Repository navigation
Conversation
YAMY1234
requested review from
ShangmingCai,
Ying1123,
hnyls2002,
merrymercy and
xiezhq-hermann
as code owners
September 20, 2026 23:22
YAMY1234
force-pushed
the
pp-verify/pp-spec-extend-launch-first-main
branch
from
September 20, 2026 23:31
34e826d to
ce5eace
Compare
4 of 5 tasks
YAMY1234
force-pushed
the
pp-verify/pp-spec-extend-launch-first-main
branch
from
September 20, 2026 23:46
ce5eace to
8e79550
Compare
Under PP+spec every non-last stage received the previous outputs before launching its forward. For a verify round that order is required (the launch rebuilds its tree from the relay), but for extend microbatches it makes stage 0 wait for the last stage's result of the microbatch launched pp_size-1 slots earlier, so with pp_async_batch_depth=0 each stage runs at most pp_size-1 forwards per ring round trip: (pp-1)/pp utilization, i.e. 75% on PP4 and 50% on PP2 regardless of layer balance. Extend microbatches consume nothing from the relay, so they now launch first exactly like the non-spec loop; verify rounds keep the old order.
…round In the non-overlap spec path an extend round returns batch.seq_lens itself as new_seq_lens. Copying it back to the CPU is redundant and, since the copy is enqueued behind the forward on the forward stream, it blocks the scheduler until the whole forward has run. Only copy when the worker produced a new tensor (verify rounds).
YAMY1234
force-pushed
the
pp-verify/pp-spec-extend-launch-first-main
branch
from
September 21, 2026 00:45
8e79550 to
b04843d
Compare
Collaborator
Author
|
/tag-and-rerun-ci |
This was referenced Sep 22, 2026
10 of 21 tasks
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.
Motivation
Under pipeline parallelism with speculative decoding (
SGLANG_ENABLE_PP_SPEC=1), every non-last stage receives the previous result dict from the ring before launching its own forward. A verify round needs that order: it rebuilds its tree from the relayed accept results and host-syncs on the previous stage's proxy, which that stage only sends after its own exchange.For extend (prefill) microbatches the order is not needed, and with
pp_async_batch_depth=0it is expensive: stage 0 cannot launch slotj+pp_size-1until the last stage has finished slotj, so each stage runs at mostpp_size-1forwards per ring round trip. That caps every stage at(pp_size-1)/pp_sizeutilization (75% on PP4, 50% on PP2) regardless of layer balance, concurrency or CUDA graphs. The non-spec loop already launches first.Measured per-step period matches
sum(stage kernel time)/(pp_size-1) + CPU overheadon Qwen3.5-397B PP4 (387 vs 398-407 ms), DeepSeek-V4-Flash PP4 (196 vs 197-200 ms) and V4-Flash TP2xPP2 (404 vs 455 ms).Modifications
scheduler_pp_mixin.py:_pp_exchange_outputs_before_forward()decides per microbatch. Extend microbatches launch first (as in the non-spec path); verify rounds andpp_async_batch_depth > 0keep the exchange-first order; the last rank always launches first.scheduler.py: after an extend round the worker returnsbatch.seq_lensitself asnew_seq_lens; skip the redundant host copy, which otherwise blocks the scheduler on the forward stream until the whole forward has run.Results (GB300, Qwen3.5-397B-A17B-FP8, TP1xPP4 + MTP, prefill-only ISL 8192 / OSL 1, C=64, chunk 32768)
DeepSeek-V4-Flash TP1xPP4 + MTP (same workload, layer partition 11,11,11,10): 39,128 -> 45,882 tok/s/GPU (+17%), per-stage period 197 -> 160 ms. Same-config re-runs on Qwen3.8-Flash-Next (+31%), GLM-5.3-Flash (+35%), DeepSeek-V4-Flash + DSpark (+23%) and Kimi-K3 + DSpark (+30%, 2 nodes) show the gain is model-independent; TP2xPP2 arms gain +70% to +107% because their cap was 50%.
Rank 0 trace: result-dict receive moved from before the launch (128/128 steps, median 307 ms blocked) to after it (160/160 steps); compute-busy 67% -> 84%. Decode (verify) rounds are unchanged by construction.
Checklist
test/registered/unit/managers/test_pp_cp_rank_offsets.pypins extend-launches-first / verify-exchanges-first (a silent revert would cost 25% throughput with every functional test green).CI States
Latest PR Test (Base): ✅ Run #35548730272
Latest PR Test (Extra): ❌ Run #35548730174
Latest PR Test (AMD ROCm 10): ❌ Run #35548730269