MLIR
17.0.0git
|
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Tensor/IR/Tensor.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/BuiltinOps.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/Support/LLVM.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/ADT/bit.h"
#include <cassert>
#include <cstdint>
#include <numeric>
#include "mlir/Dialect/Vector/IR/VectorOpsDialect.cpp.inc"
#include "mlir/Dialect/Vector/IR/VectorOpsEnums.cpp.inc"
#include "mlir/Dialect/Vector/IR/VectorOpsAttrDefs.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... | |
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 LogicalResult | incSlicePosition (MutableArrayRef< int64_t > position, ArrayRef< int64_t > shape, ArrayRef< int64_t > offsets) |
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) |
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 Value | foldExtractFromBroadcast (ExtractOp extractOp) |
Fold extractOp with scalar result coming from BroadcastOp or SplatOp. More... | |
static Value | foldExtractFromShapeCast (ExtractOp extractOp) |
static Value | foldExtractFromExtractStrided (ExtractOp extractOp) |
Fold an ExtractOp from ExtractStridedSliceOp. More... | |
static Value | foldExtractStridedOpFromInsertChain (ExtractOp op) |
Fold extract_op fed from a chain of insertStridedSlice ops. More... | |
static void | populateFromInt64AttrArray (ArrayAttr arrayAttr, SmallVectorImpl< int64_t > &results) |
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 bool | isStepIndexArray (ArrayAttr idxArr, uint64_t begin, size_t width) |
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) |
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) |
static VectorType | inferTransferOpMaskType (VectorType vecType, AffineMap permMap) |
Infers the mask type for a transfer op given its vector type and permutation map. More... | |
template<typename TransferOp > | |
static bool | isInBounds (TransferOp op, int64_t resultIdx, int64_t indicesIdx) |
template<typename TransferOp > | |
static LogicalResult | foldTransferInBoundsAttribute (TransferOp op) |
#define GET_ATTRDEF_CLASSES |
#define GET_ATTRDEF_LIST |
#define GET_OP_CLASSES |
#define GET_OP_LIST |
|
strong |
Helper enum to classify mask value.
Enumerator | |
---|---|
AllTrue | |
AllFalse | |
Unknown |
Definition at line 53 of file VectorOps.cpp.
|
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 1830 of file VectorOps.cpp.
|
static |
Definition at line 1217 of file VectorOps.cpp.
|
static |
Fold extractOp with scalar result coming from BroadcastOp or SplatOp.
Definition at line 1461 of file VectorOps.cpp.
References mlir::Type::dyn_cast(), mlir::Builder::getI64ArrayAttr(), mlir::Operation::getOperand(), mlir::Value::getType(), and mlir::Value::isa().
|
static |
Fold an ExtractOp from ExtractStridedSliceOp.
Definition at line 1571 of file VectorOps.cpp.
References mlir::Value::getDefiningOp(), and mlir::Builder::getI64ArrayAttr().
|
static |
Definition at line 1511 of file VectorOps.cpp.
References delinearize(), mlir::Value::getDefiningOp(), mlir::Builder::getI64ArrayAttr(), and mlir::linearize().
|
static |
Fold the result of chains of ExtractOp in place by simply concatenating the positions.
Definition at line 1225 of file VectorOps.cpp.
References mlir::failure(), mlir::Builder::getI64ArrayAttr(), and mlir::success().
|
static |
Fold extract_op fed from a chain of insertStridedSlice ops.
Definition at line 1612 of file VectorOps.cpp.
References mlir::Builder::getI64ArrayAttr(), mlir::Value::getType(), and mlir::Type::isa().
|
static |
Definition at line 2982 of file VectorOps.cpp.
References mlir::Value::cast(), extractStrides(), mlir::failure(), mlir::Builder::getI64ArrayAttr(), and mlir::success().
|
static |
Definition at line 3620 of file VectorOps.cpp.
References mlir::AffineExpr::dyn_cast(), mlir::failure(), mlir::Builder::getBoolArrayAttr(), mlir::AffineMap::getPermutationMap(), mlir::AffineMap::getResult(), isInBounds(), and mlir::success().
|
static |
Definition at line 963 of file VectorOps.cpp.
References mlir::detail::enumerate(), mlir::getAffineDimExpr(), and getResultIndex().
|
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 63 of file VectorOps.cpp.
References AllFalse, AllTrue, mlir::Value::getDefiningOp(), and Unknown.
|
static |
Definition at line 955 of file VectorOps.cpp.
References mlir::AffineMap::getNumResults(), and mlir::AffineMap::getResult().
Referenced by getDimMap().
|
static |
Definition at line 220 of file VectorOps.cpp.
References mlir::failure(), and mlir::success().
|
static |
Definition at line 2907 of file VectorOps.cpp.
|
static |
Infers the mask type for a transfer op given its vector type and permutation map.
The mask in a transfer op operation applies to the tensor/buffer part of it and its type should match the vector shape before any permutation or broadcasting.
Definition at line 3481 of file VectorOps.cpp.
References mlir::AffineMap::compose(), mlir::compressUnusedDims(), mlir::AffineMap::getContext(), and mlir::inversePermutation().
|
static |
Definition at line 3603 of file VectorOps.cpp.
References mlir::Value::getDefiningOp().
Referenced by foldTransferInBoundsAttribute().
|
static |
Definition at line 2469 of file VectorOps.cpp.
References mlir::Attribute::cast(), max(), min(), and mlir::success().
|
static |
Definition at line 2489 of file VectorOps.cpp.
References mlir::detail::enumerate(), max(), min(), and mlir::success().
|
static |
Definition at line 2454 of file VectorOps.cpp.
References mlir::success().
|
static |
Definition at line 2120 of file VectorOps.cpp.
|
static |
Definition at line 2511 of file VectorOps.cpp.
References mlir::detail::enumerate(), max(), min(), and mlir::success().
|
static |
Definition at line 112 of file VectorOps.cpp.
References mlir::Type::isa(), mlir::Type::isIntOrIndex(), and mlir::Type::isIntOrIndexOrFloat().
|
static |
Definition at line 2532 of file VectorOps.cpp.
|
static |
Definition at line 1809 of file VectorOps.cpp.
References mlir::Attribute::cast().
|
static |
Definition at line 3450 of file VectorOps.cpp.
References mlir::OpAsmPrinter::printOptionalAttrDict().
|
static |
Definition at line 740 of file VectorOps.cpp.
|
static |
Definition at line 751 of file VectorOps.cpp.
References mlir::AffineMap::compose(), mlir::Type::dyn_cast(), mlir::AffineMap::get(), mlir::getAffineConstantExpr(), mlir::AffineMap::getNumInputs(), mlir::AffineMap::getResults(), mlir::getUnusedDimsBitVector(), mlir::Type::isa(), mlir::simplifyAffineMap(), and mlir::success().
|
static |
Definition at line 3336 of file VectorOps.cpp.
References mlir::AffineExpr::dyn_cast(), mlir::AffineMap::getNumInputs(), mlir::AffineMap::getResults(), and mlir::success().
|
static |
Definition at line 3365 of file VectorOps.cpp.
References mlir::Type::dyn_cast(), mlir::AffineMap::getNumInputs(), mlir::AffineMap::getNumResults(), mlir::AffineMap::getNumSymbols(), mlir::AffineMap::getResult(), mlir::DataLayout::getTypeSizeInBits(), mlir::AffineConstantExpr::getValue(), mlir::BoolAttr::getValue(), mlir::AffineExpr::isa(), and mlir::success().