[ROCm][Bugfix] Gate AITER MXFP8 MoE on the aiter enable flag (#57426)
Signed-off-by: Rohan Potdar <rohan.potdar@amd.com> Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ import math
|
||||
import torch
|
||||
|
||||
import vllm.model_executor.layers.fused_moe.modular_kernel as mk
|
||||
from vllm._aiter_ops import rocm_aiter_ops
|
||||
from vllm.logger import init_logger
|
||||
from vllm.model_executor.layers.fused_moe.activation import MoEActivation
|
||||
from vllm.model_executor.layers.fused_moe.experts.mxfp8_emulation_moe import (
|
||||
@@ -24,41 +25,6 @@ _AITER_SWIGLU_ALPHA = 1.702
|
||||
_AITER_SWIGLU_BETA = 1.0
|
||||
|
||||
|
||||
def is_aiter_mxfp8_moe_available() -> bool:
|
||||
"""True when the FlyDSL MXFP8 MoE can run here: gfx950, the ``flydsl``
|
||||
package is importable, AND the installed aiter carries the mxfp8 FlyDSL
|
||||
2-stage support from ROCm/aiter#3811.
|
||||
|
||||
``flydsl`` and ``aiter`` are separate packages, so ``is_flydsl_available()``
|
||||
(flydsl pkg + arch) is necessary but not sufficient: an older aiter without
|
||||
#3811 still ships the flydsl pkg and the ``aiter.ops.flydsl`` module but a
|
||||
broken/missing ``per_1x32 + fp8`` 2-stage path. Without this extra gate a
|
||||
nightly lacking #3811 would wrongly select FlyDSL instead of falling back to
|
||||
the native Triton dot_scaled path. #3811 added no probe-able public symbol,
|
||||
so detect the ``minimax_m3_mxfp8`` tuned config it shipped. Every check fails
|
||||
closed (returns False -> triton dot_scaled), which is always safe."""
|
||||
if not (current_platform.is_rocm() and current_platform.supports_mx()):
|
||||
return False
|
||||
try:
|
||||
import os
|
||||
|
||||
import aiter
|
||||
from aiter.ops.flydsl.utils import is_flydsl_available
|
||||
|
||||
if not is_flydsl_available():
|
||||
return False
|
||||
return os.path.exists(
|
||||
os.path.join(
|
||||
os.path.dirname(aiter.__file__),
|
||||
"configs",
|
||||
"model_configs",
|
||||
"minimax_m3_mxfp8_tuned_fmoe.csv",
|
||||
)
|
||||
)
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
|
||||
class AiterMxfp8Experts(Mxfp8TritonExpertsBase):
|
||||
"""MXFP8 MoE through AITER's FlyDSL two-stage grouped GEMM (gfx950)."""
|
||||
|
||||
@@ -79,10 +45,7 @@ class AiterMxfp8Experts(Mxfp8TritonExpertsBase):
|
||||
|
||||
@staticmethod
|
||||
def _supports_current_device() -> bool:
|
||||
# Device capability only (gfx950 / MX-capable ROCm). The flydsl package
|
||||
# check lives in is_supported_config so a missing package is reported
|
||||
# distinctly from an unsupported device.
|
||||
return current_platform.is_rocm() and current_platform.supports_mx()
|
||||
return current_platform.supports_mx() and rocm_aiter_ops.is_fused_moe_enabled()
|
||||
|
||||
@staticmethod
|
||||
def _supports_parallel_config(moe_parallel_config) -> bool:
|
||||
@@ -95,12 +58,6 @@ class AiterMxfp8Experts(Mxfp8TritonExpertsBase):
|
||||
is_supported, reason = super().is_supported_config(
|
||||
cls, moe_config, weight_key, activation_key, activation_format
|
||||
)
|
||||
# _supports_current_device() only gates on the device; surface a clear
|
||||
# reason when the device is fine but the flydsl package is missing.
|
||||
if is_supported and not is_aiter_mxfp8_moe_available():
|
||||
return False, (
|
||||
"kernel requires the aiter flydsl package, which is not installed"
|
||||
)
|
||||
if (
|
||||
is_supported
|
||||
and moe_config.activation != MoEActivation.SWIGLUOAI_UNINTERLEAVE
|
||||
|
||||
Reference in New Issue
Block a user