[ckpt] feat: add NCCL M2N Reshard layout primitives - #7432
Open
ss16118 wants to merge 2 commits into
Open
Conversation
Add transport-independent source and destination layout descriptions for NCCL M2N Reshard, together with an adapter for the existing ShardSpec producer contract. Validate supported mesh topology and metadata fail closed, and cover the accepted layouts and rejection paths with CPU tests. Assisted-by: OpenAI Codex Signed-off-by: Siyuan Shen <siyshen@nvidia.com>
Describe the reusable layout axes as replica and shard dimensions instead of assigning DP and TP roles to them. Assisted-by: OpenAI Codex Signed-off-by: Siyuan Shen <siyshen@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds transport-independent tensor-layout primitives for the staged NCCL M2N Reshard checkpoint path.
veRL engine producers export rank-local parameters as
(name, tensor, ShardSpec), while M2N requires explicit source and destination mesh dimensions, placements, local shapes, and communicator rank ranges. This PR introduces:LocalWeightDescfor normalized rank-local exports;ReshardLayoutfor one side of an M2N transfer;local_weight_desc_from_shard_api()for validatedShardSpecconversion; andbuild_reshard_layouts()for constructing matching source and destination layouts.The reusable API uses replica/shard terminology rather than assigning DP or TP roles to its mesh axes.
This is the foundational PR in a staged integration. It intentionally contains no NCCL calls, checkpoint-backend registration, configuration, or rollout changes; those will be added in follow-up PRs.
This does not duplicate an existing PR. Searches for NCCL M2N and reshard layout found no matching implementation. The closest related work—#4876, #7263, #7108, and #7227—implements different consumers, transports, or wire formats rather than this layout-conversion layer.
Related to #400 and #1063.
Checklist Before Starting
[{modules}] {type}: {description}.Test
The CPU tests cover sharded and replicated layouts, one- and two-dimensional source meshes, topology mismatches, invalid local tensor sizes, unsupported placements, and deferred Hugging Face conversion metadata.
No GPU test is needed for this PR because it does not initialize NCCL or invoke M2N.
API and Usage Example
This adds an internal checkpoint-engine API and does not change user-facing configuration.
Design & Code Changes
ShardSpeccontract into a transport-independent descriptor.(world_size, 1)so all weights share the same two-axis representation.Acknowledgements
This layout layer is adapted from the original NCCL M2N Reshard prototype and RFC by Alexandre Chidiac (@achidiac). Thanks to Ke Wen (@kwen2501) and Pouya Kousha (@pkousha) for design and code-review feedback.
AI assistance disclosure
OpenAI Codex was used for code exploration, implementation assistance, test orchestration, and preparation of this PR.
The human submitter must review every changed line and understand and be able to defend the change before requesting upstream review.
Checklist Before Submitting