[Online quantization] Add online MXFP4 quantization support (#49347)
Signed-off-by: Felix Marty <Felix.Marty@amd.com>
This commit is contained in:
@@ -26,7 +26,11 @@ from vllm.model_executor.layers.quantization.utils.mxfp6_utils import dequant_mx
|
||||
from vllm.model_executor.layers.quantization.utils.ocp_mx_utils import (
|
||||
OCP_MX_Scheme,
|
||||
)
|
||||
from vllm.model_executor.layers.quantization.utils.quant_utils import (
|
||||
QuantKey,
|
||||
)
|
||||
from vllm.platforms import current_platform
|
||||
from vllm.utils.import_utils import has_quark
|
||||
|
||||
logger = init_logger(__name__)
|
||||
|
||||
@@ -92,6 +96,25 @@ class OCP_MXQuantizationEmulationTritonExperts(TritonExperts):
|
||||
]:
|
||||
self._quant_dtype = current_platform.fp8_dtype()
|
||||
|
||||
@staticmethod
|
||||
def is_supported_config(
|
||||
cls: type["mk.FusedMoEExperts"],
|
||||
moe_config: FusedMoEConfig,
|
||||
weight_key: QuantKey | None,
|
||||
activation_key: QuantKey | None,
|
||||
activation_format: mk.FusedMoEActivationFormat,
|
||||
) -> tuple[bool, str | None]:
|
||||
if not has_quark():
|
||||
return False, "kernel requires amd-quark package"
|
||||
|
||||
return TritonExperts.is_supported_config(
|
||||
cls=cls,
|
||||
moe_config=moe_config,
|
||||
weight_key=weight_key,
|
||||
activation_key=activation_key,
|
||||
activation_format=activation_format,
|
||||
)
|
||||
|
||||
@property
|
||||
def quant_dtype(self) -> torch.dtype | str | None:
|
||||
return self._quant_dtype
|
||||
|
||||
Reference in New Issue
Block a user