[all-commits] [llvm/llvm-project] 6953cf: [mlir][Linalg] Add a hoistRedundantVectorTransfers...

Nicolas Vasilache via All-commits all-commits at lists.llvm.org
Fri Jun 5 03:54:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 6953cf65024395508c464dc78c90b158b3241a3a
      https://github.com/llvm/llvm-project/commit/6953cf65024395508c464dc78c90b158b3241a3a
  Author: Nicolas Vasilache <ntv at google.com>
  Date:   2020-06-05 (Fri, 05 Jun 2020)

  Changed paths:
    M mlir/include/mlir/Dialect/Linalg/Transforms/Hoisting.h
    M mlir/include/mlir/Transforms/LoopUtils.h
    M mlir/lib/Analysis/SliceAnalysis.cpp
    M mlir/lib/Dialect/Linalg/Transforms/Hoisting.cpp
    M mlir/lib/Transforms/LoopInvariantCodeMotion.cpp
    M mlir/test/Dialect/Linalg/hoisting.mlir
    M mlir/test/lib/Transforms/TestLinalgHoisting.cpp

  Log Message:
  -----------
  [mlir][Linalg] Add a hoistRedundantVectorTransfers helper function

This revision adds a helper function to hoist vector.transfer_read /
vector.transfer_write pairs out of immediately enclosing scf::ForOp
iteratively, if the following conditions are true:
   1. The 2 ops access the same memref with the same indices.
   2. All operands are invariant under the enclosing scf::ForOp.
   3. No uses of the memref either dominate the transfer_read or are
   dominated by the transfer_write (i.e. no aliasing between the write and
   the read across the loop)

To improve hoisting opportunities, call the `moveLoopInvariantCode` helper
function on the candidate loop above which to hoist. Hoisting the transfers
results in scf::ForOp yielding the value that originally transited through
memory.

This revision additionally exposes `moveLoopInvariantCode` as a helper in
LoopUtils.h and updates SliceAnalysis to support return scf::For values and
allow hoisting across multiple scf::ForOps.

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




More information about the All-commits mailing list