Repository navigation
feat(fsdp): use TE general_gemm for mixed-precision wgrad in FSDP path - #3822
Conversation
|
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. |
|
/ok to test eb769df |
Replace torch.matmul with TE general_gemm in the FSDP gradient accumulation fusion path to support mixed-precision output (e.g. bf16 input -> fp32 main_grad buffer). torch.matmul requires the `out` tensor dtype to match the compute dtype, which forces FSDP to use grad_reduce_in_bf16 when gradient_accumulation_fusion is enabled. TE's general_gemm supports arbitrary out_dtype via cuBLAS, removing this hard dependency. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
eb769df to
f2235d6
Compare
|
/ok to test f2235d6 |
|
/ok to test b28bae0 |
|
Rebasing on main to hopefully get rid of the CodeCov failure. |
|
/ok to test 02a87e2 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/23875974307 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/23876360777 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/23877162308 |
NVIDIA#3822) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Jianbin Chang <shjwudp@gmail.com> Co-authored-by: Cory Ye <44509866+cspades@users.noreply.github.com>
NVIDIA#3822) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Jianbin Chang <shjwudp@gmail.com> Co-authored-by: Cory Ye <44509866+cspades@users.noreply.github.com> Signed-off-by: yhgalaxy <yhgalaxy@outlook.com>
NVIDIA#3822) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Jianbin Chang <shjwudp@gmail.com> Co-authored-by: Cory Ye <44509866+cspades@users.noreply.github.com> Signed-off-by: Jon Barker <jbarker@aws-cmh-slurm-1-vscode-02.cm.cluster>
NVIDIA#3822) Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Co-authored-by: Jianbin Chang <shjwudp@gmail.com> Co-authored-by: Cory Ye <44509866+cspades@users.noreply.github.com>
Summary
torch.matmulwith TEgeneral_gemmin the FSDP gradient accumulation fusion path to support mixed-precision output (e.g. bf16 input → fp32main_gradbuffer)torch.matmulrequires theouttensor dtype to match the compute dtype, which forces FSDP to usegrad_reduce_in_bf16whengradient_accumulation_fusionis enabledgeneral_gemmsupports arbitraryout_dtypevia cuBLAS, removing this hard dependencymegatron.core.extensions.transformer_engineTest plan
fsdp_double_buffer=True,gradient_accumulation_fusion=True, fp32 grad buffer, TP1/PP1/EP4/DP2, 8×H100)🤖 Generated with Claude Code