-
Notifications
You must be signed in to change notification settings - Fork 14.1k
[mlir][linalg] Add pattern to bubble-up pack through expand shape op #93529
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
Merged
adam-smnk
merged 12 commits into
llvm:main
from
adam-smnk:bubble-up-pack-through-expand
Jun 18, 2024
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f9f1f9b
[mlir][linalg] Add pattern to bubble-up pack through expand shape op
adam-smnk 7f7931a
Add TODOs
adam-smnk 6a7bd09
Merge branch 'main' into bubble-up-pack-through-expand
adam-smnk 4a020ce
Merge branch 'main' into bubble-up-pack-through-expand
adam-smnk 85cc0c6
Improve test readability
adam-smnk a9c462a
Merge branch 'main' into bubble-up-pack-through-expand
adam-smnk c5f2dfb
NYI message
adam-smnk 8fa8325
Update mlir/lib/Dialect/Linalg/Transforms/DataLayoutPropagation.cpp
adam-smnk fbb0749
Merge branch 'main' into bubble-up-pack-through-expand
adam-smnk 6484bdf
Address comment
adam-smnk cc608de
Merge branch 'main' into bubble-up-pack-through-expand
adam-smnk 752e75a
Improve docs + extra test
adam-smnk 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 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
Oops, something went wrong.
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.
Something in this new code is triggering a crash (compiler assert) in the downstream IREE project: iree-org/iree#17734. If I revert this PR locally, the crash goes away.
I don't have a reduced test case yet and the input program is large (12MB) + specific to our downstream project.
Assert + stack trace:
Here's a bit of printf debugging:
Here's the IR before we call into this code and crash (13000 lines, can try reducing): https://gist.github.com/ScottTodd/d5f9721307e78cada067a81e60a471c0
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.
Interesting, looking at the stack dump it's calling
bubbleUpPackOpThroughCollapseShape
which is unrelated and should be untouched by this PR.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.
There could be few issues. The propagation through expand_shape op changes the graph and trigger the failure. The issue could be either in expand_shape patterns or collapse_shape patterns.
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.
First guess is that this PR bubbles pack through
expand_shape
ops that acted as a barrier before and now it allows more bubbling to occur.So, it either bubbled pack through some expand that it shouldn't have or exposed an edge case in the
collapse_shape
part of code.Uh oh!
There was an error while loading. Please reload this page.
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 got same issue for mit-b0 and 3 more models. The issue could be fixed by revert this commit. Here is the stacktrace
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.
@adam-smnk I encountered the same bug on my end.
The root cause for the bug is that
outerDimsPerm
is an optional attribute that could be empty. However, when callingapplyPermutationAndReindexReassoc
, it assumesouterDimsPerm
to be non-empty. One possible solution is to fillouterDimsPerm
with default values ([0, 1, 2, ...]
).