MLIR  16.0.0git
Hoisting.h
Go to the documentation of this file.
1 //===- Hoisting.h - Linalg hoisting transformations -------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_
10 #define MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_
11 
12 namespace mlir {
13 namespace func {
14 class FuncOp;
15 } // namespace func
16 
17 namespace linalg {
18 
19 /// Hoist vector.transfer_read/vector.transfer_write on buffers pairs out of
20 /// immediately enclosing scf::ForOp iteratively, if the following conditions
21 /// are true:
22 /// 1. The two ops access the same memref with the same indices.
23 /// 2. All operands are invariant under the enclosing scf::ForOp.
24 /// 3. No uses of the memref either dominate the transfer_read or are
25 /// dominated by the transfer_write (i.e. no aliasing between the write and
26 /// the read across the loop)
27 /// To improve hoisting opportunities, call the `moveLoopInvariantCode` helper
28 /// function on the candidate loop above which to hoist. Hoisting the transfers
29 /// results in scf::ForOp yielding the value that originally transited through
30 /// memory.
31 // TODO: generalize on a per-need basis.
32 void hoistRedundantVectorTransfers(func::FuncOp func);
33 
34 /// Same behavior as `hoistRedundantVectorTransfers` but works on tensors
35 /// instead of buffers.
36 void hoistRedundantVectorTransfersOnTensor(func::FuncOp func);
37 
38 } // namespace linalg
39 } // namespace mlir
40 
41 #endif // MLIR_DIALECT_LINALG_TRANSFORMS_HOISTING_H_
Include the generated interface declarations.
void hoistRedundantVectorTransfers(func::FuncOp func)
Hoist vector.transfer_read/vector.transfer_write on buffers pairs out of immediately enclosing scf::F...
Definition: Hoisting.cpp:401
void hoistRedundantVectorTransfersOnTensor(func::FuncOp func)
Same behavior as hoistRedundantVectorTransfers but works on tensors instead of buffers.
Definition: Hoisting.cpp:349