[CI] Isolate cudagraph tests in child processes (#49510)

Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com>

Andreas Karatzas committed Jul 23, 2026 at 12:16 UTC f00efc52652046aac18dc37865adfa8f21fbdb10
1 file changed +3 -24
tests/v1/cudagraph/test_cudagraph_mode.py
+3 -24
@@ -1,11 +1,10 @@
1 # SPDX-License-Identifier: Apache-2.0
2 # SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -import weakref
3 from contextlib import ExitStack
4
5 import pytest
6
8 -from tests.utils import wait_for_gpu_memory_to_clear
7 +from tests.utils import create_new_process_for_each_test
8 from tests.v1.attention.utils import full_cg_backend_configs as backend_configs
9 from vllm import LLM
10 from vllm.config import CompilationConfig, CompilationMode
@@ -32,6 +31,7 @@ else:
31
32
33 @pytest.mark.parametrize("backend_name, cudagraph_mode, supported", combo_cases_1)
34 +@create_new_process_for_each_test("spawn")
35 def test_backend_and_cudagraph_mode_combo(backend_name, cudagraph_mode, supported):
36 if backend_name == "FlashInfer":
37 try:
@@ -64,17 +64,6 @@ def test_backend_and_cudagraph_mode_combo(backend_name, cudagraph_mode, supporte
64 ),
65 )
66 llm.generate(["Hello, my name is"] * 10)
67 - # when above code raises, `llm` may be undefined, so we need to catch that
68 - try:
69 - llm = weakref.proxy(llm)
70 - del llm
71 - except UnboundLocalError:
72 - pass
73 -
74 - wait_for_gpu_memory_to_clear(
75 - devices=[0],
76 - threshold_ratio=0.1,
77 - )
67
68
69 # test cudagraph_mode with different compilation mode.
@@ -98,6 +87,7 @@ combo_cases_2 = [
87 @pytest.mark.parametrize(
88 "backend_name,cudagraph_mode,compilation_mode,supported", combo_cases_2
89 )
90 +@create_new_process_for_each_test("spawn")
91 def test_cudagraph_compilation_combo(
92 backend_name, cudagraph_mode, compilation_mode, supported
93 ):
@@ -120,14 +110,3 @@ def test_cudagraph_compilation_combo(
110 ),
111 )
112 llm.generate(["Hello, my name is"] * 10)
123 - # when above code raises, `llm` may be undefined, so we need to catch that
124 - try:
125 - llm = weakref.proxy(llm)
126 - del llm
127 - except UnboundLocalError:
128 - pass
129 - finally:
130 - wait_for_gpu_memory_to_clear(
131 - devices=[0],
132 - threshold_ratio=0.1,
133 - )