MLIR  22.0.0git
Macros | Functions
Padding.cpp File Reference
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Interfaces/ValueBoundsOpInterface.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "linalg-padding"
 
#define DBGS()   (llvm::dbgs() << "[" DEBUG_TYPE << "]: ")
 
#define DBGSNL()   (llvm::dbgs() << "\n")
 

Functions

static FailureOr< ValuepadOperandToSmallestStaticBoundingBox (RewriterBase &rewriter, linalg::LinalgOp opToPad, OpOperand *opOperand, const LinalgPaddingOptions &options)
 Pad the opOperand in the "paddingDimensions" using the padding value and the nofold flag found in "paddingValues" and "nofoldFlags", respectively. More...
 

Macro Definition Documentation

◆ DBGS

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

Definition at line 23 of file Padding.cpp.

◆ DBGSNL

#define DBGSNL ( )    (llvm::dbgs() << "\n")

Definition at line 24 of file Padding.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "linalg-padding"

Definition at line 18 of file Padding.cpp.

Function Documentation

◆ padOperandToSmallestStaticBoundingBox()

static FailureOr<Value> padOperandToSmallestStaticBoundingBox ( RewriterBase rewriter,
linalg::LinalgOp  opToPad,
OpOperand opOperand,
const LinalgPaddingOptions options 
)
static

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

Exit early and return the opOperand value if it already has the requested shape. i.e.:

  • static shape
  • nofold is not set
  • dim sizes are multiples of "padToMultipleOf"

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 187 of file Padding.cpp.

References DBGS, mlir::remark::failed(), mlir::IROperand< DerivedT, IRValueT >::get(), mlir::getElementTypeOrSelf(), mlir::OpOperand::getOperandNumber(), mlir::Value::getType(), mlir::linalg::makeComposedPadHighOp(), mlir::RewriterBase::notifyMatchFailure(), and options.

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