Skip to content

[bugfix] correct local_chunk_len for DCP in reorg_kvcache with long context#28526

Merged
vllm-bot merged 4 commits intovllm-project:mainfrom
pisceskkk:dcp-bugfix
Nov 13, 2025
Merged

[bugfix] correct local_chunk_len for DCP in reorg_kvcache with long context#28526
vllm-bot merged 4 commits intovllm-project:mainfrom
pisceskkk:dcp-bugfix

Conversation

@pisceskkk
Copy link
Copy Markdown
Contributor

@pisceskkk pisceskkk commented Nov 12, 2025

Fix the issues #28476 #28411
The previous DCP implementation did not account for cases where long contexts were split to multi-chunks. This has now been addressed by updating the correct chunked local_chunk_len based on the chunk_size and local_context_len.

CC @LucasWilkinson @cjackal @Nemo-G

pisceskkk and others added 2 commits November 12, 2025 12:54
…l-size is enabled

Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
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 bugfix for Distributed Context Parallelism (DCP) in the context of chunked prefill for long sequences. The core of the change is in the reorg_kvcache function, where the calculation of local_chunk_len is corrected. Previously, it incorrectly used the total local_context_len, which failed for contexts split across multiple chunks. The new implementation correctly calculates the length of the context for the current rank within the current chunk by using the newly introduced chunk_size and chunk_idx parameters. The changes are well-contained, logical, and include appropriate assertions. The fix appears correct and addresses the described issue effectively.

@cjackal
Copy link
Copy Markdown
Contributor

cjackal commented Nov 12, 2025

Thanks for the quick fix, it looks promising. I'll rerun the test and come back with the result.

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.

LGTM, good catch; thanks for ascii art, helps alot!

@LucasWilkinson LucasWilkinson enabled auto-merge (squash) November 13, 2025 01:43
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Nov 13, 2025
@cjackal
Copy link
Copy Markdown
Contributor

cjackal commented Nov 13, 2025

Thanks for the quick fix, it looks promising. I'll rerun the test and come back with the result.

DSV3 now runs smooth on >120k inputs 🙌

@ehfd
Copy link
Copy Markdown
Contributor

ehfd commented Nov 13, 2025

Need to merge this soon, to land in v0.11.1.

@mgoin mgoin added this to the v0.11.1 milestone Nov 13, 2025
@vllm-bot vllm-bot merged commit 968060c into vllm-project:main Nov 13, 2025
48 of 50 checks passed
geodavic pushed a commit to geodavic/vllm that referenced this pull request Nov 16, 2025
…ontext (vllm-project#28526)

Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: George D. Torres <gdavtor@gmail.com>
khluu pushed a commit that referenced this pull request Nov 16, 2025
…ontext (#28526)

Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
(cherry picked from commit 968060c)
@pisceskkk pisceskkk deleted the dcp-bugfix branch November 20, 2025 00:39
devpatelio pushed a commit to SumanthRH/vllm that referenced this pull request Nov 29, 2025
…ontext (vllm-project#28526)

Signed-off-by: QiuChunshuo <qiuchunshuo@huawei.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants