[ROCm][CI] Fix nixl tests (#45219)

Signed-off-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
Andreas Karatzas
2026-06-23 13:11:40 -05:00
committed by GitHub
parent 6691f087a6
commit ceae5bcbda
8 changed files with 210 additions and 15 deletions
+17
View File
@@ -6,6 +6,7 @@ import json
from pathlib import Path
import pytest
from transformers import PretrainedConfig
from vllm.config import ModelConfig, ParallelConfig, SpeculativeConfig
from vllm.transformers_utils.model_arch_config_convertor import (
@@ -114,6 +115,22 @@ def _assert_model_config_methods(
assert model_config.get_head_size() == expected["head_size"]
def test_head_size_falls_back_when_head_dim_is_zero():
"""Regression test for configs that materialize missing head_dim as 0."""
hf_config = PretrainedConfig(
model_type="deepseek_vl_v2",
hidden_size=1280,
num_attention_heads=10,
num_key_value_heads=10,
head_dim=0,
kv_lora_rank=None,
)
convertor = ModelArchConfigConvertorBase(hf_config, hf_config)
assert convertor.get_head_size() == 128
@pytest.mark.parametrize("model", BASE_MODELS_TO_TEST)
def test_base_model_arch_config(model: str):
"""Test model architecture config for base models."""
@@ -13,13 +13,13 @@ tp_configs=(
"GPU_MEMORY_UTILIZATION=0.6 PREFILLER_TP_SIZE=2 DECODER_TP_SIZE=2"
"GPU_MEMORY_UTILIZATION=0.6 PREFILLER_TP_SIZE=1 DECODER_TP_SIZE=2"
"GPU_MEMORY_UTILIZATION=0.6 PREFILLER_TP_SIZE=2 DECODER_TP_SIZE=1"
"GPU_MEMORY_UTILIZATION=0.8 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny" # MLA case
"GPU_MEMORY_UTILIZATION=0.8 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny"
"GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=1 DECODER_TP_SIZE=2 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny"
"GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=2 DECODER_TP_SIZE=1 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny"
)
dp_ep_configs=(
"DP_EP=1 GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=1 DECODER_TP_SIZE=2 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny" # MLA+P-TP1, D-DPEP=2 (TP=1)
"DP_EP=1 GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=2 DECODER_TP_SIZE=2 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny" # MLA+P-TP2, D-DPEP=2 (TP=1)
"DP_EP=1 GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=1 DECODER_TP_SIZE=2 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny" # P-TP1, D-DPEP=2 (TP=1)
"DP_EP=1 GPU_MEMORY_UTILIZATION=0.8 PREFILLER_TP_SIZE=2 DECODER_TP_SIZE=2 MODEL_NAMES=deepseek-ai/deepseek-vl2-tiny" # P-TP2, D-DPEP=2 (TP=1)
)
# We assume HMA enabled by default.
hybrid_ssm_configs=(
@@ -4,9 +4,9 @@
import importlib
import importlib.metadata as metadata
import pathlib
import subprocess
import sys
import types
import pytest
import torch
@@ -20,6 +20,34 @@ def _print_distribution_version(package_name: str) -> None:
print(f"{package_name}: {version}")
def _import_nixl_ep_cpp(nixl_ep: types.ModuleType) -> types.ModuleType:
candidate_module_names = []
config_module_name = getattr(getattr(nixl_ep, "Config", None), "__module__", None)
if config_module_name and config_module_name.endswith("nixl_ep_cpp"):
candidate_module_names.append(config_module_name)
if torch.version.cuda is not None:
cuda_major = torch.version.cuda.split(".", maxsplit=1)[0]
candidate_module_names.append(f"nixl_ep_cu{cuda_major}.nixl_ep_cpp")
# Keep compatibility with the pre-dispatcher wheel layout.
candidate_module_names.append("nixl_ep.nixl_ep_cpp")
for module_name in dict.fromkeys(candidate_module_names):
try:
return importlib.import_module(module_name)
except ModuleNotFoundError as exc:
missing_module = exc.name
if missing_module not in (module_name, module_name.split(".", 1)[0]):
raise
raise AssertionError(
"No nixl_ep_cpp extension module found; tried "
f"{', '.join(dict.fromkeys(candidate_module_names))}"
)
@pytest.mark.skipif(torch.version.cuda is None, reason="CUDA NIXL EP canary")
def test_nixl_and_nixl_ep_imports() -> None:
"""Verify both core NIXL and the NIXL EP extension import successfully."""
@@ -38,14 +66,13 @@ def test_nixl_and_nixl_ep_imports() -> None:
nixl_ep = importlib.import_module("nixl_ep")
print(f"nixl_ep: {nixl_ep.__file__}")
assert nixl_ep.__file__ is not None
extension_dir = pathlib.Path(nixl_ep.__file__).parent
extension_files = sorted(extension_dir.glob("nixl_ep_cpp*.so"))
assert extension_files, f"No nixl_ep_cpp extension found in {extension_dir}"
nixl_ep_cpp = _import_nixl_ep_cpp(nixl_ep)
assert nixl_ep_cpp.__file__ is not None
extension_file = nixl_ep_cpp.__file__
print(f"nixl_ep_cpp: {extension_file}")
extension_file = extension_files[0]
completed = subprocess.run(
["ldd", str(extension_file)],
["ldd", extension_file],
capture_output=True,
check=False,
text=True,
@@ -94,6 +94,50 @@ def test_logical_to_kernel_block_ids_with_hma():
)
@pytest.mark.cpu_test
@pytest.mark.parametrize(
"is_rocm,has_mamba,use_host_buffer,done_recving,failed_recving,expected_syncs",
[
(True, True, False, {"req"}, set(), 1),
(False, True, False, {"req"}, set(), 0),
(True, False, False, {"req"}, set(), 0),
(True, True, True, {"req"}, set(), 0),
(True, True, False, set(), set(), 0),
(True, True, False, {"req"}, {"req"}, 0),
],
)
def test_sync_device_after_mamba_recv_gates(
monkeypatch,
is_rocm,
has_mamba,
use_host_buffer,
done_recving,
failed_recving,
expected_syncs,
):
"""Only direct-GPU Mamba receives on ROCm need a device fence."""
from vllm.distributed.kv_transfer.kv_connector.v1.nixl import base_worker
from vllm.distributed.kv_transfer.kv_connector.v1.nixl.worker import (
NixlConnectorWorker,
)
worker = object.__new__(NixlConnectorWorker)
worker._has_mamba = has_mamba
worker.use_host_buffer = use_host_buffer
sync_calls = []
monkeypatch.setattr(base_worker.current_platform, "is_rocm", lambda: is_rocm)
monkeypatch.setattr(
base_worker.torch.accelerator,
"synchronize",
lambda: sync_calls.append(True),
)
worker._sync_device_after_mamba_recv(done_recving, failed_recving)
assert len(sync_calls) == expected_syncs
@pytest.mark.cpu_test
@pytest.mark.parametrize(
"group_spec_types,remote_physical_per_logical,"