refactor(runner): rename runner replay/load/can_run for the shared surface - #28384
Merged
Merged
Conversation
ch-wan
requested review from
Fridge003,
Qiaolin-Yu,
Ying1123,
hnyls2002,
kpham-sgl,
merrymercy and
pyc96
as code owners
June 16, 2026 03:48
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
ch-wan
requested review from
iforgetmyname,
ispobock,
ping1jing2 and
whybeyoung
as code owners
June 16, 2026 03:48
3 tasks
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 16, 2026 07:03
75a5354 to
c30b541
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 16, 2026 07:03
596eea1 to
ef97913
Compare
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 16, 2026 20:47
c30b541 to
8e80bfe
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 16, 2026 20:47
ef97913 to
b2ef358
Compare
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 16, 2026 20:49
8e80bfe to
553893b
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 16, 2026 20:49
b2ef358 to
17f9845
Compare
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 16, 2026 20:59
553893b to
b104183
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 16, 2026 20:59
17f9845 to
1b867c6
Compare
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 16, 2026 21:24
b104183 to
d59fbb6
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 16, 2026 21:24
1b867c6 to
a40924b
Compare
Collaborator
Author
|
/rerun-test test_deepseek_v3_fp4_mtp_small.py |
Contributor
|
Results for 🚀 |
ch-wan
force-pushed
the
cheng/refactor/forward-unify-dp
branch
from
June 18, 2026 10:23
d59fbb6 to
db9191d
Compare
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 18, 2026 10:23
a40924b to
517404e
Compare
…rface
Pure mechanical rename (behavior-identical). Only the three runner methods
that become the shared BaseRunner abstract surface — dispatched
polymorphically across the cuda-graph runners and the upcoming EagerRunner —
are renamed; everything else keeps its main name:
Runner (Base/Decode/Prefill CudaGraphRunner / spec / NPU / CPUGraphRunner):
replay() -> execute() (per-iter run; shared)
replay_prepare() -> load_batch() (per-iter fill + metadata; shared)
can_run() -> can_run_graph() (dispatch gate; shared)
Kept at their main names (cuda-graph-only — the graph runner and the
ExecutionBackend are purely cuda-graph, so a generic rename would be
gratuitous):
Runner: capture(), capture_prepare(), capture_one_shape()
ExecutionBackend: capture_session(), capture_one(), can_run(),
replay_session(), replay()
Preserved (not our ABC): torch.cuda.CUDAGraph.replay(),
deepep_adapter.replay()/.capture(), tbo_plugin.replay_prepare(),
backend.replay_with_input_update (NPU), the separate ViT graph-runner
hierarchy, and the GenerationBatchResult.can_run_cuda_graph field.
CPUGraphRunner/NPUGraphRunner renamed in lockstep because
ModelRunner.{decode,prefill}_cuda_graph_runner is polymorphic over them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ch-wan
force-pushed
the
cheng/refactor/runner-lifecycle-rename
branch
from
June 19, 2026 08:43
517404e to
64fcd74
Compare
kpham-sgl
added a commit
that referenced
this pull request
Jun 22, 2026
Resolve conflicts from spec v2 refactor: - frozen_kv_mtp_worker.py: removed (replaced by frozen_kv_mtp_worker_v2.py in #27607); ported trtllm_mha draft-attn-backend branch into the v2 worker. - frozen_kv_mtp_cuda_graph_runner.py: adopt shared DecodeCudaGraphRunner surface (_replay_graph + _make_graph_key) from #28081 / #28384. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Chronostasys
pushed a commit
to MindLab-Research/sglang
that referenced
this pull request
Aug 24, 2026
jakki-amd
pushed a commit
to jakki-amd/sglang
that referenced
this pull request
Sep 9, 2026
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.
Motivation
Three runner methods are dispatched polymorphically across the cuda-graph runners (and a forthcoming eager runner). Give them a shared, intent-revealing surface; leave the cuda-graph-only methods named as they are.
Modifications
Base/Decode/Prefill CudaGraphRunnerand the speculative / NPU / CPU graph runners:replay()→execute()(per-iter run)replay_prepare()→load_batch()(per-iter fill + metadata)can_run()→can_run_graph()(dispatch gate)capture()/capture_prepare()/capture_one_shape();ExecutionBackendcapture_session()/capture_one()/can_run()/replay_session()/replay().torch.cuda.CUDAGraph.replay(), the deepep / tbo / ViT runner hierarchies, and thecan_run_cuda_graphresult field.Pure mechanical rename, behavior-identical.
Mechanical Move
Transform script: https://gist.github.com/ch-wan/c3e9f3be03f0c5451920973963a64f9e
The script renames only the three polymorphic runner-lifecycle methods (
replay→execute,replay_prepare→load_batch,can_run→can_run_graph) and their call sites, leaving every must-preserve token intact (self.backend.replay/.replay_session/.can_run,tbo_plugin.replay_prepare,deepep_adapter.replay, the_replay_graphhelpers, prose uses of "replay", and the two docstringcan_runmentions the PR kept). Line reflows from the longer identifiers are produced bypre-commit(black), which the verification scaffold runs. Verified to reproducea40924bbyte-for-byte.One-click verification
python3 <(curl -sL https://gist.githubusercontent.com/ch-wan/c3e9f3be03f0c5451920973963a64f9e/raw/transform_runner_lifecycle_rename.py)Accuracy Tests
N/A — behavior-preserving refactor (no change to model outputs).
Speed Tests and Profiling
N/A — no inference-speed impact.
Checklist
test/registered/attention/unittests/dense).🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #27815358410
Latest PR Test (Extra): ❌ Run #27815358225