[Online quantization] Add online MXFP4 quantization support (#49347)

Signed-off-by: Felix Marty <Felix.Marty@amd.com>
This commit is contained in:
fxmarty-amd
2026-08-07 12:39:46 -07:00
committed by GitHub
parent a671679e9f
commit 3518110f2f
18 changed files with 1423 additions and 35 deletions
@@ -114,9 +114,15 @@ def test_weight_only_kernels_reject_non_mxfp4_activation(kernel_cls):
"activation_quant_key",
[None, kMxfp4Dynamic, kMxfp6E3M2Dynamic, kMxfp6E2M3Dynamic],
)
def test_emulation_kernel_accepts_any_config(activation_quant_key):
def test_emulation_kernel_accepts_any_config(activation_quant_key, monkeypatch):
"""EmulationMxfp4LinearKernel is the universal fallback: it must accept
every supported activation format."""
# `EmulationMxfp4LinearKernel.can_implement` gates on `has_quark()`,
# which we are not testing here.
monkeypatch.setattr(
"vllm.model_executor.kernels.linear.mxfp4.emulation.has_quark",
lambda: True,
)
config = MxFp4LinearLayerConfig(activation_quant_key=activation_quant_key)
with patch(
"vllm.model_executor.kernels.linear._get_linear_backend",
@@ -126,9 +132,15 @@ def test_emulation_kernel_accepts_any_config(activation_quant_key):
assert can_implement, reason
def test_emulation_kernel_derives_quant_dequant_func_from_config():
def test_emulation_kernel_derives_quant_dequant_func_from_config(monkeypatch):
"""quant_dequant_func must be derived purely from the config's activation
QuantKey, not set externally."""
# `EmulationMxfp4LinearKernel.can_implement` gates on `has_quark()`,
# which we are not testing here.
monkeypatch.setattr(
"vllm.model_executor.kernels.linear.mxfp4.emulation.has_quark",
lambda: True,
)
with patch(
"vllm.model_executor.kernels.linear._get_linear_backend",
return_value="emulation",