MLIR
16.0.0git
|
#include "mlir/Dialect/Linalg/Transforms/Hoisting.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/Analysis/AffineStructures.h"
#include "mlir/Dialect/Affine/IR/AffineValueMap.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/SCF/Utils/Utils.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Dominance.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "mlir/Transforms/LoopInvariantCodeMotionUtils.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "linalg-hoisting" |
#define | DBGS() (dbgs() << '[' << DEBUG_TYPE << "] ") |
Functions | |
static bool | isEqualOffsetSizeOrStride (OpFoldResult op1, OpFoldResult op2) |
Return true if op1 and op2 are the same constant or the same SSA value. More... | |
static bool | sameOffsetsSizesAndStrides (tensor::ExtractSliceOp s, tensor::InsertSliceOp si) |
Return true is all offsets, sizes and strides are equal. More... | |
static HoistableRead | findMatchingTransferRead (HoistableWrite write, Value srcTensor) |
Look for a HoistableRead, in the given tensor uses, accessing the same offset as the HoistableWrite. More... | |
static bool | tensorChunkAccessedByUnknownOp (HoistableWrite write, HoistableRead candidateRead, BlockArgument tensorArg) |
Check if the chunk of data inserted by the HoistableWrite are read by any other op than the HoistableRead candidate. More... | |
static HoistableWrite | getLoopInvariantTransferWriteOpDefining (scf::ForOp forOp, OpOperand &yieldOperand) |
Return the forOp -invariant HoistableWrite that produces yieldOperand . More... | |
static void | hoistReadWrite (HoistableRead read, HoistableWrite write, BlockArgument tensorBBArg) |
Mechanical hoisting of a matching HoistableRead / HoistableWrite pair. More... | |
#define DBGS | ( | ) | (dbgs() << '[' << DEBUG_TYPE << "] ") |
Definition at line 38 of file Hoisting.cpp.
Referenced by findMatchingTransferRead(), hoistReadWrite(), mlir::linalg::hoistRedundantVectorTransfers(), and mlir::linalg::hoistRedundantVectorTransfersOnTensor().
#define DEBUG_TYPE "linalg-hoisting" |
Definition at line 36 of file Hoisting.cpp.
|
static |
Look for a HoistableRead, in the given tensor uses, accessing the same offset as the HoistableWrite.
Definition at line 99 of file Hoisting.cpp.
References DBGS, mlir::Value::getUsers(), mlir::Operation::getUsers(), and sameOffsetsSizesAndStrides().
Referenced by mlir::linalg::hoistRedundantVectorTransfersOnTensor().
|
static |
Return the forOp
-invariant HoistableWrite that produces yieldOperand
.
Return the null HoistableWrite() if it is not comprised of a vector.transfer_write + optional insert_slice or if any of the indexings is forOp
-dependent.
Definition at line 223 of file Hoisting.cpp.
References mlir::IROperand< DerivedT, IRValueT >::get(), mlir::Value::getDefiningOp(), and mlir::OpOperand::getOperandNumber().
Referenced by mlir::linalg::hoistRedundantVectorTransfersOnTensor().
|
static |
Mechanical hoisting of a matching HoistableRead / HoistableWrite pair.
Definition at line 261 of file Hoisting.cpp.
References DBGS, mlir::BlockArgument::getArgNumber(), mlir::BlockArgument::getOwner(), mlir::Block::getParentOp(), and mlir::replaceLoopWithNewYields().
Referenced by mlir::linalg::hoistRedundantVectorTransfersOnTensor().
|
static |
Return true if op1 and op2 are the same constant or the same SSA value.
Definition at line 59 of file Hoisting.cpp.
References mlir::Attribute::dyn_cast(), mlir::Attribute::dyn_cast_or_null(), mlir::getConstantIntValue(), mlir::Value::getDefiningOp(), and mlir::linalg::None.
Referenced by sameOffsetsSizesAndStrides().
|
static |
Return true is all offsets, sizes and strides are equal.
Definition at line 77 of file Hoisting.cpp.
References isEqualOffsetSizeOrStride().
Referenced by findMatchingTransferRead().
|
static |
Check if the chunk of data inserted by the HoistableWrite are read by any other op than the HoistableRead candidate.
Definition at line 162 of file Hoisting.cpp.
References mlir::Value::getUses(), and mlir::vector::isDisjointTransferIndices().
Referenced by mlir::linalg::hoistRedundantVectorTransfersOnTensor().