[all-commits] [llvm/llvm-project] 809e3d: [mlir][TilingInterface] Modify `TilingInterface` m...

MaheshRavishankar via All-commits all-commits at lists.llvm.org
Thu Mar 16 07:29:22 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 809e3d8c98a80fc61c8bdbb3745d1d50a3f1d365
      https://github.com/llvm/llvm-project/commit/809e3d8c98a80fc61c8bdbb3745d1d50a3f1d365
  Author: Mahesh Ravishankar <ravishankarm at google.com>
  Date:   2023-03-16 (Thu, 16 Mar 2023)

  Changed paths:
    M mlir/include/mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h
    M mlir/include/mlir/Dialect/Tensor/Transforms/Transforms.h
    M mlir/include/mlir/Interfaces/TilingInterface.h
    M mlir/include/mlir/Interfaces/TilingInterface.td
    M mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Split.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Tiling.cpp
    M mlir/lib/Dialect/Linalg/Transforms/TilingInterfaceImpl.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp
    M mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp
    M mlir/lib/Dialect/Tensor/IR/TensorTilingInterfaceImpl.cpp
    M mlir/lib/Dialect/Tensor/Transforms/SwapExtractSliceWithProducerPatterns.cpp

  Log Message:
  -----------
  [mlir][TilingInterface] Modify `TilingInterface` methods to better return the state of the transformed IR.

Currently the `getTiledImplementation` and `generateResultTileValue`
return just `SmallVector<Operation *>` and `FailureOr<Value>`.

- For `getTiledImplementation` returning empty implies tiling wasnt
  done. There is also an implicit assumption that the tiled operation
  results correspond to the tiled values of the result of the original
  operation. This cannot handle cases where the tiled implementation
  might use multiple operations to compute the tiled value for the
  results of the untiled operation. Sometimes, the tiled operation
  might not directly give the tiled values, and might require casts,
  etc to get a replacement.
- For `generateResultTileValue`, it is assumed that the op defining
  the returned `Value` is the operation that represents the tiled
  computation. Again presence of casts, etc violate this.

Instead make these methods return
```
struct TilingResult {
  SmallVector<Operation *> tiledOps;
  SmallVector<Value> tiledValues;
};
```

The `tiledOps` represent the operations generated that are relevant
for subsequent transformations. The `tiledValues` represent the tiled
values for the results of the original operation. This better
transmits the state of the transformed IR.

As a consequence the following methods also return `FailureOr<TilingResult>`
- `tensor::replaceExtractSliceWithTiledProducer`
- `tensor::bubbleUpPadSlice`

Differential Revision: https://reviews.llvm.org/D145133




More information about the All-commits mailing list