Add MimoOptimizer for heterogeneous parallelism with Mimo#3212
Closed
yashaswikarnati wants to merge 7 commits intoNVIDIA:pull-request/3211from
Closed
Add MimoOptimizer for heterogeneous parallelism with Mimo#3212yashaswikarnati wants to merge 7 commits intoNVIDIA:pull-request/3211from
yashaswikarnati wants to merge 7 commits intoNVIDIA:pull-request/3211from
Conversation
ecbde44 to
1d817b6
Compare
|
Quick note from trying to hook this into Megatron‑Bridge MIMO: there are a few small API mismatches that make the new MimoOptimizer hard to use without runtime shims in Bridge. To make the implementation work, core could expose these consistently:
If these land in core, Bridge can use MimoOptimizer directly without compatibility patches. |
Contributor
Author
thanks for raising these, i can try to address. |
b1a1ea3 to
a0acc15
Compare
Contributor
|
/ok to test 214e4fd |
cc897f0 to
80ce148
Compare
Adds optimizer support for MIMO models where different modules (encoder, LLM) may have different DP/TP/PP configurations. Key features: - MimoOptimizer class managing per-module optimizers - True global gradient norm via all_reduce MAX across module boundaries - Module-aware checkpointing (state_dict keyed by module name) - Simple API: get_mimo_optimizer(mimo_model, config)
- Rename _get_pg_collection_from_grid to _get_pg_collection_for_optimizer - Remove embedding group creation (not needed by optimizer) - Fix mp group to use ["tp", "pp"] instead of just "tp" - Add missing optimizer groups: tp_ep_pp, expt_dp - Update test to create required process groups
- Replace .get() with direct indexing for modality_submodules access - When is_active=True, module MUST exist; using .get() silently hid bugs - Direct indexing raises KeyError immediately if module missing - Add is_current_rank_in_grid() method to HyperCommGrid - Format code for consistency Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
After merging PR3211 into PR3212, the optimizer code referenced the removed `config.language_module_key` attribute. Update to use the constant `MIMO_LANGUAGE_MODULE_KEY` from role.py, remove the stale kwarg from test_mimo_optimizer.py, and add composite process groups (tp-pp, tp-ep-pp, dp-ep) required by the optimizer to the 1F1B test grid setup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ed84d18 to
9f3c4b2
Compare
test_lm_pp3_4gpu used num_layers=2 with llm_pp=3, violating the Megatron constraint that num_layers must be divisible by pp_size. This caused an assertion failure on LLM ranks while the encoder rank waited at a barrier, appearing as a deadlock. Fixed by changing num_layers to 3. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
9f3c4b2 to
c68c568
Compare
This was referenced Mar 24, 2026
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 ?
Adds optimizer support for MIMO models with heterogeneous parallelism, where different modules (encoder, LLM) can have different DP/TP/PP configurations
Introduces MimoOptimizer class that:
Contribution process
flowchart LR A[Pre-checks] --> B[PR Tests] subgraph Code Review/Approval C1[Expert Review] --> C2[Final Review] end B --> C1 C2 --> D[Merge]Pre-checks
Core 0.8)Code review
The following process is enforced via the CODEOWNERS file for changes into
megatron/core. For changes outside ofmegatron/core, it is up to the PR author whether or not to tag the Final Reviewer team.For MRs into `main` branch
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!
(Step 1): Add PR label
Expert Review(Step 2): Collect the expert reviewers reviews
Expert Reviewlabel when your PR is ready for review.Final Review might get declined if these requirements are not fulfilled.
(Step 3): Final Review
Final Reviewlabel(Optional Step 4): Cherry-pick into release branch
If this PR also needs to be merged into
core_r*release branches, after this PR has been merged, selectCherry-pickto open a new PR into the release branch.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.Merging your PR
Any member of core-adlr and
core-nemowill be able to merge your PR.