[ROCm][Test] Fix stale test_gfx950_moe MXFP4 oracle tests (#46260)

Signed-off-by: Spandan Tiwari <23646532+spandantiwari@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

Spandan Tiwari committed Jun 23, 2026 at 08:07 UTC 2aaaf3febdcc7248d4ef729f1224845a0163e527
1 file changed +23 -8
tests/quantization/test_gfx950_moe.py
+23 -8
@@ -42,7 +42,7 @@ def _make_w4a4_moe_config(moe_backend: str = "auto") -> FusedMoEConfig:
42 num_experts=8,
43 experts_per_token=2,
44 hidden_dim=256,
45 - intermediate_size_per_partition=256,
45 + intermediate_size=256,
46 num_local_experts=8,
47 num_logical_experts=8,
48 moe_parallel_config=FusedMoEParallelConfig.make_no_parallel(),
@@ -54,9 +54,22 @@ def _make_w4a4_moe_config(moe_backend: str = "auto") -> FusedMoEConfig:
54 )
55
56
57 +@pytest.fixture
58 +def mxfp4_oracle_config():
59 + """Stub the config the oracle reads (``model_config.quantization_config``)
60 + so backend dispatch resolves without a real model / user override."""
61 + from unittest.mock import patch
62 +
63 + with patch(
64 + "vllm.model_executor.layers.fused_moe.oracle.mxfp4.get_current_vllm_config"
65 + ) as mock_get_config:
66 + mock_get_config.return_value.model_config.quantization_config = None
67 + yield
68 +
69 +
70 @pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
71 @pytest.mark.skipif(not ROCM_AITER_AVAILABLE, reason="Requires AITER enabled")
59 -def test_w4a4_dispatches_to_aiter():
72 +def test_w4a4_dispatches_to_aiter(mxfp4_oracle_config):
73 """With AITER enabled + GFX950, W4A4 selects AITER_MXFP4_MXFP4."""
74 config = _make_w4a4_moe_config()
75 backend, experts_cls = select_mxfp4_moe_backend(
@@ -71,16 +84,18 @@ def test_w4a4_dispatches_to_aiter():
84 ROCM_AITER_AVAILABLE,
85 reason="Test requires AITER disabled (unset VLLM_ROCM_USE_AITER)",
86 )
74 -def test_w4a4_raises_without_aiter_and_no_moe_backend():
75 - """Without AITER and no --moe-backend, raises NotImplementedError
76 - with hint to use --moe-backend emulation."""
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()
78 - with pytest.raises(NotImplementedError, match="--moe-backend emulation"):
79 - select_mxfp4_moe_backend(config, activation_key=kMxfp4Dynamic)
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
97 @pytest.mark.skipif(not ROCM_GFX950, reason="Requires GFX950 (mi355x)")
83 -def test_w4a4_dispatches_to_emulation_with_moe_backend():
98 +def test_w4a4_dispatches_to_emulation_with_moe_backend(mxfp4_oracle_config):
99 """With --moe-backend emulation, W4A4 selects EMULATION."""
100 config = _make_w4a4_moe_config(moe_backend="emulation")
101 backend, experts_cls = select_mxfp4_moe_backend(