Skip to content

[Spec] Support FlashInfer CUDA graph for EAGLE draft-extend - #28782

Merged
hnyls2002 merged 6 commits into
mainfrom
lsyin/eagle-draft-extend-de-sync
Jun 21, 2026
Merged

hnyls2002 merged 6 commits into
mainfrom
lsyin/eagle-draft-extend-de-sync

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Jun 20, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Run the EAGLE draft-extend forward as a captured CUDA graph for FlashInfer (add FlashInferAttnBackend to the draft-extend graph whitelist), replacing eager per-layer launches.
  • ~10% online median E2E latency improvement (request-rate 8, Llama-2-7B EAGLE topk=4); accept length unchanged.

Changes

  • Graph capture: add is_draft_extend_v2() branches to _prepare_cuda_graph_metadata / init_forward_metadata_out_graph so the draft-extend forward replays as a causal paged-prefill graph.
  • Fixed qo layout: EagleDraftExtendInput.generate_attn_arg_prefill uses a constant num_draft_tokens qo layout (required for graph capture/replay), matching the padded draft-extend input.
  • Drop a per-step D2H: pass host-known extend_prefix_lens_cpu into FlashInferIndicesUpdaterPrefill.update, replacing paged_kernel_lens.sum().item() with a host-side sum.

Notes

  • FR-Spec (speculative_token_map) falls back to eager: the draft-extend graph buffers are sized to the full draft vocab and are incompatible with the reduced (hot) vocab head.

CI States

Latest PR Test (Base): ❌ Run #27916144655
Latest PR Test (Extra): 🚫 Run #27916144559

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for the FlashInfer attention backend in the Eagle draft-extend speculative execution path, enabling CUDA graph capture and replay by using a fixed query-output (qo) layout. It also optimizes performance by passing host-side prefix lengths (extend_prefix_lens_cpu) to avoid device-to-host synchronization. However, the review highlights a potential runtime crash: the update_sliding_window and update_cross_attention methods in FlashInferIndicesUpdaterPrefill need to be updated to accept the new extend_prefix_lens_cpu parameter to prevent TypeError exceptions when those features are active.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread python/sglang/srt/layers/attention/flashinfer_backend.py
@hnyls2002

hnyls2002 commented Jun 20, 2026 •

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_spec_eagle_topk.py test_spec_eagle.py test_bench_serving_1gpu_large.py

@github-actions

github-actions Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_spec_eagle_topk.py test_spec_eagle.py test_bench_serving_1gpu_large.py:

🚀 1-gpu-5090 (2 tests): ❌ View workflow run

cd test/ && python3 registered/spec/eagle/test_spec_eagle_topk.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/perf/test_bench_serving_1gpu_large.py

@github-actions

github-actions Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_spec_eagle_topk.py test_spec_eagle.py test_bench_serving_1gpu_large.py:

🚀 1-gpu-5090 (2 tests): ❌ View workflow run

cd test/ && python3 registered/spec/eagle/test_spec_eagle_topk.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py

🚀 1-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/perf/test_bench_serving_1gpu_large.py

@hnyls2002

Copy link
Copy Markdown
Collaborator Author

/rerun-test test_spec_eagle_topk.py test_spec_eagle.py

@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test_spec_eagle_topk.py test_spec_eagle.py:

🚀 1-gpu-5090 (2 tests): ✅ View workflow run

cd test/ && python3 registered/spec/eagle/test_spec_eagle_topk.py
cd test/ && python3 registered/spec/eagle/test_spec_eagle.py

@hnyls2002 hnyls2002 added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) bypass-fastfail labels Jun 21, 2026
@hnyls2002
hnyls2002 merged commit 8e89039 into main Jun 21, 2026
160 of 177 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/eagle-draft-extend-de-sync branch June 21, 2026 21:46
Chronostasys pushed a commit to MindLab-Research/sglang that referenced this pull request Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bypass-fastfail run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant