[PATCH] D72040: [mlir][Linalg] Add a linalg.reshape op
Nicolas Vasilache via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 31 13:55:29 PST 2019
nicolasvasilache created this revision.
nicolasvasilache added reviewers: mehdi_amini, rriddle, jpienaar, antiagainst, ftynse.
nicolasvasilache added a project: LLVM.
This diff adds support for `linalg.reshape` which takes a view and collapses
its dimensions according to a reassociation list of maps to return a new view.
This is a pure metadata operation which does not allocate or copy.
In the general case, such a reshape may require allocating and moving data, these
cases are currently undefined behavior.
This is captured by the op documentation:
For now, it is assumed that all reassociation occur on contiguous
dimensions or that the reshape op will be folded into its consumers.
All other cases are undefined behavior and a reshape op may not lower to LLVM
if it cannot be proven statically that it does not require alloc+copy.
Relevant invalid and roundtrip test are added.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D72040
Files:
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/include/mlir/IR/Builders.h
mlir/include/mlir/IR/StandardTypes.h
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/lib/IR/Builders.cpp
mlir/test/Dialect/Linalg/invalid.mlir
mlir/test/Dialect/Linalg/roundtrip.mlir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D72040.235729.patch
Type: text/x-patch
Size: 13585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191231/b2fcdfb7/attachment.bin>
More information about the llvm-commits
mailing list