MLIR 22.0.0git
Padding.cpp File Reference

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "linalg-padding"
#define DBGS()
#define DBGSNL()

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.

Macro Definition Documentation

◆ DBGS

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

Definition at line 23 of file Padding.cpp.

◆ DBGSNL

#define DBGSNL ( )
Value:
(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()

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::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().