feat: extended EPLB support for Mistral Large 3 and additional MoE backends (#48355)
Signed-off-by: jdebache <jdebache@nvidia.com>
This commit is contained in:
@@ -628,6 +628,17 @@ def make_fp8_moe_quant_config(
|
||||
and block_shape is None
|
||||
):
|
||||
assert a1_scale is not None and a2_scale is not None
|
||||
g1_alphas = w1_scale * a1_scale
|
||||
g2_alphas = w2_scale * a2_scale
|
||||
if layer is not None:
|
||||
layer.register_parameter(
|
||||
"g1_alphas", torch.nn.Parameter(g1_alphas, requires_grad=False)
|
||||
)
|
||||
layer.register_parameter(
|
||||
"g2_alphas", torch.nn.Parameter(g2_alphas, requires_grad=False)
|
||||
)
|
||||
g1_alphas = layer.g1_alphas
|
||||
g2_alphas = layer.g2_alphas
|
||||
return fp8_w8a8_moe_quant_config(
|
||||
w1_scale=w1_scale,
|
||||
w2_scale=w2_scale,
|
||||
@@ -637,8 +648,8 @@ def make_fp8_moe_quant_config(
|
||||
a2_scale=a2_scale,
|
||||
a1_gscale=(1.0 / a1_scale),
|
||||
a2_gscale=(1.0 / a2_scale),
|
||||
g1_alphas=(w1_scale * a1_scale).squeeze(),
|
||||
g2_alphas=(w2_scale * a2_scale).squeeze(),
|
||||
g1_alphas=g1_alphas,
|
||||
g2_alphas=g2_alphas,
|
||||
gemm1_clamp_limit=swiglu_limit,
|
||||
)
|
||||
# MXFP8 (block [1, 32]) dispatches to the mxfp8 activation quant. Scales are
|
||||
|
||||
@@ -19,6 +19,7 @@ from vllm.model_executor.layers.fused_moe.config import (
|
||||
)
|
||||
from vllm.model_executor.layers.fused_moe.routed_experts import RoutedExperts
|
||||
from vllm.model_executor.layers.quantization.utils.flashinfer_fp4_moe import (
|
||||
nvfp4_swizzled_scale_to_cutedsl_mma_view,
|
||||
prepare_nvfp4_moe_layer_for_fi_or_cutlass,
|
||||
prepare_nvfp4_moe_layer_for_flashinfer_cutedsl,
|
||||
)
|
||||
@@ -506,6 +507,10 @@ def make_nvfp4_moe_quant_config(
|
||||
gemm1_clamp_limit=swiglu_limit,
|
||||
)
|
||||
|
||||
if backend == NvFp4MoeBackend.FLASHINFER_CUTEDSL:
|
||||
w13_scale = nvfp4_swizzled_scale_to_cutedsl_mma_view(w13_scale)
|
||||
w2_scale = nvfp4_swizzled_scale_to_cutedsl_mma_view(w2_scale)
|
||||
|
||||
# Pass w13_scale_2 / w2_scale_2 directly as g1/g2_alphas.
|
||||
# The expert's process_weights_after_loading will fuse activation
|
||||
# scales in-place. Since the quant config references the same tensor
|
||||
|
||||
Reference in New Issue
Block a user