Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions vllm/model_executor/layers/fused_moe/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,10 +603,17 @@ def fp8_w8a8_moe_quant_config(
a2_gscale: torch.Tensor | None = None,
g1_alphas: torch.Tensor | None = None,
g2_alphas: torch.Tensor | None = None,
gemm1_alpha: float | None = None,
gemm1_beta: float | None = None,
gemm1_clamp_limit: float | None = None,
) -> FusedMoEQuantConfig:
"""
Construct a quant config for fp8 activations and fp8 weights.

``gemm1_alpha``/``gemm1_beta`` drive the SwiGLU-OAI GEMM1 activation
(``silu_and_mul_with_clamp``); they must be forwarded for SwiGLU-OAI MoEs
(e.g. MiniMax-M3 alpha=1.702, beta=1.0), else the kernel defaults to
alpha=1.0/beta=0.0 and produces garbage.
"""
return FusedMoEQuantConfig.make(
current_platform.fp8_dtype(),
Expand All @@ -623,6 +630,8 @@ def fp8_w8a8_moe_quant_config(
per_act_token_quant=per_act_token_quant,
per_out_ch_quant=per_out_ch_quant,
block_shape=block_shape,
gemm1_alpha=gemm1_alpha,
gemm1_beta=gemm1_beta,
gemm1_clamp_limit=gemm1_clamp_limit,
)

Expand Down
2 changes: 2 additions & 0 deletions vllm/model_executor/layers/fused_moe/oracle/fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,8 @@ def make_fp8_moe_quant_config(
block_shape=block_shape,
per_act_token_quant=per_act_token_quant,
per_out_ch_quant=per_out_ch_quant,
gemm1_alpha=gemm1_alpha,
gemm1_beta=gemm1_beta,
gemm1_clamp_limit=swiglu_limit,
)

Expand Down
5 changes: 5 additions & 0 deletions vllm/model_executor/layers/quantization/fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,11 @@ def get_fused_moe_quant_config(self, layer: RoutedExperts) -> FusedMoEQuantConfi
a2_scale=a2_scale,
block_shape=self.weight_block_size,
swiglu_limit=getattr(layer, "swiglu_limit", None),
# SwiGLU-OAI alpha/beta (e.g. MiniMax-M3: 1.702/1.0). Without these
# the fp8 MoE applies silu_and_mul_with_clamp with the default
# alpha=1.0/beta=0.0, producing garbage for SwiGLU-OAI MoEs.
gemm1_alpha=getattr(layer, "swiglu_alpha", None),
gemm1_beta=getattr(layer, "swiglu_beta", None),
)

# Inject biases into the quant config if the model has them
Expand Down
5 changes: 5 additions & 0 deletions vllm/model_executor/layers/quantization/online/fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ def get_fused_moe_quant_config(
per_act_token_quant=self.per_act_token_quant,
per_out_ch_quant=self.per_out_ch_quant,
swiglu_limit=getattr(layer, "swiglu_limit", None),
# SwiGLU-OAI alpha/beta (e.g. MiniMax-M3: 1.702/1.0). Without these
# the online fp8 MoE runs silu_and_mul_with_clamp with the default
# alpha=1.0/beta=0.0, producing garbage for SwiGLU-OAI MoEs.
gemm1_alpha=getattr(layer, "swiglu_alpha", None),
gemm1_beta=getattr(layer, "swiglu_beta", None),
)


Expand Down
1 change: 1 addition & 0 deletions vllm/platforms/rocm.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,7 @@ class RocmPlatform(Platform):
"modelopt_mixed",
"fp8_per_tensor",
"fp8_per_block",
"fp8_per_channel", # PTPC: per-channel weight + per-token act fp8
"online",
"gpt_oss_mxfp4",
]
Expand Down
Loading