perf(mtp): fuse EAGLE decode into CUDA graphs - #1451
Open
sufubao wants to merge 2 commits into
Open
Conversation
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.
Summary
gather_tokenand add focused regression coverage for scratch reuse, mapping restoration, graph dispatch, padding state, and runtime guardsThe fused path is limited to supported single-draft EAGLE requests. DP, RL, decode microbatch overlap, constrained decoding, custom generators, invalid-token masks, token penalties, unsupported attention backends, and oversized graph inputs continue through the existing decode path.
LIGHTLLM_DISABLE_MTP_FUSED_GRAPH=1provides an explicit opt-out.Why
The existing EAGLE path launches the main-model graph and each draft forward separately, with eager tensor allocation, KV-slot rotation, and inference-state setup between launches. At small and medium batch sizes, this host-side work is a measurable part of inter-token latency.
The scratch slots are reserved once while the KV pool is empty. Intermediate draft KV is discarded after the chain, and the verified KV mapping is restored before the next decode step.
Validation
Local serving benchmark:
[-10.54%, -0.81%][+0.64%, +9.73%][-7.68%, -1.30%][+1.24%, +7.40%][-7.54%, +0.25%][-0.34%, +7.33%][-6.97%, -0.28%][+0.33%, +6.09%][-7.69%, +3.88%][-3.36%, +6.99%][-5.14%, +1.61%][-2.16%, +5.08%]Across all concurrency levels, the geometric-mean ITL change is -3.62%
[-5.40%, -1.81%]and throughput change is +3.16%[+1.59%, +4.77%]. The gain is statistically clear at low/medium concurrency; the concurrency 16/32 result is not distinguishable from noise in this experiment.