Skip to content

[Feat] spec: Let out-of-tree platforms provide EAGLE draft graph runners - #45145

Merged
alexnails merged 1 commit into
mainfrom
yihao/oot-draft-graph-runners
Oct 24, 2026
Merged

alexnails merged 1 commit into
mainfrom
yihao/oot-draft-graph-runners

Conversation

@AgainstEntropy

@AgainstEntropy AgainstEntropy commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

An out-of-tree (OOT) platform that runs the built-in EAGLEWorkerV2 with device graph capture cannot capture the EAGLE draft graphs:

  • EagleDraftWorker._capture_cuda_graphs looks the draft decode and draft extend runners up in maps keyed by in-tree device names (cuda, npu, xpu, musa), which raises KeyError for an OOT device.
  • Adaptive speculation (--speculative-adaptive) hardcodes NPUGraphRunner if _is_npu else DecodeCudaGraphRunner for its per-configuration target verify graphs, so an OOT platform gets the CUDA runner, while its startup target verify graph comes from get_graph_runner_cls().

This is part of generic OOT speculative-decoding support, for platforms that use the built-in worker (the previous PR covers platforms that bring their own worker).

Modifications

  • SRTPlatform.get_speculative_graph_runner_cls(algorithm, phase) (default None) with phase in "draft_decode" / "draft_extend". The class is constructed like the built-in runner for that phase. None runs the phase eagerly, and the hook is not consulted when capabilities.graph_capture is False.
  • _select_spec_graph_runner_cls picks the runner in one place: built-in platforms keep today's device-keyed selection (including the draft extend backend conditions); on an OOT platform only the platform answers, so the device maps are never indexed.
  • Adaptive target verify runners on an OOT platform come from get_graph_runner_cls(), the same class as the startup target verify graph, so one run never mixes runner classes across step configurations. The keyword arguments it must accept (attn_backend, speculative_num_steps, speculative_num_draft_tokens) are documented on the hook.
  • Docs: the plugin guide lists the new hook and the adaptive requirement on get_graph_runner_cls().

Accuracy Tests

No change on built-in platforms: their runner selection is evaluated exactly as before.

Speed Tests and Profiling

N/A.

Tests

Added to test/registered/unit/spec/test_oot_eagle_hooks.py (CPU):

  • _capture_cuda_graphs on an OOT device takes the draft decode and draft extend runners from the platform and constructs them with the worker (fails with KeyError: 'custom' before this change);
  • nothing is consulted or captured without capabilities.graph_capture;
  • built-in platforms never consult the platform hook.
pytest test/registered/unit/spec/ test/registered/unit/platforms/ \
       test/registered/unit/test_split_attention_backend_decisions.py
# 398 passed, 2 skipped

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): 🚫 Run #40062441986
Latest PR Test (Extra): ❌ Run #40062442010
Latest PR Test (AMD ROCm 10): 🚫 Run #40062442003

@AgainstEntropy

Copy link
Copy Markdown
Collaborator Author

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 22, 2026
@AgainstEntropy

Copy link
Copy Markdown
Collaborator Author

/rerun-failed-ci

@alexnails
alexnails force-pushed the yihao/oot-draft-graph-runners branch from ef8ca35 to 6fb31cf Compare October 24, 2026 03:59
Base automatically changed from yihao/oot-spec-worker to main October 24, 2026 04:25
@mintlify

mintlify Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
sglang-doc 🟢 Ready View Preview Oct 24, 2026, 4:29 AM

💡 Tip: Enable Automations to automatically generate PRs for you.

Stacked on "[Feat] spec: Let out-of-tree platforms provide their own
speculative worker".

An out-of-tree platform that runs the built-in EAGLEWorkerV2 with device
graph capture cannot capture the draft graphs: EagleDraftWorker looks the
draft decode / draft extend runners up in maps keyed by in-tree device
names, which raises KeyError for an OOT device. Adaptive speculation also
hardcodes the CUDA runner for its per-configuration target verify graphs.

- SRTPlatform.get_speculative_graph_runner_cls(algorithm, phase) for
  "draft_decode" and "draft_extend"; None runs the phase eagerly, and it
  is not consulted when capabilities.graph_capture is False. On an OOT
  platform the device-keyed maps are never indexed.
- Adaptive target verify runners on an OOT platform come from
  get_graph_runner_cls(), the class the startup target verify graph
  already uses; document the keyword arguments it must accept.
- Built-in platforms keep their current selection.
- Document the hook in the plugin guide.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexnails
alexnails force-pushed the yihao/oot-draft-graph-runners branch from 6fb31cf to f8e4e2b Compare October 24, 2026 04:27
@alexnails
alexnails merged commit a7183a8 into main Oct 24, 2026
65 of 81 checks passed
@alexnails
alexnails deleted the yihao/oot-draft-graph-runners branch October 24, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants