reuse grad buffer for layer-wise param allgather - #3751
Conversation
|
/ok to test bec1750 |
|
/claude review |
|
/claude review |
|
/ok to test f6730fc |
|
Hi Deyu, I am working on a refactor of the way parameters are assigned in the parameter buffer here: #3812. Do you still want to merge this? |
@deepakn94 My understanding is once optimizer control layout, inplace RS/AG become possible and this optimization might no longer be needed? I'm not sure how long it'd take for in-place AG to happen. But since this change is quite small and not conflicting in terms of code/design, I suggest we merge this now. Even without this, the temp buffer code need to be cleaned up later and this PR doesn't make it harder(if not easier) |
Yes, that's right.
I am hopeful I can solicit reviews before the free days, but let's see. |
|
/ok to test dd22546 |
|
/claude review |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/24381405635 |
Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
What does this PR do ?
Reuse
bucket.grad_dataas the receive buffer for layer-wise async param all-gather instead of allocating temporary tensors viatorch.empty. During param sync (forward pass),grad_datais idle and always has sufficient bytes sincegrad_dtype.element_size >= param_dtype.element_size. This eliminates per-bucket temporary allocations and removes the_layerwise_src_bufferbookkeeping.Contribution process
Pre-checks
Code review
Feel free to message or comment the @mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.
For MRs into `dev` branch
The proposed review process for `dev` branch is under active discussion.MRs are mergable after one approval by either
eharper@nvidia.comorzijiey@nvidia.com.