Skip to content

[BugFix] Select the fused MoE scaling contract from the native factory - #23978

Open
tgrhn wants to merge 2 commits into
vllm-project:mainfrom
tgrhn:fix/fused-moe-routed-scale-api-detection
Open

tgrhn wants to merge 2 commits into
vllm-project:mainfrom
tgrhn:fix/fused-moe-routed-scale-api-detection

Conversation

@tgrhn

@tgrhn tgrhn commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it?

After fixing worker-patch import in #23977, Qwen3.6-35B-A3B MXFP8 TP2 + EP reached model construction but failed because Ascend forwarded apply_routed_scale_to_output to a core factory that accepts routed_scale_mode. The pinned main checkout and release can both report vLLM 0.34.0.

Inspect the original factory signature once to choose the existing argument mapping. Preserve the legacy Boolean argument for factories that use it and the enum mapping for factories that accept the new argument.

How was this patch tested?

The FusedMoE and DeepSeek patch CPU test files passed together (68 tests) on the pinned core. The two launch failures and fixes are independent. A complete Qwen performance run is separate from these unit checks.

CPU CI follow-up

Both CPU matrix artifacts for run 46470546953 show the EPLB warmup test raising AttributeError when it mocks vllm_version_is, which this patch removed. The test now exercises the installed factory contract without that obsolete mock. On vLLM c410543d9, the focused pre-fix run reproduced the exception and the post-fix warmup, fused MoE, and callback suite passed 29 tests.

The same CI artifacts also report a 30-second timeout in test_graph_callback_failure_exits_even_if_callback_exceptions_are_swallowed. That test passed in isolation before and after the mock change. Its CI timeout remains unclassified and is pending the full rerun.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:‌‌

  • A PR should do only one thing, smaller PRs enable faster reviews.
  • Every PR should include unit tests and end-to-end tests ‌to ensure it works and is not broken by other future PRs.
  • Write the commit message by fulfilling the PR description to help reviewer and future developers understand.

If CI fails, you can run linting and testing checks locally according Contributing and Testing.

🤖 How to trigger CI

CI runs automatically when the PR is opened or reopened. Pushing a new commit no longer re-runs the E2E CI (to save NPU runner resources), so use the comment commands below when needed. They are available to the PR author and users with triage permission or above:

  • /run — run the full PR CI gate on the latest commit.
  • /rerun — re-run the failed CI jobs (e.g. after a flaky failure).
  • /e2e — run selected E2E tests instead of the full gate.
  • /nightly / /presmoke / /weekly — run the corresponding large-scale tests (triage permission or above; blocked during the nightly maintenance window).
  • /cancel — cancel a running CI on this PR.

Note

Until the CI gate has run on a commit, the required ci-gate check stays pending and the PR cannot merge — remember to comment /run after pushing.


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [BugFix] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request replaces version-based checks with a feature-detection check (_supports_routed_scale_mode) by inspecting the signature of _original_FusedMoE. The reviewer recommends renaming the module-level constant _supports_routed_scale_mode to _SUPPORTS_ROUTED_SCALE_MODE to adhere to the repository's style guide for module-level constants, and updating all its references across the implementation and test files.


# Capture the real original before fused_moe.py's module-level code runs.
_original_FusedMoE = _fused_moe_layer.FusedMoEFactory
_supports_routed_scale_mode = "routed_scale_mode" in signature(_original_FusedMoE).parameters

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

According to the repository style guide, module-level constants should be named in ALL_UPPER_CASE. Please rename _supports_routed_scale_mode to _SUPPORTS_ROUTED_SCALE_MODE to adhere to this convention.

Suggested change
_supports_routed_scale_mode = "routed_scale_mode" in signature(_original_FusedMoE).parameters
_SUPPORTS_ROUTED_SCALE_MODE = "routed_scale_mode" in signature(_original_FusedMoE).parameters
References
  1. No new module-level mutable globals; constants (ALL_UPPER_CASE) are fine. (link)

# constructing either the router or the native factory to scale once.
scaling_kwargs: dict[str, Any]
if vllm_version_is("0.34.0"):
if not _supports_routed_scale_mode:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update the reference to the renamed constant _SUPPORTS_ROUTED_SCALE_MODE.

Suggested change
if not _supports_routed_scale_mode:
if not _SUPPORTS_ROUTED_SCALE_MODE:
References
  1. No new module-level mutable globals; constants (ALL_UPPER_CASE) are fine. (link)

)
kwargs = original_factory.call_args.kwargs
if patch_fused_moe.vllm_version_is("0.34.0"):
if not patch_fused_moe._supports_routed_scale_mode:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update the reference to the renamed constant _SUPPORTS_ROUTED_SCALE_MODE in the test file.

Suggested change
if not patch_fused_moe._supports_routed_scale_mode:
if not patch_fused_moe._SUPPORTS_ROUTED_SCALE_MODE:
References
  1. No new module-level mutable globals; constants (ALL_UPPER_CASE) are fine. (link)

router_factory = MagicMock(return_value=router)
original_factory = MagicMock(return_value=SimpleNamespace(router=router))
main = not patch_fused_moe.vllm_version_is("0.34.0")
main = patch_fused_moe._supports_routed_scale_mode

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

Update the reference to the renamed constant _SUPPORTS_ROUTED_SCALE_MODE in the test file.

Suggested change
main = patch_fused_moe._supports_routed_scale_mode
main = patch_fused_moe._SUPPORTS_ROUTED_SCALE_MODE
References
  1. No new module-level mutable globals; constants (ALL_UPPER_CASE) are fine. (link)

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Last updated: 2026-12-01 04:49 UTC+8 for commit a81c7af.

ci-gate failed. Reason:

CODEOWNERS approval gate failed: at least one changed file has no approval from its owner(s). Open the 'CODEOWNERS' steps above to see which files are missing approvals and who can approve.
This PR touches source code (src=true, ci_pipeline=false), so precision/full tests are required before merge. Recommended tests and CPU UT already ran; E2E did not. Fix: a maintainer adds the 'ready-precise' label; the workflow reruns automatically once the label is added.

See the workflow run for full logs. This comment is updated in place on each new failure and marked as passed once the gate passes (it is kept for history, not deleted).

Missing owner approvals. Every changed file needs one approval from its CODEOWNERS owner(s):

  • vllm_ascend/patch/platform/patch_fused_moe.py: waiting for approval from one of: @wxsIcey, @freyfwt

@github-actions

github-actions Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Coverage

Total Coverage Diff Coverage
Total 162761 lines 2 lines
Missing 44245 lines 0 lines
Coverage 73% 100%

More info see: Summary

Select the routed scaling contract by the factory signature. Keep the EPLB warmup test independent of the removed version helper.

Signed-off-by: Tugrahan Karakadioglu <104067096+tgrhn@users.noreply.github.com>
@tgrhn
tgrhn force-pushed the fix/fused-moe-routed-scale-api-detection branch from 04b0224 to a81c7af Compare November 30, 2026 20:13

tgrhn commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor Author

/run
[Bot]: run command accepted. E2E has been queued on the latest commit a81c7afc92f798d6f364696004cde2cabd9146e2 of this PR, with whatever test-scope labels the PR currently carries. Track progress in PR checks.

@vllm-ascend-ci vllm-ascend-ci added the ci-run E2E requested manually on the latest commit label Nov 30, 2026
Signed-off-by: Tugrahan Karakadioglu <104067096+tgrhn@users.noreply.github.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-run E2E requested manually on the latest commit module:tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants