Skip to content

[Feature][P/D] Support FullAttn use TP parallel when DCP>1 and num_kv_heads > 1 - #17524

Merged
yiz-liu merged 2 commits into
vllm-project:mainfrom
nwpu-zxr:mooncake_v2_pcp
Sep 29, 2026
Merged

yiz-liu merged 2 commits into
vllm-project:mainfrom
nwpu-zxr:mooncake_v2_pcp

Conversation

@nwpu-zxr

@nwpu-zxr nwpu-zxr commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

What this PR does / why we need it?

Support FullAttention use TP parallel when DCP>1 and num_kv_heads > 1. For example, Kimi K3 with MHA dspark draft model, if DCP is enabled, the MLA layer will use DCP to extend block_size and reuse the Redundant kv_cache across DP, but Mamba and MHA dspark drafter will still use TP to split their caches. This PR supports GQA/MHA layers to still use TP sharding for KV transmission even when DCP > 1, as long as local_num_kv_heads > 1 and remote_num_kv_heads > 1.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

By CI.

…s_tp>1

Signed-off-by: nwpu-zxr <zhouxuerong2@huawei.com>
@nwpu-zxr
nwpu-zxr requested a review from LCAIZJ as a code owner September 25, 2026 01:33
@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 enhances the Mooncake KV transfer mechanism by allowing FullAttention layers to leverage Tensor Parallelism (TP) sharding for KV cache transmission even when Data Cache Parallelism (DCP) is active. By dynamically adjusting DCP sizes based on head counts and PCP (Pipeline Cache Parallelism) status, the system can now maintain efficient TP-based KV distribution in scenarios where it was previously restricted. This change ensures better compatibility and performance for models like Kimi K3 when using specific draft model configurations.

Highlights

  • FullAttention TP Parallelism Support: Enabled Tensor Parallelism (TP) for FullAttention layers even when Data Cache Parallelism (DCP) is greater than 1, provided both local and remote head counts are greater than 1.
  • DCP Size Logic Refactoring: Introduced a centralized helper method _get_full_attention_dcp_sizes to dynamically determine DCP sizes for FullAttention, allowing for more flexible KV cache transfer configurations.
  • Testing: Added comprehensive unit tests to verify that multi-head FullAttention correctly utilizes TP layouts and address generation under global DCP configurations.
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. ↩

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


Tip

💡 Consider Linking a Related Issue or RFC

Your PR title contains the [Feature] tag, indicating a bug fix or new feature.

Linking a related issue or RFC in the PR description is strongly encouraged — it gives reviewers helpful context and speeds up the review. You can use any of these keywords:

  • Fixes #<issue_number>
  • Closes #<issue_number>
  • Resolves #<issue_number>
  • Refs #<rfc_or_issue_number> (for RFCs)

🙏 Thanks for helping us keep the project well-organized!

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

[Attention][Feature] Support TP head shards for multi-head FA with global DCP when PCP is disabled

Suggested PR Summary:

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

This pull request implements support for using TP head shards for multi-head Full Attention (FA) when PCP is disabled. It introduces the `_get_full_attention_dcp_sizes` helper method to determine local and remote DCP sizes and integrates it into the rank group retrieval, block bucket building, and transfer address generation processes. Additionally, a redundant check for `MLAAttentionSpec` in `_get_full_attention_dcp_sizes` was identified and should be removed to clean up dead code.

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

No.

### How was this patch tested?

The changes are covered by new unit tests added in `tests/ut/kv_offload/mooncake_v2/test_pull_worker.py`, specifically verifying address generation, transfer bucket building, and TP head shard usage with global DCP.

Comment thread vllm_ascend/distributed/kv_transfer/kv_p2p/mooncake/pull_worker.py
@nwpu-zxr nwpu-zxr added the ready-precise run selected e2e test for pr label Sep 25, 2026
Signed-off-by: nwpu-zxr <zhouxuerong2@huawei.com>
@yiz-liu
yiz-liu merged commit 3a52c55 into vllm-project:main Sep 29, 2026
17 checks passed
HackClawMxw pushed a commit to HackClawMxw/vllm-ascend-fork that referenced this pull request Sep 30, 2026
…_heads > 1 (vllm-project#17524)

### What this PR does / why we need it?
Support FullAttention use TP parallel when DCP>1 and `num_kv_heads > 1`.
For example, Kimi K3 with MHA dspark draft model, if DCP is enabled, the
MLA layer will use DCP to extend block_size and reuse the Redundant
kv_cache across DP, but Mamba and MHA dspark drafter will still use TP
to split their caches. This PR supports GQA/MHA layers to still use TP
sharding for KV transmission even when DCP > 1, as long as
`local_num_kv_heads > 1` and `remote_num_kv_heads > 1`.

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

### How was this patch tested?
By CI.

- vLLM main:
vllm-project/vllm@ced6857

---------

Signed-off-by: nwpu-zxr <zhouxuerong2@huawei.com>
tracellex pushed a commit to tracellex/vllm-ascend that referenced this pull request Sep 30, 2026
…ention_dcp_sizes and _compute_group_block_ids local_dcp params

The previous manual merge of upstream vllm-project#17524 (3a52c55) carried only the
three call sites into pull_worker.py but dropped:
- the _get_full_attention_dcp_sizes helper definition (18 lines)
- the local_dcp_size parameter and local_dcp_rank binding of
  _compute_group_block_ids

That left the tree in a guaranteed NameError/TypeError state on the first
Mooncake pull of a FullAttention layer. This commit restores both pieces
verbatim from upstream 3a52c55.

Verified: AST parse OK; upstream-added substantive lines present 39/39
(100%); UT tests/ut/kv_offload/mooncake_v2/test_pull_worker.py already in
tree covers _compute_group_block_ids signatures.

Signed-off-by: xiangyongzh <ascend-operator@localhost>
tracellex pushed a commit to tracellex/vllm-ascend that referenced this pull request Oct 1, 2026
…-indexer → glm5.3-flash-0.29)

含 45ee010 因果可见性修复(LoadRowMeta 改读绝对 positions, 修复 prefix-cache 命中
prefill/每步 decode 的池可见性坍缩, gsm8k 6.00→98.00 与 triton 持平) 及
PR#17542/vllm-project#17524 backport、c5182d3d4 padded-rows 掩码、2fbcf3eea dispatcher 契约测试。

029-pd-v2 转正回归证据 (experiments/029-pd-v2-split-gate-20260930):
- gsm8k-20=95.00 / gsm8k-100=98.00 (=triton)
- TTFT 64k 9.65s vs triton 12.45s (-22.5%); 192k 28.50s vs 45.91s (-37.9%)
- bundle 31ae34e694bd 内容物与源仓一致 (.o b79cb7e6… = dispatcher 281b30a9… = HEAD)

Signed-off-by: xiangyongzh <ascend-operator@localhost>
tracellex pushed a commit to tracellex/vllm-ascend that referenced this pull request Oct 8, 2026
合并 feat/glm5-kpool-ascendc-indexer 44 commits + 队友线 2 commits:
- glm5_kpool_split AscendC 内核转正(split 达成: 64k TTFT -37.5% / 192k -59% vs triton)
- glm5_kpool_indexer: dispatcher PR#17542 契约补全 + padded rows mask + absolute positions
- 上游 backport: PR#17115/vllm-project#17613/vllm-project#17542/vllm-project#17524(P/D FullAttn TP parallel / mooncake)
- Restore causal_conv1d_update_npu Triton kernel (dropped by vllm-project#14620)
- memcache: filter cacheable KV groups + rewarm SSD on load
- ascend_store: port vllm-project#16945 empty RoPE view regression tests

原始历史: backup/glm5.3-flash-0.29-pre-squash (bd6c295)
tracellex pushed a commit to tracellex/vllm-ascend that referenced this pull request Oct 8, 2026
- glm5_kpool_split AscendC 内核(64k TTFT -37.5% / 192k -59% vs triton)+ dispatcher PR#17542 契约
- 上游 backport: PR#17115/vllm-project#17613/vllm-project#17542/vllm-project#17524
- causal_conv1d_update_npu Triton 恢复 + memcache rewarm + vllm-project#16945 回归测试

squash 自 47 commits; 原始历史: backup/glm5.3-flash-0.29-pre-squash
tracellex pushed a commit to amazingapple/vllm-ascend that referenced this pull request Oct 9, 2026
The glm5.3-flash-0.29 merge of vllm-project#17524 lost method definitions in
conflict resolution: re-add _get_full_attention_dcp_sizes (upstream
3a52c55) and the selection_index/local_dcp_size parameters of
_compute_group_block_ids; make remote_pcp_size lookups tolerate
missing metadata fields. Without this the first decode-side request
fails with AttributeError. Verified on herd v029-base 39P/40D.
tracellex pushed a commit to tracellex/vllm-ascend that referenced this pull request Oct 9, 2026
The glm5.3-flash-0.29 merge of vllm-project#17524 lost method definitions in
conflict resolution: re-add _get_full_attention_dcp_sizes (upstream
3a52c55) and the selection_index/local_dcp_size parameters of
_compute_group_block_ids; make remote_pcp_size lookups tolerate
missing metadata fields. Without this the first decode-side request
fails with AttributeError. Verified on herd v029-base 39P/40D.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module:tests ready-precise run selected e2e test for pr

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants