[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>

fxmarty committed Jul 28, 2026 at 05:31 UTC 33fe71a4d3316c847ccd44a35a2055a361148600
3 files changed +63 -35
tests/kernels/moe/test_ocp_mx_moe.py
+48
@@ -1558,3 +1558,51 @@ def test_mxfp4_emulation_rounds_up_to_block_size(
1558 # The block-scale buffer (dim // OCP_MX_BLOCK_SIZE) must not floor-truncate.
1559 assert rounded_hidden % OCP_MX_BLOCK_SIZE == 0
1560 assert rounded_intermediate % OCP_MX_BLOCK_SIZE == 0
1561 +
1562 +
1563 +def test_select_mxfp4_moe_backend_raises_with_unsupported_reasons(
1564 + monkeypatch: pytest.MonkeyPatch,
1565 +):
1566 + """
1567 + select_mxfp4_moe_backend() must raise NotImplementedError, with the
1568 + collected per-backend unsupported reasons in the message, when no
1569 + backend supports the requested deployment configuration.
1570 + """
1571 + import vllm.model_executor.layers.fused_moe.oracle.mxfp4 as mxfp4_oracle
1572 + from vllm.model_executor.layers.fused_moe import FusedMoEConfig
1573 + from vllm.model_executor.layers.fused_moe.activation import MoEActivation
1574 + from vllm.model_executor.layers.fused_moe.config import (
1575 + FusedMoEParallelConfig,
1576 + RoutingMethodType,
1577 + )
1578 +
1579 + class UnsupportedExperts:
1580 + @staticmethod
1581 + def is_supported_config(
1582 + cls, moe_config, weight_key, activation_key, activation_format
1583 + ):
1584 + return False, f"unsupported reason for {cls.__name__}"
1585 +
1586 + monkeypatch.setattr(
1587 + mxfp4_oracle, "backend_to_kernel_cls", lambda backend: [UnsupportedExperts]
1588 + )
1589 + monkeypatch.setattr(mxfp4_oracle, "_user_moe_activation_override", lambda: None)
1590 + monkeypatch.setattr(current_platform, "is_xpu", lambda: False)
1591 + monkeypatch.setattr(current_platform, "is_cpu", lambda: False)
1592 +
1593 + moe_config = FusedMoEConfig(
1594 + num_experts=8,
1595 + experts_per_token=2,
1596 + hidden_dim=256,
1597 + intermediate_size=256,
1598 + num_local_experts=8,
1599 + num_logical_experts=8,
1600 + moe_parallel_config=FusedMoEParallelConfig.make_no_parallel(),
1601 + activation=MoEActivation.SILU,
1602 + in_dtype=torch.bfloat16,
1603 + device="cpu",
1604 + routing_method=RoutingMethodType.Renormalize,
1605 + )
1606 +
1607 + with pytest.raises(NotImplementedError, match="Unsupported reasons"):
1608 + mxfp4_oracle.select_mxfp4_moe_backend(moe_config)
tests/quantization/test_gfx950_moe.py
-15
@@ -79,21 +79,6 @@ def test_w4a4_dispatches_to_aiter(mxfp4_oracle_config):
79 assert experts_cls is not None
80
81
82 -@pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
83 -@pytest.mark.skipif(
84 - ROCM_AITER_AVAILABLE,
85 - reason="Test requires AITER disabled (unset VLLM_ROCM_USE_AITER)",
86 -)
87 -def test_w4a4_falls_back_to_triton_unfused_without_aiter(mxfp4_oracle_config):
88 - """Without AITER and no --moe-backend, ROCm falls back to TRITON_UNFUSED."""
89 - config = _make_w4a4_moe_config()
90 - backend, experts_cls = select_mxfp4_moe_backend(
91 - config, activation_key=kMxfp4Dynamic
92 - )
93 - assert backend == Mxfp4MoeBackend.TRITON_UNFUSED
94 - assert experts_cls is not None
95 -
96 -
82 @pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
83 def test_w4a4_dispatches_to_emulation_with_moe_backend(mxfp4_oracle_config):
84 """With --moe-backend emulation, W4A4 selects EMULATION."""
vllm/model_executor/layers/fused_moe/oracle/mxfp4.py
+15 -20
@@ -502,6 +502,7 @@ def select_mxfp4_moe_backend(
502 _get_priority_backends_for_gpt_oss(), requested_activation_key
503 )
504
505 + unsupported_reasons = []
506 for backend in AVAILABLE_BACKENDS:
507 # Use requested_activation_key if provided, otherwise use backend default
508 act_key = (
@@ -518,6 +519,7 @@ def select_mxfp4_moe_backend(
519 return backend, k_cls
520 else:
521 logger.debug_once(_make_log_unsupported(backend, reason))
522 + unsupported_reasons.append((backend, reason))
523
524 if current_platform.is_xpu():
525 backend = Mxfp4MoeBackend.XPU
@@ -541,26 +543,19 @@ def select_mxfp4_moe_backend(
543 activation_format,
544 )
545
544 - if current_platform.is_rocm():
545 - backend = Mxfp4MoeBackend.TRITON_UNFUSED
546 - logger.info_once(_make_log_backend(backend))
547 - return _return_or_raise(
548 - Mxfp4MoeBackend.TRITON_UNFUSED,
549 - config,
550 - kMxfp4Static,
551 - None,
552 - activation_format,
553 - )
554 -
555 - if current_platform.is_cuda():
556 - raise NotImplementedError(
557 - "No MXFP4 MoE backend supports the deployment configuration. "
558 - f"weight_key=kMxfp4Static, activation_key={activation_key}. "
559 - "Native backends require specific hardware. "
560 - "Set `VLLM_LOGGING_LEVEL=DEBUG` to see detailed unsupported reasons. "
561 - )
562 -
563 - return Mxfp4MoeBackend.NONE, None
546 + unsupported_log = "; ".join(
547 + [
548 + f"backend: {backend.value}, reason: {reason}"
549 + for backend, reason in unsupported_reasons
550 + ]
551 + )
552 + raise NotImplementedError(
553 + "No MXFP4 MoE backend supports the deployment configuration. "
554 + f"weight_key=kMxfp4Static, activation_key={activation_key}. "
555 + f"Candidate backends were: "
556 + f"{[backend.value for backend in AVAILABLE_BACKENDS]}. "
557 + f"Unsupported reasons: {unsupported_log}. "
558 + )
559
560
561 def select_deepseek_v4_mxfp4_moe_backend(