[mlir][Linalg] Break unnecessary dependency through unused `outs` tensor.
authorMaheshRavishankar <ravishankarm@google.com>
Wed, 19 May 2021 05:08:12 +0000 (22:08 -0700)
committerMaheshRavishankar <ravishankarm@google.com>
Wed, 19 May 2021 05:31:42 +0000 (22:31 -0700)
commite2b365948b363636624d5c8cf631f075b19351aa
tree369c3144f56d58fcd51062833507cdb1a4eb227e
parent0c509dbc7e29cbd03f161513b8d335f768c7cc2b
[mlir][Linalg] Break unnecessary dependency through unused `outs` tensor.

LinalgOps that are all parallel do not use the value of `outs`
tensor. The semantics is that the `outs` tensor is fully
overwritten. Using anything other than `init_tensor` can add false
dependencies between operations, when the use is just for the shape of
the tensor. Adding a canonicalization to always use `init_tensor` in
such cases, breaks this dependence.

Differential Revision: https://reviews.llvm.org/D102561
mlir/lib/Dialect/Linalg/Transforms/FusionOnTensors.cpp
mlir/test/Dialect/Linalg/fusion-tensor.mlir
mlir/test/Dialect/Linalg/reshape_fusion.mlir