llvm-project/mlir/lib
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
..
Analysis [mlir][NFC] Add a using directive for llvm::SetVector 2021-04-15 16:09:34 -07:00
Bindings [mlir][python] Add simple debugging and printing helpers 2021-04-16 13:47:46 +00:00
CAPI [mlir][python] Add simple debugging and printing helpers 2021-04-16 13:47:46 +00:00
Conversion [mlir][ArmSVE] Cleanup dialect registration 2021-04-16 15:56:51 +02:00
Dialect [mlir][scf] Add scf.for + tensor.cast canonicalization pattern 2021-04-16 16:50:21 +00:00
EDSC [mlir][IR] Remove the concept of `OperationProperties` 2021-02-09 12:00:15 -08:00
ExecutionEngine [mlir][sparse] support integral types i32,i16,i8 for *numerical* values 2021-04-07 10:01:37 -07:00
IR [MLIR] Fix `isValidIndex` 2021-04-16 14:58:54 +02:00
Interfaces [mlir] add support for index type in vectors. 2021-04-08 08:17:13 +00:00
Parser Expose parseXInDimensionList() to the `DialectAsmParser` 2021-04-14 02:07:34 +00:00
Pass [mlir] Tune error message for assertion. 2021-03-22 18:10:18 -07:00
Reducer Refactor the architecture of mlir-reduce 2021-04-14 13:40:44 -07:00
Rewrite [mlir][Pattern] Add better support for using interfaces/traits to match root operations in rewrite patterns 2021-03-23 14:05:33 -07:00
Support [mlir][StorageUniquer] Properly call the destructor on non-trivially destructible storage instances 2021-03-11 11:35:32 -08:00
TableGen [mlir] Add support for adding attribute+type traits/interfaces to tablegen defs 2021-04-15 11:41:51 -07:00
Target [OpenMP IRBuilder, MLIR] Add support for OpenMP do schedule dynamic 2021-04-16 16:09:49 +01:00
Transforms [mlir][NFC] Add a using directive for llvm::SetVector 2021-04-15 16:09:34 -07:00
Translation [mlir] avoid exposing mutable DialectRegistry from MLIRContext 2021-02-10 12:07:34 +01:00
CMakeLists.txt [mlir][NFC] Move around the code related to PatternRewriting to improve layering 2020-10-26 18:01:06 -07:00