Skip to content

[P/D] LayerwiseConnector supports the virtual push functionality on node D.#7361

Merged
zzzzwwjj merged 2 commits intovllm-project:mainfrom
wangxiaoteng888:virtual_inf
Mar 18, 2026
Merged

[P/D] LayerwiseConnector supports the virtual push functionality on node D.#7361
zzzzwwjj merged 2 commits intovllm-project:mainfrom
wangxiaoteng888:virtual_inf

Conversation

@wangxiaoteng888
Copy link
Copy Markdown
Contributor

@wangxiaoteng888 wangxiaoteng888 commented Mar 17, 2026

What this PR does / why we need it?

LayerwiseConnector supports the virtual push functionality on node D.By adding a do_virtual flag to request metadata, the system can now identify and process certain requests virtually, bypassing the actual KV cache transfer process. This allows for immediate completion of these requests from the consumer's perspective, potentially enabling optimizations or specific testing scenarios where physical data transfer is not required.

Does this PR introduce any user-facing change?

No

How was this patch tested?

By ci

Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
@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 introduces a 'virtual inference' capability within the distributed KV cache transfer mechanism, specifically for the vLLM Ascend implementation. By adding a do_virtual flag to request metadata, the system can now identify and process certain requests virtually, bypassing the actual KV cache transfer process. This allows for immediate completion of these requests from the consumer's perspective, potentially enabling optimizations or specific testing scenarios where physical data transfer is not required.

Highlights

  • Virtual Inference Flag: Introduced a new do_virtual boolean flag within the ReqMeta dataclass to explicitly mark requests that should undergo virtual inference.
  • Virtual Request Tracking: Added a virtual_request set to the MooncakeLayerwiseConnector class to manage and track the IDs of requests designated for virtual inference.
  • Optimized KV Cache Handling: Modified the KV cache loading and completion logic to identify requests with the do_virtual flag, add them to the virtual_request set, and immediately mark them as finished without performing actual KV cache transfer.

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

Changelog
  • vllm_ascend/distributed/kv_transfer/kv_p2p/mooncake_layerwise_connector.py
    • Added do_virtual: bool = False to the ReqMeta dataclass.
    • Modified add_new_req to accept and pass the do_virtual parameter from kv_transfer_params.
    • Initialized self.virtual_request: set[str] = set() in the MooncakeLayerwiseConnector constructor.
    • Updated get_finished to include requests from self.virtual_request in the set of completed requests and then clear the virtual_request set.
    • Modified start_load_kv to check the do_virtual flag for incoming requests; if true, the request ID is added to self.virtual_request and further KV loading is skipped for that request.
Activity
  • No specific activity (comments, reviews, progress) has been recorded for this pull request yet.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

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

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 introduces a 'virtual inference' feature to the MooncakeLayerwiseConnector. This allows certain requests to bypass the KV cache transfer process while still being tracked and marked as complete. The implementation adds a do_virtual flag and related logic to handle these virtual requests. The changes appear correct and well-contained.

As per the repository's style guide, here are suggestions for the pull request title and summary:

Suggested PR Title:

[Distributed][Feature] Add virtual inference support in layerwise connector

Suggested PR Summary:

### What this PR does / why we need it?

This PR introduces the concept of "virtual inference" to the `MooncakeLayerwiseConnector`. For requests marked as virtual, the KV cache transfer logic is bypassed, but they are still tracked and marked as completed. This is achieved by adding a `do_virtual` flag to `ReqMeta` and tracking virtual requests in the `MooncakeLayerwiseConnectorWorker`.

This feature is useful for scenarios where some requests do not require actual KV cache data transfer but need to be processed through the scheduling and completion pipeline, effectively acting as no-op requests from the KV transfer perspective.

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

No, this is an internal change to the distributed KV transfer mechanism and does not introduce any user-facing changes.

### How was this patch tested?

CI tests should be added or updated to cover this new functionality to ensure its correctness and prevent regressions.

@wangxiaoteng888 wangxiaoteng888 changed the title [P/D] add virtual infer [P/D] LayerwiseConnector supports the virtual push functionality on node D. Mar 17, 2026
Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
@liziyu179 liziyu179 added ready read for review ready-for-test start test by label for PR labels Mar 17, 2026
@zzzzwwjj zzzzwwjj merged commit c7157af into vllm-project:main Mar 18, 2026
78 of 79 checks passed
845473182 pushed a commit to 845473182/vllm-ascend that referenced this pull request Mar 18, 2026
…scend into qwen3next_graph

* 'qwen3next_graph' of https://github.com/845473182/vllm-ascend: (62 commits)
  [doc] Refresh the documentation for DeepSeek-V3.2 (vllm-project#7403)
  [bugfix][accuracy] Fix ds indexer accuracy problem caused by k rope (vllm-project#7341)
  [P/D] LayerwiseConnector supports the virtual push functionality on node D. (vllm-project#7361)
  [CI] Add PAT_TOKEN when checkout (vllm-project#7400)
  [main2main] upgrade vllm to 0308 (vllm-project#7213)
  [CI] add scheduled stale issue management (vllm-project#7354)
  [CI] expand issue labeler rules for feature/model triage (vllm-project#7356)
  [Bugfix] Assertion error when decode prefix cache fully hits (vllm-project#7236)
  [doc] Refresh the documentation for GLM-4.7 (vllm-project#7292)
  [BugFix]A2 MOE method&& layerwise MTP bugfix && Mamba gdn_metadata bugfix (vllm-project#7364)
  [doc] Upload doc for qwen3.5-27B and qwen3.5-397B-A17B on Ascend (vllm-project#7313)
  [bugfix]Enable dispatch_ffn_combine feature for qwen3.5 (vllm-project#7066)
  [bugfix] fix unzip file path for fia operator (vllm-project#7367)
  [Perf] Optimize bias handling in AscendRMSNorm (vllm-project#7226)
  [eagle3][pcp] fix bug for eagle3 and cp enable (vllm-project#7309)
  [Bugfix] fix TransposeKvCacheByBlock op error report in plog (vllm-project#7235)
  [Feature]Supports DSv3.1 PD separation and C8 quantization (vllm-project#7222)
  [main][bugfix] Fixed the problem that eagle3 will crash in FULL_DECODE_ONLY (vllm-project#7290)
  [xlite][Bugfix] Support mrope and deepstack features in xlite backend (vllm-project#7295)
  [model_runner_v2]optimize the performance of the _topk_log_softmax_kernel (vllm-project#7221)
  ...
starmountain1997 pushed a commit to starmountain1997/vllm-ascend that referenced this pull request Mar 25, 2026
…ode D. (vllm-project#7361)

### What this PR does / why we need it?
LayerwiseConnector supports the virtual push functionality on node D.By
adding a do_virtual flag to request metadata, the system can now
identify and process certain requests virtually, bypassing the actual KV
cache transfer process. This allows for immediate completion of these
requests from the consumer's perspective, potentially enabling
optimizations or specific testing scenarios where physical data transfer
is not required.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
By ci

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
lihaokun-2026 pushed a commit to lihaokun-2026/vllm-ascend that referenced this pull request Mar 29, 2026
…ode D. (vllm-project#7361)

### What this PR does / why we need it?
LayerwiseConnector supports the virtual push functionality on node D.By
adding a do_virtual flag to request metadata, the system can now
identify and process certain requests virtually, bypassing the actual KV
cache transfer process. This allows for immediate completion of these
requests from the consumer's perspective, potentially enabling
optimizations or specific testing scenarios where physical data transfer
is not required.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
By ci

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
chenchuw886 pushed a commit to chenchuw886/vllm-ascend that referenced this pull request Apr 1, 2026
…ode D. (vllm-project#7361)

### What this PR does / why we need it?
LayerwiseConnector supports the virtual push functionality on node D.By
adding a do_virtual flag to request metadata, the system can now
identify and process certain requests virtually, bypassing the actual KV
cache transfer process. This allows for immediate completion of these
requests from the consumer's perspective, potentially enabling
optimizations or specific testing scenarios where physical data transfer
is not required.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
By ci

- vLLM version: v0.17.0
- vLLM main:
vllm-project/vllm@4034c3d

---------

Signed-off-by: wangxiaoteng <wangxiaoteng@huawei.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

4 participants