MLIR 22.0.0git
LinalgOps.cpp File Reference
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/AsmParser/AsmParser.h"
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Math/IR/Math.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SparseTensor/IR/SparseTensor.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"
#include "mlir/Dialect/Utils/StaticValueUtils.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypeInterfaces.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/OperationSupport.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Interfaces/InferTypeOpInterface.h"
#include "mlir/Interfaces/SideEffectInterfaces.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetOperations.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/InterleavedRange.h"
#include "llvm/Support/LogicalResult.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <optional>
#include "mlir/Dialect/Linalg/IR/LinalgNamedStructuredOps.yamlgen.cpp.inc"
#include "mlir/Dialect/Linalg/IR/LinalgOps.cpp.inc"
#include "mlir/Dialect/Linalg/IR/LinalgStructuredOps.cpp.inc"
#include "mlir/Dialect/Linalg/IR/LinalgRelayoutOps.cpp.inc"

Go to the source code of this file.

Classes

struct  FoldTransposeWithTranspose
 Fold transpose with transpose. More...
struct  SwapTransposeWithBroadcast
 This pattern canonicalize transpose by swapping the order of broadcast and transpose: transpose(broadcast(input)) -> broadcast(transpose(input)) More...
struct  FoldBroadcasts
 Fold back-to-back broadcasts together. More...
struct  mlir::linalg::FoldTensorCastPackOp
 Folds a tensor.cast op into a consuming PackOp op if the tensor.cast has source that is more static than the consuming op. More...
struct  mlir::linalg::FoldTensorCastUnPackOp
 Folds a tensor.cast op into a consuming UnPackOp op if the tensor.cast has source that is more static than the consuming op. More...

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::linalg

Macros

#define GET_OP_CLASSES
#define GET_OP_CLASSES
#define GET_OP_CLASSES

Typedefs

using RegionBuilderFn

Functions

static OpFoldResult getDimValue (OpBuilder &builder, Location loc, Value v, int64_t dim)
 Return a memref.dim or tensor.dim for the shape of v at dim.
static OperationgetSlice (OpBuilder &b, Location loc, Value source, ArrayRef< OpFoldResult > offsets, ArrayRef< OpFoldResult > sizes, ArrayRef< OpFoldResult > strides)
 Returns a memref.subview or a tensor.extract_slice based on the type of the source.
static void fillStructuredOpRegion (OpBuilder &opBuilder, Region &region, TypeRange inputTypes, TypeRange outputTypes, ArrayRef< NamedAttribute > attrs, function_ref< InFlightDiagnostic()> emitError, RegionBuilderFn regionBuilder)
 Fills the region of a structured operation using the provided regionBuilder.
static void buildStructuredOp (OpBuilder &b, OperationState &state, std::optional< TypeRange > resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes, RegionBuilderFn regionBuilder)
 Creates a structured operation given inputs, outputs, and attributes.
static void buildMatmulOp (OpBuilder &b, OperationState &state, std::optional< TypeRange > resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes, RegionBuilderFn regionBuilder, ArrayRef< AffineMap > indexingMaps)
static void buildBatchMatmulOp (OpBuilder &b, OperationState &state, std::optional< TypeRange > resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes, RegionBuilderFn regionBuilder, ArrayRef< AffineMap > indexingMaps)
static void buildBatchReduceMatmulOp (OpBuilder &b, OperationState &state, std::optional< TypeRange > resultTensorTypes, ValueRange inputs, ValueRange outputs, ArrayRef< NamedAttribute > attributes, RegionBuilderFn regionBuilder, ArrayRef< AffineMap > indexingMaps)
static ParseResult parseCommonStructuredOpParts (OpAsmParser &parser, OperationState &result, SmallVectorImpl< Type > &inputTypes, SmallVectorImpl< Type > &outputTypes, bool addOperandSegmentSizes=true)
 Common parsing used for both named structured ops created by ods-gen and by manually defined C++ ops.
static void printCommonStructuredOpParts (OpAsmPrinter &p, ValueRange inputs, ValueRange outputs)
static ParseResult parseNamedStructuredOpRegion (OpAsmParser &parser, Region &region, unsigned numRegionArgs, TypeRange inputTypes, TypeRange outputTypes, ArrayRef< NamedAttribute > attrs, RegionBuilderFn regionBuilder, SMLoc loc)
static ParseResult parseNamedStructuredOpResults (OpAsmParser &parser, SmallVectorImpl< Type > &resultTypes)
static ParseResult parseNamedStructuredOp (OpAsmParser &parser, OperationState &result, unsigned numRegionArgs, RegionBuilderFn regionBuilder)
static void printNamedStructuredOpResults (OpAsmPrinter &p, TypeRange resultTypes)
static void printNamedStructuredOp (OpAsmPrinter &p, Operation *op, ValueRange inputs, ValueRange outputs, ArrayRef< StringRef > elidedAttrs={})
static void buildGenericRegion (OpBuilder &builder, Location loc, Region &region, ValueRange inputs, ValueRange outputs, function_ref< void(OpBuilder &, Location, ValueRange)> bodyBuild)
static void getGenericEffectsImpl (SmallVectorImpl< SideEffects::EffectInstance< MemoryEffects::Effect > > &effects, LinalgOp linalgOp)
static Speculation::Speculatability getGenericSpeculatabilityImpl (LinalgOp linalgOp)
static ParseResult parseDstStyleOp (OpAsmParser &parser, OperationState &result, function_ref< ParseResult(OpAsmParser &, NamedAttrList &)> parseAttrsFn=nullptr)
static void addBodyWithPayloadOp (OpAsmParser &parser, OperationState &result, const OperationName &payloadOpName, const NamedAttrList &payloadOpAttrs, ArrayRef< Value > operands, bool initFirst=false, bool mapInit=true)
static bool canUseShortForm (Block *body, bool initFirst=false, bool mapInit=true)
static void printShortForm (OpAsmPrinter &p, Operation *payloadOp)
static ParseResult parseDenseI64ArrayAttr (OpAsmParser &parser, NamedAttrList &attributes, StringRef attributeName)
static void printDenseI64ArrayAttr (OpAsmPrinter &p, StringRef attributeName, ArrayRef< int64_t > attributeValue)
static void buildIdentityRegion (OpBuilder &builder, Location loc, Region &region, ValueRange inputs, ValueRange outputs)
static LogicalResult verifyYield (linalg::YieldOp op, LinalgOp linalgOp)
static LogicalResult appendMangledType (llvm::raw_string_ostream &ss, Type t)
static std::tuple< SmallVector< utils::IteratorType >, SmallVector< AffineMap > > computeIteratorTypesAndIndexingMaps (OpBuilder &builder, int64_t inputRank, int64_t dim, bool allParallel=false)
template<typename T>
static Value reduce (OpBuilder &builder, Location loc, Value input, Value output, int64_t dim)
static Value buildSubAndExpOp (OpBuilder &builder, Location loc, Value input, Value max, Value output, int64_t dim)
 Produce a linalg generic that computes the second step of the softmax decomposition: res = exp(input - max), where max is the max of input on dimension dim.
static Value buildDivOp (OpBuilder &builder, Location loc, Value numerator, Value denominator, Value output, int64_t dim)
 Produce a linalg generic that computes the final step of the softmax decomposition.
static bool areResultExprsSubsetOf (AffineMap subMap, AffineMap fullMap)
static bool isBroadcasted (AffineMap explictMap, AffineMap defaultMap)
 Check if the user defined map is valid broadcast map.
static LogicalResult verifyExtendedMatmulSemantic (MatmulOp matmulOp, unsigned opIndex)
 Verifies the broadcast and transpose semantic sepecified by the explicit indexing map for the MatmulOp op for each operand specified by opIndex.
template<typename OpTy>
static LogicalResult verifyInputMaps (OpTy batchVariantMatmulOp, AffineMap opIndexingMap, AffineMap defaultIndexingMap, bool isLHS)
template<typename OpTy>
static LogicalResult verifyOutputMap (OpTy batchVariantMatmulOp, AffineMap opIndexingMap)
 This function checks if the given AffineMap for the output of a BatchMatmulOp/BatchReduceMatmulOp has exactly the desired number of result dimensions and if the output map result dimensions are valid.
template<typename OpTy>
static LogicalResult verifyExtendedBatchVariantMatmulSemantic (OpTy batchVariantMatmulOp, unsigned opIndex)
 Verifies the broadcast and transpose semantic specified by the explicit indexing map for the BatchMatmulOp/BatchReduceMatmulOp op for each operand specified by opIndex.
std::optional< WinogradConv2DFmr > mlir::linalg::getWinogradConv2DFmr (int64_t m, int64_t r)
 Converts the given m and r parameters to a WinogradConv2DFmr enumeration value.
std::pair< int64_t, int64_tmlir::linalg::getFmrFromWinogradConv2DFmr (WinogradConv2DFmr fmr)
 Converts the given WinogradConv2DFmr enumeration value to a pair of m and r parameters.
static FailureOr< SmallVector< SmallVector< int64_t > > > mlir::linalg::getAffineResultPositions (ArrayAttr maps)
static FailureOr< ArrayAttrmlir::linalg::parseIndexingMapsAttr (OpAsmParser &parser)
static ArityGroupAndKind mlir::linalg::getArityGroupAndKind (ElementwiseKind kind)
template<typename OpTy, typename = std::enable_if_t<std::is_same_v<OpTy, linalg::PackOp> || std::is_same_v<OpTy, linalg::UnPackOp>>>
SmallVector< int64_tmlir::linalg::getPackedOuterShapeWithoutTransposition (OpTy packOrUnPack)
 Returns the outer shape in the packed domain before applying the transposition.
template SmallVector< int64_tmlir::linalg::getPackedOuterShapeWithoutTransposition< PackOp > (PackOp)
template SmallVector< int64_tmlir::linalg::getPackedOuterShapeWithoutTransposition< UnPackOp > (UnPackOp)
static SmallVector< OpFoldResultmlir::linalg::getNewMixedTileSizes (PatternRewriter &rewriter, Type newPackedTy, SmallVector< OpFoldResult > mixedTiles)
template<typename OpTy>
static LogicalResult mlir::linalg::reifyResultShapesImpl (OpTy op, OpBuilder &builder, ReifiedRankedShapedTypeDims &reifiedReturnShapes)
template<typename OpTy>
static DenseMap< int64_t, OpFoldResultmlir::linalg::getDimAndTileMappingImpl (OpTy op)
template<typename OpTy>
static SmallVector< OpFoldResultmlir::linalg::getMixedTilesImpl (OpTy op)
template<typename OpTy>
static SmallVector< int64_tmlir::linalg::getStaticTilesImpl (OpTy op)
static bool mlir::linalg::isInvalidPackingPosSpecification (ArrayRef< int64_t > dimsPos, size_t rank)
 Returns true if dimsPos is invalid.
template<typename OpTy>
static LogicalResult mlir::linalg::commonVerifierPackAndUnPackOp (OpTy packOrUnPack)
template<typename OpTy>
static PackOrUnPackTransposeResult mlir::linalg::commonPermutationOfPackAndUnPackOp (OpTy packOrUnPackOp, ArrayRef< int64_t > innerPermutation, ArrayRef< int64_t > outerPermutation)
static SmallVector< int64_tmlir::linalg::asShapeWithAnyValueAsDynamic (ArrayRef< OpFoldResult > ofrs)
 Converts OpFoldResults to int64_t shape entries, unconditionally mapping all Value's to kDynamic, even if they are arith.constant values.
static SmallVector< int64_tmlir::linalg::getPackOpResultTypeShape (ArrayRef< int64_t > sourceShape, ArrayRef< int64_t > innerTileSizes, ArrayRef< int64_t > innerDimsPos, ArrayRef< int64_t > outerDimsPerm)
 Helper for PackOp::{getResultShape,inferPackedType}.
template<typename OpTy>
static bool mlir::linalg::areTilesAndTiledDimsAllConstant (OpTy op)
 Returns true if the tiles and the tiled dims are constant.
static bool mlir::linalg::hasSameInnerOuterAttribute (PackOp packOp, UnPackOp unPackOp)
static bool mlir::linalg::haveSameTiles (PackOp packOp, UnPackOp unPackOp)
static bool mlir::linalg::paddingIsNotNeeded (PackOp op)
 Returns true if the pack op does not need a padding value.
static bool mlir::linalg::inferStaticShape (PackOp packOp, SmallVectorImpl< int64_t > &srcShape, SmallVectorImpl< int64_t > &destShape)
 Returns true if the srcShape or destShape is different from the one in packOp and populates each with the inferred static shape.
template<typename PackOrUnpackOp>
static bool mlir::linalg::isLikePadUnPad (PackOrUnpackOp packOp, RankedTensorType packedTensorType)
static bool mlir::linalg::inferStaticShape (UnPackOp op, SmallVectorImpl< int64_t > &srcShape, SmallVectorImpl< int64_t > &destShape)
 Returns true if the srcShape or destShape is different from the one in op and populates each with the inferred static shape.

Macro Definition Documentation

◆ GET_OP_CLASSES [1/3]

#define GET_OP_CLASSES

Definition at line 2448 of file LinalgOps.cpp.

◆ GET_OP_CLASSES [2/3]

#define GET_OP_CLASSES

Definition at line 2448 of file LinalgOps.cpp.

◆ GET_OP_CLASSES [3/3]

#define GET_OP_CLASSES

Definition at line 2448 of file LinalgOps.cpp.

Typedef Documentation

◆ RegionBuilderFn

Initial value:
Block represents an ordered list of Operations.
Definition Block.h:33
ImplicitLocOpBuilder maintains a 'current location', allowing use of the create<> method without spec...
Definition Builders.h:630
This class represents a diagnostic that is inflight and set to be reported.
llvm::function_ref< Fn > function_ref
Definition LLVM.h:152

Definition at line 116 of file LinalgOps.cpp.

Function Documentation

◆ addBodyWithPayloadOp()

void addBodyWithPayloadOp ( OpAsmParser & parser,
OperationState & result,
const OperationName & payloadOpName,
const NamedAttrList & payloadOpAttrs,
ArrayRef< Value > operands,
bool initFirst = false,
bool mapInit = true )
static

◆ appendMangledType()

LogicalResult appendMangledType ( llvm::raw_string_ostream & ss,
Type t )
static

◆ areResultExprsSubsetOf()

bool areResultExprsSubsetOf ( AffineMap subMap,
AffineMap fullMap )
static

Definition at line 3592 of file LinalgOps.cpp.

References mlir::AffineMap::getResults().

Referenced by verifyExtendedMatmulSemantic(), and verifyInputMaps().

◆ buildBatchMatmulOp()

void buildBatchMatmulOp ( OpBuilder & b,
OperationState & state,
std::optional< TypeRange > resultTensorTypes,
ValueRange inputs,
ValueRange outputs,
ArrayRef< NamedAttribute > attributes,
RegionBuilderFn regionBuilder,
ArrayRef< AffineMap > indexingMaps )
static

Definition at line 206 of file LinalgOps.cpp.

References mlir::OperationState::addAttribute(), b, and buildStructuredOp().

◆ buildBatchReduceMatmulOp()

void buildBatchReduceMatmulOp ( OpBuilder & b,
OperationState & state,
std::optional< TypeRange > resultTensorTypes,
ValueRange inputs,
ValueRange outputs,
ArrayRef< NamedAttribute > attributes,
RegionBuilderFn regionBuilder,
ArrayRef< AffineMap > indexingMaps )
static

Definition at line 223 of file LinalgOps.cpp.

References mlir::OperationState::addAttribute(), b, and buildStructuredOp().

◆ buildDivOp()

Value buildDivOp ( OpBuilder & builder,
Location loc,
Value numerator,
Value denominator,
Value output,
int64_t dim )
static

Produce a linalg generic that computes the final step of the softmax decomposition.

Returns
linalg.generic ins(numerator, denominator) outs(output) { yield n / d }

Definition at line 3018 of file LinalgOps.cpp.

References b, computeIteratorTypesAndIndexingMaps(), and mlir::Value::getType().

◆ buildGenericRegion()

void buildGenericRegion ( OpBuilder & builder,
Location loc,
Region & region,
ValueRange inputs,
ValueRange outputs,
function_ref< void(OpBuilder &, Location, ValueRange)> bodyBuild )
static

◆ buildIdentityRegion()

void buildIdentityRegion ( OpBuilder & builder,
Location loc,
Region & region,
ValueRange inputs,
ValueRange outputs )
static

Definition at line 1965 of file LinalgOps.cpp.

References b, and buildGenericRegion().

◆ buildMatmulOp()

◆ buildStructuredOp()

void buildStructuredOp ( OpBuilder & b,
OperationState & state,
std::optional< TypeRange > resultTensorTypes,
ValueRange inputs,
ValueRange outputs,
ArrayRef< NamedAttribute > attributes,
RegionBuilderFn regionBuilder )
static

Creates a structured operation given inputs, outputs, and attributes.

The result types are derived automatically if resultTensorTypes is none. The body of the operation is filled using regionBuilder. All ods-gen created structured operations use the method to implement their builders.

Definition at line 160 of file LinalgOps.cpp.

References mlir::OperationState::addAttribute(), mlir::OperationState::addAttributes(), mlir::OperationState::addOperands(), mlir::OperationState::addRegion(), mlir::OperationState::addTypes(), mlir::OperationState::attributes, b, fillStructuredOpRegion(), mlir::NamedAttrList::getAttrs(), mlir::ValueRange::getTypes(), and TypeRange.

Referenced by buildBatchMatmulOp(), buildBatchReduceMatmulOp(), and buildMatmulOp().

◆ buildSubAndExpOp()

Value buildSubAndExpOp ( OpBuilder & builder,
Location loc,
Value input,
Value max,
Value output,
int64_t dim )
static

Produce a linalg generic that computes the second step of the softmax decomposition: res = exp(input - max), where max is the max of input on dimension dim.

Definition at line 2991 of file LinalgOps.cpp.

References b, computeIteratorTypesAndIndexingMaps(), mlir::Value::getType(), and max().

◆ canUseShortForm()

◆ computeIteratorTypesAndIndexingMaps()

std::tuple< SmallVector< utils::IteratorType >, SmallVector< AffineMap > > computeIteratorTypesAndIndexingMaps ( OpBuilder & builder,
int64_t inputRank,
int64_t dim,
bool allParallel = false )
static

◆ fillStructuredOpRegion()

void fillStructuredOpRegion ( OpBuilder & opBuilder,
Region & region,
TypeRange inputTypes,
TypeRange outputTypes,
ArrayRef< NamedAttribute > attrs,
function_ref< InFlightDiagnostic()> emitError,
RegionBuilderFn regionBuilder )
static

Fills the region of a structured operation using the provided regionBuilder.

The method is used by both named structured ops created by ods-gen and by manually defined C++ ops. It is called by both builders and parsers and creates a block with arguments corresponding to the elemental types of inputTypes and outputTypes.

Definition at line 125 of file LinalgOps.cpp.

References b, mlir::OpBuilder::createBlock(), mlir::emitError(), mlir::getElementTypeOrSelf(), mlir::Builder::getUnknownLoc(), and mlir::OpBuilder::setInsertionPointToStart().

Referenced by buildStructuredOp(), and parseNamedStructuredOpRegion().

◆ getDimValue()

OpFoldResult getDimValue ( OpBuilder & builder,
Location loc,
Value v,
int64_t dim )
static

Return a memref.dim or tensor.dim for the shape of v at dim.

Definition at line 57 of file LinalgOps.cpp.

References mlir::getAsOpFoldResult(), mlir::Builder::getIndexAttr(), and mlir::Value::getType().

◆ getGenericEffectsImpl()

◆ getGenericSpeculatabilityImpl()

Speculation::Speculatability getGenericSpeculatabilityImpl ( LinalgOp linalgOp)
static

◆ getSlice()

Operation * getSlice ( OpBuilder & b,
Location loc,
Value source,
ArrayRef< OpFoldResult > offsets,
ArrayRef< OpFoldResult > sizes,
ArrayRef< OpFoldResult > strides )
static

Returns a memref.subview or a tensor.extract_slice based on the type of the source.

Definition at line 75 of file LinalgOps.cpp.

References b, and mlir::Value::getType().

◆ isBroadcasted()

bool isBroadcasted ( AffineMap explictMap,
AffineMap defaultMap )
static

Check if the user defined map is valid broadcast map.

Here broadcast indexing maps are defined in context of corresponding default indexing maps for the given Op. This way the check becomes very simple i.e just check the number of result dims. Returns true if the explictMap is broadcasted with respect to the defaultMap.

Definition at line 3607 of file LinalgOps.cpp.

References mlir::AffineMap::getNumResults().

Referenced by verifyExtendedMatmulSemantic(), and verifyInputMaps().

◆ parseCommonStructuredOpParts()

◆ parseDenseI64ArrayAttr()

ParseResult parseDenseI64ArrayAttr ( OpAsmParser & parser,
NamedAttrList & attributes,
StringRef attributeName )
static

◆ parseDstStyleOp()

ParseResult parseDstStyleOp ( OpAsmParser & parser,
OperationState & result,
function_ref< ParseResult(OpAsmParser &, NamedAttrList &)> parseAttrsFn = nullptr )
static

◆ parseNamedStructuredOp()

◆ parseNamedStructuredOpRegion()

ParseResult parseNamedStructuredOpRegion ( OpAsmParser & parser,
Region & region,
unsigned numRegionArgs,
TypeRange inputTypes,
TypeRange outputTypes,
ArrayRef< NamedAttribute > attrs,
RegionBuilderFn regionBuilder,
SMLoc loc )
static

◆ parseNamedStructuredOpResults()

ParseResult parseNamedStructuredOpResults ( OpAsmParser & parser,
SmallVectorImpl< Type > & resultTypes )
static

Definition at line 354 of file LinalgOps.cpp.

References mlir::AsmParser::parseOptionalArrowTypeList(), and success().

Referenced by parseNamedStructuredOp().

◆ printCommonStructuredOpParts()

void printCommonStructuredOpParts ( OpAsmPrinter & p,
ValueRange inputs,
ValueRange outputs )
static

Definition at line 317 of file LinalgOps.cpp.

References mlir::ValueRange::getTypes().

◆ printDenseI64ArrayAttr()

void printDenseI64ArrayAttr ( OpAsmPrinter & p,
StringRef attributeName,
ArrayRef< int64_t > attributeValue )
static

Definition at line 1846 of file LinalgOps.cpp.

◆ printNamedStructuredOp()

void printNamedStructuredOp ( OpAsmPrinter & p,
Operation * op,
ValueRange inputs,
ValueRange outputs,
ArrayRef< StringRef > elidedAttrs = {} )
static

Definition at line 399 of file LinalgOps.cpp.

◆ printNamedStructuredOpResults()

void printNamedStructuredOpResults ( OpAsmPrinter & p,
TypeRange resultTypes )
static

Definition at line 392 of file LinalgOps.cpp.

References mlir::AsmPrinter::printOptionalArrowTypeList().

◆ printShortForm()

◆ reduce()

template<typename T>
Value reduce ( OpBuilder & builder,
Location loc,
Value input,
Value output,
int64_t dim )
static

◆ verifyExtendedBatchVariantMatmulSemantic()

template<typename OpTy>
LogicalResult verifyExtendedBatchVariantMatmulSemantic ( OpTy batchVariantMatmulOp,
unsigned opIndex )
static

Verifies the broadcast and transpose semantic specified by the explicit indexing map for the BatchMatmulOp/BatchReduceMatmulOp op for each operand specified by opIndex.

Definition at line 3719 of file LinalgOps.cpp.

References success(), verifyInputMaps(), and verifyOutputMap().

◆ verifyExtendedMatmulSemantic()

LogicalResult verifyExtendedMatmulSemantic ( MatmulOp matmulOp,
unsigned opIndex )
static

Verifies the broadcast and transpose semantic sepecified by the explicit indexing map for the MatmulOp op for each operand specified by opIndex.

Definition at line 3614 of file LinalgOps.cpp.

References areResultExprsSubsetOf(), isBroadcasted(), and success().

◆ verifyInputMaps()

template<typename OpTy>
LogicalResult verifyInputMaps ( OpTy batchVariantMatmulOp,
AffineMap opIndexingMap,
AffineMap defaultIndexingMap,
bool isLHS )
static

◆ verifyOutputMap()

template<typename OpTy>
LogicalResult verifyOutputMap ( OpTy batchVariantMatmulOp,
AffineMap opIndexingMap )
static

This function checks if the given AffineMap for the output of a BatchMatmulOp/BatchReduceMatmulOp has exactly the desired number of result dimensions and if the output map result dimensions are valid.

Definition at line 3678 of file LinalgOps.cpp.

References mlir::AffineMap::getNumResults(), and success().

Referenced by verifyExtendedBatchVariantMatmulSemantic().

◆ verifyYield()

LogicalResult verifyYield ( linalg::YieldOp op,
LinalgOp linalgOp )
static