[JAX] Fix GEMM partitioning to reduce over nested contracting mesh axes - #3429
Conversation
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
Greptile SummaryThe PR updates JAX GEMM partition inference to reduce across every mesh axis shared by both operands’ contracting dimensions while gathering non-shared axes. It also adds CPU-based partitioning tests for Megatron TP, sequence-parallel TP, and compatibility cases. Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
L[LHS contracting axes] --> I[Shared-axis intersection]
R[RHS contracting axes] --> I
I --> REDUCE[Reduction specification]
L --> FILTER[Retain shared axes]
R --> FILTER
FILTER --> GEMM[Partitioned GEMM]
GEMM --> REDUCE
Reviews (3): Last reviewed commit: "Merge branch 'main' into jax/fix_gemm_pa..." | Re-trigger Greptile |
Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
|
Tested this PR on DeepSeek-V3 with 32 H100 GPUs using TP8, DP4, EP16, FSDP2, and ETP1. The previous global WGrad buffer/all-gather disappeared, HLO now shows WGrad reduce-scatter over the tensor axis, and the training loss decreases normally. This fixes the issue I observed, thanks. |
xiaopoc
left a comment
There was a problem hiding this comment.
Looks good to me. Verified in the test described in my comment above.
jberchtold-nvidia
left a comment
There was a problem hiding this comment.
Overall looks good, thanks! Left a couple small comments and a question
…ding cases Signed-off-by: Phuong Nguyen <phuonguyen@nvidia.com>
|
/te-ci L1 JAX |
jberchtold-nvidia
left a comment
There was a problem hiding this comment.
LGTM, thanks!
Description
Please include a brief summary of the changes, relevant motivation and context.
Fixes # (issue)
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: