Skip to content

[Feature] Support Prefill Context Parallel (PCP) for GQA flashinfer#28723

Closed
pisceskkk wants to merge 7 commits intovllm-project:mainfrom
pisceskkk:pcp+flashinfer
Closed

[Feature] Support Prefill Context Parallel (PCP) for GQA flashinfer#28723
pisceskkk wants to merge 7 commits intovllm-project:mainfrom
pisceskkk:pcp+flashinfer

Conversation

@pisceskkk
Copy link
Copy Markdown
Contributor

@pisceskkk pisceskkk commented Nov 14, 2025

Purpose

This PR, splited from full PR #26864, adds the supports for the Prefill Context Parallelism (PCP) with GQA flashinfer, following PR #28718. For specific implementation details, please refer to the RFC #25749.
TL;DR: PCP enhances long-sequence inference capabilities by partitioning the sequence dimension during the prefill stage.

The current implementation primarily includes the following changes:

  • Modified ModelRunner.py for PCP partitioning logic for tokens;
  • Modified flashinfer.py to adapt the FlashInfer backend for GQA to PCP.
  • Added PrefillContextParallelMetadata shared across attention backends;
  • Renamed variables and functions shared by both PCP and DCP.

Test Plan

Qwen/Qwen2.5-3B

export VLLM_ATTENTION_BACKEND='FLASHINFER'
vllm serve Qwen/Qwen2.5-3B --tensor-parallel-size 4 --decode-context-parallel-size 2 --prefill-context-parallel-size 2 --dcp-kv-cache-interleave-size 8

Test Result

gsm8k eval

tp4 17c540a

dataset version metric mode vllm-api-general-stream
gsm8kdataset - avg@5 gen 72.78

tp4 dcp2 interleave 8

dataset version metric mode vllm-api-general-stream
gsm8kdataset - avg@5 gen 72.43

tp4 pcp2 interleave 8

dataset version metric mode vllm-api-general-stream
gsm8kdataset - avg@5 gen 72.51

tp4 dcp2 pcp2 interleave 8

dataset version metric mode vllm-api-general-stream
gsm8kdataset - avg@5 gen 72.98

CC @LookAround0301 @FENP @gjc0824 @LucasWilkinson

@mergify
Copy link
Copy Markdown

mergify bot commented Nov 14, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @pisceskkk.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

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 support for Prefill Context Parallelism (PCP) for GQA with flashinfer, which is a significant feature for enhancing long-sequence inference. The changes are extensive, touching configuration, parallel state management, attention backends, and the model runner. Overall, the implementation looks solid, but I've identified a few critical issues that need to be addressed. These include a duplicated command-line argument, a syntax error, a typo in a variable name, and incorrect tensor indexing, all of which could lead to runtime errors or prevent the code from running.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@pisceskkk pisceskkk force-pushed the pcp+flashinfer branch 2 times, most recently from c0f45f9 to 489b6c5 Compare November 18, 2025 09:12
@mergify mergify bot removed the needs-rebase label Nov 18, 2025
@pisceskkk pisceskkk force-pushed the pcp+flashinfer branch 2 times, most recently from 8bc261d to 58cbd8f Compare November 18, 2025 09:54
@mergify
Copy link
Copy Markdown

mergify bot commented Nov 19, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @pisceskkk.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Nov 19, 2025
pisceskkk and others added 2 commits November 20, 2025 09:04
Co-authored-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: FENP <yuanyongjie.yyj@antgroup.com>
Co-authored-by: LookAround <lixushi@huawei.com>
Co-authored-by: Jingchun Gao <gaojingchun1@huawei.com>
Co-authored-by: zhenwenqi2024 <zhenwenqi_2022@qq.com>
Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Signed-off-by: FENP <yuanyongjie.yyj@antgroup.com>
Signed-off-by: LookAround <lixushi@huawei.com>
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
Signed-off-by: zhenwenqi2024 <zhenwenqi_2022@qq.com>
Co-authored-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: FENP <yuanyongjie.yyj@antgroup.com>
Co-authored-by: LookAround <lixushi@huawei.com>
Co-authored-by: Jingchun Gao <gaojingchun1@huawei.com>
Co-authored-by: zhenwenqi2024 <zhenwenqi_2022@qq.com>
Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Signed-off-by: FENP <yuanyongjie.yyj@antgroup.com>
Signed-off-by: LookAround <lixushi@huawei.com>
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
Signed-off-by: zhenwenqi2024 <zhenwenqi_2022@qq.com>
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
@gjc0824 gjc0824 force-pushed the pcp+flashinfer branch 2 times, most recently from b9ed205 to d6bbe6d Compare November 24, 2025 01:59
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
Copy link
Copy Markdown
Collaborator

@LucasWilkinson LucasWilkinson left a comment

Choose a reason for hiding this comment

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

Left some comments on #28988 which I think similarly apply here

Copy link
Copy Markdown
Collaborator

@LucasWilkinson LucasWilkinson left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! A few more comments

@mergify
Copy link
Copy Markdown

mergify bot commented Nov 25, 2025

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @pisceskkk.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Nov 25, 2025
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
Signed-off-by: Jingchun Gao <gaojingchun1@huawei.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 2, 2026

This pull request has been automatically marked as stale because it has not had any activity within 90 days. It will be automatically closed if no further activity occurs within 30 days. Leave a comment if you feel this pull request should remain open. Thank you!

@github-actions github-actions bot added the stale Over 90 days of inactivity label Mar 2, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 1, 2026

This pull request has been automatically closed due to inactivity. Please feel free to reopen if you intend to continue working on it. Thank you!

@github-actions github-actions bot closed this Apr 1, 2026
@github-project-automation github-project-automation bot moved this to Done in NVIDIA Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants