[ROCm][CI] Move ROCm AITER quantization tests (#40938)

Signed-off-by: Andreas Karatzas <akaratza@amd.com> Signed-off-by: Andreas Karatzas <Andreas.Karatzas@amd.com> Co-authored-by: OpenAI Codex <codex@openai.com>

Andreas Karatzas committed Aug 18, 2026 at 01:50 UTC 5fa8ca971a7a3f19806808f72987a06187bdce55
7 files changed +144 -136
.buildkite/test-amd.yaml
+6 -18
@@ -1544,11 +1544,13 @@ steps:
1544 - vllm/_aiter_ops.py
1545 - tests/kernels/attention/test_rocm_aiter_mla_decode.py
1546 - tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
1547 + - tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
1548 - tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
1549 commands:
1550 - rocm-smi
1551 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
1552 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode.py
1553 + - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
1554 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
1555
1556 - label: Kernels Attention Test %N # TBD
@@ -1664,6 +1666,7 @@ steps:
1666 - tests/kernels/quant_utils.py
1667 - tests/kernels/utils.py
1668 - vllm/_aiter_ops.py
1669 + - vllm/kernels/aiter_ops.py
1670 - vllm/_custom_ops.py
1671 - vllm/envs.py
1672 - vllm/platforms/rocm.py
@@ -2452,24 +2455,6 @@ steps:
2455 - uv pip install --system conch-triton-kernels
2456 - VLLM_TEST_FORCE_LOAD_FORMAT=auto pytest -v -s quantization/ --ignore quantization/test_blackwell_moe.py
2457
2455 -#----------------------------------------------------------- mi300 · rocm ------------------------------------------------------------#
2456 -
2457 -- label: ROCm AITER Ops Test # TBD
2458 - timeout_in_minutes: 180
2459 - mirror_hardwares: [amdexperimental, amdproduction, amdgfx942nightly, amdmi300]
2460 - dind: false
2461 - agent_pool: mi300_1
2462 - working_dir: "/vllm-workspace/tests"
2463 - source_file_dependencies:
2464 - - vllm/_aiter_ops.py
2465 - - vllm/envs.py
2466 - - vllm/platforms/rocm.py
2467 - - tests/rocm/aiter/
2468 - - vllm/v1/attention/backends/mla/rocm_aiter_mla.py
2469 - - vllm/v1/attention/selector.py
2470 - commands:
2471 - - pytest -v -s rocm/aiter/
2472 -
2458 #--------------------------------------------------------- mi300 · samplers ----------------------------------------------------------#
2459
2460 - label: Samplers Test # TBD
@@ -3461,11 +3446,13 @@ steps:
3446 - vllm/_aiter_ops.py
3447 - tests/kernels/attention/test_rocm_aiter_mla_decode.py
3448 - tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
3449 + - tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
3450 - tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
3451 commands:
3452 - rocm-smi
3453 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode_metadata.py
3454 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_decode.py
3455 + - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py
3456 - pytest -v -s tests/kernels/attention/test_rocm_aiter_mla_op_registration.py
3457
3458 - label: Kernels Attention Test %N # TBD
@@ -3525,6 +3512,7 @@ steps:
3512 - tests/kernels/quant_utils.py
3513 - tests/kernels/utils.py
3514 - vllm/_aiter_ops.py
3515 + - vllm/kernels/aiter_ops.py
3516 - vllm/_custom_ops.py
3517 - vllm/envs.py
3518 - vllm/platforms/rocm.py
.buildkite/test_areas/kernels.yaml
+1
@@ -183,6 +183,7 @@ steps:
183 - tests/kernels/quantization
184 - tests/kernels/quantization/test_rocm_skinny_gemms.py
185 - vllm/_aiter_ops.py
186 + - vllm/kernels/aiter_ops.py
187 - vllm/platforms/rocm.py
188 - vllm/model_executor/kernels/
189 depends_on:
tests/kernels/attention/test_rocm_aiter_mla_fp8_support.py new
+137
@@ -0,0 +1,137 @@
1 +# SPDX-License-Identifier: Apache-2.0
2 +# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 +"""Tests for ROCm AITER MLA FP8 support detection."""
4 +
5 +import sys
6 +import types
7 +from typing import Any
8 +from unittest.mock import patch
9 +
10 +import pytest
11 +
12 +from vllm.platforms import current_platform
13 +
14 +_SKIP_UNSUPPORTED_AITER_HARDWARE = True
15 +if current_platform.is_rocm():
16 + from vllm.platforms.rocm import get_cdna_version
17 +
18 + _SKIP_UNSUPPORTED_AITER_HARDWARE = get_cdna_version() <= 2
19 +
20 +pytestmark = pytest.mark.skipif(
21 + not current_platform.is_rocm(), reason="ROCm-specific tests"
22 +)
23 +
24 +
25 +@pytest.fixture(autouse=True)
26 +def reset_aiter_mla_support_cache(monkeypatch: pytest.MonkeyPatch) -> None:
27 + import vllm._aiter_ops as aiter_ops
28 +
29 + monkeypatch.setattr(aiter_ops, "_AITER_MLA_SUPPORTS_FP8", None)
30 +
31 +
32 +def _install_fake_aiter_modules(
33 + monkeypatch: pytest.MonkeyPatch, *, supports_fp8: bool
34 +) -> None:
35 + aiter_mod: Any = types.ModuleType("aiter")
36 + mla_mod: Any = types.ModuleType("aiter.mla")
37 +
38 + if supports_fp8:
39 +
40 + def mla_decode_fwd_with_fp8(
41 + q,
42 + kv_buffer,
43 + kv_indptr,
44 + kv_indices,
45 + o,
46 + sm_scale,
47 + q_scale=None,
48 + kv_scale=None,
49 + ):
50 + return None
51 +
52 + mla_decode_fwd: Any = mla_decode_fwd_with_fp8
53 +
54 + else:
55 +
56 + def mla_decode_fwd_without_fp8(
57 + q,
58 + kv_buffer,
59 + kv_indptr,
60 + kv_indices,
61 + o,
62 + sm_scale,
63 + ):
64 + return None
65 +
66 + mla_decode_fwd = mla_decode_fwd_without_fp8
67 +
68 + mla_mod.mla_decode_fwd = mla_decode_fwd
69 + aiter_mod.mla = mla_mod
70 +
71 + monkeypatch.setitem(sys.modules, "aiter", aiter_mod)
72 + monkeypatch.setitem(sys.modules, "aiter.mla", mla_mod)
73 +
74 +
75 +def test_aiter_mla_fp8_support_detects_fp8_signature(monkeypatch):
76 + """The support check should detect q_scale and kv_scale parameters."""
77 + from vllm._aiter_ops import _check_aiter_mla_fp8_support
78 +
79 + _install_fake_aiter_modules(monkeypatch, supports_fp8=True)
80 +
81 + assert _check_aiter_mla_fp8_support() is True
82 +
83 +
84 +def test_aiter_mla_fp8_support_rejects_missing_fp8_signature(monkeypatch):
85 + """The support check should return False when FP8 params are absent."""
86 + from vllm._aiter_ops import _check_aiter_mla_fp8_support
87 +
88 + _install_fake_aiter_modules(monkeypatch, supports_fp8=False)
89 +
90 + assert _check_aiter_mla_fp8_support() is False
91 +
92 +
93 +@pytest.mark.skipif(
94 + _SKIP_UNSUPPORTED_AITER_HARDWARE,
95 + reason="Installed AITER MLA FP8 check requires CDNA 3 or newer",
96 +)
97 +def test_installed_aiter_mla_supports_fp8():
98 + """Supported ROCm CI must provide AITER with MLA FP8 scaling."""
99 + from vllm._aiter_ops import (
100 + _check_aiter_mla_fp8_support,
101 + is_aiter_found_and_supported,
102 + )
103 +
104 + assert is_aiter_found_and_supported(), (
105 + "AITER must be installed on supported ROCm hardware"
106 + )
107 + assert _check_aiter_mla_fp8_support() is True
108 +
109 +
110 +@pytest.mark.parametrize(
111 + "error_type",
112 + [ImportError, ModuleNotFoundError, AttributeError, ValueError, TypeError],
113 +)
114 +def test_aiter_mla_fp8_support_handles_signature_errors(monkeypatch, error_type):
115 + """The support check should fail closed on import or signature problems."""
116 + import vllm._aiter_ops as aiter_ops
117 + from vllm._aiter_ops import _check_aiter_mla_fp8_support
118 +
119 + _install_fake_aiter_modules(monkeypatch, supports_fp8=True)
120 +
121 + with patch("inspect.signature", side_effect=error_type("boom")):
122 + assert _check_aiter_mla_fp8_support() is False
123 + assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False
124 +
125 +
126 +def test_aiter_mla_fp8_support_result_is_cached(monkeypatch):
127 + """The support check should reuse the cached result on later calls."""
128 + import inspect
129 +
130 + from vllm._aiter_ops import _check_aiter_mla_fp8_support
131 +
132 + _install_fake_aiter_modules(monkeypatch, supports_fp8=True)
133 +
134 + with patch("inspect.signature", wraps=inspect.signature) as signature_mock:
135 + assert _check_aiter_mla_fp8_support() is True
136 + assert _check_aiter_mla_fp8_support() is True
137 + assert signature_mock.call_count == 1
tests/kernels/quantization/test_aiter_hipb_mm_linear_kernel.py renamed
tests/kernels/quantization/test_quant_op_schema.py renamed
tests/kernels/quantization/test_rocm_aiter_grouped_quant.py renamed
tests/rocm/aiter/test_mla_fp8_support_check.py deleted
-118
@@ -1,118 +0,0 @@
1 -# SPDX-License-Identifier: Apache-2.0
2 -# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
3 -"""
4 -Unit tests for AITER MLA FP8 support detection.
5 -
6 -These tests verify that the _check_aiter_mla_fp8_support() function
7 -correctly handles various error conditions without crashing.
8 -"""
9 -
10 -from unittest.mock import patch
11 -
12 -import pytest
13 -
14 -
15 -class TestAiterMlaFp8SupportCheck:
16 - """Test cases for _check_aiter_mla_fp8_support() function."""
17 -
18 - def setup_method(self):
19 - """Reset the global cache before each test."""
20 - import vllm._aiter_ops as aiter_ops
21 -
22 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
23 -
24 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
25 - def test_import_error_handling(self, mock_supported):
26 - """Test that ImportError is handled gracefully."""
27 - import vllm._aiter_ops as aiter_ops
28 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
29 -
30 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
31 -
32 - # Should return False without raising
33 - with patch(
34 - "inspect.signature",
35 - side_effect=ImportError("No module"),
36 - ):
37 - result = _check_aiter_mla_fp8_support()
38 - assert result is False
39 -
40 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
41 - def test_module_not_found_error_handling(self, mock_supported):
42 - """Test that ModuleNotFoundError is handled gracefully."""
43 - import vllm._aiter_ops as aiter_ops
44 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
45 -
46 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
47 -
48 - with patch(
49 - "inspect.signature",
50 - side_effect=ModuleNotFoundError("Module not found"),
51 - ):
52 - # Should return False without raising
53 - assert _check_aiter_mla_fp8_support() is False
54 - # Cache should be set to False
55 - assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False
56 -
57 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
58 - def test_attribute_error_handling(self, mock_supported):
59 - """Test that AttributeError is handled gracefully."""
60 - import vllm._aiter_ops as aiter_ops
61 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
62 -
63 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
64 -
65 - with patch(
66 - "inspect.signature",
67 - side_effect=AttributeError("No attribute"),
68 - ):
69 - assert _check_aiter_mla_fp8_support() is False
70 - assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False
71 -
72 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
73 - def test_value_error_handling(self, mock_supported):
74 - """Test that ValueError is handled gracefully (no signature)."""
75 - import vllm._aiter_ops as aiter_ops
76 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
77 -
78 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
79 -
80 - with patch(
81 - "inspect.signature",
82 - side_effect=ValueError("No signature"),
83 - ):
84 - assert _check_aiter_mla_fp8_support() is False
85 - assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False
86 -
87 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
88 - def test_type_error_handling(self, mock_supported):
89 - """Test that TypeError is handled gracefully (not callable)."""
90 - import vllm._aiter_ops as aiter_ops
91 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
92 -
93 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = None
94 -
95 - with patch(
96 - "inspect.signature",
97 - side_effect=TypeError("Not a callable"),
98 - ):
99 - assert _check_aiter_mla_fp8_support() is False
100 - assert aiter_ops._AITER_MLA_SUPPORTS_FP8 is False
101 -
102 - @patch("vllm._aiter_ops.is_aiter_found_and_supported", return_value=True)
103 - def test_result_caching(self, mock_supported):
104 - """Test that the result is cached after first check."""
105 - import vllm._aiter_ops as aiter_ops
106 -
107 - # Set cache to True
108 - aiter_ops._AITER_MLA_SUPPORTS_FP8 = True
109 -
110 - from vllm._aiter_ops import _check_aiter_mla_fp8_support
111 -
112 - # Should return cached value without re-checking
113 - result = _check_aiter_mla_fp8_support()
114 - assert result is True
115 -
116 -
117 -if __name__ == "__main__":
118 - pytest.main([__file__, "-v"])