|
MLIR 22.0.0git
|
#include <climits>#include <cmath>#include <cstddef>#include "mlir/Dialect/Arith/IR/Arith.h"#include "mlir/Dialect/Math/IR/Math.h"#include "mlir/Dialect/Math/Transforms/Approximation.h"#include "mlir/Dialect/Math/Transforms/Passes.h"#include "mlir/Dialect/Utils/IndexingUtils.h"#include "mlir/Dialect/Vector/IR/VectorOps.h"#include "mlir/Dialect/Vector/Utils/VectorUtils.h"#include "mlir/Dialect/X86Vector/X86VectorDialect.h"#include "mlir/IR/Builders.h"#include "mlir/IR/BuiltinTypes.h"#include "mlir/IR/OpDefinition.h"#include "mlir/IR/PatternMatch.h"#include "mlir/IR/TypeUtilities.h"#include "mlir/Transforms/DialectConversion.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/STLExtras.h"#include "llvm/Support/MathExtras.h"Go to the source code of this file.
Classes | |
| struct | VectorShape |
Macros | |
| #define | LN2_VALUE 0.693147180559945309417232121458176568075500134360255254120680009493393621L |
| #define | LOG2E_VALUE 1.442695040888963407359924681001892137426645954152985934135449406931109219L |
| #define | TWO_OVER_PI 0.6366197723675813430755350534900574481378385829618257949906693762L |
| #define | PI_OVER_2 1.5707963267948966192313216916397514420985846996875529104874722961L |
Functions | |
| static std::optional< VectorShape > | vectorShape (Type type) |
| static std::optional< VectorShape > | vectorShape (Value value) |
| static Type | broadcast (Type type, std::optional< VectorShape > shape) |
| static Value | broadcast (ImplicitLocOpBuilder &builder, Value value, std::optional< VectorShape > shape) |
| static Value | handleMultidimensionalVectors (ImplicitLocOpBuilder &builder, ValueRange operands, int64_t vectorWidth, llvm::function_ref< Value(ValueRange)> compute) |
| static Value | boolCst (ImplicitLocOpBuilder &builder, bool value) |
| static Value | floatCst (ImplicitLocOpBuilder &builder, float value, Type elementType) |
| static Value | f32Cst (ImplicitLocOpBuilder &builder, double value) |
| static Value | i32Cst (ImplicitLocOpBuilder &builder, int32_t value) |
| static Value | f32FromBits (ImplicitLocOpBuilder &builder, uint32_t bits) |
| static Value | min (ImplicitLocOpBuilder &builder, Value value, Value bound) |
| static Value | max (ImplicitLocOpBuilder &builder, Value value, Value bound) |
| static Value | clamp (ImplicitLocOpBuilder &builder, Value value, Value lowerBound, Value upperBound) |
| static std::pair< Value, Value > | frexp (ImplicitLocOpBuilder &builder, Value arg, bool isPositive=false) |
| static Value | exp2I32 (ImplicitLocOpBuilder &builder, Value arg) |
| template<typename T> | |
| LogicalResult | insertCasts (Operation *op, PatternRewriter &rewriter) |
| template<typename OpType> | |
| static void | populateMathF32ExpansionPattern (RewritePatternSet &patterns, llvm::function_ref< bool(StringRef)> predicate, PatternBenefit benefit) |
| template<typename OpType, typename PatternType> | |
| static void | populateMathPolynomialApproximationPattern (RewritePatternSet &patterns, llvm::function_ref< bool(StringRef)> predicate, PatternBenefit benefit) |
| #define LN2_VALUE 0.693147180559945309417232121458176568075500134360255254120680009493393621L |
Definition at line 620 of file PolynomialApproximation.cpp.
| #define LOG2E_VALUE 1.442695040888963407359924681001892137426645954152985934135449406931109219L |
Definition at line 622 of file PolynomialApproximation.cpp.
| #define PI_OVER_2 1.5707963267948966192313216916397514420985846996875529104874722961L |
Definition at line 1482 of file PolynomialApproximation.cpp.
| #define TWO_OVER_PI 0.6366197723675813430755350534900574481378385829618257949906693762L |
Definition at line 1480 of file PolynomialApproximation.cpp.
|
static |
Definition at line 174 of file PolynomialApproximation.cpp.
References mlir::Builder::getBoolAttr().
Referenced by mlir::math::ErfcPolynomialApproximation::matchAndRewrite().
|
static |
Definition at line 70 of file PolynomialApproximation.cpp.
References broadcast(), and mlir::Value::getType().
|
static |
Definition at line 63 of file PolynomialApproximation.cpp.
Referenced by broadcast(), exp2I32(), and frexp().
|
static |
Definition at line 220 of file PolynomialApproximation.cpp.
Referenced by createLinalgBodyCalculationForElementwiseOp(), and wmmaPushOutputOperand().
|
static |
Definition at line 268 of file PolynomialApproximation.cpp.
References broadcast(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), i32Cst(), and vectorShape().
|
static |
Definition at line 186 of file PolynomialApproximation.cpp.
References mlir::Builder::getF32FloatAttr().
Referenced by frexp().
|
static |
Definition at line 194 of file PolynomialApproximation.cpp.
References mlir::Builder::getF32Type(), and i32Cst().
Referenced by frexp().
|
static |
Definition at line 178 of file PolynomialApproximation.cpp.
References mlir::Builder::getFloatAttr(), mlir::Type::isF16(), and mlir::Type::isF32().
Referenced by mlir::math::ErfcPolynomialApproximation::matchAndRewrite(), and mlir::math::ErfPolynomialApproximation::matchAndRewrite().
|
static |
Definition at line 227 of file PolynomialApproximation.cpp.
References broadcast(), f32Cst(), f32FromBits(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), mlir::Builder::getIntegerType(), i32Cst(), and vectorShape().
|
static |
Definition at line 97 of file PolynomialApproximation.cpp.
References mlir::computeMaxLinearIndex(), mlir::computeStrides(), mlir::delinearize(), mlir::getType(), mlir::Builder::getZeroAttr(), and result.
Referenced by mlir::LLVM::detail::vectorOneToOneRewrite().
|
static |
Definition at line 190 of file PolynomialApproximation.cpp.
References mlir::Builder::getI32IntegerAttr().
Referenced by exp2I32(), f32FromBits(), and frexp().
| LogicalResult insertCasts | ( | Operation * | op, |
| PatternRewriter & | rewriter ) |
Definition at line 318 of file PolynomialApproximation.cpp.
References mlir::ValueTypeRange< ValueRangeT >::front(), mlir::Operation::getAttrs(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), mlir::Operation::getLoc(), mlir::Operation::getOperands(), mlir::Operation::getOperandTypes(), mlir::Operation::getResultTypes(), mlir::RewriterBase::notifyMatchFailure(), mlir::RewriterBase::replaceOpWithNewOp(), result, and success().
|
static |
Definition at line 212 of file PolynomialApproximation.cpp.
Referenced by mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), buildSubAndExpOp(), clamp(), mlir::tosa::clampFloatHelper(), clampInput(), mlir::tosa::clampIntHelper(), mlir::presburger::IntegerRelation::computeVolume(), createLinalgBodyCalculationForElementwiseOp(), mlir::quant::CalibratedQuantizedType::get(), mlir::quant::CalibratedQuantizedType::getChecked(), getReduxIntrinsicId(), mlir::intrange::inferXor(), isIntegerArrayAttrConfinedToRange(), isIntegerArrayAttrConfinedToShape(), isSumOfIntegerArrayAttrConfinedToShape(), mlir::gpu::index_lowering::OpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), mlir::presburger::Matrix< T >::Matrix(), minMaxBy(), MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(), mlirCalibratedQuantizedTypeGet(), parseCalibratedType(), parseExpressedTypeAndRange(), populateDialectQuantSubmodule(), mlir::ConstantIntRanges::range(), mlir::ReductionNode::ReductionNode(), mlir::InlinerConfig::setMaxInliningIterations(), mlir::quant::CalibratedQuantizedType::verifyInvariants(), and mlir::dataflow::IntegerRangeAnalysis::visitNonControlFlowArguments().
|
static |
Definition at line 204 of file PolynomialApproximation.cpp.
Referenced by mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), clamp(), mlir::tosa::clampFloatHelper(), clampInput(), mlir::tosa::clampIntHelper(), mlir::presburger::IntegerRelation::computeVolume(), createLinalgBodyCalculationForElementwiseOp(), mlir::sparse_tensor::genCoIteration(), mlir::quant::CalibratedQuantizedType::get(), getBestVarToEliminate(), mlir::quant::CalibratedQuantizedType::getChecked(), getReduxIntrinsicId(), mlir::intrange::inferXor(), isIntegerArrayAttrConfinedToRange(), isIntegerArrayAttrConfinedToShape(), isSumOfIntegerArrayAttrConfinedToShape(), mlir::gpu::index_lowering::OpLowering< Op, XOp, YOp, ZOp >::matchAndRewrite(), minMaxBy(), minMaxValueForFloat(), minMaxValueForSignedInt(), minMaxValueForUnsignedInt(), MLIR_DECLARE_CAPI_DIALECT_REGISTRATION(), mlirCalibratedQuantizedTypeGet(), parseCalibratedType(), parseExpressedTypeAndRange(), populateDialectQuantSubmodule(), mlir::ConstantIntRanges::range(), mlir::quant::CalibratedQuantizedType::verifyInvariants(), and mlir::dataflow::IntegerRangeAnalysis::visitNonControlFlowArguments().
|
static |
Definition at line 1785 of file PolynomialApproximation.cpp.
References mlir::patterns.
Referenced by mlir::populateMathF32ExpansionPatterns().
|
static |
Definition at line 1825 of file PolynomialApproximation.cpp.
References mlir::patterns.
Referenced by mlir::populateMathPolynomialApproximationPatterns().
|
static |
Definition at line 47 of file PolynomialApproximation.cpp.
Referenced by exp2I32(), extractInsertFoldConstantOp(), foreachIndividualVectorElement(), frexp(), VectorizationState::getCanonicalVecType(), mlir::vector::isContiguousSlice(), mlir::math::ErfcPolynomialApproximation::matchAndRewrite(), mlir::math::ErfPolynomialApproximation::matchAndRewrite(), and vectorShape().
|
static |
Definition at line 54 of file PolynomialApproximation.cpp.
References mlir::Value::getType(), and vectorShape().