[all-commits] [llvm/llvm-project] ed7c1f: [mlir][linalg] Add backward slice filtering in hoi...

Tobias Gysi via All-commits all-commits at lists.llvm.org
Thu Nov 25 02:30:41 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ed7c1fb9b099193f0edafb58df2b2a91f561d6c2
      https://github.com/llvm/llvm-project/commit/ed7c1fb9b099193f0edafb58df2b2a91f561d6c2
  Author: Tobias Gysi <gysit at google.com>
  Date:   2021-11-25 (Thu, 25 Nov 2021)

  Changed paths:
    M mlir/lib/Dialect/Linalg/Transforms/HoistPadding.cpp
    M mlir/test/Dialect/Linalg/pad-and-hoist.mlir

  Log Message:
  -----------
  [mlir][linalg] Add backward slice filtering in hoist padding.

Adapt hoist padding to filter the backward slice before cloning the packing loop nest. The filtering removes all operations that are not used to index the hoisted pad tensor op and its extract slice op. The filtering is needed to support the more complex loop nests created after fusion. For example, fusing the producer of an output operand can added linalg ops and pad tensor ops to the backward slice. These operations have regions and currently prevent hoisting.

The following example demonstrates the effect of the newly introduced `dropNonIndexDependencies` method that filters the backward slice:
```
%source = linalg.fill(%cst, %arg0)
scf.for %i
  %unrelated = linalg.fill(%cst, %arg1)    // not used to index %source!
  scf.for %j (%arg2 = %unrelated)
    scf.for %k                             // not used to index %source!
      %ubi = affine.min #map(%i)
      %ubj = affine.min #map(%j)
      %slice = tensor.extract_slice %source [%i, %j] [%ubi, %ubj]
      %padded_slice = linalg.pad_tensor %slice
```
dropNonIndexDependencies(%padded_slice, %slice)
removes [scf.for %k, linalg.fill(%cst, %arg1)] from backwardSlice.

Depends On D114175

Reviewed By: nicolasvasilache

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




More information about the All-commits mailing list