@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 77f0d465d0
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 06:00 UTC

[BugFix] Allow use_cudagraph to work with dynamic VLLM_USE_V1 (#19390)

Signed-off-by: rzou <zou3519@gmail.com>

Richard Zou committed Jun 10, 2025 at 19:54 UTC 77f0d465d0a666b65dd877ec462f024a980dd55c
2 files changed +11 -1
tests/compile/test_config.py
+10
@@ -11,6 +11,16 @@ from vllm.config import (CompilationConfig, CompilationLevel, VllmConfig,
11 from .piecewise.test_simple import SillyModel
12
13
14 +def test_use_cudagraphs_dynamic(monkeypatch):
15 + assert vllm.envs.VLLM_USE_V1
16 + vllm_config = VllmConfig()
17 + assert vllm_config.compilation_config.use_cudagraph
18 +
19 + monkeypatch.setenv('VLLM_USE_V1', '0')
20 + vllm_config = VllmConfig()
21 + assert not vllm_config.compilation_config.use_cudagraph
22 +
23 +
24 @pytest.mark.parametrize("enabled", [True, False])
25 def test_use_cudagraphs(enabled):
26 assert vllm.envs.VLLM_USE_V1
vllm/config.py
+1 -1
@@ -3931,7 +3931,7 @@ class CompilationConfig:
3931 constructor, e.g. `CompilationConfig(inductor_passes={"a": func})`."""
3932
3933 # CudaGraph compilation
3934 - use_cudagraph: bool = envs.VLLM_USE_V1
3934 + use_cudagraph: bool = field(default_factory=lambda: envs.VLLM_USE_V1)
3935 """Whether to use cudagraph inside compilation.
3936 - False: cudagraph inside compilation is not used.
3937 - True: cudagraph inside compilation is used. It requires