Skip to content

[Bugfix] DSv4 MXFP4 selector: stop narrowing explicit aliases to their BF16 variant - #53586

Merged
zyongye merged 6 commits into
vllm-project:mainfrom
lucifer1004:pr/mxfp4-alias-variant-fallthrough
Sep 7, 2026
Merged

[Bugfix] DSv4 MXFP4 selector: stop narrowing explicit aliases to their BF16 variant#53586
zyongye merged 6 commits into
vllm-project:mainfrom
lucifer1004:pr/mxfp4-alias-variant-fallthrough

Conversation

@lucifer1004

Copy link
Copy Markdown
Contributor

[Bugfix] DSv4 MXFP4 selector: stop narrowing explicit aliases to their BF16 variant

Purpose

On DeepSeek-V4-class MXFP4 models, passing an explicit non-b12x MoE backend
(e.g. --moe-backend flashinfer_cutlass) can fail outright on SM100+/SM120
even though a supported variant of that backend exists.

Root cause: the DSv4 selector routed explicit aliases through
_get_requested_backends(alias, None). With no declared model activation,
the BF16-preference filter keeps only the BF16 variant of the alias. The
FlashInfer CUTLASS BF16 variant is gated to SM90, so on SM100+/SM120 the
selection dead-ends instead of falling through to the W4A8 (MXFP4 weights +
MXFP8 activations) variant, which is the variant that actually supports those
devices.

Fix: for explicit non-b12x aliases, try every variant of the alias in priority
order (map_mxfp4_backend). The narrowing stays scoped to b12x, where it
encodes the intended W4A8-by-default backend policy.

A regression test simulates the SM120 gate (BF16 variant unsupported, W4A8
variant supported) and requires flashinfer_cutlass to select
FLASHINFER_CUTLASS_MXFP4_MXFP8; it fails on unfixed code and passes with
this change.

Test plan

  • pytest tests/kernels/moe/test_b12x.py -k "flashinfer_cutlass_falls_through or b12x_activation_selection" — 3 passed; the new test fails without the
    fix (fail-before verified).
  • pre-commit run --from-ref upstream/main --to-ref HEAD — all hooks pass.
  • E2E on 4x RTX 6000 Pro (SM120), DeepSeek-V4-Flash-0731 NVFP4, TP4 with
    DSpark speculative decoding: --moe-backend flashinfer_cutlass previously
    errored at startup; with this fix the server starts and an 8K/1K random
    benchmark completes with zero failed requests. Current main additionally
    needs [Bugfix][SM120] DSv4: pass contiguous C128A decode topk indices on SM120 #53574 (one-line C128A contiguity fix) to boot DSv4 + spec decoding on
    SM120 at all, so the E2E was run with that fix stacked.

Notes

AI assistance (Kimi Code / OpenAI Codex) was used in preparing this change;
every line was reviewed and tested by the submitting human.

The DSv4 selector routed explicit non-b12x aliases through
_get_requested_backends(..., None), whose BF16-preference filter drops
every non-BF16 variant when the model declares no activation. The
FlashInfer CUTLASS BF16 variant is gated to SM90, so on SM100+/SM120
`--moe-backend flashinfer_cutlass` failed outright instead of falling
through to the W4A8 (MXFP8) variant. Restore trying every variant of
the alias in priority order; keep the narrowing scoped to b12x, where
it encodes the W4A8-by-default backend policy.

Adds a regression test that simulates the SM120 gate (BF16 variant
unsupported) and requires selection to land on the MXFP8 variant.

Verified end-to-end on RTX 6000 Pro (SM120), DeepSeek-V4-Flash-0731:
`--moe-backend flashinfer_cutlass` now starts and serves.

Signed-off-by: Zihua Wu <zihuaw@nvidia.com>
Signed-off-by: Zihua Wu <13583761+lucifer1004@users.noreply.github.com>

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added DSv4 bug Something isn't working labels Aug 24, 2026
@zyongye

zyongye commented Aug 25, 2026

Copy link
Copy Markdown
Member

/ci run

@zyongye
zyongye enabled auto-merge (squash) August 25, 2026 08:32
@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85470 for commit 2b014d69c8b6.

@github-actions github-actions Bot added the ready ONLY add when PR is ready to merge/full CI is needed label Aug 25, 2026
@zyongye

zyongye commented Aug 25, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

Copy link
Copy Markdown

✅ Triggered Buildkite CI #85471 for commit 88d719494743.

auto-merge was automatically disabled August 26, 2026 08:56

Head branch was pushed to by a user without write access

@lucifer1004
lucifer1004 force-pushed the pr/mxfp4-alias-variant-fallthrough branch from 88d7194 to 8ca081d Compare August 26, 2026 08:56
@lucifer1004

Copy link
Copy Markdown
Contributor Author

Thanks for the review! The only failing CI job is nvidia-h200-model-executor (1 of 596). I can't read the Buildkite log from here, but the change should be behavior-preserving wherever the BF16 variant is supported (SM90 included): explicit aliases try their BF16 variant first, exactly what the previous narrowing produced; the only behavior change is on SM100+/SM120 where the BF16 variant is gated out and we now fall through to the W4A8 variant instead of erroring. Could you check whether that failure is related, or retry the job? (Note: I also force-pushed to drop a co-author trailer, no code change.)

lucifer1004 added a commit to lucifer1004/vllm that referenced this pull request Aug 26, 2026
@jeejeelee

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #86474 for commit 6f37ac0c051b.

@zyongye
zyongye enabled auto-merge (squash) September 7, 2026 05:09
@zyongye

zyongye commented Sep 7, 2026

Copy link
Copy Markdown
Member

/ci run

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87489 for commit 0fe8f879522f.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: c5df860c-bc08-4bab-99c4-847e6968054f

📥 Commits

Reviewing files that changed from the base of the PR and between d9105ea and 0fe8f87.

📒 Files selected for processing (2)
  • tests/kernels/moe/test_b12x.py
  • vllm/model_executor/layers/fused_moe/oracle/mxfp4.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes

    • Improved DeepSeek v4 MXFP4 backend selection for explicit configurations.
    • Unsupported BF16 variants now correctly fall back to compatible W4A8 MXFP4/MXFP8 variants on supported hardware.
  • Tests

    • Added regression coverage for backend fallback behavior.

Walkthrough

The DeepSeek v4 MXFP4 backend selector now preserves activation variants for explicit backends. A regression test verifies that flashinfer_cutlass falls back to the MXFP4/MXFP8 implementation when the BF16 variant is unavailable.

Changes

DeepSeek v4 backend selection

Layer / File(s) Summary
Backend selection and regression coverage
vllm/model_executor/layers/fused_moe/oracle/mxfp4.py, tests/kernels/moe/test_b12x.py
Explicit backends now use all mapped activation variants, while b12x retains its existing requested-backend handling. The test verifies flashinfer_cutlass selects FLASHINFER_CUTLASS_MXFP4_MXFP8 with FlashInferExperts.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 0fe8f

Explicit non-b12x DeepSeek-V4 backend aliases can now fall through to supported MXFP4/MXFP8 variants on SM120-class hardware, while b12x behavior remains unchanged. Regression and reported end-to-end coverage support merge readiness.

Suggested reviewers: fxmarty-amd

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly explains the selector bug, the explicit-backend fix, the retained b12x behavior, and the regression and end-to-end tests.
Title check ✅ Passed The title clearly identifies the DeepSeek-V4 MXFP4 selector bug and the change to stop narrowing explicit aliases to the BF16 variant.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zyongye
zyongye merged commit 5893426 into vllm-project:main Sep 7, 2026
127 checks passed
ItsRoy69 pushed a commit to ItsRoy69/vllm that referenced this pull request Sep 10, 2026
…r BF16 variant (vllm-project#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>
Signed-off-by: Jyotirmoy Roy <jyotirmoyroy649@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working DSv4 ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants