Repository navigation
perf(schedule): interleave busy prefill with decode and align admission across DP ranks - #5187
silencelamb wants to merge 7 commits into
Conversation
…sion rounds (cherry picked from commit 8ff9e72)
0a0ce34 to
6a1b635
Compare
|
Need real DP timing and performance validation for the current version. |
|
@yidingcheng0206 We measured the same unmodified
Compared with off, period 4 changed output throughput by +16.33%, completed requests/s by +13.76%, TTFT p95 by +916.8 ms and TPOT p95 by -36.58 ms. Actual rank-zero metadata during injection (Off: 4,068 rounds, 1.224 mean prefill ranks/round; Period 2: 5,413 rounds, 1.430 mean prefill ranks/round; Period 4: 4,661 rounds, 1.770 mean prefill ranks/round). The PR includes the 1–8 rank histogram and the fraction of prefill rounds on each admission phase. Full report · Off rounds · Period 2 rounds · Period 4 rounds |
RunningLeon
left a comment
There was a problem hiding this comment.
Thanks for the updated DP measurements. I reran the two scheduling cases on d987c93: both pass on the stacked base and with the policy off, but fail with it enabled.
| if len(running) == 1 and maker.long_context_chunker.is_long_context(running[0]): | ||
| maker.long_context_chunker.set_seq(running[0]) | ||
| if len(running) == 1 and maker.long_context_chunker.is_long_context(running[0], self.token_budget): | ||
| maker.long_context_chunker.set_seq(running[0], self.token_budget) |
There was a problem hiding this comment.
With a busy budget of 32, a multimodal prefix hit can leave a 64-token tail that fits in one forward. set_seq replaces the chunker for the already-running request, then clear() drops it: in my scheduler test that request had 288 prompt tokens left and no subsequent forward. Could we use the admission result (kv_token_limit) to identify a non-final chunk before replacing the owner, and test that the original request finishes?
There was a problem hiding this comment.
I reproduced the lost continuation on d987c93b and fixed it in b072bc25. The input maker now starts a chunk chain only when admission returns a non-final kv_token_limit. A cache-hit tail that fits in one forward goes through normal prefill and leaves the active chunker owner in place.
The regression uses the real prefix trie and scheduler with a busy budget of 32. B reuses a 64-token image prefix and submits its 64-token text tail in one forward. A keeps ownership, submits its remaining 288 tokens in order, and enters decode. Regression test
A separate chunk-sizing behavior predates this PR: an image span already covered by a prefix hit can still enlarge the chunk capacity for the remaining text. We’ll address that separately so cached images no longer expand the text budget and only an indivisible image span that still needs computation can raise the chunk limit. Existing base regression
| return None | ||
| if not any(seq.status == MessageStatus.RUNNING for seq in self.running_seqs): | ||
| return None | ||
| return min(budget, self.config.max_prefill_token_num) |
There was a problem hiding this comment.
With a dLLM block length of 4 and a busy budget of 3, a 12-token prompt produces a 3-token chunk. The unmasker then fails at unflatten(0, (-1, 4)); the same prompt passes with the policy off. Please align the effective budget to whole denoising blocks and reject budgets smaller than one block, or reject this policy for dLLM at startup if it is not supported.
There was a problem hiding this comment.
I took the startup-rejection option in b072bc25. Interleaved prefill in this PR supports autoregressive models, including speculative verification. Once the host resolves the target model as dLLM, a positive LMDEPLOY_INTERLEAVED_PREFILL_TOKENS raises a ValueError before the executor or workers are created. The error tells the operator to unset the variable or set it to zero.
The regression covers the reported block length 4 / budget 3 case and an aligned budget of 4. Both are rejected because dLLM is outside this policy’s scope. With a zero budget, dLLM startup proceeds, including when a DP period is configured by itself. Startup regression
Scheduling policy
In an MTP3 test, 24 uncached 8K prompts arrived while 32 requests were streaming. The median of the streams’ longest output gaps was 1,810 ms. Capping new prefill work at 4,096 tokens on busy ranks and giving decode or verification a turn between prefills cut that gap to 535 ms.
When ranks admit prefills in different rounds, more collective rounds have to wait for a rank doing prefill. Aligning admission to the existing collective round number (period 2) kept the median gap at 614 ms and let all 24 new requests finish in 2.38–2.54 s, down from 3.20–3.25 s with local interleaving alone. Streaming timeline
Idle ranks can use the full engine prefill budget. This policy supports autoregressive generation, including speculative verification. Starting a dLLM with a positive busy prefill budget raises a configuration error before worker creation. This PR is stacked on #5186 at
fb433c7d.LMDEPLOY_INTERLEAVED_PREFILL_TOKENS--max-prefill-token-num. Existing multimodal chunk rules can expand a chunk to accommodate an indivisible span.LMDEPLOY_DP_PREFILL_PERIODPerformance
GLM-5.3-Flash, 8×H200, DP8/EP8/TP1, MTP3. The fixed-length and incremental-stack results below are historical. The three C100 scheduler configurations below were measured on the same commit,
d987c93b, before the correctness follow-up.Fixed input/output. Each request had 8,192 input and 256 output tokens at C64. Throughput is total output tokens divided by total elapsed time across four runs per policy. Latency ranges are across service launches. Methodology and ablations · Reproduction tools and data
AgentX. Weka 256K, seed 20260707, RDMA Mooncake, 1,800 seconds per window. C90 used MegaMoE and FlashKDA on both sides and shows the best observed aligned throughput. At C100 the baseline includes #5186, #5211, #5212 and #5216. Both admission periods use a 4,096-token busy prefill budget.
Alignment improved output throughput and TPOT P95 in both workloads. AgentX TTFT P95 increased by 223 ms at C90 and 372 ms at C100 with period 4. C90 deployment · FlashKDA integration · C90 configurations · Raw C90 measurements · Five-PR AgentX report
AgentX C100 on scheduler head
d987c93bEach policy ran once from a cold start on the same unmodified commit and image. We used 8×H200, DP8/EP8/TP1, MTP3, MegaMoE, FlashKDA, and RDMA Mooncake. All windows used the Weka 256K workload, seed 20260707, concurrency 100, 1,800 s injection, an 8,192-token engine budget, 48,000 KV blocks/rank and identical DEBUG logging. The enabled policies used a 4,096-token busy prefill budget.
Completed requests/s comes from the client’s request throughput for each scored window, including drain. Rank counts below use the 1,800 s injection interval. The worker on rank zero logs the number of non-dummy prefill ranks after each real collective containing prefill.
The per-round CSVs include round number, timestamp, measurement phase, active prefill rank count, and per-rank query-token counts.
Full report · Off rounds · Period 2 rounds · Period 4 rounds
Accuracy and validation
GSM8K on GLM-5.3-Flash FP8 with native experts, scored at
b45dad94. All 1,319 questions, five-shot greedy decoding, C32, 1,024 output-token limit. Per-run counts and scoring detailsAt
b072bc25, a real-scheduler regression verifies that serving a 64-token tail after a multimodal prefix hit preserves the other request’s 288 pending tokens through its final chunk and transition to decode. Startup tests cover dLLM with the policy disabled and with positive budgets below and equal to a denoising block. The CPU suite passed 755 tests (10 skipped, 32 CUDA cases deselected), and all pre-commit hooks passed. With the policy disabled, the default and chunked-prefill paths each matched the comparison base across 72 replayed scheduling decisions.