[mlir][Linalg] Add utility method to reshape ops to express output shape in terms...
authorMaheshRavishankar <ravishankarm@google.com>
Tue, 16 Feb 2021 21:15:55 +0000 (13:15 -0800)
committerMaheshRavishankar <ravishankarm@google.com>
Tue, 16 Feb 2021 21:42:08 +0000 (13:42 -0800)
commit81264dfbe80df08668a325a61613b64243b99c01
treec0f09d209bd1f9822a57182bb0e88aa20f22ba31
parent6ffcb2937c96bd0d7a55b984b5eb8f381b68e322
[mlir][Linalg] Add utility method to reshape ops to express output shape in terms of input shape.

Resolving the dim of outputs of a tensor_reshape op in terms of its
input shape allows the op to be eliminated when its used only in its
dims. The init_tensor -> tensor_reshape canonicalization can be
simplified to use the dims of the output of the tensor_reshape which
gets canonicalized away later making the tensor_reshape dead.

Differential Revision: https://reviews.llvm.org/D96635
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.h
mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
mlir/test/Dialect/Linalg/canonicalize.mlir