Repository navigation
Enable breakable CUDA graph for eagle - #25795
Conversation
|
/tag-and-rerun-ci |
There was a problem hiding this comment.
Code Review
This pull request enhances the BreakableCudaGraphRunner to support multimodal models and Eagle speculative decoding. Key updates include the introduction of CaptureHiddenMode for flexible hidden state management, implementation of a custom replay_prepare method for draft workers, and logic to handle input_embeds in multimodal scenarios. The PR also modifies the ModelRunner to allow forced initialization of piecewise CUDA graphs for draft workers and adds utility functions for calculating draft hidden dimensions. Feedback was provided regarding the use of assert statements for runtime validation, suggesting they be replaced with ValueError to prevent them from being optimized away in production environments.
- Add draft worker support to BreakableCudaGraphRunner: capture_hidden_mode, spec_info with hidden states, and replay_prepare for draft hidden state copy - Add multimodal/input_embeds support to BCG replay path - Add force parameter to init_piecewise_cuda_graphs for draft workers - Eagle worker calls init_piecewise_cuda_graphs(force=True) when BCG enabled - Simplify prefill disaggregation: always disable CUDA graph for prefill mode - Add get_draft_hidden_dim utility to eagle_utils Co-authored-by: Lianmin Zheng <[email protected]>
- Move `import inspect` to top-level imports (merrymercy) - Add TODO about fixing PiecewiseCudaGraphRunner for draft workers (merrymercy) - Restore deleted comment block before replay_layer_forward (merrymercy) - Replace assert with ValueError for runtime validation (gemini-code-assist) - Fix black formatting (collapse multi-line conditions)
4f32300 to
4e07947
Compare
… from sgl-project#25795 The cuda graph runner refactor (sgl-project#23906) consolidated BCG and PCG into PrefillCudaGraphRunner but dropped four sgl-project#25795 hooks needed for BCG+EAGLE end to end: * __init__: capture_hidden_mode for BCG+EAGLE — draft worker LAST, target worker FULL. * __init__: allocate static_draft_hidden_states buffer for BCG+draft+EAGLE (captured segments hold its address). * capture_prepare: pass spec_info=EagleDraftInput(hidden_states=...) aliasing the static buffer instead of spec_info=None. * load_batch: copy live forward_batch.spec_info.hidden_states into the static buffer before replay. Also narrow the existing model_runner.py skip block to non-BCG so the restored target-FULL capture isn't short-circuited to eager_runner. tc_piecewise stays on the skip — it has no pre-sgl-project#23906 logic to restore here, and its dead-graph capture corrupts FP4 / TRTLLM-MoE decode replay (see sgl-project#28386). Alternative to PR sgl-project#28809, which only attempted the target-worker capture_hidden_mode flip, botched the tc_piecewise branch (codex P1), and dropped the skip block — reproducing the sgl-project#28386 corruption end to end (gsm8k=0.0 on test_deepseek_v3_fp4_mtp_small in PR Test (Base)). Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Motivation
Enable breakable CUDA graph (BCG) support for eagle speculative decoding
Modifications
forceparameter toinit_piecewise_cuda_graphsso draft workers can explicitly initialize PCG/BCG afterinit_lm_headinit_piecewise_cuda_graphs(force=True)when BCG is enabledget_draft_hidden_dimutility for deriving draft hidden state dimensionsSkipped files
http_server.py: Warmup logging fix already applied in OSSeagle_draft_extend_cuda_graph_runner.py: Hidden dim calculation already refactored in OSS viaEagleDraftExtendInput.hidden_size_forOriginal commits
5f2c73d2cCI States
Latest PR Test (Base): ✅ Run #26179533584
Latest PR Test (Extra): ✅ Run #26179533125