[all-commits] [llvm/llvm-project] ea1e33: [mlir][Linalg] Introduce folding patterns to remov...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Wed Jan 29 06:52:56 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ea1e3369f7a8aa9729f8e2fc208b8f6a79392874
      https://github.com/llvm/llvm-project/commit/ea1e3369f7a8aa9729f8e2fc208b8f6a79392874
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-01-29 (Wed, 29 Jan 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgOps.td
    M mlir/include/mlir/Dialect/Linalg/IR/LinalgStructuredOps.td
    M mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
    A mlir/test/Dialect/Linalg/canonicalize.mlir

  Log Message:
  -----------
  [mlir][Linalg] Introduce folding patterns to remove certain MemRefCastOp

Summary:
Canonicalization and folding patterns in StandardOps may interfere with the needs
of Linalg. This revision introduces specific foldings for dynamic memrefs that can
be proven to be static.

Very concretely:

Determines whether it is possible to fold it away in the parent Linalg op:

```mlir
  %1 = memref_cast %0 : memref<8x16xf32> to memref<?x?xf32>
  %2 = linalg.slice %1 ... : memref<?x?xf32> ...
  // or
  %1 = memref_cast %0 : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
         to memref<?x?xf32>
  linalg.generic(%1 ...) : memref<?x?xf32> ...
```

into

```mlir
  %2 = linalg.slice %0 ... : memref<8x16xf32> ...
  // or
  linalg.generic(%0 ... : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
```

Reviewers: ftynse, aartbik, jsetoain, tetuante, asaadaldien

Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits

Tags: #llvm

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




More information about the All-commits mailing list