Skip to content

[Misc][main2main] Adapt vllm-ascend to vLLM 0420#8428

Merged
wangxiyuan merged 7 commits intovllm-project:mainfrom
Meihan-chen:main2main_0420
Apr 29, 2026
Merged

[Misc][main2main] Adapt vllm-ascend to vLLM 0420#8428
wangxiyuan merged 7 commits intovllm-project:mainfrom
Meihan-chen:main2main_0420

Conversation

@Meihan-chen
Copy link
Copy Markdown
Collaborator

@Meihan-chen Meihan-chen commented Apr 20, 2026

Commit range: 6f786f2..d886c26

  1. Fix 'DPMetadata' object has no attribute 'max_tokens_across_dp_cpu' by [MoE Refactor] Remove MoE DP chunking vllm#39107
  2. Fix 'Indexer' object has no attribute 'wk' by [Bugfix][Perf] Indexer upcast WK to BF16 for fusion vllm#38928
  3. Fix 'float' object has no attribute 'language_model' by Measure encoder compile time seperate from llm backbone vllm#39240

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

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aligns the vllm-ascend extension with recent upstream changes in vLLM, specifically focusing on FusedMoE router compatibility and updating the tracked vLLM commit hash. These changes ensure that the Ascend-specific operations remain functional with the latest core vLLM developments.

Highlights

  • Zero-expert logical expert boundary: Updated Ascend FusedMoE implementations to utilize logical_num_experts, ensuring compatibility with upstream vLLM FusedMoE router changes.
  • Main-branch synchronization: Bumped the vLLM main-branch commit reference to d886c26d4d4fef7d079696beb4ece1cfb4b008a8 across documentation and CI configuration files.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/dockerfiles/Dockerfile.lint
    • .github/workflows/pr_test_full.yaml
    • .github/workflows/pr_test_light.yaml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@Meihan-chen Meihan-chen changed the title [main2main] Adapt vllm-ascend to vLLM 0420 [Misc][main2main] Adapt vllm-ascend to vLLM 0420 Apr 20, 2026
@zhangxinyuehfad zhangxinyuehfad added ready read for review ready-for-test start test by label for PR labels Apr 20, 2026
Copy link
Copy Markdown
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 updates the vLLM commit hash in the documentation and introduces a _get_num_logical_experts helper function across several MoE implementation files to correctly handle expert counts in zero_experts_compute. Feedback indicates that using global_num_experts as a fallback is incorrect because it includes redundant padding experts, which can disable zero-expert logic. Additionally, the logic should be adjusted to account for shared experts when mix_placement is enabled.

Suggested PR Title:

[Ops][Misc] Update vLLM commit and refine logical expert count in MoE

Suggested PR Summary:

### What this PR does / why we need it?
This PR updates the vLLM commit hash in the documentation and introduces a `_get_num_logical_experts` helper function across several MoE implementation files to correctly handle expert counts in `zero_experts_compute`. Feedback indicates that using `global_num_experts` as a fallback is incorrect because it includes redundant padding experts, which can disable zero-expert logic. Additionally, the logic should be adjusted to account for shared experts when `mix_placement` is enabled.

### Does this PR introduce _any_ user-facing change?
No.

### How was this patch tested?
CI passed with existing tests.

Comment thread vllm_ascend/ops/fused_moe/fused_moe.py Outdated
expert_indices=topk_ids,
expert_scales=topk_weights,
num_experts=global_num_experts,
num_experts=_get_num_logical_experts(layer, global_num_experts),
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

The num_experts parameter in zero_experts_compute defines the boundary between real experts and padding (zero) experts. Using global_num_experts as the fallback is incorrect because it includes global_redundant_expert_num (padding), which effectively disables the zero-expert logic for those padding experts. The boundary should be the total number of non-padding experts (routed + shared).

Suggested change
num_experts=_get_num_logical_experts(layer, global_num_experts),
num_experts=_get_num_logical_experts(layer, global_num_experts - global_redundant_expert_num),

expert_indices=topk_ids,
expert_scales=topk_weights,
num_experts=global_num_experts,
num_experts=_get_num_logical_experts(layer, global_num_experts),
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

Using global_num_experts as the fallback for num_experts in zero_experts_compute fails to identify padding experts when global_redundant_expert_num > 0.

Additionally, when mix_placement is active, logical_num_experts (which typically represents the number of routed experts) should be incremented by n_shared_experts to ensure shared experts are not incorrectly treated as zero experts. Since valid_global_expert_num is already calculated as the routed expert count, it should be used as the fallback for the routed portion.

Suggested change
num_experts=_get_num_logical_experts(layer, global_num_experts),
num_experts=_get_num_logical_experts(layer, valid_global_expert_num) + (n_shared_experts if mix_placement else 0),

@Meihan-chen Meihan-chen force-pushed the main2main_0420 branch 2 times, most recently from 062d5fd to 6d65f94 Compare April 20, 2026 06:56
@zhangxinyuehfad zhangxinyuehfad added ready-for-test start test by label for PR ready read for review and removed ready-for-test start test by label for PR ready read for review labels Apr 20, 2026
@Meihan-chen Meihan-chen force-pushed the main2main_0420 branch 3 times, most recently from c8dc4e8 to 5c620d5 Compare April 28, 2026 01:30
@Meihan-chen Meihan-chen force-pushed the main2main_0420 branch 2 times, most recently from 0f79355 to 4de9623 Compare April 28, 2026 09:25
Meihan-chen and others added 7 commits April 28, 2026 22:45
**Commit range:** `6f786f2`..`d886c26`

| Priority | Change | vLLM File | vllm-ascend File | Description |
|:---|:---|:---|:---|:---|
| P0 | Zero-expert logical expert boundary | `vllm/model_executor/layers/fused_moe/layer.py` | `vllm_ascend/ops/fused_moe/fused_moe.py`, `vllm_ascend/_310p/fused_moe/fused_moe.py`, `vllm_ascend/quantization/methods/w8a8_dynamic.py`, `vllm_ascend/_310p/quantization/methods/w8a8_dynamic.py` | Use `logical_num_experts` when available so Ascend zero-expert handling stays compatible with the upstream FusedMoE router changes on main. |
| P1 | Main2main commit reference bump | `docs/source/conf.py`, `.github/workflows/pr_test_full.yaml`, `.github/workflows/pr_test_light.yaml`, `.github/workflows/dockerfiles/Dockerfile.lint` | same | Update main-branch vLLM commit references from `6f786f2c506cb07f4566771fdc62e640e2c4a176` to `d886c26d4d4fef7d079696beb4ece1cfb4b008a8`. |

- `.github/workflows/dockerfiles/Dockerfile.lint`
- `.github/workflows/pr_test_full.yaml`
- `.github/workflows/pr_test_light.yaml`
- `docs/source/conf.py`
- `vllm_ascend/ops/fused_moe/fused_moe.py`
- `vllm_ascend/_310p/fused_moe/fused_moe.py`
- `vllm_ascend/quantization/methods/w8a8_dynamic.py`
- `vllm_ascend/_310p/quantization/methods/w8a8_dynamic.py`

Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
CI Fix Summary (run ID: 24638481321)
Commit range: 6f786f2..f150107

Issues Fixed
Error	Upstream Cause Commit	Affected Files	Fix Description
AttributeError: 'float' object has no attribute 'language_model'	c08f3b2a — Measure encoder compile time seperate from llm backbone	vllm_ascend/worker/worker.py, tests/ut/worker/test_worker_v1.py	Return CompilationTimes on vLLM main, keep scalar return for v0.19.0 via vllm_version_is("0.19.0").

Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: Meihan-chen <jcccx.cmh@gmail.com>
Signed-off-by: Meihan-chen <zr010426ztt@outlook.com>
Signed-off-by: Meihan-chen <zr010426ztt@outlook.com>
@wangxiyuan wangxiyuan merged commit eb3548a into vllm-project:main Apr 29, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build documentation Improvements or additions to documentation module:ops module:quantization ready read for review ready-for-test start test by label for PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants