Skip to content

Commit 46aaa53

Browse files
zou3519jimpang
authored andcommitted
[BugFix] Allow use_cudagraph to work with dynamic VLLM_USE_V1 (vllm-project#19390)
Signed-off-by: rzou <zou3519@gmail.com>
1 parent 3c57d96 commit 46aaa53

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/compile/test_config.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@
1111
from .piecewise.test_simple import SillyModel
1212

1313

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+
1424
@pytest.mark.parametrize("enabled", [True, False])
1525
def test_use_cudagraphs(enabled):
1626
assert vllm.envs.VLLM_USE_V1

vllm/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3938,7 +3938,7 @@ class CompilationConfig:
39383938
constructor, e.g. `CompilationConfig(inductor_passes={"a": func})`."""
39393939

39403940
# CudaGraph compilation
3941-
use_cudagraph: bool = envs.VLLM_USE_V1
3941+
use_cudagraph: bool = field(default_factory=lambda: envs.VLLM_USE_V1)
39423942
"""Whether to use cudagraph inside compilation.
39433943
- False: cudagraph inside compilation is not used.
39443944
- True: cudagraph inside compilation is used. It requires

0 commit comments

Comments
 (0)