Repository navigation
[ROCm][CI] Move ROCm AITER quantization tests #40938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tjtanaa
merged 10 commits into
vllm-project:main
from
ROCm:akaratza_ci_move_rocm_grouped_quant
Aug 18, 2026
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
87e57f3
[ROCm][CI] Move ROCm grouped quant test
AndreasKaratzas 8379322
Move ROCm AITER quantization tests
AndreasKaratzas 2fbe5de
Move ROCm AITER quantization tests
AndreasKaratzas bfd4746
Move ROCm AITER quantization tests
AndreasKaratzas aada794
[ROCm][CI] Move ROCm AITER grouped quant
AndreasKaratzas ccc8ca0
[ROCm][CI] Move ROCm AITER grouped quant
AndreasKaratzas 9432abc
Merge remote-tracking branch 'origin/main' into akaratza_ci_move_rocm…
AndreasKaratzas cff44c2
[ROCm][CI] Bring AITER test moves up to date
AndreasKaratzas 296a4f7
Merge branch 'main' into akaratza_ci_move_rocm_grouped_quant
AndreasKaratzas 2b73ad5
[ROCm][Test] Validate installed AITER MLA FP8 support
AndreasKaratzas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project |
113 changes: 113 additions & 0 deletions
113
tests/kernels/quantization/rocm/aiter/test_grouped_quant.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
| """Tests for the ROCm AITER grouped FP8 quantization path.""" | ||
|
|
||
| import pytest | ||
| import torch | ||
|
|
||
| from vllm._aiter_ops import is_aiter_found_and_supported, rocm_aiter_ops | ||
| from vllm.model_executor.layers.quantization.input_quant_fp8 import QuantFP8 | ||
| from vllm.model_executor.layers.quantization.utils.quant_utils import GroupShape | ||
| from vllm.platforms import current_platform | ||
| from vllm.platforms.rocm import on_mi3xx | ||
|
|
||
| pytestmark = pytest.mark.skipif( | ||
| not (current_platform.is_rocm() and on_mi3xx()), | ||
| reason="ROCm MI300/MI350 grouped-quant tests", | ||
| ) | ||
|
|
||
| GROUP_SIZE = 128 | ||
| GROUP_QUANT_SHAPES = [(32, 1024), (64, 2048), (128, 4096)] | ||
|
|
||
|
|
||
| def _assert_aiter_group_quant_supported() -> None: | ||
| assert is_aiter_found_and_supported(), ( | ||
| "AITER grouped FP8 quantization is expected on MI300/MI350 ROCm tests" | ||
| ) | ||
|
|
||
|
|
||
| def _native_group_quant_reference( | ||
| x: torch.Tensor, | ||
| ) -> tuple[torch.Tensor, torch.Tensor]: | ||
| quant_op = QuantFP8( | ||
| static=False, | ||
| group_shape=GroupShape(1, GROUP_SIZE), | ||
| column_major_scales=False, | ||
| use_ue8m0=False, | ||
| ) | ||
| return quant_op.forward_native(x) | ||
|
|
||
|
|
||
| def test_rocm_aiter_group_fp8_quant_fake_implementation(): | ||
| _assert_aiter_group_quant_supported() | ||
|
|
||
| x = torch.randn((128, 4096), dtype=torch.bfloat16, device="cuda") | ||
| torch.library.opcheck( | ||
| torch.ops.vllm.rocm_aiter_group_fp8_quant, | ||
| (x, GROUP_SIZE), | ||
| test_utils=("test_faketensor",), | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("shape", GROUP_QUANT_SHAPES) | ||
| def test_rocm_aiter_group_fp8_quant_matches_native_reference( | ||
| default_vllm_config, | ||
| shape, | ||
| ): | ||
| _assert_aiter_group_quant_supported() | ||
|
|
||
| x = torch.randn(shape, dtype=torch.bfloat16, device="cuda") | ||
| x_fp8, scales = rocm_aiter_ops.group_fp8_quant(x, GROUP_SIZE) | ||
| ref_fp8, ref_scales = _native_group_quant_reference(x) | ||
|
|
||
| assert x_fp8.shape == x.shape | ||
| assert scales.shape == (shape[0], shape[1] // GROUP_SIZE) | ||
| assert x_fp8.dtype == current_platform.fp8_dtype() | ||
| assert scales.dtype == torch.float32 | ||
| torch.testing.assert_close(x_fp8, ref_fp8, atol=0.0, rtol=0.0) | ||
| torch.testing.assert_close(scales, ref_scales, atol=0.0, rtol=0.0) | ||
|
|
||
|
|
||
| def test_rocm_aiter_group_fp8_quant_torch_compile_matches_eager(): | ||
| _assert_aiter_group_quant_supported() | ||
|
|
||
| def group_fp8_quant_fn(x: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor]: | ||
| return rocm_aiter_ops.group_fp8_quant(x, GROUP_SIZE) | ||
|
|
||
| compiled_fn = torch.compile( | ||
| group_fp8_quant_fn, | ||
| fullgraph=True, | ||
| backend="inductor", | ||
| mode="reduce-overhead", | ||
| dynamic=False, | ||
| ) | ||
|
|
||
| x = torch.randn((128, 4096), dtype=torch.bfloat16, device="cuda") | ||
| eager_fp8, eager_scales = group_fp8_quant_fn(x) | ||
| compiled_fp8, compiled_scales = compiled_fn(x) | ||
|
|
||
| torch.testing.assert_close(compiled_fp8, eager_fp8, atol=0.0, rtol=0.0) | ||
| torch.testing.assert_close(compiled_scales, eager_scales, atol=0.0, rtol=0.0) | ||
|
|
||
| x_2 = torch.randn((128, 4096), dtype=torch.bfloat16, device="cuda") | ||
| eager_fp8_2, eager_scales_2 = group_fp8_quant_fn(x_2) | ||
| compiled_fp8_2, compiled_scales_2 = compiled_fn(x_2) | ||
|
|
||
| torch.testing.assert_close(compiled_fp8_2, eager_fp8_2, atol=0.0, rtol=0.0) | ||
| torch.testing.assert_close(compiled_scales_2, eager_scales_2, atol=0.0, rtol=0.0) | ||
|
|
||
|
|
||
| def test_rocm_aiter_group_fp8_quant_rejects_non_128_group_size(): | ||
| _assert_aiter_group_quant_supported() | ||
|
|
||
| x = torch.randn((32, 1024), dtype=torch.bfloat16, device="cuda") | ||
| with pytest.raises(AssertionError, match="Group size must be 128"): | ||
| rocm_aiter_ops.group_fp8_quant(x, 64) | ||
|
|
||
|
|
||
| def test_rocm_aiter_group_fp8_quant_rejects_non_divisible_hidden_size(): | ||
| _assert_aiter_group_quant_supported() | ||
|
|
||
| x = torch.randn((32, 1025), dtype=torch.bfloat16, device="cuda") | ||
| with pytest.raises(AssertionError, match="divisible by group size"): | ||
| rocm_aiter_ops.group_fp8_quant(x, GROUP_SIZE) | ||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.