MLIR
20.0.0git
|
#include "mlir/Dialect/Linalg/Transforms/Transforms.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 LogicalResult | computePaddedShape (linalg::LinalgOp opToPad, OpOperand *opOperand, const LinalgPaddingOptions &options, SmallVector< int64_t > &paddedShape, bool &alreadyHasRequestedShape) |
Compute the padded shape of the given operand. More... | |
static FailureOr< Value > | padOperandToSmallestStaticBoundingBox (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... | |
#define DBGS | ( | ) | (llvm::dbgs() << "[" DEBUG_TYPE << "]: ") |
Definition at line 22 of file Padding.cpp.
#define DBGSNL | ( | ) | (llvm::dbgs() << "\n") |
Definition at line 23 of file Padding.cpp.
#define DEBUG_TYPE "linalg-padding" |
Definition at line 17 of file Padding.cpp.
|
static |
Compute the padded shape of the given operand.
The operand is padded to a static bounding box according to the specified padding options.
Definition at line 27 of file Padding.cpp.
References mlir::presburger::ceil(), mlir::ValueBoundsConstraintSet::computeConstantBound(), DBGS, mlir::detail::enumerate(), mlir::IROperand< DerivedT, IRValueT >::get(), mlir::AffineMap::getResults(), options, and mlir::presburger::UB.
Referenced by padOperandToSmallestStaticBoundingBox().
|
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.:
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 102 of file Padding.cpp.
References computePaddedShape(), mlir::OpBuilder::create(), DBGS, mlir::IROperand< DerivedT, IRValueT >::get(), mlir::get(), mlir::getElementTypeOrSelf(), mlir::OpOperand::getOperandNumber(), mlir::Value::getType(), mlir::linalg::makeComposedPadHighOp(), mlir::RewriterBase::notifyMatchFailure(), and options.
Referenced by mlir::linalg::rewriteAsPaddedOp().