perf: eliminate validate-to-draft bubbles with asynchronous device-side handoff.#1966
Draft
maojunx99 wants to merge 10 commits into
Draft
perf: eliminate validate-to-draft bubbles with asynchronous device-side handoff.#1966maojunx99 wants to merge 10 commits into
maojunx99 wants to merge 10 commits into
Conversation
Restore the existing speculative-token broadcast capability guard at the draft and validation sampling sites. NPU enablement is maintained independently on the bugfix branch.
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.
Description
The NPU becomes idle between target-model validation/sampling and the next draft-model forward when MTP is enabled.
The previous execution path waited for validation results on the host, copied accepted-token state from device to host, rebuilt the next decode input on CPU, and copied the metadata back to device before launching the draft model. Stream
synchronization and scheduler serialization made this latency directly visible as a validate-to-draft bubble.
Changes
slot calculation device-resident across MTP iterations.
blocking the scheduling thread with unnecessary stream synchronization.
overwriting valid KV cache data.
the canonical scheduler state before switching to the device-resident path.
handoff, including the accepted-prefix offset during the first transition.
host memory every iteration.
MtpPrepareNextDraftAscendC fused operator to replace thesequence of small Torch operators used for:
path readable.
Profiling Comparision (qwen3.5 2b tp=2 mtp=3)
before:

after:

Performance Statistics
Relevant PR
xLLM-AI/xllm-ops#18
Change Type
Build and Test Coverage
python setup.py build testhas passed on a CUDA machine.python setup.py build testhas passed on an NPU machine.python setup.py build testhas passed on an MLU machine.Reviewer Notes