Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[vllm] fix: use data-parallel rank in vLLM ZMQ handles#6620

Merged
wuxibin89 merged 1 commit into
verl-project:mainfrom
he-yufeng:fix/vllm-zmq-dp-rank
Jun 8, 2026
Merged

[vllm] fix: use data-parallel rank in vLLM ZMQ handles#6620
wuxibin89 merged 1 commit into
verl-project:mainfrom
he-yufeng:fix/vllm-zmq-dp-rank

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Fixes #6615.

Summary

  • derive the colocated vLLM weight-sync receiver socket rank from the vLLM data-parallel local rank and tensor-parallel rank
  • keep the existing single-DP socket layout unchanged
  • add coverage for DP-local rank offsetting, global-DP fallback, and the generated ZMQ handle

Why

The sender side builds the ZMQ handle from a rollout-local rank that spans the local TP/DP workers:

local_rank = self.rollout_rank % local_world_size

The receiver side was using the vLLM worker's self.local_rank directly. In DP>1 colocated vLLM setups, that rank can be TP-local, so multiple DP workers on the same node can try to receive from the same rank-0 / rank-1 socket.

This patch reconstructs the sender-side local rank as:

data_parallel_rank_local * tensor_parallel_size + tensor_parallel_rank

When DP is not enabled, the existing local-rank behavior is preserved.

Validation

  • python -m py_compile verl\workers\rollout\vllm_rollout\utils.py tests\workers\rollout\test_vllm_cli_args_on_cpu.py
  • python -m ruff check verl\workers\rollout\vllm_rollout\utils.py tests\workers\rollout\test_vllm_cli_args_on_cpu.py
  • git diff --check
  • Ran a minimal stubbed import smoke test for _resolve_vllm_weight_sync_local_rank() and _get_zmq_handle()

I also attempted:

python -m pytest tests/workers/rollout/test_vllm_cli_args_on_cpu.py -q

On my Windows machine this gets blocked by local vLLM packaging/native-extension availability after setting up a Python 3.12 .venv and installing the reachable Python dependencies. The same test should run in CI where vLLM is installed as a package.

@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

This pull request introduces a helper function _resolve_vllm_weight_sync_local_rank to resolve the local rank for vLLM weight synchronization, taking into account tensor and data parallel configurations. This prevents socket collisions when multiple data-parallel workers run on the same node. The _get_zmq_handle method is updated to use this resolved rank, and comprehensive unit tests are added. Feedback suggests logging a warning when the function silently falls back to worker_local_rank if dp_local_rank cannot be resolved, as this could still lead to socket collisions.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +63 to +64
if dp_local_rank is None:
return worker_local_rank

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.

high

When dp_size > 1 or dp_local_size > 1, but dp_local_rank cannot be resolved (i.e., it is None), the function silently falls back to worker_local_rank. This will cause multiple DP workers on the same node to use the same socket, leading to silent socket collisions and weight synchronization failures.

Consider logging a warning when this fallback occurs to aid in debugging distributed configuration issues.

Suggested change
if dp_local_rank is None:
return worker_local_rank
if dp_local_rank is None:
logger.warning(
"Data parallelism is enabled (dp_size=%d, dp_local_size=%d), but "
"the local data-parallel rank could not be resolved from parallel_config. "
"Falling back to worker_local_rank=%d, which may cause socket collisions.",
dp_size, dp_local_size, worker_local_rank
)
return worker_local_rank

@wuxibin89 wuxibin89 changed the title fix: use data-parallel rank in vLLM ZMQ handles [vllm] fix: use data-parallel rank in vLLM ZMQ handles Jun 8, 2026
@wuxibin89 wuxibin89 requested a review from aoshen02 June 8, 2026 03:48
@wuxibin89 wuxibin89 merged commit 478b718 into verl-project:main Jun 8, 2026
80 of 85 checks passed
@Mind-s

Mind-s commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Could you also merge this into version 0.8.0? The same issue exists there too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CheckpointEngine] Same socket reused by multiple vllm workers (DP>1 + EP enabled)

3 participants