[mlir][TilingInterface] Enable tile and fuse using TilingInterface.
authorMahesh Ravishankar <ravishankarm@google.com>
Mon, 13 Jun 2022 23:24:31 +0000 (23:24 +0000)
committerMahesh Ravishankar <ravishankarm@google.com>
Tue, 21 Jun 2022 16:47:14 +0000 (16:47 +0000)
commitea75511319d9dff8c38c8794c3949c40b63a38d7
tree0f917346fd9ed51aaee35e4a7a7fc1fae990b4c6
parentaaf1630ac38c890f1476fe9ee002f5fe2f5cc188
[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
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/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