lower memory required for capturing cudagraphs for large cudagraph sizes (#48483)
Signed-off-by: Omer Ullman Argov <118735753+omera-nv@users.noreply.github.com>
Omer Ullman Argov committed
Jul 13, 2026 at 17:14 UTC
1be6e937b2b49bae652370d80294f6171bd7b981
1 file changed
+5
-1
vllm/v1/worker/gpu_model_runner.py
+5
-1
@@ -6426,7 +6426,11 @@ class GPUModelRunner(
6426
kv_cache_spec = self.get_kv_cache_spec()
6427
KVCacheSpecRegistry.check_kv_cache_spec_registry(kv_cache_spec)
6428
kv_cache_groups = get_kv_cache_groups(self.vllm_config, kv_cache_spec)
6429
- min_blocks = self.compilation_config.max_cudagraph_capture_size or 1
6429
+ # the minimum number of blocks required is 1 block *per sequence*
6430
+ min_blocks = (
6431
+ min(self.max_num_reqs, self.compilation_config.max_cudagraph_capture_size)
6432
+ or 1
6433
+ )
6434
6435
# Temporarily change num_gpu_blocks_override to allocate a minimal KV cache
6436
saved_override = self.cache_config.num_gpu_blocks_override