vllm.model_executor.kernels.linear.mxfp4
¶
Modules:
-
aiter– -
b12x– -
base– -
emulation– -
flashinfer– -
humming– -
pytorch– -
rdna3_hip–MXFP4 linear kernel for RDNA3/RDNA3.5 (gfx11) with an int8-activation decode
-
xpu–
Classes:
-
MxFp4LinearKernel–Base class for MXFP4 quantized linear kernels.
-
MxFp4LinearLayerConfig–Configuration for an MXFP4 linear layer.
MxFp4LinearKernel
¶
Bases: ABC
Base class for MXFP4 quantized linear kernels.
Each subclass implements a specific GEMM backend (CUTLASS, Marlin, etc).
The kernel selection mechanism iterates over registered subclasses in
priority order, calling is_supported, _supports_quant_scheme and
can_implement to find the best match for the current hardware.
Methods:
-
apply_weights–Run the quantized GEMM.
-
can_implement–Return whether this kernel can handle config.
-
is_supported–Return whether this kernel can run on the current platform.
-
process_weights_after_loading–Transform weights into the format required by this kernel.
Source code in vllm/model_executor/kernels/linear/mxfp4/base.py
_supports_quant_scheme(weight_key, activation_key)
classmethod
¶
Return whether this kernel implements weight_key x activation_key.
Selection uses this to dispatch on the requested activation format
(from the checkpoint or --quantization-config.linear.activation).
The default covers MXFP4 weights with MXFP4 or unquantized activations;
kernels for other activation formats override it.
Source code in vllm/model_executor/kernels/linear/mxfp4/base.py
apply_weights(layer, x, bias=None)
abstractmethod
¶
Run the quantized GEMM.
can_implement(config)
abstractmethod
classmethod
¶
Return whether this kernel can handle config.
is_supported(compute_capability=None)
abstractmethod
classmethod
¶
Return whether this kernel can run on the current platform.
process_weights_after_loading(layer)
abstractmethod
¶
Transform weights into the format required by this kernel.
Called once after checkpoint weights have been loaded onto the device. Implementations should repack / swizzle / pad weights and scales in-place on layer.
Source code in vllm/model_executor/kernels/linear/mxfp4/base.py
MxFp4LinearLayerConfig
dataclass
¶
Configuration for an MXFP4 linear layer.
All MXFP4 layers share the same structure: packed uint8 weights (2 FP4 values per byte) and per-block weight scales (group size 32).
Attributes:
-
activation_quant_key(QuantKey | None) –Identifies the activation quantization format, or
Nonewhen activations must not be quantized.