MLIR
18.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/ImplicitLocOpBuilder.h"
#include "mlir/IR/OpDefinition.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/Transforms/DialectConversion.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Support/MathExtras.h"
Go to the source code of this file.
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 ArrayRef< int64_t > | vectorShape (Type type) |
static ArrayRef< int64_t > | vectorShape (Value value) |
static Type | broadcast (Type type, ArrayRef< int64_t > shape) |
static Value | broadcast (ImplicitLocOpBuilder &builder, Value value, ArrayRef< int64_t > shape) |
static Value | handleMultidimensionalVectors (ImplicitLocOpBuilder &builder, ValueRange operands, int64_t vectorWidth, llvm::function_ref< Value(ValueRange)> compute) |
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) |
#define LN2_VALUE 0.693147180559945309417232121458176568075500134360255254120680009493393621L |
Definition at line 606 of file PolynomialApproximation.cpp.
#define LOG2E_VALUE 1.442695040888963407359924681001892137426645954152985934135449406931109219L |
Definition at line 608 of file PolynomialApproximation.cpp.
#define PI_OVER_2 1.5707963267948966192313216916397514420985846996875529104874722961L |
Definition at line 1188 of file PolynomialApproximation.cpp.
#define TWO_OVER_PI 0.6366197723675813430755350534900574481378385829618257949906693762L |
Definition at line 1186 of file PolynomialApproximation.cpp.
|
static |
Definition at line 64 of file PolynomialApproximation.cpp.
References broadcast(), mlir::ImplicitLocOpBuilder::create(), and mlir::Value::getType().
Definition at line 58 of file PolynomialApproximation.cpp.
References mlir::get().
Referenced by broadcast(), exp2I32(), and frexp().
|
static |
Definition at line 208 of file PolynomialApproximation.cpp.
Referenced by wmmaPushOutputOperand().
|
static |
Definition at line 256 of file PolynomialApproximation.cpp.
References broadcast(), mlir::ImplicitLocOpBuilder::create(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), i32Cst(), and vectorShape().
|
static |
Definition at line 176 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create(), and mlir::Builder::getF32FloatAttr().
Referenced by frexp().
|
static |
Definition at line 184 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create(), mlir::Builder::getF32Type(), and i32Cst().
Referenced by frexp().
|
static |
Definition at line 168 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create(), mlir::Builder::getFloatAttr(), mlir::Type::isF16(), and mlir::Type::isF32().
|
static |
Definition at line 215 of file PolynomialApproximation.cpp.
References broadcast(), mlir::ImplicitLocOpBuilder::create(), f32Cst(), f32FromBits(), mlir::getElementTypeOrSelf(), mlir::Builder::getF32Type(), mlir::Builder::getIntegerType(), i32Cst(), and vectorShape().
Referenced by computeMultiplierAndShiftTosaScale16(), and computeMultiplierAndShiftTosaScale32().
|
static |
Definition at line 91 of file PolynomialApproximation.cpp.
References mlir::computeMaxLinearIndex(), mlir::computeStrides(), mlir::ImplicitLocOpBuilder::create(), mlir::delinearize(), mlir::detail::enumerate(), mlir::get(), and mlir::Builder::getZeroAttr().
|
static |
Definition at line 180 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create(), and mlir::Builder::getI32IntegerAttr().
Referenced by exp2I32(), f32FromBits(), and frexp().
LogicalResult insertCasts | ( | Operation * | op, |
PatternRewriter & | rewriter | ||
) |
Definition at line 306 of file PolynomialApproximation.cpp.
|
static |
Definition at line 201 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create().
Referenced by mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), buildSubAndExpOp(), calculateStructAlignment(), mlir::sparse_tensor::detail::checkedMul(), mlir::sparse_tensor::detail::checkOverflowCast(), clamp(), mlir::tosa::clampFloatHelper(), mlir::tosa::clampIntHelper(), computeDirectionVector(), computeMultiplierAndShiftTosaScale16(), computeMultiplierAndShiftTosaScale32(), mlir::presburger::IntegerRelation::computeVolume(), mlir::concatAffineMaps(), declareReduction(), findIndicesForOffset(), generateFusedElementwiseOpRegion(), mlir::quant::CalibratedQuantizedType::get(), mlir::quant::CalibratedQuantizedType::getChecked(), getDefaultStorageParams(), mlir::affine::NestedPattern::getDepth(), mlir::affine::getInnermostCommonLoopDepth(), mlir::affine::getLargestDivisorOfTripCount(), mlir::AffineMap::getLargestKnownDivisorOfMapExprs(), getLocationFromLoc(), mlir::getMaxDimAndSymbol(), getMaxPosOfType(), getMaxWidth(), mlir::detail::PassOptions::getOptionWidth(), mlir::affine::getPerfectlyNestedLoops(), getSemiAffineExprFromFlatForm(), getTypeNumBytes(), mlir::LLVM::LLVMStructType::getTypeSizeInBits(), handleByValArgument(), isFusionProfitable(), mlir::AffineMap::isPermutationOfMinorIdentityWithBroadcasting(), mlir::presburger::Matrix< T >::Matrix(), maybeConstantDimsAttr(), mlirCalibratedQuantizedTypeGet(), mlir::presburger::detail::SlowMPInt::operator%(), parseAndVerify< unsigned >(), parseCalibratedType(), parseExpressedTypeAndRange(), mlir::detail::Parser::parseIntegerInDimensionList(), mlir::detail::Parser::parseStridedLayoutAttr(), populateDialectQuantSubmodule(), mlir::ConstantIntRanges::range(), mlir::OpTrait::util::staticallyKnownBroadcastable(), mlir::affine::substWithMin(), mlir::raw_indented_ostream::unindent(), mlir::presburger::IntegerRelation::unionBoundingBox(), mlir::quant::CalibratedQuantizedType::verify(), and mlir::quant::UniformQuantizedValueConverter::~UniformQuantizedValueConverter().
|
static |
Definition at line 194 of file PolynomialApproximation.cpp.
References mlir::ImplicitLocOpBuilder::create().
Referenced by addOrderingConstraints(), mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), mlir::sparse_tensor::detail::checkOverflowCast(), clamp(), mlir::tosa::clampFloatHelper(), mlir::tosa::clampIntHelper(), computeDirectionVector(), mlir::presburger::IntegerRelation::computeVolume(), declareReduction(), mlir::presburger::detail::divWouldOverflow(), mlir::quant::CalibratedQuantizedType::get(), getBestVarToEliminate(), mlir::quant::CalibratedQuantizedType::getChecked(), mlir::affine::getConstantTripCount(), getDefaultStorageParams(), mlir::affine::getInnermostCommonLoopDepth(), getNumCommonLoops(), mlir::affine::getNumCommonSurroundingLoops(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), minMaxValueForFloat(), minMaxValueForSignedInt(), minMaxValueForUnsignedInt(), mlirCalibratedQuantizedTypeGet(), mlir::presburger::MPInt::operator-(), parseCalibratedType(), parseExpressedTypeAndRange(), populateDialectQuantSubmodule(), mlir::raw_indented_ostream::printReindented(), mlir::ConstantIntRanges::range(), splitIntegerStore(), mlir::affine::substWithMin(), mlir::presburger::IntegerRelation::unionBoundingBox(), mlir::quant::CalibratedQuantizedType::verify(), and mlir::quant::UniformQuantizedValueConverter::~UniformQuantizedValueConverter().
Definition at line 44 of file PolynomialApproximation.cpp.
Referenced by exp2I32(), foreachIndividualVectorElement(), frexp(), VectorizationState::getCanonicalVecType(), and vectorShape().
Definition at line 49 of file PolynomialApproximation.cpp.
References mlir::Value::getType(), and vectorShape().