Skip to content

[CI] vllm main2main 0731 0351e9a - #13358

Merged
linfeng-yuan merged 22 commits into
vllm-project:mainfrom
zhangxinyuehfad:zxy_main2main_0731
Aug 3, 2026
Merged

[CI] vllm main2main 0731 0351e9a#13358
linfeng-yuan merged 22 commits into
vllm-project:mainfrom
zhangxinyuehfad:zxy_main2main_0731

Conversation

@zhangxinyuehfad

@zhangxinyuehfad zhangxinyuehfad commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

Files Upstream vLLM change vllm-ascend adaptation
vllm_ascend/__init__.py vllm#48841 — added from triton.experimental import gluon, from triton.experimental.gluon import language as gl and from triton.language.core import _aggregate to triton_utils/__init__.py, requiring Triton 3.6+ API absent from triton-ascend 3.2.1 Pre-register triton.experimental.gluon / .language as sys.modules stubs; stub triton.language.core._aggregate. Gated on os.getenv("VLLM_VERSION") != "0.26.0", mirroring vllm_version_is env var path.
tests/ut/patch/platform/test_patch_structured_output.py vllm#49665 — changed VLLMValidationError base class from ValueError to VLLMClientError, breaking pytest.raises(ValueError) assertions Updated 3 assertions from pytest.raises(ValueError, ...) to pytest.raises(VLLMValidationError, ...)
tests/e2e/pull_request/one_card/test_guided_decoding.py vllm#49665 — same VLLMValidationError base-class change; on 0.26.0 the upstream validation may still raise ValueError Version-gated assertion: pytest.raises(ValueError, ...) on 0.26.0 vs pytest.raises(VLLMValidationError, ...) on main
vllm_ascend/ops/vocab_parallel_embedding.py
vllm_ascend/_310p/ops/vocab_parallel_embedding.py
vllm#49731 — added *, disable_tp: bool = False keyword arg to ParallelLMHead.__init__() and VocabParallelEmbedding.__init__() Version-gated __init__ with vllm_version_is("0.26.0"): else branch accepts disable_tp kwarg and forwards it (Ascend manages TP via lmhead_tp_enable())
vllm_ascend/distributed/kv_transfer/kv_p2p/mooncake_connector.py
vllm_ascend/distributed/kv_transfer/kv_p2p/mooncake_hybrid_connector.py
vllm#26593KVConnectorBase_V1.__init__() sets self._kv_transfer_config, required by requires_kv_delivery property Version-gated __init__: else branch sets self._kv_transfer_config on vllm main
vllm_ascend/ops/fused_moe/fused_moe.py vllm#50089 — added fused_output_is_reduced kwarg to _maybe_reduce_shared_expert_output() and output_is_reduced kwarg to _maybe_reduce_final_output() Version-gated both methods: else branch accepts new kwargs but ignores them (Ascend handles reduction independently); trunc_size may now be None
vllm_ascend/patch/worker/patch_distributed.py vllm#47288 — added use_all2all: bool = False param to GroupCoordinator.__init__() Version-gated via _IS_VLLM_026 env var check (avoids vllm-ascend import cycle). Else branch stores self.use_all2all (unused, no all2all on Ascend)
vllm_ascend/distributed/device_communicators/npu_communicator.py vllm#47288 — added use_all2all: bool = False param to DeviceCommunicatorBase.__init__() Version-gated NPUCommunicator.__init__ with vllm_version_is("0.26.0"): else branch accepts and forwards use_all2all (NPU keeps the no-op _NpuAll2AllManager)
vllm_ascend/worker/npu_input_batch.py vllm#48018 — added use_replayssm: bool kwarg (Mamba replay-SSM); vllm#40996 — added slot_mapping_modes kwarg (DCP hybrid attention) Accepts both kwargs unconditionally; stores self.use_replayssm and self.slot_mapping_modes only on main (not vllm_version_is("0.26.0")) for interface alignment
vllm_ascend/worker/v2/spec_decode/eagle/aclgraph.py vllm#49364 — renamed skip_attn parameter to full_cudagraph in cudagraph mode logic Version-gated call: 0.26.0 keeps skip_attn=(cg_mode != PIECEWISE); main passes full_cudagraph=(cg_mode != PIECEWISE)
vllm_ascend/distributed/weight_transfer/npu_ipc_engine.py
vllm_ascend/distributed/weight_transfer/__init__.py
vllm#48042 + vllm#48981 — replaced static IPCTrainerSendWeightsArgs/trainer_send_weights with a stateful IPCTrainerWeightTransferEngine driven by WeightTransferTrainerFactory.trainer_init(...).send_weights(); packed moved onto trainer init-info; per-round update_info slimmed Whole module version-gated: 0.26.0 keeps the static NPUIPCWeightTransferEngine; main defines stateful NPUIPCTrainerWeightTransferEngine (_send_unpacked instance method, packed on NPUIPCWeightTransferInitInfo, no-arg npu_generate_uuid(), is_sender/_all_gather_and_merge_handles). register_engine() also registers the trainer engine in WeightTransferTrainerFactory on main only
examples/rl/rlhf_http_npu_ipc.py vllm#48981 — ported RL examples to WeightTransferTrainerFactory.trainer_init(...) + engine.send_weights() with HTTPVLLMWeightSyncClient/ModuleSource Version-gated example: 0.26.0 uses static NPUIPCWeightTransferEngine.trainer_send_weights; main uses the stateful trainer engine path
tests/e2e/pull_request/one_card/test_npu_ipc_weight_transfer.py vllm#48981 — IPC weight-transfer E2E now exercised via the stateful trainer engine Version-gated test: 0.26.0 keeps the manual _post(start/finish) + static trainer_send_weights; main drives WeightTransferTrainerFactory.trainer_init(...).send_weights() (engine owns the lifecycle)
tests/ut/distributed/weight_transfer/test_npu_ipc_engine.py vllm#48981 — trainer-side IPC APIs changed from static methods to instance methods on the stateful engine Version-gated tests (IS_VLLM_026): _send_unpacked, packed placement, npu_generate_uuid arity, and start/finish_weight_update no-op behavior asserted per version
vllm_ascend/worker/v2/spec_decode/dflash/speculator.py vllm#50000_prepare_dflash_inputs_kernel gained temperature/seeds sampling params for probabilistic draft sampling Version-gated _prepare_dflash_inputs_kernel_ascend: 0.26.0 branch keeps the old signature; main branch adds the four temperature/seeds pointers and the corresponding stores to stay aligned with upstream while keeping Ascend's own kernel
.github/vllm-main-verified.commit Updated verified main commit hash to 0351e9aa1fdf1a51329d1906881528dfe61fc88e

Does this PR introduce any user-facing change?

How was this patch tested?

@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 PR synchronizes vllm-ascend with the latest vLLM upstream changes while ensuring backward compatibility with vLLM 0.26.0. It introduces version-gated logic across core components, including distributed communicators, weight transfer engines, and custom ops, to handle upstream API evolutions. Additionally, it updates verified commit hashes and refactors the weight transfer engine to support stateful trainer-side operations.

Highlights

  • Triton API Compatibility: Added stubs for triton.experimental.gluon and triton.language.core._aggregate to support vLLM main branch requirements on Triton-Ascend 3.2.1.
  • Version-Gated API Adaptations: Implemented extensive version-gating (vLLM 0.26.0 vs. main) across ops, distributed, and worker modules to accommodate upstream API changes like disable_tp, use_all2all, and VLLMValidationError.
  • Weight Transfer Engine Refactor: Migrated NPU IPC weight transfer to a stateful NPUIPCTrainerWeightTransferEngine for vLLM main, while maintaining the legacy static path for 0.26.0.
  • Kernel and Test Updates: Synchronized NPU-specific kernels and E2E/UT test suites with upstream changes, including updated sampling parameters and exception handling.
New Features

🧠 You can now enable Memory (public preview) 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.

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

@mergify

mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown

⚠️ The sha of the head commit of this PR conflicts with #11090. Mergify cannot evaluate rules on this PR. Once #11090 is merged or closed, Mergify will resume processing this PR. ⚠️

@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

Suggested PR Title:

[Ops][Misc] Add compatibility support for vLLM main branch (post-0.26.0)

Suggested PR Summary:

### What this PR does / why we need it?
This pull request introduces comprehensive compatibility updates to ensure the `vllm-ascend` plugin works seamlessly with both vLLM `0.26.0` and the upstream `main` branch (post-`0.26.0`). It addresses various API, interface, and signature changes introduced in the upstream vLLM repository, including:
- Refactoring the NPU IPC weight transfer engine to support both the static `0.26.0` path and the stateful `IPCTrainerWeightTransferEngine` on `main`.
- Aligning signatures for `ParallelLMHead`, `NPUCommunicator`, `GroupCoordinator`, `MooncakeConnector`, `fused_moe` operators, and `InputBatch` to handle new arguments (such as `disable_tp`, `use_all2all`, `use_replayssm`, and `slot_mapping_modes`).
- Stubbing missing Triton modules (`triton.experimental.gluon`) and core functions (`_aggregate`) to prevent import failures on newer vLLM versions when using `triton-ascend 3.2.1`.
- Updating Triton kernels and Speculator/Eagle execution paths to match the updated upstream signatures (e.g., adding temperature/seeds parameters to `_prepare_dflash_inputs_kernel_ascend`).

Additionally, three critical issues were identified in the review:
1. In `examples/rl/rlhf_http_npu_ipc.py`, the local variable `client` shadows the global OpenAI `client`, which will cause an `AttributeError` during generation. It should be renamed to `sync_client`.
2. In `vllm_ascend/distributed/weight_transfer/npu_ipc_engine.py`, `device_index` is retrieved but not passed to `npu_generate_uuid()`, which can lead to generating the wrong physical NPU UUID.
3. The corresponding unit test in `tests/ut/distributed/weight_transfer/test_npu_ipc_engine.py` needs to be updated to assert that `npu_generate_uuid` is called with `device_index` on both branches.

### Does this PR introduce _any_ user-facing change?
No user-facing changes are introduced. These are internal compatibility and alignment updates to support different vLLM versions.

### How was this patch tested?
The changes are covered by existing and updated end-to-end and unit tests, which have been adapted to handle version-specific behaviors.

Comment thread examples/rl/rlhf_http_npu_ipc.py
Comment thread vllm_ascend/distributed/weight_transfer/npu_ipc_engine.py
Comment thread tests/ut/distributed/weight_transfer/test_npu_ipc_engine.py
@github-actions

github-actions Bot commented Aug 3, 2026

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.

if vllm_version_is("0.26.0"):

@triton.jit
def _prepare_dflash_inputs_kernel_ascend(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why change the ops? #48042 is not associate with it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The kernel change is required because upstream _prepare_dflash_inputs_kernel gained 4 temperature/seeds params in #50000 (Kimi K3); since the Ascend kernel is monkey-patched, the signature must match the upstream call site or Triton fails at launch. You're right that #48042 is unrelated — that was a typo, the comment/PR description will be corrected to #50000.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

@zhangxinyuehfad zhangxinyuehfad added the ready enable e2e test for PR label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

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

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…nd tests

Upstream vLLM PR #49665 changed VLLMValidationError to inherit from
VLLMClientError instead of ValueError, breaking pytest.raises(ValueError)
assertions that relied on the old inheritance relationship.

Fix the 3 affected test cases to assert VLLMValidationError directly.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
- Add triton.experimental.gluon stubs to platform-level init before any
  triton import, fixing ImportError(constexpr_type) in subprocesses such
  as python -m vllm.model_executor.models.registry. Gated on
  VLLM_VERSION != '0.26.0'.
- Add use_all2all kwarg to GroupCoordinatorPatch.__init__() gated on
  !vllm_version_is('0.26.0') to match upstream GroupCoordinator signature
  added in vllm main post-0.26.0. Ascend NPU has no all2all impl so the
  parameter is only accepted for interface alignment.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…ss coverage

Placing gluon stubs in patch/platform/__init__.py only ran when
pre_register_and_update() was called from EngineArgs.create_engine_config(),
missing subprocesses such as python -m vllm.model_executor.models.registry
where vllm.platforms discovery imports vllm_ascend but never calls
pre_register_and_update(). Move stubs to module level in vllm_ascend/__init__.py
so they execute the moment the plugin module is loaded - before any triton
import chain can start. Also stub triton.language.core._aggregate, which vllm
main also expects post-0.26.0 but triton-ascend 3.2.1 lacks.

Revert stub placement from patch/platform/__init__.py.
Revert conftest.py stub changes; keep a pointer comment to vllm_ascend/__init__.py.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…InputBatch

Upstream InputBatch.__init__() added use_replayssm and slot_mapping_modes
parameters after 0.26.0. NPUInputBatch overrides __init__() without accepting
them, causing AttributeError on self.use_replayssm when the parent class
add_request() method runs. Accept the kwargs and store them under a
vllm_version_is('0.26.0') gate. NPU does not implement Mamba replay-SSM, so
the parameters are only accepted for interface alignment.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
- Add module-level triton gluon and _aggregate stubs to vllm_ascend/__init__.py
  so they execute when the plugin module is imported by vllm.platforms
  discovery, covering subprocesses such as python -m vllm.model_executor.
  models.registry where pre_register_and_update() is never called. Gate
  _aggregate import on find_spec('triton') to avoid ModuleNotFoundError on
  310P and CPU-UT environments where triton is absent or mocked. Gated on
  VLLM_VERSION != '0.26.0'.

- Add use_all2all kwarg to GroupCoordinatorPatch.__init__() gated on
  !vllm_version_is('0.26.0') to match upstream GroupCoordinator signature
  added post-0.26.0.

- Add use_replayssm and slot_mapping_modes kwargs to NPUInputBatch.__init__()
  gated on !vllm_version_is('0.26.0') to match upstream InputBatch signature
  added post-0.26.0. NPU does not implement Mamba replay-SSM; parameters are
  only accepted for interface alignment.

- Revert conftest.py triton stubs; keep a pointer comment directing readers to
  vllm_ascend/__init__.py.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
- Add disable_tp kwarg to AscendParallelLMHead and AscendParallelLMHead310
  __init__() gated on vllm_version_is('0.26.0') to match upstream
  ParallelLMHead signature added post-0.26.0. Ascend NPU uses its own TP
  logic via lmhead_tp_enable(), so the parameter is accepted for interface
  alignment only.

- Add used_output_is_reduced kwarg to AscendMoERunner.
  _maybe_reduce_shared_expert_output() gated on vllm_version_is('0.26.0')
  to match upstream signature. Ascend already handles shared expert
  reduction in _forward_shared_experts, so the parameter is ignored.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…tput

Upstream MoERunner._maybe_reduce_final_output() added output_is_reduced
parameter after 0.26.0. The call site at moe_runner.py:776 now passes 4
arguments (including fused_output_is_reduced), but AscendMoERunner's
override only accepted 3. Accept and ignore the kwarg under a
vllm_version_is('0.26.0') gate. Also widen trunc_size to int | None to
match the upstream signature.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
- test: expect VLLMValidationError instead of ValueError in
  structured output mixed backend tests (vllm#49665)
- test: stub triton modules missing from triton-ascend 3.2.1
  before vllm import in e2e conftest (vllm#48841)
- patch: gate FLA imports with vllm_version_is(10.26.01) to
  avoid triton-ascend NPU driver crash during module load
- spec_decode: gate prepare_inputs_to_capture keyword between
  skip_attn (v0.26.0) and full_cudagraph (main) (vllm#49364)
- npu_communicator: accept use_all2all on main for interface
  alignment with upstream DeviceCommunicatorBase (vllm#47288)

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
… vLLM version compat

vLLM main (post-0.26.0) removed IPCTrainerSendWeightsArgs and the static
trainer_send_weights path via:

  vllm-project/vllm#48042 — Stateful Trainer Send: New Abstractions [1/N]
  vllm-project/vllm#48981 — Stateful Trainer Send: IPC [2/N]

Add a vllm_version_is conditional branch:

- 0.26.0: preserves the existing static NPUIPCTrainerSendWeightsArgs +
  NPUIPCWeightTransferEngine.trainer_send_weights path unchanged.
- main:   introduces NPUIPCTrainerInitInfo (backend='npu_ipc'),
  NPUIPCTrainerWeightTransferEngine (subclass of upstream's
  IPCTrainerWeightTransferEngine), and delegates HTTP transport to
  HTTPVLLMWeightSyncClient.  Register the trainer-side engine via
  WeightTransferTrainerFactory only on main.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…ter drift

Upstream _prepare_dflash_inputs_kernel gained four new parameters
(out_temperature_ptr, out_seeds_ptr, temperature_ptr, seeds_ptr) via
vllm-project/vllm#50000.  The Ascend kernel, monkey-patched in
patch_v2/patch_triton.py, must present the same signature as the
upstream call-site in prepare_dflash_inputs() to avoid 'got multiple
values for argument' Triton errors at launch.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
vllm main added trainer_send_weights as an abstract method on WeightTransferEngine (30b4e7f479). Add a transitional stub to NPUIPCWeightTransferEngine (else branch only, not 0.26.0) to satisfy the ABC contract.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…o for vllm main compat

In vllm main, WeightTransferInitInfo no longer has packed field; it was moved to IPCWeightTransferInitInfo. Add packed: bool = False to NPUIPCWeightTransferInitInfo so init_transfer_engine can read it. Harmless in 0.26.0 where init_transfer_engine is a no-op.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
…ferEngine

NPUIPCTrainerWeightTransferEngine.__init__ called super().__init__()
which triggered torch.cuda.get_device_properties() in the parent
IPCTrainerWeightTransferEngine.__init__, failing on NPU-only systems.

Changes:
- Bypass IPCTrainerWeightTransferEngine.__init__ to skip CUDA call;
  the NPU engine uses npu_uuid, not gpu_uuid, so this is safe.
- Version-gate worker.update_weights: on 0.26.0 keep load_weights
  callback path; on main delegate to engine.update_weights() matching
  upstream gpu_worker.py pattern.
- E2E test: register npu_ipc backend and close probe-initiated weight
  update so the stateful engine can drive its own lifecycle.
- UT: fix dict access after asdict() serialization.

Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
Signed-off-by: hfadzxy <starmoon_zhang@163.com>
@linfeng-yuan
linfeng-yuan merged commit bf016a1 into vllm-project:main Aug 3, 2026
72 of 124 checks passed
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.

4 participants