Repository navigation
Remove dummy weight gradients from fused accumulation - #3759
Open
vthumbe1503 wants to merge 7 commits into
Open
vthumbe1503 wants to merge 7 commits into
vthumbe1503 wants to merge 7 commits into
Conversation
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
2 of 3 tasks
timmoon10
previously approved these changes
Oct 28, 2026
timmoon10
left a comment
Member
There was a problem hiding this comment.
Dummy wgrads were an ugly hack. It'll be really nice getting rid of it all now that we don't need it.
13 tasks
1 task done
Track participating parameters with temporary warmup hooks rather than treating every None gradient as an unused parameter. Retain fused-wgrad autograd edges without dummy gradients or a replay wrapper, while excluding unused and frozen parameters. Cover fused and unfused accumulation, ordered capture, input gradients, shared weights, and repeated replay. Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
Co-authored-by: Tim Moon <4406448+timmoon10@users.noreply.github.com> Signed-off-by: vthumbe1503 <vthumbe@nvidia.com>
Merge tested main 8afe7c8 while retaining the None-gradient fused-accumulation contract. Preserve upstream userbuffer validation and delayed-wgrad graph behavior, update BatchedLinear, and align sharded/expert-parallel tests with main_grad accumulation. Validate on Ptyche GB200 with focused TE and Megatron correctness tests, distributed CUDA-graph checks, tied-embedding DDP, and matched main/Megatron-only/combined GPT, GTP, FSDP and DeepSeek V3 runs. Full CI and long-horizon convergence remain outside this validation. Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
vthumbe1503
marked this pull request as ready for review
December 1, 2026 07:44
Contributor
[Medium impact] The latest changes appear safe to merge. SummaryThe PR returns
Reviews (2) · Last reviewed commit: "Remove unused main_grad argument from gr..." · Reviewed by Greptile |
Drop the obsolete dummy-gradient argument and stop passing it from the eager and graph-safe backward paths. Resolve pylint W0613 without suppressing the check. Validate with the full PyTorch Python lint launcher using pylint 4.1.3, Black, and 120 BF16 grouped-linear gradient-accumulation cases in the existing Ptyche build. Signed-off-by: Varun Thumbe <vthumbe@nvidia.com>
This branch has not been deployed
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.
Description
Remove dummy weight-gradient tensors from Transformer Engine's fused weight-gradient accumulation path. When the real gradient has been accumulated into
main_grad, returnNoneto autograd instead of allocating or reusing an unused dummy. This removes the dummy cache, zero-tensor handling, and extra gradient addition needed by tied embeddings.This is paired with Megatron-LM #4680, which updates Megatron's gradient hooks and consumers for the
Nonecontract. PyTorch 2.6+ runs the accumulator hook on the parameter's device worker thread.Type of change
Changes
Nonefor fused weight gradients already written tomain_gradacross linear, grouped linear, fused ops, and distributed-weight paths.Nonefor a group.Checklist
Nonegradient contractThis PR is a draft for author review before maintainer review.