|
MLIR 24.0.0git
|
#include "mlir/Conversion/TosaToLinalg/TosaToLinalg.h"#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Arith/Utils/Utils.h"#include "mlir/Dialect/Index/IR/IndexOps.h"#include "mlir/Dialect/Linalg/IR/Linalg.h"#include "mlir/Dialect/Math/IR/Math.h"#include "mlir/Dialect/SCF/IR/SCF.h"#include "mlir/Dialect/Tensor/IR/Tensor.h"#include "mlir/Dialect/Tosa/IR/TosaOps.h"#include "mlir/Dialect/Tosa/Utils/ConversionUtils.h"#include "mlir/Dialect/Utils/ReshapeOpsUtils.h"#include "mlir/Dialect/Utils/StaticValueUtils.h"#include "mlir/IR/Matchers.h"#include "mlir/IR/OpDefinition.h"#include "mlir/IR/PatternMatch.h"#include "mlir/Transforms/DialectConversion.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/Sequence.h"#include "llvm/ADT/SmallVectorExtras.h"#include <type_traits>Go to the source code of this file.
Typedefs | |
| using | IndexPool = DenseMap<int64_t, Value> |
Functions | |
| template<typename OpTy> | |
| static OpTy | createWithDefaultProperties (OpBuilder &builder, Location loc, TypeRange resultTypes, ValueRange operands) |
| template<typename OpTy> | |
| static Value | materializeBinaryNanCheckIfRequired (OpTy op, PatternRewriter &rewriter, Value lhs, Value rhs, Value result) |
| static Value | createLinalgBodyCalculationForElementwiseOp (Operation *op, ValueRange args, ArrayRef< Type > resultTypes, ConversionPatternRewriter &rewriter) |
| static Value | createIndex (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, int64_t index) |
| static Value | getTensorDim (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, Value tensor, int64_t index) |
| static OpFoldResult | getOrFoldTensorDim (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, Value tensor, int64_t index) |
| static bool | operandsAndResultsRanked (Operation *operation) |
| static std::pair< OpFoldResult, Value > | computeTargetSize (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, ValueRange operands, int64_t dim) |
| static std::pair< SmallVector< OpFoldResult >, SmallVector< Value > > | computeTargetShape (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, ValueRange operands) |
| static Value | broadcastDynamicDimension (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, Value operand, int64_t dim, OpFoldResult targetSize, Value masterOperand) |
| static Value | broadcastDynamicDimensions (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, Value operand, ArrayRef< OpFoldResult > targetShape, ArrayRef< Value > masterOperands) |
| static SmallVector< Value > | broadcastDynamicDimensions (PatternRewriter &rewriter, Location loc, IndexPool &indexPool, ValueRange operands, ArrayRef< OpFoldResult > targetShape, ArrayRef< Value > masterOperands) |
| static LogicalResult | emitElementwiseComputation (ConversionPatternRewriter &rewriter, Location loc, Operation *operation, ValueRange operands, ArrayRef< OpFoldResult > targetShape, const TypeConverter &converter) |
| static ValueRange | getBroadcastableOperands (Operation *operation, ValueRange operands) |
| static LogicalResult | elementwiseMatchAndRewriteHelper (Operation *operation, ValueRange operands, ConversionPatternRewriter &rewriter, const TypeConverter &converter) |
| static APFloat | getFloatMinMaxIdentity (const llvm::fltSemantics &semantics, bool negative, bool allowNonFinites) |
| static TypedAttr | createInitialValueForReduceOp (Operation *op, Type elementTy, PatternRewriter &rewriter, bool allowNonFinites) |
| static Value | createLinalgBodyCalculationForReduceOp (Operation *op, ValueRange args, Type elementTy, PatternRewriter &rewriter) |
| template<typename OpTy> | |
| static LogicalResult | reduceMatchAndRewriteHelper (OpTy op, uint64_t axis, PatternRewriter &rewriter, bool allowNonFinites) |
|
static |
Definition at line 856 of file TosaToLinalg.cpp.
References createIndex(), mlir::OpBuilder::createOrFold(), mlir::AffineMap::get(), mlir::Builder::getAffineConstantExpr(), mlir::Builder::getAffineDimExpr(), mlir::Builder::getContext(), mlir::Builder::getMultiDimIdentityMap(), mlir::tosa::getNParallelLoopsAttrs(), getOrFoldTensorDim(), getTensorDim(), and mlir::Value::getType().
Referenced by broadcastDynamicDimensions().
|
static |
Definition at line 938 of file TosaToLinalg.cpp.
References broadcastDynamicDimension(), and mlir::Value::getType().
Referenced by broadcastDynamicDimensions(), and elementwiseMatchAndRewriteHelper().
|
static |
Definition at line 953 of file TosaToLinalg.cpp.
References broadcastDynamicDimensions().
|
static |
Definition at line 841 of file TosaToLinalg.cpp.
References computeTargetSize(), and mlir::ValueRange::getType().
Referenced by elementwiseMatchAndRewriteHelper().
|
static |
Definition at line 800 of file TosaToLinalg.cpp.
References mlir::Builder::getIndexAttr(), getTensorDim(), and mlir::Value::getType().
Referenced by computeTargetShape().
|
static |
Definition at line 755 of file TosaToLinalg.cpp.
References mlir::Builder::getIndexAttr(), and inserted().
Referenced by broadcastDynamicDimension(), and getTensorDim().
|
static |
Definition at line 1107 of file TosaToLinalg.cpp.
References mlir::Builder::getFloatAttr(), getFloatMinMaxIdentity(), getFloatSemantics(), mlir::Builder::getIntegerAttr(), mlir::Type::getIntOrFloatBitWidth(), and mlir::Type::isInteger().
Referenced by reduceMatchAndRewriteHelper().
|
static |
Definition at line 95 of file TosaToLinalg.cpp.
References b, clamp(), mlir::tosa::clampFloatHelper(), mlir::tosa::clampIntHelper(), mlir::arith::ConstantIntOp::create(), createWithDefaultProperties(), mlir::getElementTypeOrSelf(), getFloatSemantics(), mlir::Type::getIntOrFloatBitWidth(), mlir::Operation::getLoc(), mlir::Operation::getOperand(), mlir::Value::getType(), mlir::DenseElementsAttr::getValues(), mlir::Type::isInteger(), mlir::Type::isIntOrFloat(), mlir::Type::isUnsignedInteger(), mlir::m_Constant(), mlir::matchPattern(), materializeBinaryNanCheckIfRequired(), max(), min(), and result.
Referenced by emitElementwiseComputation().
|
static |
Definition at line 1163 of file TosaToLinalg.cpp.
References createWithDefaultProperties(), mlir::Operation::getLoc(), and mlir::Type::isInteger().
Referenced by reduceMatchAndRewriteHelper().
|
static |
Definition at line 39 of file TosaToLinalg.cpp.
References mlir::Builder::getContext().
Referenced by createLinalgBodyCalculationForElementwiseOp(), and createLinalgBodyCalculationForReduceOp().
|
static |
Definition at line 1065 of file TosaToLinalg.cpp.
References broadcastDynamicDimensions(), computeTargetShape(), emitElementwiseComputation(), getBroadcastableOperands(), mlir::Operation::getLoc(), mlir::Operation::getNumOperands(), mlir::Operation::getNumResults(), and operandsAndResultsRanked().
|
static |
Definition at line 981 of file TosaToLinalg.cpp.
References createLinalgBodyCalculationForElementwiseOp(), mlir::ValueTypeRange< ValueRangeT >::front(), mlir::AffineMap::get(), mlir::tosa::getNParallelLoopsAttrs(), mlir::Operation::getNumOperands(), mlir::Operation::getResultTypes(), mlir::Value::getType(), and success().
Referenced by elementwiseMatchAndRewriteHelper().
|
static |
Definition at line 1042 of file TosaToLinalg.cpp.
References mlir::Operation::getOperand(), mlir::m_Constant(), and mlir::matchPattern().
Referenced by elementwiseMatchAndRewriteHelper().
|
static |
Definition at line 1098 of file TosaToLinalg.cpp.
Referenced by createInitialValueForReduceOp().
|
static |
Definition at line 770 of file TosaToLinalg.cpp.
References mlir::Builder::getIndexAttr(), and getTensorDim().
Referenced by broadcastDynamicDimension().
|
static |
Definition at line 764 of file TosaToLinalg.cpp.
References createIndex().
Referenced by broadcastDynamicDimension(), computeTargetSize(), and getOrFoldTensorDim().
|
static |
Definition at line 74 of file TosaToLinalg.cpp.
References mlir::getElementTypeOrSelf(), and result.
Referenced by createLinalgBodyCalculationForElementwiseOp().
Definition at line 781 of file TosaToLinalg.cpp.
References mlir::Operation::getOperands(), and mlir::Operation::getResults().
Referenced by elementwiseMatchAndRewriteHelper().
|
static |
Definition at line 1217 of file TosaToLinalg.cpp.
References createInitialValueForReduceOp(), createLinalgBodyCalculationForReduceOp(), mlir::Builder::getAffineDimExpr(), mlir::Builder::getBoolAttr(), mlir::Builder::getF32Type(), mlir::Builder::getFloatAttr(), getFloatSemantics(), mlir::Builder::getMultiDimIdentityMap(), mlir::tosa::getNParallelLoopsAttrs(), mlir::Builder::getType(), mlir::getType(), mlir::Value::getType(), mlir::RewriterBase::notifyMatchFailure(), mlir::RewriterBase::replaceOpWithNewOp(), result, and success().