[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."""
@@ -502,6 +502,7 @@ def select_mxfp4_moe_backend(
_get_priority_backends_for_gpt_oss(), requested_activation_key
)
unsupported_reasons = []
for backend in AVAILABLE_BACKENDS:
# Use requested_activation_key if provided, otherwise use backend default
act_key = (
@@ -518,6 +519,7 @@ def select_mxfp4_moe_backend(
return backend, k_cls
else:
logger.debug_once(_make_log_unsupported(backend, reason))
unsupported_reasons.append((backend, reason))
if current_platform.is_xpu():
backend = Mxfp4MoeBackend.XPU
@@ -541,26 +543,19 @@ def select_mxfp4_moe_backend(
activation_format,
)
if current_platform.is_rocm():
backend = Mxfp4MoeBackend.TRITON_UNFUSED
logger.info_once(_make_log_backend(backend))
return _return_or_raise(
Mxfp4MoeBackend.TRITON_UNFUSED,
config,
kMxfp4Static,
None,
activation_format,
)
if current_platform.is_cuda():
raise NotImplementedError(
"No MXFP4 MoE backend supports the deployment configuration. "
f"weight_key=kMxfp4Static, activation_key={activation_key}. "
"Native backends require specific hardware. "
"Set `VLLM_LOGGING_LEVEL=DEBUG` to see detailed unsupported reasons. "
)
return Mxfp4MoeBackend.NONE, None
unsupported_log = "; ".join(
[
f"backend: {backend.value}, reason: {reason}"
for backend, reason in unsupported_reasons
]
)
raise NotImplementedError(
"No MXFP4 MoE backend supports the deployment configuration. "
f"weight_key=kMxfp4Static, activation_key={activation_key}. "
f"Candidate backends were: "
f"{[backend.value for backend in AVAILABLE_BACKENDS]}. "
f"Unsupported reasons: {unsupported_log}. "
)
def select_deepseek_v4_mxfp4_moe_backend(