MLIR
16.0.0git
|
#include "mlir/Dialect/Linalg/Transforms/HoistPadding.h"
#include "mlir/Analysis/SliceAnalysis.h"
#include "mlir/Dialect/Affine/IR/AffineOps.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/Utils/IndexingUtils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Vector/Utils/VectorUtils.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/Matchers.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Debug.h"
Go to the source code of this file.
Classes | |
struct | HoistingAnalysis |
Analysis class to support tensor::PadOp hoisting across multiple enclosing loops. More... | |
Macros | |
#define | DEBUG_TYPE "hoist-padding" |
#define | DBGS() (dbgs() << '[' << DEBUG_TYPE << "] ") |
Functions | |
static bool | isOnlyUsedAsInputOfLinalgOp (tensor::PadOp padOp) |
Return true if all uses of padOp are an input tensor of some LinalgOp. More... | |
static void | getAtMostNEnclosingLoops (tensor::PadOp padOp, int nLevels, SmallVector< scf::ForOp > &reverseEnclosingLoops) |
Return at most nLevels of immediately enclosing scf::ForOp loops. More... | |
static FailureOr< RankedTensorType > | computeTransposedType (RankedTensorType rankedTensorType, ArrayRef< int64_t > transposeVector) |
Returns the transposed rankedTensorType if transposeVector is non-empty. More... | |
static bool | isDefinedOutsideOrConstant (scf::ForOp outer, Value v) |
static Value | buildLoopIterationCount (OpBuilder &b, scf::ForOp outer, scf::ForOp forOp) |
Return the current iteration number in the loop (iv - lb).ceilDiv(step). More... | |
#define DBGS | ( | ) | (dbgs() << '[' << DEBUG_TYPE << "] ") |
Definition at line 36 of file HoistPadding.cpp.
Referenced by getAtMostNEnclosingLoops(), HoistingAnalysis::HoistingAnalysis(), mlir::linalg::hoistPaddingOnTensors(), and isOnlyUsedAsInputOfLinalgOp().
#define DEBUG_TYPE "hoist-padding" |
Definition at line 34 of file HoistPadding.cpp.
Return the current iteration number in the loop (iv - lb).ceilDiv(step).
The returned Value is guaranteed not to depend on any loop comprised in [outer
, forOp
]. Return null if such a loop-independent quantity cannot be computed.
Definition at line 381 of file HoistPadding.cpp.
References mlir::bindDims(), mlir::bindSymbols(), mlir::ceilDiv(), mlir::OpBuilder::createOrFold(), mlir::Value::getLoc(), and isDefinedOutsideOrConstant().
Referenced by mlir::linalg::hoistPaddingOnTensors().
|
static |
Returns the transposed rankedTensorType
if transposeVector
is non-empty.
Fail if transposeVector
is no permutation matching the tensor rank.
Definition at line 150 of file HoistPadding.cpp.
References mlir::applyPermutationToVector(), mlir::failure(), mlir::linalg::isPermutation(), and mlir::RankedTensorType::Builder::setShape().
Referenced by mlir::linalg::hoistPaddingOnTensors().
|
static |
Return at most nLevels of immediately enclosing scf::ForOp loops.
Stops at the first parent that is not an scf::ForOp. Multi-loops such as scf.parallel or linalg.tiled_loop are not modeled atm. Control-flow and other containing ops with regions are not modeled atm.
Definition at line 130 of file HoistPadding.cpp.
References DBGS, and mlir::Operation::getParentOp().
Referenced by HoistingAnalysis::HoistingAnalysis().
|
static |
Definition at line 373 of file HoistPadding.cpp.
References mlir::m_Constant(), and mlir::matchPattern().
Referenced by buildLoopIterationCount().
|
static |
Return true if all uses of padOp
are an input tensor of some LinalgOp.
Definition at line 111 of file HoistPadding.cpp.
References DBGS.
Referenced by HoistingAnalysis::HoistingAnalysis().