Skip to content

Conversation

@1092626063
Copy link
Contributor

…tion (#4050)"

This reverts commit c87a77e.

What this PR does / why we need it?

Does this PR introduce any user-facing change?

How was this patch tested?

@github-actions
Copy link

👋 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.

…tion (vllm-project#4050)"

This reverts commit c87a77e.

Signed-off-by: 1092626063 <1092626063@qq.com>
Copy link
Contributor

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

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 reverts a previous commit that aimed to generalize the gatingtopk operator. The revert appears to be a necessary step, likely due to limitations discovered in the generalized operator. The changes correctly restore the logic to use more specialized operators for different expert selection scenarios, and the corresponding tests have been updated to reflect this. However, I've identified a potential critical issue in the restored code where two conditional blocks are not mutually exclusive, which could lead to incorrect behavior under certain conditions. My review includes a suggestion to fix this.

# y2_flag=False, # old api; should the third output be output
routed_scaling_factor=1,
eps=float(1e-20))
if not use_grouped_topk and custom_routing_function is None and scoring_func == "softmax":
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

The if block at line 183 for is_deepseek_v3_r1 and this if block for scoring_func == "softmax" are not mutually exclusive. If is_deepseek_v3_r1 is true and scoring_func also happens to be "softmax", this block will execute and overwrite the topk_weights and topk_ids calculated in the first block. This could lead to incorrect expert selection. To prevent this, this if should be converted to an elif to ensure only one of the specialized operator paths is taken.

Suggested change
if not use_grouped_topk and custom_routing_function is None and scoring_func == "softmax":
elif not use_grouped_topk and custom_routing_function is None and scoring_func == "softmax":

@wangxiyuan
Copy link
Collaborator

see #4352

@wangxiyuan wangxiyuan closed this Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants