[Megatron-FSDP] Fix segmentation fault when using precision-aware optimizers with the updated MCore. - #3510
Merged
Conversation
This was referenced Apr 24, 2026
cspades
force-pushed
the
cye/mfsdp-decoup-grad-argfix
branch
from
April 24, 2026 05:15
b0f7e53 to
7433675
Compare
cspades
force-pushed
the
cye/mfsdp-decoup-grad-argfix
branch
from
April 24, 2026 19:08
4fac51d to
c264ef7
Compare
Contributor
Author
|
Either some corrupt global state / config (test OOM'ing on FusedAdam, which shouldn't be used) or something else. Debugging that test... |
…led_grad when FusedAdam is used. Signed-off-by: Cory Ye <cye@nvidia.com>
Signed-off-by: Cory Ye <cye@nvidia.com>
Signed-off-by: Cory Ye <cye@nvidia.com>
Signed-off-by: Cory Ye <cye@nvidia.com>
cspades
force-pushed
the
cye/mfsdp-decoup-grad-argfix
branch
from
April 25, 2026 01:25
c264ef7 to
8594fb8
Compare
cspades
enabled auto-merge (squash)
April 25, 2026 02:09
Contributor
QA RCCA Analysis1. Fix Reference
2. Root CauseSegmentation fault caused by passing 3. Trigger Configuration
4. Nature of the BugClassification: CODE BUG - Incorrect optimizer configuration causing segfault 5. Existing Test CoverageIn Fix PR: YES - 2 test files added/modified:
In NMFW Tests: Not specifically covering this precision-aware optimizer scenario 6. Coverage Assessment
7. New Regression TestNOT NEEDED - Fix PR includes functional tests for Megatron-FSDP with precision-aware optimizers. 8. ConclusionVerdict: ADEQUATE COVERAGE - Fix PR includes comprehensive functional tests. |
vasunvidia
pushed a commit
to vasunvidia/Megatron-Bridge
that referenced
this pull request
Jun 10, 2026
…imizers with the updated MCore. (NVIDIA-NeMo#3510) Signed-off-by: Cory Ye <cye@nvidia.com> Signed-off-by: Vasudevan Rengasamy <vrengasamy@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 ?
param.decoupled_grad = Noneintoclip_grad_norm -> multi_tensor_apply, which is fixed by settingmegatron_fsdp_use_decoupled_grad = use_precision_aware_optimizeras Megatron-FSDP always uses a decoupled gradient when usingTE.FusedAdam.FusedAdam(use_decoupled_grad)is set appropriately, otherwise the training will not converge (silently without hard errors): [Main] Fix FusedAdam.use_decoupled_grad mis-set for Megatron-FSDP. NVIDIA/Megatron-LM#4427 / [Dev] Fix mis-set decoupled gradient for Megatron-FSDP. NVIDIA/Megatron-LM#4426Testing
megatron_fsdp_use_decoupled_gradconfig causes the segfault.FusedAdam(use_decoupled_grad),MegatronFSDP.param_and_grad_buffer.use_decoupled_grad, andclip_grad_norm(use_decoupled_grad)are all consistent and produce non-zero gradients.GitHub Actions CI
See the CI sectionin the Contributing doc for how to trigger the CI. A Nvidia developer will need to approve and trigger the CI for external contributors.
Before your PR is "Ready for review"
Pre checks:
If you haven't finished some of the above items you can still open "Draft" PR.
Additional Information