Repository navigation
[Fix] dLLM: Preserve prompt tails and literal mask tokens across prefix reuse - #39592
Merged
Merged
Conversation
3 of 5 tasks
0z5a
marked this pull request as ready for review
September 16, 2026 11:50
0z5a
requested review from
ClawSeven,
Fridge003,
Ying1123,
hnyls2002,
ispobock,
merrymercy,
rwang5203 and
xiezhq-hermann
as code owners
September 16, 2026 11:50
0z5a
marked this pull request as draft
September 18, 2026 18:29
0z5a
marked this pull request as ready for review
September 18, 2026 18:34
0z5a
marked this pull request as draft
September 18, 2026 23:25
0z5a
marked this pull request as ready for review
September 19, 2026 07:52
0z5a
marked this pull request as draft
September 19, 2026 15:05
0z5a
added a commit
to 0z5a/sglang
that referenced
this pull request
Sep 23, 2026
Signed-off-by: 0z5a <[email protected]>
0z5a
added a commit
to 0z5a/sglang
that referenced
this pull request
Sep 24, 2026
Signed-off-by: 0z5a <[email protected]>
0z5a
force-pushed
the
dllm-prefix-tail
branch
from
September 24, 2026 01:17
0cac819 to
53657b3
Compare
Signed-off-by: 0z5a <[email protected]>
…unting Signed-off-by: 0z5a <[email protected]>
Signed-off-by: 0z5a <[email protected]>
Signed-off-by: 0z5a <[email protected]>
Signed-off-by: 0z5a <[email protected]>
0z5a
force-pushed
the
dllm-prefix-tail
branch
from
September 24, 2026 06:38
53657b3 to
8182162
Compare
rwang5203
marked this pull request as ready for review
October 9, 2026 22:20
rwang5203
reviewed
Oct 10, 2026
rwang5203
reviewed
Oct 10, 2026
Collaborator
|
On current main, a prompt holding the mask id still kills the scheduler under |
Collaborator
|
With the regression tests removed, no CI test fails on main for the literal prompt mask, the prefix bound, or negative cached tokens. Could you add one case for each to the existing dLLM tests? |
rwang5203
reviewed
Oct 10, 2026
rwang5203
reviewed
Oct 10, 2026
rwang5203
requested changes
Oct 10, 2026
Signed-off-by: 0z5a <[email protected]>
Collaborator
|
Thanks, folding the prompt lengths into the existing transfer removes the sync. Could we build |
Every denoise pass carried the committed lengths in a pinned staging buffer and ran a comparison kernel to build dllm_prompt_mask, although only requests whose committed tokens contain the mask ID need it. Record per request whether its prompt or kept outputs hold the mask ID, computed once when its fill IDs are first built and again after retraction. Batches without such a request keep the plain position transfer and leave dllm_prompt_mask unset, where every mask ID in the block is still to be denoised and the algorithms' existing fallbacks give the same prompt positions.
Collaborator
|
/rerun-failed-ci |
1 similar comment
Collaborator
|
/rerun-failed-ci |
Collaborator
|
/rerun-failed-ci |
rwang5203
approved these changes
Oct 18, 2026
Fridge003
approved these changes
Oct 19, 2026
5 tasks done
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.
Incremental review: Files changed against
main.dLLM prefix lookup can consume a partial prompt block and its synthetic masks when a cached prompt contains the same literal mask IDs. Literal mask IDs in a real prompt can also be denoised and emitted as generated tokens, causing KV accounting errors and a serving crash.
Bound cache lookup by complete real-token blocks and classify the request after matching its cache prefix. Carry an explicit committed-position mask into LowConfidence, JointThreshold and JointThresholdInDel so literal prompt IDs and previously emitted outputs stay immutable after retraction. Repeated denoising no longer subtracts the current block from the reported cached-token count. The change preserves autoregressive lookup and logprob boundaries.
The GPU/HTTP results below are historical qualification of the previous revision; they were not rerun for the October 10 refresh.
--no-dllm-fdfo)HTTP tests use
JetLM/SDAR-1.7B-Chat-b32, BF16, TP=1, Triton, CUDA graphs disabled, block size 32, threshold 0.95, greedy sampling, 32 new tokens, andignore_eos=true. Hardware: RTX PRO 4000 Blackwell 24 GB; Python 3.12, PyTorch 2.13.0+cu130, sglang-kernel 0.4.7. Each configuration runs 19 actual/generaterequests. An observation-only wrapper records cache matches afterReq.init_next_round_input.The collision test first caches a 33-token prompt followed by 31 literal mask IDs, then submits the original 33-token prompt. Its output matches a clean-cache request and only 32 tokens are reused. Unit tests additionally exercise both JointThreshold implementations and both scheduling modes. These results do not qualify CUDA graph execution or multi-block prefill.
Contributes to the prefix-cache / prompt-tail item in #39499. The post-cache phase ordering overlaps the prerequisite in #31586; this PR does not add its multi-block scheduler.
CI States
Latest PR Test (Base): ✅ Run #39056280279
Latest PR Test (Extra): ❌ Run #39056280293
Latest PR Test (AMD ROCm 10): ❌ Run #39056280358
October 10 review follow-up
Merged main
c55790d38ba0c41170cec8993e7a85d5c687149cand addressed the remaining review items:torch.whereto exclude committed positions. Algorithms read the declared ForwardBatch field directly, and test doubles provide it explicitly.All scoped pre-commit checks passed, including CI registry validation. CPU source execution passed 25 exact repository algorithm tests, committed-token phase/prefix controls over 72 prompt/output layouts, three actual position-branch controls and the repeated-pass cache-accounting guard. Negative controls reproduced the literal-prompt InDel failure; these tests also caught and corrected its mask-count/transfer path. This source-level run omits package initialization and native dependencies. Full registered-suite and HTTP reruns require the complete SGLang environment and were not executed in this refresh; no GPU performance or memory measurement is claimed.
Review fix commit:
0fbe7e46218ce8b728c72095f1332c3b98e6de19.