llvm-project/mlir
Nicolas Vasilache 843f1fc825 [mlir][scf] Add scf.for + tensor.cast canonicalization pattern
Fold scf.for iter_arg/result pairs that go through incoming/ougoing
a tensor.cast op pair so as to pull the tensor.cast inside the scf.for:

```
  %0 = tensor.cast %t0 : tensor<32x1024xf32> to tensor<?x?xf32>
  %1 = scf.for %i = %c0 to %c1024 step %c32 iter_args(%iter_t0 = %0)
     -> (tensor<?x?xf32>) {
    %2 = call @do(%iter_t0) : (tensor<?x?xf32>) -> tensor<?x?xf32>
    scf.yield %2 : tensor<?x?xf32>
  }
  %2 = tensor.cast %1 : tensor<?x?xf32> to tensor<32x1024xf32>
  use_of(%2)
```

folds into:

```
  %0 = scf.for %arg2 = %c0 to %c1024 step %c32 iter_args(%arg3 = %arg0)
      -> (tensor<32x1024xf32>) {
    %2 = tensor.cast %arg3 : tensor<32x1024xf32> to tensor<?x?xf32>
    %3 = call @do(%2) : (tensor<?x?xf32>) -> tensor<?x?xf32>
    %4 = tensor.cast %3 : tensor<?x?xf32> to tensor<32x1024xf32>
    scf.yield %4 : tensor<32x1024xf32>
  }
  use_of(%0)
```

Differential Revision: https://reviews.llvm.org/D100661
2021-04-16 16:50:21 +00:00
..
cmake/modules Change add_mlir_doc CMake macro to take the tablegen command as last argument to allow extra flags 2021-04-15 02:59:40 +00:00
docs [mlir] add support for index type in vectors. 2021-04-08 08:17:13 +00:00
examples Change add_mlir_doc CMake macro to take the tablegen command as last argument to allow extra flags 2021-04-15 02:59:40 +00:00
include [mlir][vector] Move transferOp on tensor opt to folder/canonicalization 2021-04-16 08:13:10 -07:00
lib [mlir][scf] Add scf.for + tensor.cast canonicalization pattern 2021-04-16 16:50:21 +00:00
test [mlir][scf] Add scf.for + tensor.cast canonicalization pattern 2021-04-16 16:50:21 +00:00
tools [mlir][NFC] Add a using directive for llvm::SetVector 2021-04-15 16:09:34 -07:00
unittests [MLIR] Support symbols in emptiness checks for FlatAffineConstraints 2021-04-08 21:38:47 +05:30
utils [mlir] Add simple jupyter kernel 2021-02-21 18:16:06 -08:00
.clang-format
.clang-tidy
CMakeLists.txt [CMake] Require python 3.6 if enabling LLVM test targets 2021-03-15 09:50:39 -07:00
LICENSE.TXT
README.md

README.md

Multi-Level Intermediate Representation

See https://mlir.llvm.org/ for more information.