|
MLIR
22.0.0git
|
#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/Linalg/IR/RelayoutOpInterface.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/Builders.h"#include "mlir/IR/BuiltinAttributeInterfaces.h"#include "mlir/IR/BuiltinTypeInterfaces.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/IRMapping.h"#include "mlir/IR/Matchers.h"#include "mlir/IR/OpDefinition.h"#include "mlir/IR/PatternMatch.h"#include "mlir/IR/TypeUtilities.h"#include "mlir/Interfaces/DestinationStyleOpInterface.h"#include "mlir/Interfaces/InferIntRangeInterface.h"#include "mlir/Interfaces/LoopLikeInterface.h"#include "mlir/Interfaces/Utils/InferIntRangeCommon.h"#include "mlir/Interfaces/ViewLikeInterface.h"#include "mlir/Support/LLVM.h"#include "llvm/ADT/DenseSet.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallBitVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/Support/Casting.h"#include "llvm/Support/MathExtras.h"#include <optional>#include "mlir/Dialect/Tensor/IR/TensorOps.cpp.inc"Go to the source code of this file.
Classes | |
| struct | SliceReturnTypeCanonicalizer |
| Return the canonical type of the result of an extract_slice op. More... | |
| struct | SliceCanonicalizer |
| A canonicalizer wrapper to replace ExtractSliceOps. More... | |
| struct | FoldTensorCastProducerOp |
Folds a tensor.cast op into a consuming DestinationStyleOpInterface op if the tensor.cast has source that is more static than the consuming op. More... | |
Macros | |
| #define | GET_OP_CLASSES |
Functions | |
| static llvm::SmallBitVector | getDroppedDims (ArrayRef< int64_t > reducedShape, ArrayRef< OpFoldResult > mixedSizes) |
| Compute the dropped dimensions of a rank-reducing tensor.extract_slice op or rank-extending tensor.insert_slice op. More... | |
| static RankedTensorType | foldDynamicToStaticDimSizes (RankedTensorType type, ValueRange dynamicSizes, SmallVector< Value > &foldedDynamicSizes) |
| Given a ranked tensor type and a range of values that defines its dynamic dimension sizes, turn all dynamic sizes that have a constant value into static dimension sizes. More... | |
| static TensorType | joinShapes (TensorType one, TensorType two) |
| Compute a TensorType that has the joined shape knowledge of the two given TensorTypes. More... | |
| static Value | foldExtractAfterInsert (ExtractOp extractOp) |
| If we have an ExtractOp consuming an InsertOp with the same indices, we can return the InsertOp's scalar directly. More... | |
| static LogicalResult | verifyGatherOrScatterDims (Operation *op, ArrayRef< int64_t > dims, ArrayRef< int64_t > indices, int64_t rank, StringRef gatherOrScatter, StringRef sourceOrDest) |
| static int64_t | getNumElements (ShapedType type) |
| template<typename TensorReshapeOp , bool isExpansion = std::is_same< TensorReshapeOp, ExpandShapeOp>::value> | |
| static LogicalResult | verifyTensorReshapeOp (TensorReshapeOp op, RankedTensorType expandedType, RankedTensorType collapsedType) |
| static LogicalResult | produceSliceErrorMsg (SliceVerificationResult result, Operation *op, RankedTensorType expectedType) |
| static LogicalResult | foldIdentityOffsetSizeAndStrideOpInterface (OffsetSizeAndStrideOpInterface op, ShapedType shapedType) |
| static Value | foldExtractAfterInsertSlice (ExtractSliceOp extractOp) |
| If we have an ExtractSliceOp consuming an InsertSliceOp with the same slice, we can return the InsertSliceOp's source directly. More... | |
| static SliceVerificationResult | verifyInsertSliceOp (RankedTensorType srcType, RankedTensorType dstType, ArrayRef< int64_t > staticOffsets, ArrayRef< int64_t > staticSizes, ArrayRef< int64_t > staticStrides, RankedTensorType *expectedType=nullptr) |
| Rank-reducing type verification for both InsertSliceOp and ParallelInsertSliceOp. More... | |
| static LogicalResult | foldInsertAfterInsertSlice (InsertSliceOp insertOp) |
| If we have two consecutive InsertSliceOp writing to the same slice, we can mutate the second InsertSliceOp's destination to the first one's. More... | |
| static Value | foldInsertAfterExtractSlice (InsertSliceOp insertOp) |
| Folds round-trip extract/insert slice op pairs. More... | |
| static bool | foldTensorCastPrecondition (DestinationStyleOpInterface op) |
| #define GET_OP_CLASSES |
Definition at line 4135 of file TensorOps.cpp.
|
static |
Given a ranked tensor type and a range of values that defines its dynamic dimension sizes, turn all dynamic sizes that have a constant value into static dimension sizes.
Definition at line 180 of file TensorOps.cpp.
References mlir::get(), and mlir::getConstantIntValue().
|
static |
If we have an ExtractOp consuming an InsertOp with the same indices, we can return the InsertOp's scalar directly.
Definition at line 1368 of file TensorOps.cpp.
References mlir::getAsOpFoldResult(), and mlir::Value::getDefiningOp().
|
static |
If we have an ExtractSliceOp consuming an InsertSliceOp with the same slice, we can return the InsertSliceOp's source directly.
Definition at line 2749 of file TensorOps.cpp.
References mlir::Value::getDefiningOp().
|
static |
Definition at line 2727 of file TensorOps.cpp.
References mlir::getConstantIntValue().
|
static |
Folds round-trip extract/insert slice op pairs.
Example:
can be folded into val.
Definition at line 2907 of file TensorOps.cpp.
References mlir::Value::getDefiningOp().
|
static |
If we have two consecutive InsertSliceOp writing to the same slice, we can mutate the second InsertSliceOp's destination to the first one's.
Example:
folds into:
This pattern works with both InsertSliceOp and ParallelInsertSliceOp.
Definition at line 2887 of file TensorOps.cpp.
|
static |
Definition at line 4057 of file TensorOps.cpp.
References mlir::tensor::hasFoldableTensorCastOperand().
Referenced by FoldTensorCastProducerOp::matchAndRewrite().
|
static |
Compute the dropped dimensions of a rank-reducing tensor.extract_slice op or rank-extending tensor.insert_slice op.
Definition at line 136 of file TensorOps.cpp.
References mlir::detail::enumerate().
|
static |
Definition at line 1812 of file TensorOps.cpp.
|
static |
Compute a TensorType that has the joined shape knowledge of the two given TensorTypes.
The element types need to match.
Definition at line 416 of file TensorOps.cpp.
References mlir::get(), mlir::TensorType::getElementType(), and mlir::TensorType::hasRank().
|
static |
Definition at line 2434 of file TensorOps.cpp.
References mlir::ElemTypeMismatch, mlir::Operation::emitError(), mlir::RankTooLarge, mlir::SizeMismatch, and mlir::Success.
|
static |
Definition at line 1554 of file TensorOps.cpp.
References mlir::Operation::emitOpError().
|
static |
Rank-reducing type verification for both InsertSliceOp and ParallelInsertSliceOp.
Definition at line 2836 of file TensorOps.cpp.
References mlir::isRankReducedType().
|
static |
Definition at line 2039 of file TensorOps.cpp.
References mlir::remark::failed(), mlir::tensor::isSameTypeWithoutEncoding(), and mlir::verifyReshapeLikeTypes().