[CI/Build][Hardware][AMD] Fix v1/shutdown (#31997)

Signed-off-by: Ryan Rock <ryan.rock@amd.com>
This commit is contained in:
Ryan Rock
2026-01-14 22:01:42 -06:00
committed by GitHub
parent 8471b27df9
commit 15422ed3f7
3 changed files with 64 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
"""Test that we handle an Error in model forward and shutdown."""
import asyncio
import inspect
import pytest
@@ -38,11 +39,22 @@ def evil_forward(self, *args, **kwargs):
return self.model(*args, **kwargs)
@pytest.fixture
def rocm_evil_forward(rocm_sitecustomize_factory):
lines = [
"from vllm.distributed import get_tensor_model_parallel_rank",
"from vllm.model_executor.models.llama import LlamaForCausalLM",
inspect.getsource(evil_forward),
f"LlamaForCausalLM.forward = {evil_forward.__name__}",
]
rocm_sitecustomize_factory(lines)
@pytest.mark.asyncio
@pytest.mark.parametrize("tensor_parallel_size", [2, 1])
@pytest.mark.parametrize("model", MODELS)
async def test_async_llm_model_error(
monkeypatch, tensor_parallel_size: int, model: str
monkeypatch, rocm_evil_forward, tensor_parallel_size: int, model: str
) -> None:
"""Test that AsyncLLM propagates a forward pass error and frees memory.
@@ -104,7 +116,11 @@ async def test_async_llm_model_error(
@pytest.mark.parametrize("tensor_parallel_size", [2, 1])
@pytest.mark.parametrize("model", MODELS)
def test_llm_model_error(
monkeypatch, tensor_parallel_size: int, enable_multiprocessing: bool, model: str
monkeypatch,
rocm_evil_forward,
tensor_parallel_size: int,
enable_multiprocessing: bool,
model: str,
) -> None:
"""Test that LLM propagates a forward pass error and frees memory.
TODO(andy) - LLM without multiprocessing; LLM with multiprocessing