Skip to content

perf(sampler): capture CUDA graphs for power-of-two batch sizes only - #359

Merged
hodaaaaaaaaaa merged 1 commit into
mainfrom
perf/pow2-cudagraph-sizes
Oct 23, 2026
Merged

hodaaaaaaaaaa merged 1 commit into
mainfrom
perf/pow2-cudagraph-sizes

Conversation

@hodaaaaaaaaaa

@hodaaaaaaaaaa hodaaaaaaaaaa commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

At start-up, vLLM records a CUDA graph for every batch size it might see (172 sizes for gemma-4-E2B) and records them twice. That takes up to a minute.

Change

The sampler records graphs only for powers of two up to the maximum batch size (9 sizes at 256). A batch runs on the next recorded size up.

Results

From the latest fleet test on GKE (eight GSM8K GRPO jobs launched together: gemma-4-E2B on H100, Qwen3-0.6B on L4, LoRA and full fine-tuning), with all three sampler start-up changes (#358, #359, #360):

  • Recording graphs takes 24 s instead of 52 s for the gemma-4-E2B LoRA sampler, and 7 s instead of 19 s for Qwen3-0.6B.
  • Sampling time per step shows no consistent change.
  • Together, samplers are ready in 36–85 s instead of 91–243 s, and the whole workload takes 678 s instead of 737 s.

@google-cla

google-cla Bot commented Oct 22, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@hodaaaaaaaaaa
hodaaaaaaaaaa force-pushed the perf/pow2-cudagraph-sizes branch from cb8d47d to 152090a Compare October 23, 2026 00:05
}


def cudagraph_capture_sizes(max_num_seqs: int) -> list[int]:

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

i didn't add an env var for the capture sizes, I wanted to avoid growing the list of knobs when nothing needs it yet. VLLM_ENFORCE_EAGER=1 still turns graphs off completely. If a real need comes up, adding the variable back is a small change.

@hodaaaaaaaaaa
hodaaaaaaaaaa marked this pull request as ready for review October 23, 2026 00:08
@hodaaaaaaaaaa
hodaaaaaaaaaa requested review from ShubyM and droot October 23, 2026 00:09
@hodaaaaaaaaaa
hodaaaaaaaaaa merged commit 3e7658b into main Oct 23, 2026
16 checks passed
@hodaaaaaaaaaa
hodaaaaaaaaaa deleted the perf/pow2-cudagraph-sizes branch October 23, 2026 17:41
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.

3 participants