[mlir][MemRef] Allow transposed layouts in ExpandShapeOp.
authorNicolas Vasilache <ntv@google.com>
Wed, 6 Apr 2022 07:57:03 +0000 (03:57 -0400)
committerNicolas Vasilache <ntv@google.com>
Wed, 6 Apr 2022 08:19:30 +0000 (04:19 -0400)
commitfc8f465a0008826cb7431eb5684861477998662c
tree21f16dd5207e38c94deb54758cde21c0ae5d814f
parent9e97b2a477f3b9bdd1ef7954ce22e15d15fb54d8
[mlir][MemRef] Allow transposed layouts in ExpandShapeOp.

https://reviews.llvm.org/D122641 introduced fixes to the ExpandShapeOp verifier
but also introduced an artificial layout limitation that prevents the consideration of transposed layouts.

This revision fixes the omissions and reimplements the logic using saturated arithmetic which is more
idiomatic and avoids leaking internal implementation details.

Tests cases are added for transposed layouts.

Reviewed By: springerm

Differential Revision: https://reviews.llvm.org/D122845
mlir/lib/Dialect/MemRef/IR/MemRefOps.cpp
mlir/test/Dialect/MemRef/invalid.mlir
mlir/test/Dialect/MemRef/ops.mlir
mlir/test/Dialect/Tensor/bufferize.mlir