Skip to content

feat: support sparse HCCL weight sync with TP - #408

Draft
wangx700 wants to merge 10 commits into
vllm-project:ascendfrom
wangx700:feature/sparse-hccl-weight-sync
Draft

feat: support sparse HCCL weight sync with TP#408
wangx700 wants to merge 10 commits into
vllm-project:ascendfrom
wangx700:feature/sparse-hccl-weight-sync

Conversation

@wangx700

@wangx700 wangx700 commented Sep 1, 2026

Copy link
Copy Markdown

Summary

  • add sparse HCCL weight synchronization for Megatron TP training and vLLM-Ascend rollout
  • distribute Megatron-to-HF sparse diff export across TP ranks
  • use exact-size HCCL P2P gathering to rank 0 instead of the HCCL gather-to-allgather fallback
  • pack sparse patches by dtype to reduce HCCL/RPC launch count
  • add double-buffered actor snapshots and CPU diff parallelism

Validation

  • 398 HF tensors matched full-diff bit-exact verification
  • HCCL P2P microtest passed on 4 ranks
  • 4+4 NPU three-round validation succeeded
  • sparse local processing time reduced from 4.49–6.59s to 1.22–1.31s

Notes

This PR is based on validated-delta, so it currently includes those prerequisite commits in the diff. The matching vLLM-Ascend branch is feature/sparse-hccl-weight-sync.

@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 support for Ascend Delta Weight Sync and Sparse Weight Sync strategies, allowing efficient weight synchronization across non-colocated rollout engines. It adds new classes (UpdateWeightFromDiskDelta and UpdateWeightFromSparseDistributed), delta encoding/decoding utilities, checksum verification, and integrates these strategies into the Megatron-Bridge actor and vLLM engine. Feedback on the changes highlights a critical issue in the PyTorch distributed communication logic within sparse_gather.py, where global ranks are incorrectly used instead of group-local ranks in dist.P2POp calls, which could lead to runtime errors during tensor parallel training.

"""
rank = dist.get_rank(group)
world = dist.get_world_size(group)
destination = dist.get_global_rank(group, 0)

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

In PyTorch distributed, when a process group group is specified in dist.P2POp, the peer (or destination) rank must be the rank within that process group (i.e., the group rank), not the global rank. Passing the global rank will cause runtime errors or incorrect communication when group is not the world group (e.g., under tensor parallel training where tp_size > 1).

Since the destination is always the rank 0 of the process group, it should be set to 0 directly.

Suggested change
destination = dist.get_global_rank(group, 0)
destination = 0

)
index_list.append(index_buffer)
value_list.append(value_buffer)
peer = dist.get_global_rank(group, group_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

Similarly, the peer rank passed to dist.P2POp must be the group rank (group_rank) rather than the global rank when group is specified. Using the global rank here will lead to out-of-bounds errors or incorrect communication when the process group is not the world group.

Suggested change
peer = dist.get_global_rank(group, group_rank)
peer = group_rank

@wangx700
wangx700 marked this pull request as draft September 1, 2026 06:39
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.

1 participant