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 7, 11:30 UTC
[ROCm] add amd-quark package in requirements for rocm to use quantized models (#35658)
Signed-off-by: Hongxia Yang <hongxiay.yang@amd.com> Co-authored-by: Hongxia Yang <hongxiay.yang@amd.com>
Hongxia Yang committed
Mar 2, 2026 at 01:02 UTC
f26650d649aac25cb3b7a6b49863e1929da5df32
2 files changed
+24
-6
requirements/rocm.txt
+4
-1
@@ -19,4 +19,7 @@ setuptools>=77.0.3,<80.0.0
19
setuptools-scm>=8
20
runai-model-streamer[s3,gcs]==0.15.3
21
conch-triton-kernels==1.2.1
22
-timm>=1.0.17
\ No newline at end of file
22
+timm>=1.0.17
23
+# amd-quark: required for Quark quantization on ROCm
24
+# To be consistent with test_quark.py
25
+amd-quark>=0.8.99
\ No newline at end of file
tests/quantization/test_quark.py
+20
-5
@@ -26,9 +26,12 @@ from vllm.platforms import current_platform
26
27
from .reference_mxfp4 import dq_mxfp4_torch, qdq_mxfp4_torch
28
29
+# Minimum amd-quark version for MXFP4/OCP_MX tests (single source of truth).
30
+QUARK_MXFP4_MIN_VERSION = "0.8.99"
31
+
32
QUARK_MXFP4_AVAILABLE = find_spec("quark") is not None and version.parse(
33
importlib.metadata.version("amd-quark")
31
-) >= version.parse("0.8.99")
34
+) >= version.parse(QUARK_MXFP4_MIN_VERSION)
35
36
if QUARK_MXFP4_AVAILABLE:
37
from quark.torch.export.nn.modules.realquantizer import StaticScaledRealQuantizer
@@ -200,7 +203,10 @@ WIKITEXT_ACCURACY_CONFIGS = [
203
]
204
205
203
-@pytest.mark.skipif(not QUARK_MXFP4_AVAILABLE, reason="amd-quark>=0.9 is not available")
206
+@pytest.mark.skipif(
207
+ not QUARK_MXFP4_AVAILABLE,
208
+ reason=f"amd-quark>={QUARK_MXFP4_MIN_VERSION} is not available",
209
+)
210
@pytest.mark.parametrize("config", WIKITEXT_ACCURACY_CONFIGS)
211
@pytest.mark.parametrize("tp_size", [1, 2])
212
def test_ocp_mx_wikitext_correctness(config: AccuracyTestConfig, tp_size: int):
@@ -231,7 +237,10 @@ def test_ocp_mx_wikitext_correctness(config: AccuracyTestConfig, tp_size: int):
237
238
239
@pytest.mark.parametrize("config", GSM8K_ACCURACY_CONFIGS)
234
-@pytest.mark.skipif(not QUARK_MXFP4_AVAILABLE, reason="amd-quark>=0.9 is not available")
240
+@pytest.mark.skipif(
241
+ not QUARK_MXFP4_AVAILABLE,
242
+ reason=f"amd-quark>={QUARK_MXFP4_MIN_VERSION} is not available",
243
+)
244
@pytest.mark.skipif(
245
not HF_HUB_AMD_ORG_ACCESS,
246
reason="Read access to huggingface.co/amd is required for this test.",
@@ -261,7 +270,10 @@ def test_mxfp4_gsm8k_correctness(config: AccuracyTestConfig):
270
), f"Expected: {EXPECTED_VALUE} | Measured: {measured_value}"
271
272
264
-@pytest.mark.skipif(not QUARK_MXFP4_AVAILABLE, reason="amd-quark>=0.9 is not available")
273
+@pytest.mark.skipif(
274
+ not QUARK_MXFP4_AVAILABLE,
275
+ reason=f"amd-quark>={QUARK_MXFP4_MIN_VERSION} is not available",
276
+)
277
@pytest.mark.parametrize("float_dtype", [torch.bfloat16, torch.float16])
278
@pytest.mark.parametrize("scalings", [[2.3, 0.03, 7.3, 0.1, 0.004, 17.3, 1e4, 1e-4]])
279
def test_mxfp4_fused_qdq_match_quark(float_dtype: torch.dtype, scalings: list[int]):
@@ -289,7 +301,10 @@ def test_mxfp4_fused_qdq_match_quark(float_dtype: torch.dtype, scalings: list[in
301
)
302
303
292
-@pytest.mark.skipif(not QUARK_MXFP4_AVAILABLE, reason="amd-quark>=0.9 is not available")
304
+@pytest.mark.skipif(
305
+ not QUARK_MXFP4_AVAILABLE,
306
+ reason=f"amd-quark>={QUARK_MXFP4_MIN_VERSION} is not available",
307
+)
308
@pytest.mark.parametrize("float_dtype", [torch.bfloat16, torch.float16])
309
@pytest.mark.parametrize("scalings", [[2.3, 0.03, 7.3, 0.1, 0.004, 17.3, 1e4, 1e-4]])
310
def test_mxfp4_dequant_kernel_match_quark(