-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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
[mlir] Bug in MemrefToLLVM lowering pattern for memref.transpose #65145
Labels
Comments
Phabricator: https://reviews.llvm.org/D159290 |
It would also make sense to update the affine map representation to a list of integers if you are up for it. Thanks for fixing! |
Good idea! I will have a look and try to apply the integer notation to memref.transpose |
kstoimenov
pushed a commit
to kstoimenov/llvm-project
that referenced
this issue
Sep 14, 2023
The lowering pattern to LLVM for memref.transpose has a bug where instead of transposing from (source) -> (dest) it actually transposes (dest) -> (source). This patch fixes the bug and updates the test. Fix llvm#65145 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D159290
ZijunZhaoCCK
pushed a commit
to ZijunZhaoCCK/llvm-project
that referenced
this issue
Sep 19, 2023
The lowering pattern to LLVM for memref.transpose has a bug where instead of transposing from (source) -> (dest) it actually transposes (dest) -> (source). This patch fixes the bug and updates the test. Fix llvm#65145 Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D159290
ubfx
added a commit
to ubfx/llvm-project
that referenced
this issue
Sep 30, 2023
…ef.transpose Until now, the dimensional permutation for memref.transpose was given in the form of an affine map. However, just from looking at such a representation, e.g. `(i, j) -> (j, i)`, it's not obvious whether it represents a mapping from the result dimensions to the source dimensions or the other way around. This has led to a bug (llvm#65145). This patch introduces to `memref.transpose` the integer array based notation that is also used in Ops like `linalg.transpose`, `memref.collapse_shape` and others which is harder to misinterpret and easier to work with.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Permutation maps can sometimes be confusing because it's easy to mix up the source and the target dimensions. I think this is what happened with the lowering Pattern for memref.transpose:
https://github.com/llvm/llvm-project/blob/main/mlir/lib/Conversion/MemRefToLLVM/MemRefToLLVM.cpp#L1562
For the testcase to demonstrate the problem I will use the textual representation of verified Ops where it is clear what the shape and strides should be as the reference:
test.mlir:
test.cpp:
We can see that instead of doing the (i,j,k)->(k,i,j) transposition, the lowering pass actually did it the other way around, i.e. (k,i,j)->(i,j,k).
The text was updated successfully, but these errors were encountered: