Compute matmul dim roles with no-devices leaf domain#2300
Merged
jacobhinkle merged 1 commit intomainfrom May 27, 2024
Merged
Conversation
This fixes a bug introduced by #2272 in `test_multidevice` where we reject a matmul segment shaped like `[iDIDxMo, iMi, bN, iK]` for having too many M dimensions. Locally this still has a single M dimension so it is valid. This PR ignores device dims for the purposes of computing tensor roles and problem shape. Further issues we should look into: 1. As mentioned in #2272 we should proceed to handle multiple M, N, K, and Batch dimensions, although in this case the restriction was useful for surfacing this bug. 2. Even if the matmul scheduler is completely broken or disabled, the _reduction_ scheduler should have been able to schedule this fusion. However, it identified the reduction tensor as `isResharding` and removed it from the `reduction_tvs` list, causing a failure in `scheduleReduction`. We should clean up that check to be able to schedule this type of fusion as a reduction. 3. The rfactor domain is often used for scheduling utilities to inspect the logical size of tensors. However, because multidevice scheduling modifies the leaf domain before segmentation, we should probably audit our schedulers to ensure they use the leaf domain and ignore device dims where necessary. 4. I should also not forget to rerun `!build` before merging PRs :-).
Collaborator
Author
|
!build --diff |
samnordmann
approved these changes
May 26, 2024
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 fixes a bug introduced by #2272 in
test_multidevicewhere we reject a matmul segment shaped like[iDIDxMo, iMi, bN, iK]for having too many M dimensions. Locally this still has a single M dimension so it is valid. This PR ignores device dims for the purposes of computing tensor roles and problem shape.Further issues we should look into:
isReshardingand removed it from thereduction_tvslist, causing a failure inscheduleReduction. We should clean up that check to be able to schedule this type of fusion as a reduction.canonicalizeMmaTvOrderingwhich I believe still uses rfactor domain to determine domain ordering. Instead this should be updated to use dim roles that are already computed from theMatmulPattern.!buildbefore merging PRs 😅