Skip to content

[CI] Restore the full prefill CUDA graph capture range in test launches - #33847

Merged
hnyls2002 merged 1 commit into
mainfrom
lsyin/revert-ci-prefill-bs-trim
Aug 6, 2026
Merged

hnyls2002 merged 1 commit into
mainfrom
lsyin/revert-ci-prefill-bs-trim

Conversation

@hnyls2002

@hnyls2002 hnyls2002 commented Aug 6, 2026 •

Copy link
Copy Markdown
Collaborator

Reverts the --cuda-graph-max-bs-prefill 1024 default injection added to popen_launch_server in #33776: it sets prefill.max_bs in _handle_cuda_graph_config() before _handle_gpu_memory_settings() would derive it from chunked_prefill_size, which gates off post-capture KV sizing (test_post_capture_kv_sizing.py fails on H100-class GPUs, where chunked_prefill_size is 8192) and conversely inflates capture from 128 to 1024 for fixtures that set a smaller chunked_prefill_size.


CI States

Latest PR Test (Base): ❌ Run #31085624619
Latest PR Test (Extra): ❌ Run #31085627008

@hnyls2002
hnyls2002 merged commit efc99a8 into main Aug 6, 2026
102 of 119 checks passed
@hnyls2002
hnyls2002 deleted the lsyin/revert-ci-prefill-bs-trim branch August 6, 2026 08:40
saturn-acc pushed a commit to saturn-acc/sglang that referenced this pull request Aug 16, 2026
Atituiset pushed a commit to Atituiset/sglang that referenced this pull request Sep 10, 2026
awesome-pro added a commit to awesome-pro/sglang that referenced this pull request Sep 27, 2026
…overage

post_capture_kv_sizing_planned() returned False for the prefill-coverage case
without logging anything, so passing --cuda-graph-max-bs-prefill below
chunked_prefill_size turned the feature off with no diagnostic (the sgl-project#33847
case, where a CI-wide 1024 silenced it on H100-class machines whose
chunked_prefill_size defaults to 8192).

Split the compound condition so the two genuinely-inapplicable gates
(backend == DISABLED, chunked_prefill_size <= 0) stay silent and only the
coverage shortfall warns, naming both values and the flag that fixes it. The
number quoted is max_prefill_buffer_tokens(), so under PP dynamic chunking it
is the ceiling the graph actually has to cover.

The gate is not relaxed: the return value is unchanged for every input.
awesome-pro added a commit to awesome-pro/sglang that referenced this pull request Sep 30, 2026
…overage

post_capture_kv_sizing_planned() returned False for the prefill-coverage case
without logging anything, so passing --cuda-graph-max-bs-prefill below
chunked_prefill_size turned the feature off with no diagnostic (the sgl-project#33847
case, where a CI-wide 1024 silenced it on H100-class machines whose
chunked_prefill_size defaults to 8192).

Split the compound condition so the two genuinely-inapplicable gates
(backend == DISABLED, chunked_prefill_size <= 0) stay silent and only the
coverage shortfall warns, naming both values and the knob that fixes it. The
number quoted is max_prefill_buffer_tokens(), so under PP dynamic chunking it
is the ceiling the graph actually has to cover.

The remedy names a value that actually works:

* Capture buckets are quantised (256-wide to 4096, then 512-wide) and
  --cuda-graph-max-bs-prefill does not append its own value, so advising the
  raw ceiling can be a no-op -- setting it to 10000 leaves the largest bucket
  at 9728 and the warning fires again. required_prefill_capture_bucket()
  quotes the smallest bucket that covers the ceiling instead (10240 there).
* When the bucket list came from --cuda-graph-bs-prefill, the capture ceiling
  is not what is short and raising it changes nothing, so the warning points
  at the list. Detected through _cuda_graph_config_locked, which the calling
  hook already reads.

The gate is not relaxed: the return value is unchanged for every input.
Eliaaazzz added a commit to Eliaaazzz/sglang that referenced this pull request Oct 21, 2026
… under post-capture KV sizing

post_capture_kv_sizing_planned() returned False whenever
max_prefill_buffer_tokens() exceeded the largest captured prefill
bucket. Passing --cuda-graph-max-bs-prefill below chunked_prefill_size
therefore turned the feature off without a log line, and the
mem_fraction heuristic fell back to estimating graph memory (sgl-project#33847).
Decode already handles the same gap: a captured decode max_bs below
max_running_requests keeps the feature on and reserves activation
headroom.

Apply that treatment to prefill, as proposed in RFC sgl-project#33852:

- The prefill gate keeps only the hard conditions: a disabled prefill
  graph or chunked prefill off.
- compute_post_capture_kv_resize() detects a prefill coverage shortfall,
  logs both token counts and raises the headroom to
  pre_capture_activation_reserve_mb().
- The reserve is sized for the prefill buffer ceiling. Under PP dynamic
  chunking the ceiling is max(chunked_prefill_size, max_prefill_tokens,
  1.25 x chunked_prefill_size), and the chunk-size profiler runs eager
  prefills of up to 1.25 x chunked_prefill_size after the resize, so
  pre_capture_activation_reserve_mb() takes an optional prefill_tokens.
  Its other callers are unchanged.

Nothing changes while post-capture KV sizing is off
(SGLANG_ENABLE_POST_CAPTURE_KV_SIZING defaults to False). With it on,
configs whose largest captured prefill bucket covers the prefill buffer
ceiling are unchanged.

Tests:
- test_server_args: a coverage shortfall keeps the gate True; a disabled
  prefill graph or chunked prefill off still returns False.
- test_kv_canary_headroom: the reserve applies only with a coverage gap,
  and under PP dynamic chunking it is sized for the 8192-token ceiling
  with the real reserve formula.
- test_post_capture_kv_sizing (GPU e2e): a second server with
  --chunked-prefill-size 2048 --cuda-graph-max-bs-prefill 512 checks
  that sizing ran, the warning fired and an eager prefill chunk is
  served.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant