Repository navigation
Conversation
|
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 Nov 3, 2026
Originally NVIDIA#7487. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#6259. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#6293. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#6257. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#6303. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…mmunicator caches on teardown Originally NVIDIA#7029. 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>
Originally NVIDIA#8026. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8723. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8017. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8049. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8039. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…sformer part) Originally NVIDIA#8045, split by code owner into 5 parts: this is the transformer part; the others are training, mcore-optimizer, dist-optimizer, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8022. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8023. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
… converter Originally NVIDIA#8033. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8044. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8722, split by code owner into 6 parts: this is the core part; the others are post-training, transformer, moe, hybrid-model, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…ate (hybrid-model part) Originally NVIDIA#8754, split by code owner into 6 parts: this is the hybrid-model part; the others are transformer, gpt, training, unowned files, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…and MTP fall back to the global pipeline state" Originally part of NVIDIA#8754's tests. They land with the hybrid-model part, which they exercise, instead of with the rest of NVIDIA#8754's tests. 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>
Originally NVIDIA#8722, split by code owner into 6 parts: this is the moe part; the others are core, post-training, transformer, hybrid-model, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8722, split by code owner into 6 parts: this is the hybrid-model part; the others are core, post-training, transformer, moe, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8722, split by code owner into 6 parts: this is the tests part; the others are core, post-training, transformer, moe, hybrid-model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8732. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8073. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
… part) Originally NVIDIA#8748, split by code owner into 7 parts: this is the moe part; the others are core, post-training, transformer, multi-modal, hybrid-model, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…rid-model part) Originally NVIDIA#8748, split by code owner into 7 parts: this is the hybrid-model part; the others are core, post-training, transformer, multi-modal, moe, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…ts part) Originally NVIDIA#8748, split by code owner into 7 parts: this is the tests part; the others are core, post-training, transformer, multi-modal, moe, hybrid-model. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…raphs part) Originally NVIDIA#8755, split by code owner into 9 parts: this is the cuda-graphs part; the others are batch-invariant+moe, moe, core, gpt, hybrid-model, multi-modal, data-parallelism, tests. 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>
…groups Originally NVIDIA#8042. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…e-optimizer part) Originally NVIDIA#8045, split by code owner into 5 parts: this is the mcore-optimizer part; the others are transformer, training, dist-optimizer, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…-optimizer part) Originally NVIDIA#8045, split by code owner into 5 parts: this is the dist-optimizer part; the others are transformer, training, mcore-optimizer, tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…s part) Originally NVIDIA#8045, split by code owner into 5 parts: this is the tests part; the others are transformer, training, mcore-optimizer, dist-optimizer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
Originally NVIDIA#8731. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…d (core part) Originally NVIDIA#8734, split by code owner into 9 parts: this is the core part; the others are gtp, mcore-optimizer, dist-optimizer, mcore-emerging-optimizers, tests, data-parallelism, training, moe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…d (gtp part) Originally NVIDIA#8734, split by code owner into 9 parts: this is the gtp part; the others are core, mcore-optimizer, dist-optimizer, mcore-emerging-optimizers, tests, data-parallelism, training, moe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yan Xu <yxu1@nvidia.com>
…allbacks to WORLD or the global grid" Originally part of NVIDIA#8734's tests. They land with the core part, which they exercise, instead of with the rest of NVIDIA#8734's tests. 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>
Connor-XY
force-pushed
the
yx/pstate-unit-U6
branch
from
November 4, 2026 18:40
69813b5 to
41edc4b
Compare
This was referenced Nov 4, 2026
This branch has not been deployed
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.
This PR moves the optimizer's duplicate filters and expert naming off the global parallel state, and makes the tensor-parallel and GTP helpers warn when they still fall back to it. It's part of the
parallel_statedeprecation (#6307). Gradient-norm and zero-count filtering now treat a TP or GTP group that the model's collection sets toNoneas an axis that's off, instead of reading the global rank, so a model on its own grid gets the same norm as on the standard grid. The distributed optimizer, the param-group dump and the MFSDP v2 optimizer name experts by the model's expert-parallel layout. The duplicate filters,model_parallel_cuda_manual_seed,resolve_gtp_remat_group,gtp_replica_rankand the DDP and optimizer group setup helpers emit aProcessGroupFallbackWarningwhen a caller leaves out a group. Callers that build optimizers, DDP or linears, or seed the RNG, without aProcessGroupCollectionare affected, as are maintainers of the optimizer, distributed optimizer and GTP code. It carries #8042, three parts of #8045, #8731, and the core and GTP parts of #8734. Each commit is one original change, so please review commit by commit. A final commit regeneratestools/process_group_usage_allowlist.json. It builds on #8890 (#8049'sresolve_process_groupsandwarn_global_process_group_fallback, which the new warnings use) and #8892 (#8045'sget_ep_rank_and_sizeandget_model_ep_rank_and_size, which the optimizers call). It lands after #8891, which passes stock training's collection to DDP and the optimizer, #8895, which seeds the RNG from it, and #8898, which passes it to the optimizer with Gloo groups on, so stock runs reach none of the new warnings.Review
This PR's own commits: Connor-XY/Megatron-LM@25ecaf8...41edc4b
The full PR diff also shows the earlier PRs of the stack until they merge.
Commits
set_duplicate_filter_groups(optimizer, pg_collection)inoptimizer/optimizer.pysets the TP, expert-TP and GTP groups for the grad-norm and zero-count filters, and replaces the group assignments in_get_megatron_optimizer_based_on_param_groups,_get_megatron_emerging_optimizerandLayerWiseDistributedOptimizer.param_is_not_tensor_parallel_duplicate,param_is_not_gtp_duplicateandcount_zeros_fp32take a keyword-onlyuse_global_fallback; optimizers set up from a collection passFalse, so aNonegroup means the axis is off instead of "read the global rank". This fixes an under-counted gradient norm, and so too-weak clipping, when the model's collection turns TP or GTP off next to a global grid that has them on. New cases intest_grad_norm_gtp_invariance.pycover axes off in the collection, the collection's expert TP and a collection withouttp.get_megatron_optimizerreads the EP rank and size from itspg_collectionwithget_ep_rank_and_sizeand passes them toget_global_unique_param_namewhen it dumps the param-to-param-group map. The other parts land in Use modules' own process groups in BERT, GPT, MLA, attention and checkpoints #8892 (the FSDP-DTensor helpers), Save and load checkpoints on the model's process groups #8981 (training) and in this PR (dist-optimizer, tests).DistributedOptimizernames its parameters with the EP rank and size of its first model chunk (get_model_ep_rank_and_size) when the model has experts, and passes them tohandle_experts_in_state_dict. The other parts land in Use modules' own process groups in BERT, GPT, MLA, attention and checkpoints #8892, Save and load checkpoints on the model's process groups #8981 and in this PR (mcore-optimizer, tests).test_fsdp_dtensor_expert_offsets.py,test_distrib_optimizer_param_name.pyandtest_param_group_map_expert_names.py, which check expert offsets from integers, collections and wrapped models, and that the distributed optimizer and the param-group dump follow a custom expert layout. The other parts land in Use modules' own process groups in BERT, GPT, MLA, attention and checkpoints #8892, Save and load checkpoints on the model's process groups #8981 and in this PR (mcore-optimizer, dist-optimizer).FullyShardedOptimizerpasses the EP rank and size from the model's collection, found byget_model_ep_rank_and_size, when the model has experts. Dense models skip the lookup. Tests intest_fully_sharded_optimizer_param_name.pyand the MFSDP v2 MoE test.model_parallel_cuda_manual_seed,setup_process_groups_for_optimizerandsetup_process_groups_for_ddpwarn before they read the global grid. The TP filter and the seed read group ranks throughresolve_process_groups, and the GTP filter and the seed resolve GTP groups withresolve_gtp_remat_group, instead of theparallel_staterank getters.resolve_gtp_remat_groupgains a keyword-onlyownerand warns when it falls back to a global GTP group of more than one rank; the TE, inference and tensor-parallel linears andVocabParallelEmbeddingpass their class name. Theintra_dist_opterror message now says what the group is for. The other parts land in Warn on optimizer process-group fallbacks and pass groups to the config logger #8903 (optimizer grad-stats warnings and their tests), Warn on finalize_model_grads, DSGQA and FSDP fallbacks to global groups #8905 (data-parallelism), Deprecate the parallel_state grid accessors and quiet training's fallback reads #8907 (training) and Enforce the process-group checks and warn on the last core grid reads #8909 (MoE), plus the GTP part here.gtp_replica_rankresolves its global fallback throughresolve_process_groups(dp_cp, orexpt_dpfor routed experts), which warns, and raisesRuntimeErrorwhen no such group exists. The other parts land as listed above.test_grad_norm_gtp_invariance.pystops patching the rank getters thattensor_parallel.layersno longer imports. They land here with the core part, which they exercise.Behavior changes for callers
tp(Nonewhen TP is off). Otherwiseset_duplicate_filter_groupsraisesValueError; before, an unsettpread asNoneand the filters used the global TP rank.tp,expt_tp,gtp_rematorexpt_gtp_rematset toNonenow means the axis is off for the duplicate filters, not "use the global group". An unsetexpt_tpdefaults totp.gtp_rematorexpt_gtp_rematresolves throughresolve_gtp_remat_group, as the model's layers resolve it, instead ofgetattr(..., "gtp_remat", None). When the field is unset, these two can return different groups.DistributedDataParallelwithoutpg_collection,setup_process_groups_for_optimizerwithout one, and direct calls without groups to the duplicate filters,model_parallel_cuda_manual_seedorgtp_replica_rankwarn once per owner and argument, and raise under anerrorfilter.resolve_gtp_remat_groupwarns only when the global GTP group has more than one rank.model_parallel_cuda_manual_seedwithout a collection now warn once per process. They are not converted here.set_tensor_model_parallel_rankor the expert rank setters no longer replaces the group rank there.determinism-exempt: the registered kernel files change only by warnings, group plumbing andowner=keywords.Teams
core-adlr, core-nemo, dist-optimizer, gtp, mcore-optimizer
Testing
I ran the 7 unit-test files that cover this change at this PR's commit on one 4-GPU GB300 node. I compared each failure with the same test at the end of the stack (#8989, same code) and at the commit the stack starts from.
Test files
tests/unit_tests/distributed/mfsdp_v2/test_mcore_moe.pytests/unit_tests/optimizer/test_distrib_optimizer_param_name.pytests/unit_tests/optimizer/test_fully_sharded_optimizer_param_name.pytests/unit_tests/optimizer/test_grad_norm_gtp_invariance.pytests/unit_tests/optimizer/test_param_group_map_expert_names.pytests/unit_tests/test_process_groups_config.pytests/unit_tests/transformer/test_fsdp_dtensor_expert_offsets.py🤖 Generated with Claude Code