From b6770d7b544febb9636f1750b77cde8904024728 Mon Sep 17 00:00:00 2001 From: djramic Date: Wed, 15 Jul 2026 08:39:31 +0200 Subject: [PATCH] [ROCm] Run init test engine in-process to avoid KV-cache OOM (#48527) Signed-off-by: Djordje Ramic Co-authored-by: Andreas Karatzas --- tests/models/test_initialization.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/models/test_initialization.py b/tests/models/test_initialization.py index 6632d50bc0..f36c4f1fc4 100644 --- a/tests/models/test_initialization.py +++ b/tests/models/test_initialization.py @@ -14,7 +14,7 @@ from vllm.v1.core.kv_cache_utils import ( ) from vllm.v1.engine.core import EngineCore as V1EngineCore -from ..utils import create_new_process_for_each_test +from ..utils import create_new_process_for_each_test, requires_spawn_multiprocessing from .registry import ( _TRANSFORMERS_BACKEND_MODELS, AUTO_EXAMPLE_MODELS, @@ -129,6 +129,12 @@ def can_initialize( patch.object(V1EngineCore, "_initialize_kv_caches", _initialize_kv_caches_v1), monkeypatch.context() as m, ): + if requires_spawn_multiprocessing(): + # The EngineCore subprocess re-imports the class and does not + # inherit the KV-cache patch above, so it OOMs. Run in-process + # so the patch applies. + m.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0") + # FIXME: A hack to bypass FA3 assertion because our CI's L4 GPU # has cc==8.9 which hasn't supported FA3 yet. Remove this hack when # L4 supports FA3.