Skip to content

[Feature] Optimize forward metadata collection across dp ranks#1857

Closed
jianzs wants to merge 1 commit intovllm-project:mainfrom
jianzs:feat/dp-comm-opt
Closed

[Feature] Optimize forward metadata collection across dp ranks#1857
jianzs wants to merge 1 commit intovllm-project:mainfrom
jianzs:feat/dp-comm-opt

Conversation

@jianzs
Copy link
Copy Markdown
Collaborator

@jianzs jianzs commented Jul 17, 2025

Resubmit #1593

What this PR does / why we need it?

This PR introduces two optimizations for cases where data parallel size > 1:
1. Eliminates DP communication in set_forward_context
2. Implements HCCL for DP metadata communication, resulting in significant performance improvements for large DP configurations

  • Achieves ~20ms latency reduction with DP size of 64

Does this PR introduce any user-facing change?

no

How was this patch tested?

CI passed.

@jianzs jianzs force-pushed the feat/dp-comm-opt branch from d35cbf3 to f8eba17 Compare July 17, 2025 11:46
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 17, 2025

Codecov Report

❌ Patch coverage is 0% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.56%. Comparing base (2bfbf9b) to head (c05804d).
⚠️ Report is 1041 commits behind head on main.

Files with missing lines Patch % Lines
vllm_ascend/worker/model_runner_v1.py 0.00% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1857   +/-   ##
=======================================
  Coverage   72.55%   72.56%           
=======================================
  Files         146      146           
  Lines       21710    21706    -4     
=======================================
- Hits        15752    15751    -1     
+ Misses       5958     5955    -3     
Flag Coverage Δ
unittests 72.56% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Yikun
Copy link
Copy Markdown
Member

Yikun commented Jul 17, 2025

Rebase here: f9dfde0

@jianzs jianzs force-pushed the feat/dp-comm-opt branch 2 times, most recently from 7b605f8 to 2b0c3c1 Compare July 18, 2025 03:15
if runner.dp_size > 1:
max_num_tokens, with_prefill = runner._get_forward_metadata_across_dp(
max_num_tokens, with_prefill)
if runner.dp_size <= 1:
Copy link
Copy Markdown
Collaborator

@wangxiyuan wangxiyuan Jul 19, 2025

Choose a reason for hiding this comment

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

Let's do the torchair refactor fist. Then add related code there #1885

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.

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

What are your plans for the model_runner refactoring?

@github-actions
Copy link
Copy Markdown
Contributor

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

@github-actions
Copy link
Copy Markdown
Contributor

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

@wangxiyuan
Copy link
Copy Markdown
Collaborator

please rebase to fix the merge conflict if this PR is still needed.

Signed-off-by: Jade Zheng <zheng.shoujian@outlook.com>
@wangxiyuan wangxiyuan added the ready read for review label Aug 28, 2025
@github-actions github-actions bot added merge-conflicts and removed ready read for review labels Aug 28, 2025
@github-actions
Copy link
Copy Markdown
Contributor

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

with_prefill = bool(num_tokens_across_dp[-2])
enable_dbo = not bool(num_tokens_across_dp[-1])
num_tokens_across_dp = num_tokens_across_dp[:-2]
local_forward_metadata = torch.tensor(
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.

Please provide the data for the memory increase.

@jianzs jianzs closed this Sep 25, 2025
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.

5 participants