Skip to content

Conversation

Pr0Wh1teGivee
Copy link
Contributor

@Pr0Wh1teGivee Pr0Wh1teGivee commented Sep 18, 2025

What this PR does / why we need it?

Fix issues mentioned in #2791

  1. Use Enum instead of string.
  2. Avoid setting a new property to forward_context in AscendFusedMoE.forward().

Does this PR introduce any user-facing change?

No

How was this patch tested?

E2E & UT

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.

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 refactors the Mixture-of-Experts (MoE) communication method selection to use an Enum instead of raw strings, which is a great improvement for code clarity and type safety. The changes are mostly consistent with this goal. However, I've identified a few critical issues, including typos in Enum member access and an incorrect import, which would lead to runtime errors. Please address these issues to ensure the refactoring is robust.

moe_comm_method_name = forward_context.moe_comm_method_name
if moe_comm_method_name in {"alltoallcommimpl", "mc2commimpl"}:
moe_comm_method_type = forward_context.moe_comm_method_type
if moe_comm_method_type in {MoECommImpl.AllTOAll, MoECommImpl.MC2}:
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There is a typo in the MoECommImpl enum member name. It should be ALLTOALL instead of AllTOAll. This will cause an AttributeError at runtime.

Suggested change
if moe_comm_method_type in {MoECommImpl.AllTOAll, MoECommImpl.MC2}:
if moe_comm_method_type in {MoECommImpl.ALLTOALL, MoECommImpl.MC2}:

moe_comm_method_name = forward_context.moe_comm_method_name
if moe_comm_method_name in {"alltoallcommimpl", "mc2commimpl"}:
moe_comm_method_type = forward_context.moe_comm_method_type
if moe_comm_method_type in {MoECommImpl.AllTOAll, MoECommImpl.MC2}:
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

There is a typo in the MoECommImpl enum member name. It should be ALLTOALL instead of AllTOAll. This will cause an AttributeError at runtime.

Suggested change
if moe_comm_method_type in {MoECommImpl.AllTOAll, MoECommImpl.MC2}:
if moe_comm_method_type in {MoECommImpl.ALLTOALL, MoECommImpl.MC2}:

Comment on lines 91 to 92
from vllm_ascend.ascend_config import (MoECommImpl,
get_ascend_config)
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 MoECommImpl enum is being imported from vllm_ascend.ascend_config, but it is defined in vllm_ascend.ascend_forward_context. This will cause an ImportError at runtime. Please correct the import statement. For better code style, you could also combine this with the existing import from vllm_ascend.ascend_forward_context on the next line.

Suggested change
from vllm_ascend.ascend_config import (MoECommImpl,
get_ascend_config)
from vllm_ascend.ascend_config import get_ascend_config
from vllm_ascend.ascend_forward_context import MoECommImpl

@Pr0Wh1teGivee Pr0Wh1teGivee changed the title refactor moe_comm_method selection process [Refactor] Adjustments to moe_comm_method selection process Sep 18, 2025
@Pr0Wh1teGivee Pr0Wh1teGivee force-pushed the comments_fix branch 4 times, most recently from 9c54be4 to fc83278 Compare September 18, 2025 04:46
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

@Pr0Wh1teGivee Pr0Wh1teGivee force-pushed the comments_fix branch 2 times, most recently from e1696a2 to 1a137ac Compare September 18, 2025 06:25
@MengqingCao MengqingCao added ready read for review ready-for-test start test by label for PR labels Sep 18, 2025
Co-Authored-By: weijinqian0 <12153182+weijinqian0@users.noreply.github.com>
Signed-off-by: Pr0Wh1teGivee <calvin_zhu0210@outlook.com>
@github-actions github-actions bot added merge-conflicts and removed ready read for review labels Sep 19, 2025
Copy link

This pull request has conflicts, please resolve those before we can evaluate the pull request.

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