A high-throughput and memory-efficient inference and serving engine for LLMs
[Refactor] Rename rocm_moe.py to rocm_moe_rdna.py (#45011)
Signed-off-by: JartX <sagformas@epdcenter.es> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
JartX committed
Jun 10, 2026 at 11:02 UTC
32daf56b42de854c696ea4de3c8454cc30f1e189
3 files changed
+19
-19
tests/kernels/quantization/test_rdna3_compile_guards.py
+16
-16
@@ -166,14 +166,14 @@ def test_op_absent_on_non_gfx1100(op_name):
166
167
@not_gfx1100
168
def test_rocm_moe_not_supported_on_non_gfx1100():
169
- """rocm_moe.is_supported() must return False on non-gfx1100 hardware."""
169
+ """rocm_moe_rdna.is_supported() must return False on non-gfx1100 hardware."""
170
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
171
- rocm_moe,
171
+ rocm_moe_rdna,
172
)
173
174
wq = type("WQ", (), {"num_bits": 4})()
175
- assert rocm_moe.is_supported(wq) is False, (
176
- "rocm_moe.is_supported() returned True on non-gfx1100 — "
175
+ assert rocm_moe_rdna.is_supported(wq) is False, (
176
+ "rocm_moe_rdna.is_supported() returned True on non-gfx1100 — "
177
"dispatch guard is broken"
178
)
179
@@ -371,43 +371,43 @@ class TestMoEDispatchMocked:
371
"""Mock on_gfx1100() to False and verify RDNA3 MoE is unreachable."""
372
373
def test_is_supported_false_when_mocked_cdna(self):
374
- """rocm_moe.is_supported() must return False when not on gfx1100."""
374
+ """rocm_moe_rdna.is_supported() must return False when not on gfx1100."""
375
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
376
- rocm_moe,
376
+ rocm_moe_rdna,
377
)
378
379
with patch("vllm.platforms.rocm.on_gfx1100", return_value=False):
380
- assert rocm_moe.is_supported(_FakeWeightQuant(num_bits=4)) is False
380
+ assert rocm_moe_rdna.is_supported(_FakeWeightQuant(num_bits=4)) is False
381
382
@pytest.mark.parametrize("num_bits", [2, 3, 8, 16])
383
def test_is_supported_rejects_non_w4(self, num_bits):
384
"""is_supported() rejects non-4-bit even before checking arch."""
385
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
386
- rocm_moe,
386
+ rocm_moe_rdna,
387
)
388
389
- assert rocm_moe.is_supported(_FakeWeightQuant(num_bits=num_bits)) is False
389
+ assert rocm_moe_rdna.is_supported(_FakeWeightQuant(num_bits=num_bits)) is False
390
391
def test_is_supported_false_when_op_missing(self):
392
"""is_supported() returns False when the C++ op doesn't exist."""
393
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
394
- rocm_moe,
394
+ rocm_moe_rdna,
395
)
396
397
fake_rocm_c = type("FakeRocmC", (), {"gptq_gemm_rdna3": None})()
398
with patch.object(torch, "ops", create=True) as mock_ops:
399
mock_ops._rocm_C = fake_rocm_c
400
- assert rocm_moe.is_supported(_FakeWeightQuant(num_bits=4)) is False
400
+ assert rocm_moe_rdna.is_supported(_FakeWeightQuant(num_bits=4)) is False
401
402
def test_is_supported_false_when_rocm_c_absent(self):
403
"""is_supported() returns False when _rocm_C doesn't exist at all."""
404
from vllm.model_executor.layers.quantization.compressed_tensors.compressed_tensors_moe import ( # noqa: E501
405
- rocm_moe,
405
+ rocm_moe_rdna,
406
)
407
408
fake_ops = type("FakeOps", (), {})()
409
with patch.object(torch, "ops", fake_ops):
410
- assert rocm_moe.is_supported(_FakeWeightQuant(num_bits=4)) is False
410
+ assert rocm_moe_rdna.is_supported(_FakeWeightQuant(num_bits=4)) is False
411
412
413
class TestDenseKernelSelectionMocked:
@@ -475,10 +475,10 @@ class TestDenseKernelSelectionMocked:
475
476
477
class TestCompressedTensorsMoEDispatchGuard:
478
- """Verify compressed_tensors_moe.py only enters rocm_moe under is_rocm()."""
478
+ """Verify compressed_tensors_moe.py only enters rocm_moe_rdna under is_rocm()."""
479
480
def test_rocm_guard_in_dispatch_source(self):
481
- """The rocm_moe import and call must be inside an is_rocm() check."""
481
+ """The rocm_moe_rdna import and call must be inside an is_rocm() check."""
482
src = _read_pkg_source_or_skip(
483
"model_executor",
484
"layers",
@@ -498,6 +498,6 @@ class TestCompressedTensorsMoEDispatchGuard:
498
found_guard = True
499
break
500
assert found_guard, (
501
- f"L{i}: rocm_moe reference not protected by "
501
+ f"L{i}: rocm_moe_rdna reference not protected by "
502
f"is_rocm() guard: {stripped}"
503
)
vllm/model_executor/layers/quantization/compressed_tensors/compressed_tensors_moe/compressed_tensors_moe.py
+3
-3
@@ -109,10 +109,10 @@ class CompressedTensorsMoEMethod(FusedMoEMethodBase):
109
110
# Native ROCm HIP kernels (RDNA3, etc.)
111
if current_platform.is_rocm():
112
- from . import rocm_moe
112
+ from . import rocm_moe_rdna
113
114
- if rocm_moe.is_supported(weight_quant):
115
- return rocm_moe.make_method(
114
+ if rocm_moe_rdna.is_supported(weight_quant):
115
+ return rocm_moe_rdna.make_method(
116
weight_quant, input_quant, layer.moe_config
117
)
118