Repository navigation
Conversation
SequentialMLP built each local expert MLP with only tp_group (the expert TP group) and no pg_collection. The expert linears then resolved their GTP-remat group through resolve_gtp_remat_group(None, is_expert=True), which reads the global expt_gtp_remat group through ProcessGroupCollection.use_mpu_process_groups(), and stamped no replica group on their GTP shards, so checkpointing elected the shard writer from parallel_state.get_expert_data_parallel_rank(). A model built on its own grid had its experts sharded over the global expert GTP-remat group, or left unsharded when the globals do not exist, and it read the global grid to save them. TEGroupedMLP already passes its collection to its grouped linears. Pass SequentialMLP's collection to each expert MLP, which hands it to fc1 and fc2. They take expt_gtp_remat for the shard group and stamp expt_dp as the replica group of their GTP shards. On the standard grid both fields hold the global groups, so the sharding, the initialization and the checkpoint replica ids are unchanged. A collection without expt_gtp_remat keeps the existing fallback to the globals. Add tests that build SequentialMLP with local and Transformer Engine linears while every global grid accessor raises: one with a full collection, and one with expert GTP-remat on distinct communicators over the global ranks, which also checks each expert weight's group and replica group and the sharded state dict. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
This was referenced Oct 30, 2026
Connor-XY
added a commit
to Connor-XY/Megatron-LM
that referenced
this pull request
Nov 1, 2026
The guard tests that follow extend NVIDIA#8724's test_sequential_mlp_process_groups.py, and the checker classification requires the SequentialMLP experts to read their collection's expert groups instead of the global grid. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
This was referenced Nov 3, 2026
Contributor
Author
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.
Why.
SequentialMLPbuilds each local expertMLPwith onlytp_group=expt_tpand no collection. The expertfc1andfc2then:resolve_gtp_remat_group(None, is_expert=True), which reads the globalexpt_gtp_remat;parallel_state.get_expert_data_parallel_rank().A model on its own grid gets its experts sharded over the global group, or left unsharded when the globals do not exist, and reads the global grid to save them.
TEGroupedMLPalready passes its collection to its grouped linears.What. Pass
SequentialMLP'spg_collectionto each expertMLP, which hands it tofc1andfc2. They takeexpt_gtp_rematas the shard group and stampexpt_dpas the replica group of their GTP shards.Tests. New
tests/unit_tests/transformer/moe/test_sequential_mlp_process_groups.py, with local and TE linears:SequentialMLPfrom a full collection while everyparallel_stateaccessor anduse_mpu_process_groups()raise;sharded_state_dictreads no global group.In the integration run on 4 GPUs,
test_sequential_mlp_process_groups.pygives 2 passed and 2 skipped; main has no such file, so all 4 tests are new. In the integration run, this PR's test files show no regressions against main. The 2 passing tests are the raising-accessor cases; a 4-GPU run against main before the 2026-11-01 sync showed them failing on main and passing here. The two GTP cases skip on the test image because GTP needs Transformer Engine 2.19 or later, so the GTP-sharded expert path has not run on GPU yet. Do you want a run on a Transformer Engine 2.19 image before review?Compatibility.
expt_gtp_rematkeeps the fallback to the globals.build_inference_pg_collectionsetsexpt_gtp_remat=Noneon purpose.SequentialMLPexperts on such a collection now stay unsharded, matchingTEGroupedMLP. On main they took the globalexpt_gtp_remat.SequentialMLP's real collection instead ofNone. One that takes its TP group frompg_collection.tpwould switch the experts from expert TP to dense TP. That can't be checked in this repo.SequentialMLP.sharded_state_dictwithmetadata=Nonestill reads the global DP x CP group. Use the owner's DP x CP group for replica ids in SSM, MoE and TE layers #8732 fixes that and merges cleanly with this change._is_deprecated_accessor. It can switch to Add test helpers to forbid global grid reads and build collections #8017'sforbid_global_process_groupsonce Add test helpers to forbid global grid reads and build collections #8017 lands.determinism-exempt:experts.pyis a registered kernel file, and only process groups change.The branch was synced with main 77391e7 on 2026-11-01 by a merge commit, with no conflicts, so existing commits and review links stay valid.
Part of #6307.
🤖 Generated with Claude Code