[ROCm] Run init test engine in-process to avoid KV-cache OOM (#48527)

Signed-off-by: Djordje Ramic <djoramic@amd.com> Co-authored-by: Andreas Karatzas <akaratza@amd.com>

djramic committed Jul 15, 2026 at 08:39 UTC b6770d7b544febb9636f1750b77cde8904024728
1 file changed +7 -1
tests/models/test_initialization.py
+7 -1
@@ -14,7 +14,7 @@ from vllm.v1.core.kv_cache_utils import (
14 )
15 from vllm.v1.engine.core import EngineCore as V1EngineCore
16
17 -from ..utils import create_new_process_for_each_test
17 +from ..utils import create_new_process_for_each_test, requires_spawn_multiprocessing
18 from .registry import (
19 _TRANSFORMERS_BACKEND_MODELS,
20 AUTO_EXAMPLE_MODELS,
@@ -129,6 +129,12 @@ def can_initialize(
129 patch.object(V1EngineCore, "_initialize_kv_caches", _initialize_kv_caches_v1),
130 monkeypatch.context() as m,
131 ):
132 + if requires_spawn_multiprocessing():
133 + # The EngineCore subprocess re-imports the class and does not
134 + # inherit the KV-cache patch above, so it OOMs. Run in-process
135 + # so the patch applies.
136 + m.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
137 +
138 # FIXME: A hack to bypass FA3 assertion because our CI's L4 GPU
139 # has cc==8.9 which hasn't supported FA3 yet. Remove this hack when
140 # L4 supports FA3.