MLIR  16.0.0git
Macros | Functions
Transforms.cpp File Reference
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Linalg/Analysis/DependenceAnalysis.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Transforms/HoistPadding.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/SCF/Transforms/Transforms.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Tensor/IR/TensorTilingInterfaceImpl.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/Matchers.h"
#include "mlir/Pass/Pass.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <type_traits>
#include <utility>
+ Include dependency graph for Transforms.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "linalg-transforms"
 
#define DBGS()   (llvm::dbgs() << "[" DEBUG_TYPE << "]: ")
 

Functions

static FailureOr< ValuepadOperandToSmallestStaticBoundingBox (OpBuilder &b, linalg::LinalgOp opToPad, OpOperand *opOperand, ArrayRef< int64_t > paddingDimensions, ArrayRef< Attribute > paddingValues, ArrayRef< bool > packPaddings)
 Pad the opOperand in the paddingDimensions using the padding value and the nofold flag found in paddingValues and packPaddings, respectively. More...
 
static SmallVector< Value, 4 > peelLoop (RewriterBase &rewriter, Operation *op)
 Try to peel a loop op and return the new result. More...
 
static SmallVector< StringRef > getNParallelLoopsAttrs (unsigned nParallelLoops)
 

Macro Definition Documentation

◆ DBGS

#define DBGS ( )    (llvm::dbgs() << "[" DEBUG_TYPE << "]: ")

◆ DEBUG_TYPE

#define DEBUG_TYPE   "linalg-transforms"

Definition at line 40 of file Transforms.cpp.

Function Documentation

◆ getNParallelLoopsAttrs()

static SmallVector<StringRef> getNParallelLoopsAttrs ( unsigned  nParallelLoops)
static

◆ padOperandToSmallestStaticBoundingBox()

static FailureOr<Value> padOperandToSmallestStaticBoundingBox ( OpBuilder b,
linalg::LinalgOp  opToPad,
OpOperand opOperand,
ArrayRef< int64_t >  paddingDimensions,
ArrayRef< Attribute paddingValues,
ArrayRef< bool >  packPaddings 
)
static

Pad the opOperand in the paddingDimensions using the padding value and the nofold flag found in paddingValues and packPaddings, respectively.

Exit early and return the opOperand value if the shape dimensions that match paddingDimensions have a static size and the nofold flag is not set. Otherwise, try to pad the shape dimensions that match the iterator dimensions paddingDimensions and return the tensor::PadOp result if padding succeeds or failure otherwise.

Definition at line 171 of file Transforms.cpp.

References mlir::Value::cast(), mlir::OpBuilder::create(), DBGS, mlir::Attribute::dyn_cast(), mlir::detail::enumerate(), mlir::failed(), mlir::failure(), mlir::IROperand< DerivedT, IRValueT >::get(), mlir::linalg::getConstantUpperBoundForIndex(), mlir::Value::getDefiningOp(), mlir::getElementTypeOrSelf(), mlir::OpOperand::getOperandNumber(), mlir::OpResult::getResultNumber(), mlir::AffineMap::getResults(), mlir::Builder::getType(), and mlir::linalg::makeComposedPadHighOp().

Referenced by mlir::linalg::rewriteAsPaddedOp().

◆ peelLoop()

static SmallVector<Value, 4> peelLoop ( RewriterBase rewriter,
Operation op 
)
static

Try to peel a loop op and return the new result.

Definition at line 318 of file Transforms.cpp.

References mlir::Operation::getResults(), mlir::scf::peelAndCanonicalizeForLoop(), and mlir::succeeded().

Referenced by mlir::linalg::peelLoops().