Repository navigation
Conversation
shenxiul
requested review from
Qiaolin-Yu,
Ying1123,
hnyls2002 and
merrymercy
as code owners
September 18, 2026 05:09
This was referenced Sep 18, 2026
This was referenced Oct 28, 2026
This was referenced Nov 9, 2026
This branch has not been 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.
Why is this change needed?
After each target prefill chunk, DFlash constructs two device tensors from CPU lists: extension lengths and cached-prefix lengths. Each CUDA copy waits on the host before draft KV projection can be queued.
Stage the lengths in pinned CPU memory where supported and transfer them with
non_blocking=True. The existing device-aware pinning helper handles other backends. Int32 values, position construction and cache destinations stay the same: extension lengths[3, 4]with prefixes[10, 20]still produce positions[10, 11, 12, 20, 21, 22, 23].Test Plan
test/registered/unit/spec/test_dflash_overlap_hostsync.py: 6 passed, 1 CUDA-only test skipped on the CPU test host.pre-commit run --files python/sglang/srt/speculative/dflash_worker_v2.py: passed.GPU evidence below was measured with the identical runtime patch in a vendored SGLang deployment; this upstream checkout was validated locally on CPU. The paired runs used the public Inkling NVFP4 target and Modal DFlash draft, TP4 on GB300, six draft tokens, batch 16, ShareGPT, six repetitions, temperature 1, top-p 1, 128 output tokens, and EXTEND autotuning in both arms. Only this patch differed.
Prefill tokens/second/GPU:
All points had zero failed requests and zero retractions; acceptance was unchanged within floating-point aggregation precision. At 8K, paired traces each contained 18 target prefill chunks: blocking pageable H2D copies inside the scheduler fell 36 → 0, and gaps between target spans fell 364.21 → 128.15 ms. The asynchronous transfers remain.
CI States
Latest PR Test (Base): ❌ Run #35309676869
Latest PR Test (Extra): ❌ Run #35309676697
Latest PR Test (AMD ROCm 10): ❌ Run #35309676721