[Bugfix] DSv4 MXFP4 selector: stop narrowing explicit aliases to their BF16 variant (#53586)
Signed-off-by: Zihua Wu <zihuaw@nvidia.com> Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Jee Jee Li <pandaleefree@gmail.com> Co-authored-by: Yongye Zhu <zyy1102000@gmail.com>
This commit is contained in:
co-authored by
mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Jee Jee Li
Yongye Zhu
parent
34b1e9f7a6
commit
5893426b88
@@ -464,6 +464,35 @@ def test_deepseek_v4_b12x_activation_selection(
|
||||
assert experts_cls is B12xExperts
|
||||
|
||||
|
||||
def test_deepseek_v4_flashinfer_cutlass_falls_through_to_w4a8(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
"""Explicit flashinfer_cutlass must try the W4A8 variant when the BF16
|
||||
variant is unsupported (the BF16 variant is gated to SM90)."""
|
||||
from vllm.model_executor.layers.fused_moe.experts.flashinfer_cutlass_moe import (
|
||||
FlashInferExperts,
|
||||
)
|
||||
|
||||
monkeypatch.setattr(FlashInferExperts, "_supports_current_device", lambda: True)
|
||||
|
||||
def sm120_quant_gate(weight_key, activation_key):
|
||||
return (weight_key, activation_key) == (
|
||||
mxfp4_oracle.kMxfp4Static,
|
||||
mxfp4_oracle.kMxfp8Dynamic,
|
||||
)
|
||||
|
||||
monkeypatch.setattr(
|
||||
FlashInferExperts, "_supports_quant_scheme", staticmethod(sm120_quant_gate)
|
||||
)
|
||||
config = make_dummy_moe_config(hidden_dim=256, intermediate_size=64)
|
||||
config.moe_backend = "flashinfer_cutlass"
|
||||
|
||||
backend, experts_cls = select_deepseek_v4_mxfp4_moe_backend(config)
|
||||
|
||||
assert backend == Mxfp4MoeBackend.FLASHINFER_CUTLASS_MXFP4_MXFP8
|
||||
assert experts_cls is FlashInferExperts
|
||||
|
||||
|
||||
def test_compressed_tensors_mxfp4_preserves_checkpoint_packing(
|
||||
monkeypatch: pytest.MonkeyPatch,
|
||||
) -> None:
|
||||
|
||||
@@ -670,7 +670,13 @@ def select_deepseek_v4_mxfp4_moe_backend(
|
||||
# falling back to the auto priority list.
|
||||
runner_backend = config.moe_backend
|
||||
if runner_backend != "auto":
|
||||
requested_backends = _get_requested_backends(runner_backend, None)
|
||||
if runner_backend == "b12x":
|
||||
requested_backends = _get_requested_backends(runner_backend, None)
|
||||
else:
|
||||
# Try every variant of the alias in priority order. Narrowing to
|
||||
# the BF16 variant would drop SM100+ W4A8 variants on devices where
|
||||
# the BF16 variant is gated to SM90.
|
||||
requested_backends = map_mxfp4_backend(runner_backend)
|
||||
if activation_format == mk.FusedMoEActivationFormat.BatchedExperts:
|
||||
requested_backends = [
|
||||
Mxfp4MoeBackend.BATCHED_MARLIN if b == Mxfp4MoeBackend.MARLIN else b
|
||||
|
||||
Reference in New Issue
Block a user