Skip to content
Merged
24 changes: 6 additions & 18 deletions .buildkite/test-amd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1543,11 +1543,13 @@ steps:
- vllm/_aiter_ops.py
- tests/kernels/attention/test_rocm_aiter_mla_decode.py
- tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
- tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
- tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
commands:
- rocm-smi
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_op_registration.py

- label: Kernels Attention Test %N # TBD
Expand Down Expand Up @@ -1663,6 +1665,7 @@ steps:
- tests/kernels/quant_utils.py
- tests/kernels/utils.py
- vllm/_aiter_ops.py
- vllm/kernels/aiter_ops.py
- vllm/_custom_ops.py
- vllm/envs.py
- vllm/platforms/rocm.py
Expand Down Expand Up @@ -2451,24 +2454,6 @@ steps:
- uv pip install --system conch-triton-kernels
- VLLM_TEST_FORCE_LOAD_FORMAT=auto pytest -v -s quantization/ --ignore quantization/test_blackwell_moe.py

#----------------------------------------------------------- mi300 · rocm ------------------------------------------------------------#

- label: ROCm AITER Ops Test # TBD
timeout_in_minutes: 180
mirror_hardwares: [amdexperimental, amdproduction, amdgfx942nightly, amdmi300]
dind: false
agent_pool: mi300_1
working_dir: "/vllm-workspace/tests"
source_file_dependencies:
- vllm/_aiter_ops.py
- vllm/envs.py
- vllm/platforms/rocm.py
- tests/rocm/aiter/
- vllm/v1/attention/backends/mla/rocm_aiter_mla.py
- vllm/v1/attention/selector.py
commands:
- pytest -v -s rocm/aiter/

#--------------------------------------------------------- mi300 · samplers ----------------------------------------------------------#

- label: Samplers Test # TBD
Expand Down Expand Up @@ -3442,11 +3427,13 @@ steps:
- vllm/_aiter_ops.py
- tests/kernels/attention/test_rocm_aiter_mla_decode.py
- tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
- tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
- tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
commands:
- rocm-smi
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
- pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_op_registration.py

- label: Kernels Attention Test %N # TBD
Expand Down Expand Up @@ -3506,6 +3493,7 @@ steps:
- tests/kernels/quant_utils.py
- tests/kernels/utils.py
- vllm/_aiter_ops.py
- vllm/kernels/aiter_ops.py
- vllm/_custom_ops.py
- vllm/envs.py
- vllm/platforms/rocm.py
Expand Down
1 change: 1 addition & 0 deletions .buildkite/test_areas/kernels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ steps:
- tests/kernels/quantization
- tests/kernels/quantization/test_rocm_skinny_gemms.py
- vllm/_aiter_ops.py
- vllm/kernels/aiter_ops.py
- vllm/platforms/rocm.py
- vllm/model_executor/kernels/
depends_on:
Expand Down
114 changes: 114 additions & 0 deletions tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""Unit tests for ROCm AITER MLA FP8 support detection."""

import sys
import types
from typing import Any
from unittest.mock import patch

import pytest

from vllm.platforms import current_platform

pytestmark = pytest.mark.skipif(
not current_platform.is_rocm(), reason="ROCm-specific tests"
)


@pytest.fixture(autouse=True)
def reset_aiter_mla_support_cache(monkeypatch: pytest.MonkeyPatch) -> None:
import vllm._aiter_ops as aiter_ops

monkeypatch.setattr(aiter_ops, "_AITER_MLA_SUPPORTS_FP8", None)


def _install_fake_aiter_modules(
monkeypatch: pytest.MonkeyPatch, *, supports_fp8: bool
) -> None:
aiter_mod: Any = types.ModuleType("aiter")
mla_mod: Any = types.ModuleType("aiter.mla")

if supports_fp8:

def mla_decode_fwd_with_fp8(
q,
kv_buffer,
kv_indptr,
kv_indices,
o,
sm_scale,
q_scale=None,
kv_scale=None,
):
return None

mla_decode_fwd: Any = mla_decode_fwd_with_fp8

else:

def mla_decode_fwd_without_fp8(
q,
kv_buffer,
kv_indptr,
kv_indices,
o,
sm_scale,
):
return None

mla_decode_fwd = mla_decode_fwd_without_fp8

mla_mod.mla_decode_fwd = mla_decode_fwd
aiter_mod.mla = mla_mod

monkeypatch.setitem(sys.modules, "aiter", aiter_mod)
monkeypatch.setitem(sys.modules, "aiter.mla", mla_mod)


def test_aiter_mla_fp8_support_detects_fp8_signature(monkeypatch):
"""The support check should detect q_scale and kv_scale parameters."""
from vllm._aiter_ops import _check_aiter_mla_fp8_support

_install_fake_aiter_modules(monkeypatch, supports_fp8=True)

assert _check_aiter_mla_fp8_support() is True


def test_aiter_mla_fp8_support_rejects_missing_fp8_signature(monkeypatch):
"""The support check should return False when FP8 params are absent."""
from vllm._aiter_ops import _check_aiter_mla_fp8_support

_install_fake_aiter_modules(monkeypatch, supports_fp8=False)

assert _check_aiter_mla_fp8_support() is False


@pytest.mark.parametrize(
"error_type",
[ImportError, ModuleNotFoundError, AttributeError, ValueError, TypeError],
)
def test_aiter_mla_fp8_support_handles_signature_errors(monkeypatch, error_type):
"""The support check should fail closed on import or signature problems."""
import vllm._aiter_ops as aiter_ops
from vllm._aiter_ops import _check_aiter_mla_fp8_support

_install_fake_aiter_modules(monkeypatch, supports_fp8=True)

with patch("inspect.signature", side_effect=error_type("boom")):
assert _check_aiter_mla_fp8_support() is False
assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False


def test_aiter_mla_fp8_support_result_is_cached(monkeypatch):
"""The support check should reuse the cached result on later calls."""
import inspect

from vllm._aiter_ops import _check_aiter_mla_fp8_support

_install_fake_aiter_modules(monkeypatch, supports_fp8=True)

with patch("inspect.signature", wraps=inspect.signature) as signature_mock:
assert _check_aiter_mla_fp8_support() is True
assert _check_aiter_mla_fp8_support() is True
assert signature_mock.call_count == 1
118 changes: 0 additions & 118 deletions tests/rocm/aiter/test_mla_fp8_support_check.py

This file was deleted.

Loading