[feat] Generalized Tensor Parallelism (GTP) - #4967
Conversation
Co-authored-by: Jieming Zhang <jiemingz@nvidia.com> Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
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. |
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
/claude review |
|
/ok to test 34d420c |
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
/ok to test 9870010 |
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
/ok to test 10fa249 |
mkhona-nvidia
left a comment
There was a problem hiding this comment.
Please leave TODOs in the 2 places where a comment has been added
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
/ok to test dea1206 |
|
/ok to test 269949e |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30157876620 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30159727680 |
Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
Buckets were split by the layout's num_optimizer_shards (full DP world) while the collective runs over the intra-instance data_parallel_group, leaving half the params with no owning rank. Take the count from the group again. Signed-off-by: Shiqing Fan <shiqingf@nvidia.com>
|
/ok to test 19f8482 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/30171324705 |
What does this PR do ?
Generalized Tensor Parallelism (GTP) is a light-weight, high-performance and memory-efficient distributed training strategy implemented in Megatron-LM and TransformerEngine. It shards weight tensors across an GTP process group and reconstructs them on-demand via async all-gather, enabling training of larger models without sacrificing throughput by overlapping communication with computation.
GTP_README.md
Outline:
Features
1.1 Fine-grained, per-weight materialization & gradient reduction
1.2 CUDA graph compatibility
1.3 Low-precision gather (native FP8 / NVFP4 param)
1.4 Composability with TP / SP / EP / DDP
1.5 Opt-in, minimally invasive integration
1.6 Optimizer-agnostic (Adam + Muon)
1.7 Scaling
1.8 Native distributed checkpointing (DCP)
Usage
2.1 Required flags
2.2 High-priority streams (Blackwell and later)
2.3 Minimal end-to-end example
2.4 Tuning knobs
Implementation details
3.1 GTP_remat architecture (Mcore ↔ TE integration)
Class hierarchy: which linears shard
3.2 DDP buckets with (E)GTP_remat
3.3 Distributed checkpointing (DCP)
3.4 Prefetch-chain construction and its design assumptions
Testing
TE related MR: TE-3005 (Merged)
GTP's Architecture (Mcore + TE)
• TE ships self-contained: Protocol + dispatcher no-op.
• GTP lives 100% in Mcore as one protocol implementer.
Changes Summary
Convergence Test (07/25)
Config: 1/4 of NT3 Ultra,27Layers512Experts, 32xGB200, GTP16_EP8EGTP2_m1g32_mxfp8_CG, Adam Optimizer, forceBalance, vs. 3D parallel baseline with parallelism=TP8_EP16DP2_m1g32, ~10k steps, dataset=blend_files/1T-phase1var-moresft.json
GTP matches well with the 3d baseline in
lm losscurve:Issue tracking
For PRs from open-source community contributors:
Linked issue:
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.