[MLIR] Fix tiling for `tensor.unpack` with outer permutations
authorLorenzo Chelini <l.chelini@icloud.com>
Fri, 13 Jan 2023 16:32:34 +0000 (17:32 +0100)
committerLorenzo Chelini <l.chelini@icloud.com>
Mon, 16 Jan 2023 07:42:18 +0000 (08:42 +0100)
commitd5a9fc13ef82f7f6c1a350bceef79f7988cdac20
tree4ae0a5301ca7b41090ecb429e5a45a7a165bcca1
parent08d6cf232c0e4ca8ebafc3e2b9eb488f014f5b41
[MLIR] Fix tiling for `tensor.unpack` with outer permutations

An outer dim permutation requires adjusting the offsets and sizes of the
`tensor.extract_slice` operations generated during tiling. Originally
this was done by computing an inverse permutation of the outer
permutation for both `tensor.pack` and `tensor.unpack`. For packing, the
tiling is applied on interchanged dimensions; thus, it is correct to
compute the inverse. For unpacking, on the other hand, tiling involves
the output tensor that does not have interchanged dimensions, and no
inverse is required.

Reviewed By: hanchung

Differential Revision: https://reviews.llvm.org/D141688
mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
mlir/test/Dialect/Tensor/tiling.mlir