@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / afb1e5b380
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 12, 04:45 UTC

[CI][ROCm][tests/v1/e2e] Fix multiprocessing launch for the test (#29123)

Signed-off-by: Divakar Verma <divakar.verma@amd.com>

Divakar Verma committed Dec 2, 2025 at 14:46 UTC afb1e5b380ff623e478d19a246b42b2903b9331f
1 file changed +19 -3
tests/v1/e2e/test_kv_sharing_fast_prefill.py
+19 -3
@@ -7,6 +7,7 @@ import pytest
7
8 from vllm import LLM, SamplingParams
9 from vllm.config import CompilationConfig, CompilationMode
10 +from vllm.platforms import current_platform
11
12 from ...utils import check_answers, fork_new_process_for_each_test, prep_prompts
13
@@ -43,15 +44,26 @@ def test_prompts():
44 return prompts
45
46
46 -@fork_new_process_for_each_test
47 +use_fork_for_test = (
48 + fork_new_process_for_each_test if not current_platform.is_rocm() else lambda x: x
49 +)
50 +
51 +
52 +@use_fork_for_test
53 @pytest.mark.parametrize("kv_sharing_fast_prefill", [False, True])
54 @pytest.mark.parametrize("enforce_eager", [True, False])
55 def test_kv_sharing_fast_prefill(
56 monkeypatch: pytest.MonkeyPatch,
57 kv_sharing_fast_prefill: bool,
58 enforce_eager: bool,
53 - test_prompts: list[str],
59 ):
60 + if not enforce_eager and current_platform.is_rocm():
61 + # Relevant context: https://github.com/vllm-project/vllm/pull/29244
62 + pytest.skip(
63 + "ROCm: torch.compile produces incorrect output for gemma-3n's GELU "
64 + "with tanh approximation. Use enforce_eager=True instead."
65 + )
66 +
67 sampling_params = SamplingParams(temperature=0.0, max_tokens=100)
68 compilation_config = CompilationConfig(
69 # This allows vLLM compilation backend to handle allocating and
@@ -65,7 +77,11 @@ def test_kv_sharing_fast_prefill(
77
78 with monkeypatch.context() as m:
79 # Make scheduling deterministic for reproducibility
68 - m.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
80 + if current_platform.is_rocm():
81 + # Use spawn to prevent cuda re-initialization error
82 + m.setenv("VLLM_WORKER_MULTIPROC_METHOD", "spawn")
83 + else:
84 + m.setenv("VLLM_ENABLE_V1_MULTIPROCESSING", "0")
85
86 prompts, answer, indices = prep_prompts(batch_size)
87