Fix layer-wise (Muon) distributed optimizer + fp8-param - #5707
Closed
fanshiqing wants to merge 0 commit into
Closed
Conversation
svcnvidia-nemo-ci
marked this pull request as draft
July 8, 2026 10:04
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
fanshiqing
marked this pull request as ready for review
July 8, 2026 10:05
Member
Author
|
/ok to test b9ebad6 |
Member
Author
|
/ok to test eb367a4 |
Member
Author
|
Close this MR as this fix (fanshiqing@1b0121d) has already been merged with #4967 together. |
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?
Support Muon (LayerWiseDistributedOptimizer) with mxfp8 fp8-param-gather
fp8-param-gather relies on the DistributedOptimizer param-buffer machinery, which
LayerWiseDistributedOptimizer (Muon) does not have, so the optimizer's weight
update never reached the forward and loss stayed flat. Wire the missing pieces so
Muon trains with --fp8-param-gather + --reuse-grad-buf-for-mxfp8-param-ag at both
DP=1 and DP>1:
optimizer.py: the reuse_grad_buf (master -> fp8 param buffer) copy only applies
to DistributedOptimizer; gate it on _copy_main_params_to_param_buffer so
non-DistOpt optimizers (Muon's Float16 base opts) fall through to
master -> model params. The forward then reads the update.
param_and_grad_buffer.py: in the LayerWise variable-size param all-gather, stage
the high-precision fp32 master (param.main_param, cast to bf16) for MXFP8 params
instead of flattening the MXFP8 wrapper (view(-1) is unsupported); the receive
side re-quantizes via param.data.copy_. Also skip _post_param_sync for buckets
with no param_data buffer (the LayerWise path already updated params in place).