|
MLIR 24.0.0git
|
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"#include "mlir/Analysis/SliceAnalysis.h"#include "mlir/Dialect/Affine/IR/AffineOps.h"#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Complex/IR/Complex.h"#include "mlir/Dialect/Linalg/IR/LinalgInterfaces.h"#include "mlir/Dialect/Tensor/IR/Tensor.h"#include "mlir/Dialect/UB/IR/UBMatchers.h"#include "mlir/Dialect/Utils/StaticValueUtils.h"#include "mlir/IR/AffineExpr.h"#include "mlir/IR/BuiltinAttributes.h"#include "mlir/IR/BuiltinTypeInterfaces.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/OpDefinition.h"#include "mlir/IR/Value.h"#include "mlir/Interfaces/TilingInterface.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Support/Casting.h"Go to the source code of this file.
Macros | |
| #define | DEBUG_TYPE "pad-tiling-interface" |
| #define | DBGS() |
| #define | DBGSNL() |
Functions | |
| static SmallVector< OpFoldResult > | getFullRankPaddingSizes (Builder &b, ArrayRef< OpFoldResult > indexingSizes, const PadTilingInterfaceOptions &options) |
| Form a "full-rank" padding specification so that the application is easy. | |
| static int64_t | extractConstantMultiplier (AffineExpr expr) |
| Extracts the constant multiplier from an affine expression of the form d * c or c * d, where d is an AffineDimExpr and c is an AffineConstantExpr. | |
| static Value | padOperand (OpBuilder &builder, TilingInterface opToPad, TypedValue< RankedTensorType > v, ArrayRef< OpFoldResult > paddedShape, Attribute paddingValueAttr) |
| Pad a single operand to paddedShape using paddingValueAttr as padding Value. | |
| static bool | isReducedOperand (linalg::LinalgOp linalgOp, OpOperand *operand, ArrayRef< utils::IteratorType > iterTypes) |
| Returns true if operand is indexed along at least one reduction dimension of linalgOp | |
| static FailureOr< SmallVector< Attribute > > | inferContractionPaddingValues (OpBuilder &builder, linalg::LinalgOp linalgOp, ArrayRef< utils::IteratorType > iterTypes, ArrayRef< Attribute > defaultPadVals) |
| On success, returns a vector with pad values for every operand of linalgOp. | |
| static FailureOr< SmallVector< Attribute > > | inferPaddingValues (OpBuilder &builder, TilingInterface toPad) |
| Infers a semantics-preserving padding value for every operand of toPad (indexed by operand number). | |
| #define DBGS | ( | ) |
Definition at line 35 of file PadTilingInterface.cpp.
Referenced by mlir::linalg::computePaddedShape(), getFullRankPaddingSizes(), padOperand(), and mlir::linalg::rewriteAsPaddedOp().
| #define DBGSNL | ( | ) |
Definition at line 36 of file PadTilingInterface.cpp.
| #define DEBUG_TYPE "pad-tiling-interface" |
Definition at line 29 of file PadTilingInterface.cpp.
|
static |
Extracts the constant multiplier from an affine expression of the form d * c or c * d, where d is an AffineDimExpr and c is an AffineConstantExpr.
Returns 1 if the expression is not a simple multiplication of a dimension and a constant.
Definition at line 66 of file PadTilingInterface.cpp.
References mlir::Mul.
Referenced by mlir::linalg::computePaddedShape().
|
static |
Form a "full-rank" padding specification so that the application is easy.
Definition at line 40 of file PadTilingInterface.cpp.
References b, DBGS, mlir::isZeroInteger(), and options.
Referenced by mlir::linalg::computePaddedShape().
|
static |
On success, returns a vector with pad values for every operand of linalgOp.
Fails if the body of linalgOp is not contraction-like, or if its elemwise/reduce pair admits no padding value.
Definition at line 287 of file PadTilingInterface.cpp.
References mlir::getElementTypeOrSelf(), mlir::Operation::getResult(), mlir::Value::getType(), mlir::Builder::getZeroAttr(), mlir::linalg::detail::isContractionBody(), mlir::Type::isInteger(), isReducedOperand(), and reduce().
Referenced by inferPaddingValues().
|
static |
Infers a semantics-preserving padding value for every operand of toPad (indexed by operand number).
Operands that are reduced are padded with the neutral element of their reduction combiner (e.g. -inf for maximumf, 1 for mulf); every other operand is padded with the zero value of its element type.
Inference is conservative: it returns failure when a semantics-preserving value cannot be determined (a non-LinalgOp reduction, or a reduction whose neutral element is unknown), letting callers set options.paddingValues explicitly instead.
Definition at line 348 of file PadTilingInterface.cpp.
References mlir::getElementTypeOrSelf(), mlir::arith::getNeutralElement(), mlir::Operation::getOperandTypes(), mlir::Builder::getZeroAttr(), inferContractionPaddingValues(), isReducedOperand(), and mlir::matchReduction().
Referenced by mlir::linalg::rewriteAsPaddedOp().
|
static |
Returns true if operand is indexed along at least one reduction dimension of linalgOp
Definition at line 271 of file PadTilingInterface.cpp.
References mlir::detail::IROperandBase::getOwner(), and mlir::AffineMap::isFunctionOfDim().
Referenced by inferContractionPaddingValues(), and inferPaddingValues().
|
static |
Pad a single operand to paddedShape using paddingValueAttr as padding Value.
Definition at line 230 of file PadTilingInterface.cpp.
References DBGS, mlir::getConstantIntValue(), mlir::getElementTypeOrSelf(), mlir::ub::m_Poison(), mlir::linalg::makeComposedPadHighOp(), and mlir::matchPattern().
Referenced by mlir::linalg::rewriteAsPaddedOp().