forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Segment self mapping fusions #1954
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5d8a099
Segment self mapping fusions
zasdfgbnm e801e93
more test
zasdfgbnm b067a46
Remove unused variables
zasdfgbnm 1b0354d
format
zasdfgbnm 4efee3f
Merge branch 'devel' of github.com:csarofeen/pytorch into segment-sel…
zasdfgbnm eb65c31
Merge branch 'devel' of github.com:csarofeen/pytorch into segment-sel…
zasdfgbnm c7e6855
error message
zasdfgbnm c6c2d0a
fix
zasdfgbnm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @csarofeen
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't get caught?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Random thought: we might want to make sure the disjoint view sets, and something similar for axes involved in permutation match. The issue here seems to be that we're transposing the same partial dimensions. We probably want to make sure throughout the fusion the dimensions active in a transpose are dimensions that are disjoint in the view set.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thinking through the analysis, I don't know if we'd need to build something like a transpose disjoint map, but I think it might be enough if we check all the dimensions active in a transpose are disjoint. I'm wondering if we could somehow get in trouble with a series of transposes that are all individually disjoint in the view map, but could exhibit behavior above where we're effectively transposing "partial" dimensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any thoughts on this @zasdfgbnm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that this is in the wrong direction. For example
torch.zeros(6).view(2, 3).transpose(0, 1)
should be totally fine to schedule, but the transpose dimensions are not disjoint in the view disjoint map.In my opinion, using solely disjoint-set is not sufficient for modeling this problem. That is, we can not just come up with a new fancy disjoint-set of IterDomains such that a fusion is schedulable iif its disjoint-set is really disjoint.
I think we should do the following analysis: For the DAG
we first start from the view operation. What the view operation tells us is:
If we propagate this order and contiguity information, along the DAG, at some point, we will see a conflict. For example, if we propagate T0->T2 and T1->T3->T2, then:
The above 1 and 2 are in conflict, so we reject this fusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we merge this PR, and discuss and fix the skipped test in a follow-up? Currently, transpose is already enabled on TorchScript in TOT devel, and this would prevent the bug from happening on transpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, let's merge this, then please move your comment to an issue and we can discuss further there.