diff --git a/.sync/vllm-sha b/.sync/vllm-sha index 2921343706..e482aabb49 100644 --- a/.sync/vllm-sha +++ b/.sync/vllm-sha @@ -1 +1 @@ -82ae4164ee016d4daecd2033c26f5c0827984a80 +5233368daccd3d84293bab7b04bacae1433ea0e4 diff --git a/aphrodite/model_executor/layers/fused_moe/experts/ocp_mx_emulation_moe.py b/aphrodite/model_executor/layers/fused_moe/experts/ocp_mx_emulation_moe.py index 0276750d1c..1a6a2d40c9 100644 --- a/aphrodite/model_executor/layers/fused_moe/experts/ocp_mx_emulation_moe.py +++ b/aphrodite/model_executor/layers/fused_moe/experts/ocp_mx_emulation_moe.py @@ -68,9 +68,15 @@ def __init__( self.quantization_emulation = True if self.ocp_mx_scheme in { + OCP_MX_Scheme.w_mxfp4, + OCP_MX_Scheme.w_mxfp6_e3m2, + OCP_MX_Scheme.w_mxfp6_e2m3, + }: + # Weight-only schemes leave activations unquantized. + self._quant_dtype = None + elif self.ocp_mx_scheme in { OCP_MX_Scheme.w_mxfp4_a_mxfp4, }: - # Weight has to be dequantized for mxfp4 emulation. self._quant_dtype = "mxfp4" elif self.ocp_mx_scheme in [ OCP_MX_Scheme.w_mxfp4_a_mxfp6_e3m2, diff --git a/aphrodite/model_executor/layers/fused_moe/experts/triton_moe.py b/aphrodite/model_executor/layers/fused_moe/experts/triton_moe.py index 38e9641582..812f1c48a4 100644 --- a/aphrodite/model_executor/layers/fused_moe/experts/triton_moe.py +++ b/aphrodite/model_executor/layers/fused_moe/experts/triton_moe.py @@ -129,6 +129,7 @@ def _supports_activation(activation: MoEActivation) -> bool: MoEActivation.SILU, MoEActivation.GELU, MoEActivation.GELU_TANH, + MoEActivation.SITU, MoEActivation.SWIGLUOAI, MoEActivation.SWIGLUOAI_UNINTERLEAVE, MoEActivation.SWIGLUSTEP, diff --git a/aphrodite/model_executor/layers/fused_moe/oracle/mxfp4.py b/aphrodite/model_executor/layers/fused_moe/oracle/mxfp4.py index c372ecc34f..57da7bb210 100644 --- a/aphrodite/model_executor/layers/fused_moe/oracle/mxfp4.py +++ b/aphrodite/model_executor/layers/fused_moe/oracle/mxfp4.py @@ -333,7 +333,10 @@ def _get_priority_backends() -> list[Mxfp4MoeBackend]: backend-level ``is_supported_config`` check filters by device capability). """ if current_platform.is_rocm(): - return [Mxfp4MoeBackend.AITER_MXFP4_BF16] + return [ + Mxfp4MoeBackend.AITER_MXFP4_BF16, + Mxfp4MoeBackend.EMULATION, + ] if current_platform.is_xpu(): return [Mxfp4MoeBackend.XPU] _AVAILABLE_BACKENDS = [ @@ -1091,8 +1094,12 @@ def swap_every_two_rows(x, axis=-1): w13_bias, w2_bias, ) - elif mxfp4_backend == Mxfp4MoeBackend.XPU: - # No additional transformation needed for XPU backend + elif mxfp4_backend in ( + Mxfp4MoeBackend.XPU, + Mxfp4MoeBackend.EMULATION, + ): + # No additional transformation is needed: XPU consumes the checkpoint + # layout directly, while emulation dequantizes that layout at runtime. return ( w13_weight, w2_weight, @@ -1460,7 +1467,7 @@ def shuffle_weight(w: torch.Tensor) -> torch.Tensor: else: raise ValueError( f"Unsupported mxfp4_backend for Mxfp4MoEMethod: {mxfp4_backend}. " - f"Expected TRTLLM, Triton, AITER, or XPU backend." + f"Expected TRTLLM, Triton, AITER, XPU, or emulation backend." ) diff --git a/aphrodite/model_executor/layers/quantization/mxfp4.py b/aphrodite/model_executor/layers/quantization/mxfp4.py index d681a254fd..396ba7ad7d 100644 --- a/aphrodite/model_executor/layers/quantization/mxfp4.py +++ b/aphrodite/model_executor/layers/quantization/mxfp4.py @@ -15,6 +15,9 @@ SharedExperts, ) from aphrodite.model_executor.layers.fused_moe import modular_kernel as mk +from aphrodite.model_executor.layers.fused_moe.config import ( + mxfp4_w4a16_moe_quant_config, +) from aphrodite.model_executor.layers.fused_moe.oracle.mxfp4 import ( TRITON_BACKENDS, Mxfp4MoeBackend, @@ -832,6 +835,18 @@ def get_fused_moe_quant_config( w1_scale = layer.w13_weight_scale w2_scale = layer.w2_weight_scale + if self.mxfp4_backend == Mxfp4MoeBackend.EMULATION: + # Canonical ``mxfp4`` checkpoints are weight-only W4A16. The + # generic EMULATION config is W4A4, so preserve BF16 activations + # while the fallback dequantizes only the weights. + return mxfp4_w4a16_moe_quant_config( + w1_scale=w1_scale, + w2_scale=w2_scale, + w1_bias=w1_bias, + w2_bias=w2_bias, + gemm1_clamp_limit=swiglu_limit, + ) + return make_mxfp4_moe_quant_config( mxfp4_backend=self.mxfp4_backend, w1_scale=w1_scale,