[AMD] Revert Mxfp4MoeBackend.TRITON_UNFUSED fallback (#46491)

Signed-off-by: Felix Marty <Felix.Marty@amd.com>
Co-authored-by: Felix Marty <Felix.Marty@amd.com>
Co-authored-by: Andreas Karatzas <akaratza@amd.com>
This commit is contained in:
fxmarty
2026-07-27 22:31:23 -05:00
committed by GitHub
co-authored by Felix Marty Andreas Karatzas
parent d18ed2304a
commit 33fe71a4d3
3 changed files with 63 additions and 35 deletions
+48
View File
@@ -1558,3 +1558,51 @@ def test_mxfp4_emulation_rounds_up_to_block_size(
# The block-scale buffer (dim // OCP_MX_BLOCK_SIZE) must not floor-truncate.
assert rounded_hidden % OCP_MX_BLOCK_SIZE == 0
assert rounded_intermediate % OCP_MX_BLOCK_SIZE == 0
def test_select_mxfp4_moe_backend_raises_with_unsupported_reasons(
monkeypatch: pytest.MonkeyPatch,
):
"""
select_mxfp4_moe_backend() must raise NotImplementedError, with the
collected per-backend unsupported reasons in the message, when no
backend supports the requested deployment configuration.
"""
import vllm.model_executor.layers.fused_moe.oracle.mxfp4 as mxfp4_oracle
from vllm.model_executor.layers.fused_moe import FusedMoEConfig
from vllm.model_executor.layers.fused_moe.activation import MoEActivation
from vllm.model_executor.layers.fused_moe.config import (
FusedMoEParallelConfig,
RoutingMethodType,
)
class UnsupportedExperts:
@staticmethod
def is_supported_config(
cls, moe_config, weight_key, activation_key, activation_format
):
return False, f"unsupported reason for {cls.__name__}"
monkeypatch.setattr(
mxfp4_oracle, "backend_to_kernel_cls", lambda backend: [UnsupportedExperts]
)
monkeypatch.setattr(mxfp4_oracle, "_user_moe_activation_override", lambda: None)
monkeypatch.setattr(current_platform, "is_xpu", lambda: False)
monkeypatch.setattr(current_platform, "is_cpu", lambda: False)
moe_config = FusedMoEConfig(
num_experts=8,
experts_per_token=2,
hidden_dim=256,
intermediate_size=256,
num_local_experts=8,
num_logical_experts=8,
moe_parallel_config=FusedMoEParallelConfig.make_no_parallel(),
activation=MoEActivation.SILU,
in_dtype=torch.bfloat16,
device="cpu",
routing_method=RoutingMethodType.Renormalize,
)
with pytest.raises(NotImplementedError, match="Unsupported reasons"):
mxfp4_oracle.select_mxfp4_moe_backend(moe_config)
-15
View File
@@ -79,21 +79,6 @@ def test_w4a4_dispatches_to_aiter(mxfp4_oracle_config):
assert experts_cls is not None
@pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
@pytest.mark.skipif(
ROCM_AITER_AVAILABLE,
reason="Test requires AITER disabled (unset VLLM_ROCM_USE_AITER)",
)
def test_w4a4_falls_back_to_triton_unfused_without_aiter(mxfp4_oracle_config):
"""Without AITER and no --moe-backend, ROCm falls back to TRITON_UNFUSED."""
config = _make_w4a4_moe_config()
backend, experts_cls = select_mxfp4_moe_backend(
config, activation_key=kMxfp4Dynamic
)
assert backend == Mxfp4MoeBackend.TRITON_UNFUSED
assert experts_cls is not None
@pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
def test_w4a4_dispatches_to_emulation_with_moe_backend(mxfp4_oracle_config):
"""With --moe-backend emulation, W4A4 selects EMULATION."""