MLIR  22.0.0git
Classes | Namespaces | Macros | Enumerations | Functions
VectorOps.cpp File Reference
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Conversion/ConvertToLLVM/ToLLVMInterface.h"
#include "mlir/Dialect/Affine/IR/ValueBoundsOpInterfaceImpl.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/Dialect/UB/IR/UBOps.h"
#include "mlir/Dialect/Utils/IndexingUtils.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/BuiltinTypes.h"
#include "mlir/IR/DialectImplementation.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/OpImplementation.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Interfaces/SubsetOpInterface.h"
#include "mlir/Interfaces/ValueBoundsOpInterface.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/InliningUtils.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Casting.h"
#include <cassert>
#include <cstdint>
#include "mlir/Dialect/Vector/IR/VectorDialect.cpp.inc"
#include "mlir/Dialect/Vector/IR/VectorEnums.cpp.inc"
#include "mlir/Dialect/Vector/IR/VectorAttributes.cpp.inc"
#include "mlir/Dialect/Vector/IR/VectorOps.cpp.inc"

Go to the source code of this file.

Classes

struct  mlir::vector::detail::BitmaskEnumStorage
 
struct  CanonicalizeContractAdd< AddOpType >
 Return a fused vector::ContractionOp which represents a patterns such as: More...
 
class  FromElementsToShapeCast
 Rewrite from_elements on multiple scalar extracts as a shape_cast on a single extract. More...
 

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::vector
 
 mlir::vector::detail
 

Macros

#define GET_ATTRDEF_LIST
 
#define GET_OP_LIST
 
#define GET_ATTRDEF_CLASSES
 
#define GET_OP_CLASSES
 

Enumerations

enum class  MaskFormat { AllTrue = 0 , AllFalse = 1 , Unknown = 2 }
 Helper enum to classify mask value. More...
 

Functions

static MaskFormat getMaskFormat (Value mask)
 Helper method to classify a mask value. More...
 
static bool isSupportedCombiningKind (CombiningKind combiningKind, Type elementType)
 
static unsigned getEffectiveVectorRankForXferOp (ShapedType shapedType, VectorType vectorType)
 Returns the effective rank of the vector to read/write for Xfer Ops. More...
 
static bool isSplatWriteConsistentWithMaskedRead (vector::TransferWriteOp write, vector::TransferReadOp read)
 Check if write is of a constant splat and the masked read is padded with the same splat value – meaning it could be the same value as the initial constant splat. More...
 
static LogicalResult incSlicePosition (MutableArrayRef< int64_t > position, ArrayRef< int64_t > shape, ArrayRef< int64_t > offsets)
 
static Attribute convertIntegerAttr (Attribute attr, Type expectedType)
 Converts an IntegerAttr to have the specified type if needed. More...
 
static bool verifyDimMap (VectorType lhsType, VectorType rhsType, const std::vector< std::pair< int64_t, int64_t >> &map)
 
static LogicalResult verifyOutputShape (ContractionOp op, VectorType lhsType, VectorType rhsType, Type accType, Type resType, const std::vector< std::pair< int64_t, int64_t >> &contractingDimMap, const std::vector< std::pair< int64_t, int64_t >> &batchDimMap)
 
static int64_t getResultIndex (AffineMap map, AffineExpr targetExpr)
 
static std::vector< std::pair< int64_t, int64_t > > getDimMap (ArrayRef< AffineMap > indexingMaps, ArrayAttr iteratorTypes, IteratorType targetIteratorType, MLIRContext *context)
 
static bool isValidPositiveIndexOrPoison (int64_t index, int64_t poisonValue, int64_t maxIndex)
 
template<typename IntType >
static SmallVector< IntType > extractVector (ArrayAttr arrayAttr)
 
static LogicalResult foldExtractOpFromExtractChain (ExtractOp extractOp)
 Fold the result of chains of ExtractOp in place by simply concatenating the positions. More...
 
static bool hasZeroDimVectors (Operation *op)
 Returns true if the operation has a 0-D vector type operand or result. More...
 
static bool isBroadcastLike (Operation *op)
 All BroadcastOps and SplatOps, as well as ShapeCastOps that only prepend 1s, are considered to be 'broadcastlike'. More...
 
static Value foldExtractFromBroadcast (ExtractOp extractOp)
 Fold extract(broadcast(X)) to either extract(X) or just X. More...
 
static Value foldExtractFromShuffle (ExtractOp extractOp)
 Fold extractOp coming from ShuffleOp. More...
 
static Value foldExtractFromShapeCast (ExtractOp extractOp)
 
static Value foldExtractFromExtractStrided (ExtractOp extractOp)
 Fold an ExtractOp from ExtractStridedSliceOp. More...
 
static Value foldExtractStridedOpFromInsertChain (ExtractOp extractOp)
 Fold extract_op fed from a chain of insertStridedSlice ops. More...
 
static Value foldScalarExtractFromFromElements (ExtractOp extractOp)
 Try to fold the extraction of a scalar from a vector defined by vector.from_elements. More...
 
template<typename OpType , typename AdaptorType >
static Value extractInsertFoldConstantOp (OpType op, AdaptorType adaptor, SmallVectorImpl< Value > &operands)
 If the dynamic indices of extractOp or insertOp are in fact constants, then fold it. More...
 
static Attribute foldPoisonIndexInsertExtractOp (MLIRContext *context, ArrayRef< int64_t > staticPos, int64_t poisonVal)
 Fold an insert or extract operation into an poison value when a poison index is found at any dimension of the static position. More...
 
static Attribute foldPoisonSrcExtractOp (Attribute srcAttr)
 Fold a vector extract from is a poison source. More...
 
static Attribute foldDenseElementsAttrSrcExtractOp (ExtractOp extractOp, Attribute srcAttr)
 Fold a vector extract extracting from a DenseElementsAttr. More...
 
static void populateFromInt64AttrArray (ArrayAttr arrayAttr, SmallVectorImpl< int64_t > &results)
 
static bool haveSameDefiningOp (OperandRange operands, Operation *defOp)
 Returns true if all the operands are defined by defOp. More...
 
static LogicalResult foldToElementsFromElements (ToElementsOp toElementsOp, SmallVectorImpl< OpFoldResult > &results)
 Folds vector.to_elements(vector.from_elements(e0, e1, ...)) into (e0, e1, ...). More...
 
static OpFoldResult foldFromElementsToElements (FromElementsOp fromElementsOp)
 Folds vector.from_elements(vector.to_elements(vector)) into vector. More...
 
static OpFoldResult foldFromElementsToConstant (FromElementsOp fromElementsOp, ArrayRef< Attribute > elements)
 Fold vector.from_elements to a constant when all operands are constants. More...
 
static LogicalResult rewriteFromElementsAsBroadcast (FromElementsOp fromElementsOp, PatternRewriter &rewriter)
 Rewrite vector.from_elements as vector.broadcast if the elements are the same. More...
 
static llvm::SetVector< int64_t > computeBroadcastedUnitDims (ArrayRef< int64_t > srcShape, ArrayRef< int64_t > dstShape)
 Return the dimensions of the result vector that were formerly ones in the source tensor and thus correspond to "dim-1" broadcasting. More...
 
static LogicalResult foldBroadcastOfShapeCast (BroadcastOp broadcastOp)
 
template<typename T >
static bool isStepIndexArray (ArrayRef< T > idxArr, uint64_t begin, size_t width)
 
static int64_t calculateInsertPosition (VectorType destTy, ArrayRef< int64_t > positions)
 
static Attribute foldDenseElementsAttrDestInsertOp (InsertOp insertOp, Attribute srcAttr, Attribute dstAttr, int64_t maxVectorSizeFoldThreshold)
 
static Value foldInsertUseChain (InsertOp insertOp)
 Folder to replace the dest operand of the insert op with the root dest of the insert op use chain. More...
 
template<typename OpType >
static LogicalResult isIntegerArrayAttrSmallerThanShape (OpType op, ArrayAttr arrayAttr, ArrayRef< int64_t > shape, StringRef attrName)
 
template<typename OpType >
static LogicalResult isIntegerArrayAttrConfinedToRange (OpType op, ArrayAttr arrayAttr, int64_t min, int64_t max, StringRef attrName, bool halfOpen=true)
 
template<typename OpType >
static LogicalResult isIntegerArrayAttrConfinedToShape (OpType op, ArrayAttr arrayAttr, ArrayRef< int64_t > shape, StringRef attrName, bool halfOpen=true, int64_t min=0)
 
template<typename OpType >
static LogicalResult isSumOfIntegerArrayAttrConfinedToShape (OpType op, ArrayAttr arrayAttr1, ArrayAttr arrayAttr2, ArrayRef< int64_t > shape, StringRef attrName1, StringRef attrName2, bool halfOpen=true, int64_t min=1)
 
static ArrayAttr makeI64ArrayAttr (ArrayRef< int64_t > values, MLIRContext *context)
 
static Type inferStridedSliceOpResultType (VectorType vectorType, ArrayAttr offsets, ArrayAttr sizes, ArrayAttr strides)
 
static LogicalResult foldExtractStridedOpFromInsertChain (ExtractStridedSliceOp op)
 
static OpFoldResult foldExtractStridedSliceNonSplatConstant (ExtractStridedSliceOp op, Attribute foldInput)
 
template<typename EmitFun >
static LogicalResult verifyPermutationMap (AffineMap permutationMap, EmitFun emitOpError)
 
static LogicalResult verifyTransferOp (VectorTransferOpInterface op, ShapedType shapedType, VectorType vectorType, VectorType maskType, VectorType inferredMaskType, AffineMap permutationMap, ArrayAttr inBounds)
 
static void printTransferAttrs (OpAsmPrinter &p, VectorTransferOpInterface op)
 
template<typename TransferOp >
static bool isInBounds (TransferOp op, int64_t resultIdx, int64_t indicesIdx)
 
template<typename TransferOp >
static LogicalResult foldTransferInBoundsAttribute (TransferOp op)
 
template<typename TransferOp >
static LogicalResult foldTransferFullMask (TransferOp op)
 

Macro Definition Documentation

◆ GET_ATTRDEF_CLASSES

#define GET_ATTRDEF_CLASSES

◆ GET_ATTRDEF_LIST

#define GET_ATTRDEF_LIST

◆ GET_OP_CLASSES

#define GET_OP_CLASSES

◆ GET_OP_LIST

#define GET_OP_LIST

Enumeration Type Documentation

◆ MaskFormat

enum MaskFormat
strong

Helper enum to classify mask value.

Enumerator
AllTrue 
AllFalse 
Unknown 

Definition at line 59 of file VectorOps.cpp.

Function Documentation

◆ calculateInsertPosition()

static int64_t calculateInsertPosition ( VectorType  destTy,
ArrayRef< int64_t >  positions 
)
static

Definition at line 3296 of file VectorOps.cpp.

References computeStrides(), copy(), and mlir::linearize().

Referenced by foldDenseElementsAttrDestInsertOp().

◆ computeBroadcastedUnitDims()

static llvm::SetVector<int64_t> computeBroadcastedUnitDims ( ArrayRef< int64_t >  srcShape,
ArrayRef< int64_t >  dstShape 
)
static

Return the dimensions of the result vector that were formerly ones in the source tensor and thus correspond to "dim-1" broadcasting.

Definition at line 2649 of file VectorOps.cpp.

◆ convertIntegerAttr()

static Attribute convertIntegerAttr ( Attribute  attr,
Type  expectedType 
)
static

Converts an IntegerAttr to have the specified type if needed.

This handles cases where constant attributes have a different type than the target element type. If the input attribute is not an IntegerAttr or already has the correct type, returns it unchanged.

Definition at line 403 of file VectorOps.cpp.

References mlir::get().

Referenced by foldDenseElementsAttrDestInsertOp(), and foldFromElementsToConstant().

◆ extractInsertFoldConstantOp()

template<typename OpType , typename AdaptorType >
static Value extractInsertFoldConstantOp ( OpType  op,
AdaptorType  adaptor,
SmallVectorImpl< Value > &  operands 
)
static

If the dynamic indices of extractOp or insertOp are in fact constants, then fold it.

Definition at line 2024 of file VectorOps.cpp.

References vectorShape().

◆ extractVector()

template<typename IntType >
static SmallVector<IntType> extractVector ( ArrayAttr  arrayAttr)
static

Definition at line 1373 of file VectorOps.cpp.

◆ foldBroadcastOfShapeCast()

static LogicalResult foldBroadcastOfShapeCast ( BroadcastOp  broadcastOp)
static

Definition at line 2861 of file VectorOps.cpp.

References mlir::vector::isBroadcastableTo(), and min().

◆ foldDenseElementsAttrDestInsertOp()

static Attribute foldDenseElementsAttrDestInsertOp ( InsertOp  insertOp,
Attribute  srcAttr,
Attribute  dstAttr,
int64_t  maxVectorSizeFoldThreshold 
)
static

Converts the expected type to an IntegerAttr if there's a mismatch.

Definition at line 3471 of file VectorOps.cpp.

References calculateInsertPosition(), convertIntegerAttr(), copy(), and mlir::get().

◆ foldDenseElementsAttrSrcExtractOp()

static Attribute foldDenseElementsAttrSrcExtractOp ( ExtractOp  extractOp,
Attribute  srcAttr 
)
static

Fold a vector extract extracting from a DenseElementsAttr.

Definition at line 2091 of file VectorOps.cpp.

References computeStrides(), copy(), mlir::get(), and mlir::linearize().

◆ foldExtractFromBroadcast()

static Value foldExtractFromBroadcast ( ExtractOp  extractOp)
static

Fold extract(broadcast(X)) to either extract(X) or just X.

Example:

   broadcast             extract [1][2]

(3, 4) -----—> (2, 3, 4) -------------—> (4)

becomes extract [1] (3,4) ----------------------------------—> (4)

The variable names used in this implementation correspond to the above shapes as,

  • (3, 4) is input shape.
  • (2, 3, 4) is broadcast shape.
  • (4) is extract shape.

This folding is possible when the suffix of input shape is the same as extract shape.

Definition at line 1694 of file VectorOps.cpp.

References mlir::decomposeMixedValues(), mlir::detail::enumerate(), mlir::Builder::getIndexAttr(), mlir::Operation::getOperand(), mlir::Value::getType(), and isBroadcastLike().

◆ foldExtractFromExtractStrided()

static Value foldExtractFromExtractStrided ( ExtractOp  extractOp)
static

Fold an ExtractOp from ExtractStridedSliceOp.

Definition at line 1856 of file VectorOps.cpp.

References hasZeroDimVectors().

◆ foldExtractFromShapeCast()

static Value foldExtractFromShapeCast ( ExtractOp  extractOp)
static

Definition at line 1791 of file VectorOps.cpp.

References delinearize(), and mlir::linearize().

◆ foldExtractFromShuffle()

static Value foldExtractFromShuffle ( ExtractOp  extractOp)
static

Fold extractOp coming from ShuffleOp.

Example:

shuffle = vector.shuffle a, b [0, 8, 7, 15] : vector<8xf32>, vector<8xf32> extract = vector.extract shuffle[3] : f32 from vector<4xf32> -> extract = vector.extract b[7] : f32 from vector<8xf32>

Definition at line 1759 of file VectorOps.cpp.

◆ foldExtractOpFromExtractChain()

static LogicalResult foldExtractOpFromExtractChain ( ExtractOp  extractOp)
static

Fold the result of chains of ExtractOp in place by simply concatenating the positions.

Definition at line 1381 of file VectorOps.cpp.

◆ foldExtractStridedOpFromInsertChain() [1/2]

static Value foldExtractStridedOpFromInsertChain ( ExtractOp  extractOp)
static

Fold extract_op fed from a chain of insertStridedSlice ops.

Definition at line 1908 of file VectorOps.cpp.

References hasZeroDimVectors().

◆ foldExtractStridedOpFromInsertChain() [2/2]

static LogicalResult foldExtractStridedOpFromInsertChain ( ExtractStridedSliceOp  op)
static

Definition at line 4090 of file VectorOps.cpp.

References extractStrides(), and mlir::Builder::getI64ArrayAttr().

◆ foldExtractStridedSliceNonSplatConstant()

static OpFoldResult foldExtractStridedSliceNonSplatConstant ( ExtractStridedSliceOp  op,
Attribute  foldInput 
)
static

◆ foldFromElementsToConstant()

static OpFoldResult foldFromElementsToConstant ( FromElementsOp  fromElementsOp,
ArrayRef< Attribute elements 
)
static

Fold vector.from_elements to a constant when all operands are constants.

Example: c1 = arith.constant 1 : i32 c2 = arith.constant 2 : i32 v = vector.from_elements c1, c2 : vector<2xi32> => v = arith.constant dense<[1, 2]> : vector<2xi32>

Definition at line 2464 of file VectorOps.cpp.

References convertIntegerAttr(), and mlir::get().

◆ foldFromElementsToElements()

static OpFoldResult foldFromElementsToElements ( FromElementsOp  fromElementsOp)
static

Folds vector.from_elements(vector.to_elements(vector)) into vector.

Case #1: Input and output vectors are the same.

%0:3 = vector.to_elements a : vector<3xf32> %1 = vector.from_elements %0#0, %0#1, %0#2 : vector<3xf32> user_op %1

becomes:

user_op a

Definition at line 2431 of file VectorOps.cpp.

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

◆ foldInsertUseChain()

static Value foldInsertUseChain ( InsertOp  insertOp)
static

Folder to replace the dest operand of the insert op with the root dest of the insert op use chain.

Definition at line 3518 of file VectorOps.cpp.

References mlir::Value::getDefiningOp(), and mlir::Operation::setOperand().

◆ foldPoisonIndexInsertExtractOp()

static Attribute foldPoisonIndexInsertExtractOp ( MLIRContext context,
ArrayRef< int64_t >  staticPos,
int64_t  poisonVal 
)
static

Fold an insert or extract operation into an poison value when a poison index is found at any dimension of the static position.

Definition at line 2073 of file VectorOps.cpp.

References mlir::get().

◆ foldPoisonSrcExtractOp()

static Attribute foldPoisonSrcExtractOp ( Attribute  srcAttr)
static

Fold a vector extract from is a poison source.

Definition at line 2083 of file VectorOps.cpp.

◆ foldScalarExtractFromFromElements()

static Value foldScalarExtractFromFromElements ( ExtractOp  extractOp)
static

Try to fold the extraction of a scalar from a vector defined by vector.from_elements.

E.g.:

%0 = vector.from_elements a, b : vector<2xf32> %1 = vector.extract %0[0] : f32 from vector<2xf32> ==> fold to a

Definition at line 1988 of file VectorOps.cpp.

References mlir::Value::getDefiningOp().

◆ foldToElementsFromElements()

static LogicalResult foldToElementsFromElements ( ToElementsOp  toElementsOp,
SmallVectorImpl< OpFoldResult > &  results 
)
static

Folds vector.to_elements(vector.from_elements(e0, e1, ...)) into (e0, e1, ...).

For example:

%0 = vector.from_elements a, b, c : vector<3xf32> %1:3 = vector.to_elements %0 : vector<3xf32> user_op %1#0, %1#1, %1#2

becomes:

user_op a, b, c

Definition at line 2389 of file VectorOps.cpp.

◆ foldTransferFullMask()

template<typename TransferOp >
static LogicalResult foldTransferFullMask ( TransferOp  op)
static

Definition at line 4912 of file VectorOps.cpp.

References AllTrue, and getMaskFormat().

◆ foldTransferInBoundsAttribute()

template<typename TransferOp >
static LogicalResult foldTransferInBoundsAttribute ( TransferOp  op)
static

◆ getDimMap()

static std::vector<std::pair<int64_t, int64_t> > getDimMap ( ArrayRef< AffineMap indexingMaps,
ArrayAttr  iteratorTypes,
IteratorType  targetIteratorType,
MLIRContext context 
)
static

◆ getEffectiveVectorRankForXferOp()

static unsigned getEffectiveVectorRankForXferOp ( ShapedType  shapedType,
VectorType  vectorType 
)
static

Returns the effective rank of the vector to read/write for Xfer Ops.

When the element type of the shaped type is a scalar, this will simply return the rank of the vector ( the result for xfer_read or the value to store for xfer_write).

When the element type of the base shaped type is a vector, returns the difference between the original vector type and the element type of the shaped type.

EXAMPLE 1 (element type is a scalar):

  • shapedType = tensor<10x20xf32>, vectorType = vector<2x4xf32>
    • shapedType.getElementType() = f32 (rank 0)
    • vectorType.getRank() = 2
    • Result = 2 - 0 = 2

EXAMPLE 2 (element type is a vector):

  • shapedType = tensor<10xvector<20xf32>>, vectorType = vector<20xf32>
    • shapedType.getElementType() = vector<20xf32> (rank 1)
    • vectorType.getRank() = 1
    • Result = 1 - 1 = 0

This is used to determine the number of minor dimensions for identity maps in vector transfer Ops.

Definition at line 178 of file VectorOps.cpp.

Referenced by mlir::vector::getTransferMinorIdentityMap().

◆ getMaskFormat()

static MaskFormat getMaskFormat ( Value  mask)
static

Helper method to classify a mask value.

Currently, the method looks "under the hood" of a constant value with dense attributes and a constant mask operation (since the client may be called at various stages during progressive lowering).

Definition at line 69 of file VectorOps.cpp.

References AllFalse, AllTrue, mlir::Value::getDefiningOp(), and Unknown.

Referenced by foldTransferFullMask().

◆ getResultIndex()

static int64_t getResultIndex ( AffineMap  map,
AffineExpr  targetExpr 
)
static

Definition at line 1121 of file VectorOps.cpp.

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

Referenced by getDimMap().

◆ hasZeroDimVectors()

static bool hasZeroDimVectors ( Operation op)
static

Returns true if the operation has a 0-D vector type operand or result.

Definition at line 1642 of file VectorOps.cpp.

References mlir::Operation::getOperandTypes(), and mlir::Operation::getResultTypes().

Referenced by foldExtractFromExtractStrided(), and foldExtractStridedOpFromInsertChain().

◆ haveSameDefiningOp()

static bool haveSameDefiningOp ( OperandRange  operands,
Operation defOp 
)
static

Returns true if all the operands are defined by defOp.

Otherwise, returns false.

Definition at line 2367 of file VectorOps.cpp.

References mlir::Value::getDefiningOp().

Referenced by foldFromElementsToElements().

◆ incSlicePosition()

static LogicalResult incSlicePosition ( MutableArrayRef< int64_t >  position,
ArrayRef< int64_t >  shape,
ArrayRef< int64_t >  offsets 
)
static

Definition at line 327 of file VectorOps.cpp.

Referenced by foldExtractStridedSliceNonSplatConstant().

◆ inferStridedSliceOpResultType()

static Type inferStridedSliceOpResultType ( VectorType  vectorType,
ArrayAttr  offsets,
ArrayAttr  sizes,
ArrayAttr  strides 
)
static

Definition at line 3998 of file VectorOps.cpp.

References mlir::get().

◆ isBroadcastLike()

static bool isBroadcastLike ( Operation op)
static

All BroadcastOps and SplatOps, as well as ShapeCastOps that only prepend 1s, are considered to be 'broadcastlike'.

Definition at line 1654 of file VectorOps.cpp.

Referenced by foldExtractFromBroadcast().

◆ isInBounds()

template<typename TransferOp >
static bool isInBounds ( TransferOp  op,
int64_t  resultIdx,
int64_t  indicesIdx 
)
static

Definition at line 4840 of file VectorOps.cpp.

References getConstantIntValue().

Referenced by foldTransferInBoundsAttribute().

◆ isIntegerArrayAttrConfinedToRange()

template<typename OpType >
static LogicalResult isIntegerArrayAttrConfinedToRange ( OpType  op,
ArrayAttr  arrayAttr,
int64_t  min,
int64_t  max,
StringRef  attrName,
bool  halfOpen = true 
)
static

Definition at line 3600 of file VectorOps.cpp.

References max(), and min().

◆ isIntegerArrayAttrConfinedToShape()

template<typename OpType >
static LogicalResult isIntegerArrayAttrConfinedToShape ( OpType  op,
ArrayAttr  arrayAttr,
ArrayRef< int64_t >  shape,
StringRef  attrName,
bool  halfOpen = true,
int64_t  min = 0 
)
static

Definition at line 3620 of file VectorOps.cpp.

References mlir::detail::enumerate(), max(), and min().

◆ isIntegerArrayAttrSmallerThanShape()

template<typename OpType >
static LogicalResult isIntegerArrayAttrSmallerThanShape ( OpType  op,
ArrayAttr  arrayAttr,
ArrayRef< int64_t >  shape,
StringRef  attrName 
)
static

Definition at line 3585 of file VectorOps.cpp.

◆ isSplatWriteConsistentWithMaskedRead()

static bool isSplatWriteConsistentWithMaskedRead ( vector::TransferWriteOp  write,
vector::TransferReadOp  read 
)
static

Check if write is of a constant splat and the masked read is padded with the same splat value – meaning it could be the same value as the initial constant splat.

Definition at line 206 of file VectorOps.cpp.

References mlir::DenseElementsAttr::getSplatValue(), mlir::DenseElementsAttr::isSplat(), mlir::m_Constant(), and mlir::matchPattern().

◆ isStepIndexArray()

template<typename T >
static bool isStepIndexArray ( ArrayRef< T >  idxArr,
uint64_t  begin,
size_t  width 
)
static

Definition at line 3007 of file VectorOps.cpp.

◆ isSumOfIntegerArrayAttrConfinedToShape()

template<typename OpType >
static LogicalResult isSumOfIntegerArrayAttrConfinedToShape ( OpType  op,
ArrayAttr  arrayAttr1,
ArrayAttr  arrayAttr2,
ArrayRef< int64_t >  shape,
StringRef  attrName1,
StringRef  attrName2,
bool  halfOpen = true,
int64_t  min = 1 
)
static

Definition at line 3643 of file VectorOps.cpp.

References mlir::detail::enumerate(), max(), and min().

◆ isSupportedCombiningKind()

static bool isSupportedCombiningKind ( CombiningKind  combiningKind,
Type  elementType 
)
static

◆ isValidPositiveIndexOrPoison()

static bool isValidPositiveIndexOrPoison ( int64_t  index,
int64_t  poisonValue,
int64_t  maxIndex 
)
static

Definition at line 1263 of file VectorOps.cpp.

◆ makeI64ArrayAttr()

static ArrayAttr makeI64ArrayAttr ( ArrayRef< int64_t >  values,
MLIRContext context 
)
static

Definition at line 3664 of file VectorOps.cpp.

References mlir::get().

◆ populateFromInt64AttrArray()

static void populateFromInt64AttrArray ( ArrayAttr  arrayAttr,
SmallVectorImpl< int64_t > &  results 
)
static

Definition at line 2347 of file VectorOps.cpp.

◆ printTransferAttrs()

static void printTransferAttrs ( OpAsmPrinter p,
VectorTransferOpInterface  op 
)
static

Definition at line 4666 of file VectorOps.cpp.

References mlir::OpAsmPrinter::printOptionalAttrDict().

◆ rewriteFromElementsAsBroadcast()

static LogicalResult rewriteFromElementsAsBroadcast ( FromElementsOp  fromElementsOp,
PatternRewriter rewriter 
)
static

Rewrite vector.from_elements as vector.broadcast if the elements are the same.

Example: %0 = vector.from_elements a, a, a : vector<3xf32> => %0 = vector.broadcast a : f32 to vector<3xf32>

Definition at line 2499 of file VectorOps.cpp.

References mlir::RewriterBase::replaceOpWithNewOp().

◆ verifyDimMap()

static bool verifyDimMap ( VectorType  lhsType,
VectorType  rhsType,
const std::vector< std::pair< int64_t, int64_t >> &  map 
)
static

Definition at line 910 of file VectorOps.cpp.

◆ verifyOutputShape()

static LogicalResult verifyOutputShape ( ContractionOp  op,
VectorType  lhsType,
VectorType  rhsType,
Type  accType,
Type  resType,
const std::vector< std::pair< int64_t, int64_t >> &  contractingDimMap,
const std::vector< std::pair< int64_t, int64_t >> &  batchDimMap 
)
static

◆ verifyPermutationMap()

template<typename EmitFun >
static LogicalResult verifyPermutationMap ( AffineMap  permutationMap,
EmitFun  emitOpError 
)
static

◆ verifyTransferOp()

static LogicalResult verifyTransferOp ( VectorTransferOpInterface  op,
ShapedType  shapedType,
VectorType  vectorType,
VectorType  maskType,
VectorType  inferredMaskType,
AffineMap  permutationMap,
ArrayAttr  inBounds 
)
static