[Bugfix] Use DP index for dense DP weight updates and EC CPU region (#56950)

Signed-off-by: lxy-alexander <lxy_alexander@outlook.com>
Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Alexander Lee
2026-09-17 22:44:36 +08:00
committed by GitHub
co-authored by aoshen02 Claude Opus 5 aoshen02 mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 861a299adc
commit 9e1cd262cb
4 changed files with 45 additions and 7 deletions
@@ -13,6 +13,8 @@ from unittest.mock import MagicMock, patch
import pytest
import torch
from vllm.config import ParallelConfig
from vllm.distributed.ec_transfer.ec_connector.cpu import common
from vllm.distributed.ec_transfer.ec_connector.cpu.ec_shared_region import (
ECSharedRegion,
_wait_for_file_size,
@@ -95,6 +97,32 @@ def test_second_instance_opens_existing_file_and_shares_memory():
r1.cleanup()
def test_dense_dp_engines_get_distinct_regions(monkeypatch):
"""Dense DP engines reset data_parallel_rank to 0 but share instance_id,
so the region must be keyed by data_parallel_index."""
monkeypatch.setattr(common, "_get_encoder_cache_hidden_dim", lambda cfg: 8)
instance_id = str(uuid.uuid4())
regions = []
try:
for dp_index in range(2):
parallel_config = ParallelConfig(
data_parallel_size=2, data_parallel_rank=dp_index
)
parallel_config.reconfigure_for_independent_dp_rank()
cfg = MagicMock()
cfg.instance_id = instance_id
cfg.parallel_config = parallel_config
cfg.model_config.dtype = torch.float16
cfg.ec_transfer_config.ec_connector_extra_config = {"ec_cpu_bytes": 64}
regions.append(common.create_ec_shared_region(cfg))
assert all(r._is_creator for r in regions)
assert regions[0]._mmap_path != regions[1]._mmap_path
finally:
for r in regions:
r.cleanup()
def test_only_creator_unlinks_file_on_cleanup():
"""Critical contract: if the non-creator unlinks, the creator's mmap path
becomes a dangling backing file and a third opener would create a new one