Bugfix spec check for DP+FSDP configurations - #3272
Open
dinodeep wants to merge 2 commits into
Open
Conversation
Contributor
Greptile SummaryThis PR extends collective GEMM sharding handling and distributed coverage.
Confidence Score: 3/5The PR is not yet safe to merge because partially overlapping tuple-valued operand specs can still produce an invalid output PartitionSpec. The revised checks recognize exact tuple equality but do not detect a mesh axis shared by different tuples, so both specs can survive and assign that axis to multiple output dimensions. Files Needing Attention: transformer_engine/jax/cpp_extensions/gemm.py Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Operand PartitionSpecs] --> B[Extract non-contracting specs]
B --> C[Flatten opposite operand axes]
C --> D[Filter overlapping specs]
D --> E[Concatenate output PartitionSpec]
Reviews (2): Last reviewed commit: "Add in check for if spec is a tuple" | Re-trigger Greptile |
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.
Description
Please include a brief summary of the changes, relevant motivation and context.
In the collective GEMM code, there is a small bug where the code misses the general case that
(lhs|rhs)_non_cspecscan have elements that are tuples when a dimension in sharded on multiple resource axes (e.g.(data, fsdp)on the batch dimension).This leads to an incorrect check which results in a sharding in which a tensor is sharded on the same device axis twice.
The change in this PR resolves that problem by flattening the tuple so that dimensions that are sharded on multiple device mesh axes are considered correctly.
Type of change
Changes
Please list the changes introduced in this PR:
Checklist: