Skip to content

[1/N] Add optional NCCL m2n weight sync backend#159

Open
princepride wants to merge 4 commits into
mainfrom
feature/nccl-xfer-weight-sync-mvp
Open

[1/N] Add optional NCCL m2n weight sync backend#159
princepride wants to merge 4 commits into
mainfrom
feature/nccl-xfer-weight-sync-mvp

Conversation

@princepride

@princepride princepride commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

This PR is the first step toward the NCCL m2n rollout weight sync proposal in #52.

It adds an opt-in non-colocated weight sync backend:

--non-colocate-weight-sync-backend {broadcast,nccl-m2n}

The existing gather-broadcast path remains the default. Colocated rollout engines continue using the existing CUDA IPC path.

Changes

  • Add UpdateWeightFromNcclm2n as an optional non-colocated updater.
  • Add initial NCCL m2n layout analysis for common dense/MoE/replicated tensor patterns.
  • Wire backend selection through the actor update-weight setup.
  • Keep explicit fallback to the existing broadcast updater for unsupported layouts or unavailable runtime support.
  • Add focused unit coverage for layout decisions and fallback/native selection behavior.

Stack

This is [1/N].

Follow-up PRs will cover the native ncclm2nReshardWithWindow runtime path, vLLM worker receive integration, staging/window management, and performance comparison against the legacy gather-broadcast path.

Test Plan

python -m pytest tests/unit/backends/megatron_utils/update_weight/test_nccl_m2n_layout.py tests/unit/backends/megatron_utils/update_weight/test_update_weight_from_nccl_m2n.py

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

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 an experimental NCCL Xfer weight synchronization backend (UpdateWeightFromNcclXfer) for non-colocated rollout engines, complete with command-line options, validation, layout analysis, and unit tests. The review feedback highlights two important improvements: caching the fallback reason during initialization to prevent a performance bottleneck from traversing model parameters on every weight update, and defensively handling quantization_config to avoid potential AttributeError crashes when it is passed as a configuration object rather than a dictionary.

Comment thread vime/backends/megatron_utils/update_weight/nccl_xfer_layout.py Outdated
@princepride princepride changed the title [1/N] Add optional NCCL Xfer weight sync backend [1/N] Add optional NCCL m2n weight sync backend Jun 10, 2026
princepride and others added 4 commits June 10, 2026 15:49
Add the non-colocate backend switch and an explicit NCCL Xfer fallback wrapper so the experimental path can be enabled without changing the stable broadcast default.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
Keep the MVP PR focused by dropping standalone argument parser tests for the opt-in backend flag.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
Avoid repeated model scans during weight updates and handle object-style quantization configs when deciding broadcast fallback.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
Add the explicit zip strictness required by Ruff and include formatter-only cleanup so the branch passes local hooks.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: princepride <wangzhipeng628@gmail.com>
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