@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b75f826fca
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 11, 17:30 UTC

[CI/Build][AMD] Skip quantization kernels tests that require CUTLASS or e4m3fn when not supported by platform (#30020)

Signed-off-by: Randall Smith <ransmith@amd.com> Co-authored-by: Randall Smith <ransmith@amd.com>

rasmith committed Dec 9, 2025 at 20:28 UTC b75f826fca4febb17a76c12a45d5e315111c7618
3 files changed +20 -3
tests/kernels/quantization/test_block_fp8.py
+14 -3
@@ -54,6 +54,10 @@ def setup_cuda():
54 torch.set_default_device("cuda")
55
56
57 +@pytest.mark.skipif(
58 + current_platform.is_fp8_fnuz(),
59 + reason="This platform supports e4m3fnuz, not e4m3fn.",
60 +)
61 @pytest.mark.parametrize(
62 "num_tokens,d,dtype,group_size,seed",
63 itertools.product(NUM_TOKENS, D, DTYPES, GROUP_SIZE, SEEDS),
@@ -78,14 +82,14 @@ def test_per_token_group_quant_fp8(num_tokens, d, dtype, group_size, seed):
82 def test_w8a8_block_fp8_matmul(M, N, K, block_size, out_dtype, seed):
83 torch.manual_seed(seed)
84 factor_for_scale = 1e-2
81 - fp8_info = torch.finfo(torch.float8_e4m3fn)
85 + fp8_info = torch.finfo(current_platform.fp8_dtype())
86 fp8_max, fp8_min = fp8_info.max, fp8_info.min
87
88 A_fp32 = (torch.rand(M, K, dtype=torch.float32) - 0.5) * 2 * fp8_max
85 - A_fp8 = A_fp32.clamp(min=fp8_min, max=fp8_max).to(torch.float8_e4m3fn)
89 + A_fp8 = A_fp32.clamp(min=fp8_min, max=fp8_max).to(current_platform.fp8_dtype())
90
91 B_fp32 = (torch.rand(N, K, dtype=torch.float32) - 0.5) * 2 * fp8_max
88 - B_fp8 = B_fp32.clamp(min=fp8_min, max=fp8_max).to(torch.float8_e4m3fn)
92 + B_fp8 = B_fp32.clamp(min=fp8_min, max=fp8_max).to(current_platform.fp8_dtype())
93
94 block_n, block_k = block_size[0], block_size[1]
95 n_tiles = (N + block_n - 1) // block_n
@@ -103,6 +107,9 @@ def test_w8a8_block_fp8_matmul(M, N, K, block_size, out_dtype, seed):
107 assert rel_diff < 0.001
108
109
110 +@pytest.mark.skipif(
111 + not current_platform.is_cuda(), reason="CUTLASS only supported on CUDA platform."
112 +)
113 @torch.inference_mode()
114 def test_w8a8_block_fp8_cutlass_matmul():
115 # Test simple case where weight.shape % 128 != 0,
@@ -151,6 +158,10 @@ def test_w8a8_block_fp8_cutlass_matmul():
158 assert rel_diff < 0.001
159
160
161 +@pytest.mark.skipif(
162 + current_platform.is_fp8_fnuz(),
163 + reason="This platform supports e4m3fnuz, not e4m3fn.",
164 +)
165 @pytest.mark.parametrize(
166 "M,N,K,block_size,out_dtype,seed",
167 itertools.product(M, N, K, BLOCK_SIZE, OUT_DTYPES, SEEDS),
tests/kernels/quantization/test_cutlass_scaled_mm.py
+3
@@ -15,6 +15,9 @@ from vllm import _custom_ops as ops
15 from vllm.platforms import current_platform
16 from vllm.utils.math_utils import cdiv
17
18 +if not current_platform.is_cuda():
19 + pytest.skip("These tests use CUTLASS which requires CUDA", allow_module_level=True)
20 +
21 MNK_FACTORS = [
22 (1, 256, 128),
23 (1, 16384, 1024),
tests/kernels/quantization/test_cutlass_w4a8.py
+3
@@ -21,6 +21,9 @@ from vllm.model_executor.layers.quantization.utils.quant_utils import (
21 from vllm.platforms import current_platform
22 from vllm.scalar_type import ScalarType, scalar_types
23
24 +if not current_platform.is_cuda():
25 + pytest.skip("These tests use CUTLASS which requires CUDA", allow_module_level=True)
26 +
27 # TODO: in future PR refactor this and `is_quant_method_supported` in the kernel
28 # unit tests to a common utility function. Currently the use of
29 # `is_quant_method_supported` conflates kernels with quantization methods