Repository navigation
fix gdn sp - #253
Merged
Merged
fix gdn sp#253
Conversation
tastelikefeet
approved these changes
Nov 3, 2026
1 task done
hjh0119
pushed a commit
that referenced
this pull request
Nov 4, 2026
…254) #253 makes `_force_sequence_parallel_off` clear `sequence_parallel` on the projections and on their parameters. Without the parameter half, the gradient finalizer still sums the projection gradient over the tensor parallel group even though every rank already holds the complete copy, which is the #241 report (a 4x gamma gradient at TP4). The new test drives the real `_force_sequence_parallel_off` on a Transformer Engine shaped stand-in and reads the reduction back off `main_grad` after Megatron's own `_allreduce_non_tensor_model_parallel_grads`: * every projection gets the flag cleared on both the submodule and the marked parameters, and unmarked parameters are left alone; * a `linear_decoupled_in_proj` build (no `in_proj`, no `out_proj`) does not raise; * `out_norm` keeps its flag -- its weight is shared by all heads while the head axis is TP-split, so that gradient really is partial and still needs the sum; * on two gloo ranks, the gamma gradient stays at 1x with the flag cleared and comes out at tp_size when the flag is put back, so the test fails if the parameter half of the toggle goes missing. CPU only (gloo), no GPU and no NCCL.
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.
No description provided.