[PP] Support prefill CUDA graph proxy tensors - #36248
Merged
YAMY1234 merged 15 commits intoAug 31, 2026
Merged
Conversation
5 tasks
YAMY1234
force-pushed
the
pp-fixed2k-prefill-cuda-graph-upstream-20260824
branch
from
August 25, 2026 03:49
c6c0add to
41f7d98
Compare
YAMY1234
marked this pull request as ready for review
August 25, 2026 06:23
YAMY1234
requested review from
Fridge003,
Ying1123,
hnyls2002,
ispobock and
merrymercy
as code owners
August 25, 2026 06:23
Collaborator
Author
|
/tag-and-rerun-ci |
YAMY1234
commented
Aug 27, 2026
YAMY1234
commented
Aug 27, 2026
YAMY1234
left a comment
Collaborator
Author
There was a problem hiding this comment.
Three follow-up correctness and memory issues to address before merge.
YAMY1234
requested review from
BBuf,
Edwardf0t1,
HaiShaw and
ch-wan
as code owners
August 27, 2026 18:40
YAMY1234
force-pushed
the
pp-fixed2k-prefill-cuda-graph-upstream-20260824
branch
4 times, most recently
from
August 28, 2026 00:28
3143f0b to
b15350e
Compare
YAMY1234
force-pushed
the
pp-fixed2k-prefill-cuda-graph-upstream-20260824
branch
from
August 28, 2026 03:59
4e30f3a to
a0f92e8
Compare
Collaborator
Author
|
/rerun-failed-ci bypass-fastfail a0f92e8 |
…da-graph-upstream-20260824
…da-graph-upstream-20260824 # Conflicts: # python/sglang/srt/server_args.py
…da-graph-upstream-20260824 # Conflicts: # python/sglang/srt/model_executor/model_runner_components/cuda_graph_setup.py # python/sglang/srt/model_executor/runner/prefill_cuda_graph_runner.py # python/sglang/srt/model_executor/runner_utils/buffers.py
# Conflicts: # python/sglang/srt/arg_groups/memory_hook.py
Collaborator
saturn-acc
pushed a commit
to saturn-acc/sglang
that referenced
this pull request
Aug 31, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
nzr-niu
pushed a commit
to nzr-niu/sglang
that referenced
this pull request
Sep 1, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
RolaoDenthu
pushed a commit
to RolaoDenthu/sglang
that referenced
this pull request
Sep 1, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
YAMY1234
added a commit
to YAMY1234/sglang
that referenced
this pull request
Sep 1, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> (cherry picked from commit b77cac0)
Zongjy
pushed a commit
to Zongjy/sglang
that referenced
this pull request
Sep 1, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
GungnirAP
pushed a commit
to GungnirAP/sglang
that referenced
this pull request
Sep 1, 2026
…ration Upstream sgl-project#36248 threads pp_proxy_tensors through every spec worker's forward_batch_generation (eagle_worker_v2, ngram, dflash) but missed the multi-layer worker, so any multi-layer EAGLE launch dies with an unexpected-keyword TypeError on the first forward. Mirror eagle_worker_v2: accept the kwarg and pass it to the target prefill. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ano1FPUW83sBmr6GdxNov5
9 tasks
StevenChenSE
pushed a commit
to StevenChenSE/sglang
that referenced
this pull request
Sep 6, 2026
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
Pipeline-parallel prefill could not use the breakable prefill CUDA Graph path because PP stages expose globally indexed attention layers and exchange
PPProxyTensors, while the graph runner previously assumed a non-PP layer list and rejected proxy inputs and outputs. This leaves genuine small aggregate forwards dominated by launch and control overhead. On Qwen3.5 PP4 withmax_prefill_tokens == chunked_prefill_size == 2048, the eager path peaked at 34,857 tok/s at concurrency 16.Modifications
max_bsorbssettings still override the default.This does not change scheduler admission, request grouping, chunk boundaries, or aggregate prefill budgets. A 2K configuration still executes at most 2K aggregate new tokens in one model forward.
Accuracy Tests
Both arms used the same 200 GSM8K five-shot chat prompts, 128 threads,
max_tokens=16000,temperature=0.6,top_p=0.95,top_k=20, and runtime decode seed 42. The captured request payload files were byte-identical. Requests do not carry a sampling seed, so the observed 1.0 percentage-point difference is not treated as an accuracy change.Targeted CPU tests cover global-layer alignment, stable PP proxy replay inputs (including hidden-only contracts), signature-safe proxy/embed binding, proxy output slicing, PP opt-in policy, and default and explicit capture limits.
Speed Tests and Profiling
AgentX end-to-end benchmark
The largest matched dual-axis end-to-end gain in the 900-second AgentX screen was at C44 on aggregate TP2 with B3/CG4. The source, model, container, Dynamo and AIPerf commits, MTP, cache policy, routing, chunking, and decode batch and graph caps were fixed. The effective runtime change was eager prefill versus breakable prefill CUDA Graph.
34111733411823The eager and graph arms retained 862 and 974 requests with zero request errors. The graph arm had 15 credits still in flight at the phase-end grace timeout; the eager arm had none. These are 900-second screening results, not 3,600-second submission numbers.
Prefill-only throughput benchmark
Configuration: GB300, Qwen3.5-397B-A17B NVFP4, one TP1×PP4 prefill worker and one TP4 decode worker, 8K ISL, 1 OSL, radix cache off, MTP off, and
max_prefill_tokens == chunked_prefill_size. Throughput is aggregate input-plus-output tokens per second; all points completed10 × concurrencyrequests with exact 8192/1 token lengths and zero request errors.Each concurrency cell is
eager → graphtok/s. Both paths use the same source and differ only incuda-graph-backend-prefill=disabled/breakable.The benefit is concentrated in small forwards, so PP uses breakable prefill CUDA Graph only when the backend is selected explicitly. Its default capture limit is 8K actual aggregate tokens, the last measured size with a positive peak result; larger forwards automatically use eager. Operators can override the limit with
--cuda-graph-max-bs-prefillor explicit capture buckets. Fixed-2K peak rises from 18.66% of eager 32K peak to 47.75% of graph 32K peak, a 2.56× recovery of the relative small-batch throughput.At matched C64, fixed 2K improves from 33,274 to 86,433 tok/s, or 2.60×. The graph sweep logged 95,596 full 2K forwards as graph replays and zero as eager; no forward exceeded the 2K aggregate cap.
Stage profiling
run_batchmedianrun_batchmedianThe graph reduces stage wall time by 71–73% while kernel busy time stays within 1.2%, consistent with removing launch and control bubbles without changing model compute. In the common trace window, average kernel-active GPUs increased from 0.709/4 to 2.009/4. Profiler overhead affects cadence, so throughput numbers come only from unprofiled runs.
Checklist
Review and Merge Process
/tag-and-rerun-ci,/tag-run-ci-label,/rerun-failed-ciCI States
Latest PR Test (Base): ✅ Run #33265642901
Latest PR Test (Extra): ❌ Run #33265642817
Latest PR Test (AMD ROCm 7.2): ❌ Run #33265642882