[mlir][TilingInterface] Enable tile and fuse using TilingInterface.
authorMahesh Ravishankar <ravishankarm@google.com>
Tue, 21 Jun 2022 16:59:26 +0000 (16:59 +0000)
committerMahesh Ravishankar <ravishankarm@google.com>
Tue, 21 Jun 2022 17:22:58 +0000 (17:22 +0000)
commit2f637fe730a7b65f4584ae636c50197ebaf5a4a7
tree63d4165cf1715b754af8b8e5f2cf42726c65eb37
parentd4ee43153d37779f29d14c38a454467506942b05
[mlir][TilingInterface] Enable tile and fuse using TilingInterface.

This patch implements tile and fuse transformation for ops that
implement the tiling interface. To do so,
- `TilingInterface` needs a new method that generates a tiled
  implementation of the operation based on the tile of the result
  needed.
- A pattern is added that replaces a `tensor.extract_slice` whose
  source is defined by an operation that implements the
  `TilingInterface` with a tiled implementation that produces the
  extracted slice in-place (using the method added to
  `TilingInterface`).
- A pattern is added that takes a sequence of operations that
  implement the `TilingInterface` (for now `LinalgOp`s), tiles the
  consumer, and greedily fuses its producers iteratively.

Differential Revision: https://reviews.llvm.org/D127809
12 files changed:
mlir/include/mlir/Dialect/SCF/Transforms/TileUsingInterface.h
mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
mlir/include/mlir/Interfaces/TilingInterface.td
mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
mlir/lib/Dialect/SCF/Transforms/CMakeLists.txt
mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
mlir/lib/Dialect/Tensor/Transforms/CMakeLists.txt
mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducer.cpp [new file with mode: 0644]
mlir/test/Interfaces/TilingInterface/tile-and-fuse-using-interface.mlir [new file with mode: 0644]
mlir/test/Interfaces/TilingInterface/tile-using-interface.mlir
mlir/test/lib/Interfaces/TilingInterface/TestTilingInterface.cpp
utils/bazel/llvm-project-overlay/mlir/BUILD.bazel