MLIR  15.0.0git
Macros | Functions
PolynomialApproximation.cpp File Reference
#include <climits>
#include <cstddef>
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.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 dependency graph for PolynomialApproximation.cpp:

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 f32Cst (ImplicitLocOpBuilder &builder, float 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, Valuefrexp (ImplicitLocOpBuilder &builder, Value arg, bool isPositive=false)
 
static Value exp2I32 (ImplicitLocOpBuilder &builder, Value arg)
 
template<typename T >
LogicalResult insertCasts (Operation *op, PatternRewriter &rewriter)
 

Macro Definition Documentation

◆ LN2_VALUE

#define LN2_VALUE   0.693147180559945309417232121458176568075500134360255254120680009493393621L

Definition at line 554 of file PolynomialApproximation.cpp.

◆ LOG2E_VALUE

#define LOG2E_VALUE   1.442695040888963407359924681001892137426645954152985934135449406931109219L

Definition at line 556 of file PolynomialApproximation.cpp.

◆ PI_OVER_2

#define PI_OVER_2   1.5707963267948966192313216916397514420985846996875529104874722961L

Definition at line 1085 of file PolynomialApproximation.cpp.

◆ TWO_OVER_PI

#define TWO_OVER_PI   0.6366197723675813430755350534900574481378385829618257949906693762L

Definition at line 1083 of file PolynomialApproximation.cpp.

Function Documentation

◆ broadcast() [1/2]

static Type broadcast ( Type  type,
ArrayRef< int64_t >  shape 
)
static

◆ broadcast() [2/2]

static Value broadcast ( ImplicitLocOpBuilder builder,
Value  value,
ArrayRef< int64_t >  shape 
)
static

◆ clamp()

static Value clamp ( ImplicitLocOpBuilder builder,
Value  value,
Value  lowerBound,
Value  upperBound 
)
static

◆ exp2I32()

static Value exp2I32 ( ImplicitLocOpBuilder builder,
Value  arg 
)
static

◆ f32Cst()

static Value f32Cst ( ImplicitLocOpBuilder builder,
float  value 
)
static

◆ f32FromBits()

static Value f32FromBits ( ImplicitLocOpBuilder builder,
uint32_t  bits 
)
static

◆ frexp()

static std::pair<Value, Value> frexp ( ImplicitLocOpBuilder builder,
Value  arg,
bool  isPositive = false 
)
static

◆ handleMultidimensionalVectors()

static Value handleMultidimensionalVectors ( ImplicitLocOpBuilder builder,
ValueRange  operands,
int64_t  vectorWidth,
llvm::function_ref< Value(ValueRange)>  compute 
)
static

◆ i32Cst()

static Value i32Cst ( ImplicitLocOpBuilder builder,
int32_t  value 
)
static

◆ insertCasts()

template<typename T >
LogicalResult insertCasts ( Operation op,
PatternRewriter rewriter 
)

◆ max()

static Value max ( ImplicitLocOpBuilder builder,
Value  value,
Value  bound 
)
static

Definition at line 193 of file PolynomialApproximation.cpp.

References mlir::ImplicitLocOpBuilder::create(), and value.

Referenced by adjustToDivisorsOfTripCounts(), mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), calculateStructAlignment(), checkAndUpdateCapabilityRequirements(), clamp(), mlir::tosa::clampHelper(), computeDirectionVector(), computeMultiplierAndShiftTosaScale16(), computeMultiplierAndShiftTosaScale32(), mlir::presburger::IntegerRelation::computeVolume(), mlir::ConstantIntRanges::ConstantIntRanges(), mlir::createAffineDataCopyGenerationPass(), createDepthwiseConvCollapseMap(), createLinalgBodyCalculationForElementwiseOp(), declareReduction(), mlir::VulkanLayoutUtils::decorateType(), eachHasOnlyOneOfTypes(), mlir::detail::OperandStorage::eraseOperands(), executeGetOperandsResults(), foldExtractStridedOpFromInsertChain(), generateFusedElementwiseOpRegion(), mlir::quant::CalibratedQuantizedType::get(), mlir::quant::CalibratedQuantizedType::getChecked(), getDefaultStorageParams(), mlir::NestedPattern::getDepth(), mlir::quant::detail::CalibratedQuantizedTypeStorage::KeyTy::getHashValue(), getIndexRange(), mlir::getInnermostCommonLoopDepth(), mlir::getLargestDivisorOfTripCount(), getLLVMAtomicBinOp(), getLocationFromLoc(), mlir::getMaxDimAndSymbol(), getMaxPosOfType(), getMaxWidth(), getNeutralElement(), mlir::detail::PassOptions::getOptionWidth(), mlir::getPerfectlyNestedLoops(), getSemiAffineExprFromFlatForm(), getTypeNumBytes(), mlir::LLVM::LLVMStructType::getTypeSizeInBits(), hasOneBranchOpTo(), isFusionProfitable(), isIntegerArrayAttrConfinedToRange(), isIntegerArrayAttrConfinedToShape(), mlir::AffineMap::isPermutationOfMinorIdentityWithBroadcasting(), isSumOfIntegerArrayAttrConfinedToShape(), loopScheduling(), mlir::ConversionPattern::matchAndRewrite(), ClampClampOptimization::matchAndRewrite(), mlir::presburger::Matrix::Matrix(), mlir::presburger::detail::SlowMPInt::operator%(), parseAndVerifyInteger(), parseCalibratedType(), mlir::detail::Parser::parseIntegerInDimensionList(), populateDialectQuantSubmodule(), printTimeHeader(), mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt64(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), mlir::OpTrait::util::staticallyKnownBroadcastable(), mlir::substWithMin(), mlir::raw_indented_ostream::unindent(), mlir::linalg::detail::verifyStructuredOpInterface(), and mlir::detail::IntRangeAnalysisImpl::visitNonControlFlowArguments().

◆ min()

static Value min ( ImplicitLocOpBuilder builder,
Value  value,
Value  bound 
)
static

Definition at line 186 of file PolynomialApproximation.cpp.

References mlir::ImplicitLocOpBuilder::create(), and value.

Referenced by addOrderingConstraints(), mlir::tensor::bubbleUpPadSlice(), mlir::tosa::buildQTypeFromMinMax(), clamp(), mlir::tosa::clampHelper(), collectFusableLoops(), computeDirectionVector(), mlir::presburger::IntegerRelation::computeVolume(), mlir::ConstantIntRanges::ConstantIntRanges(), createDepthwiseConvCollapseMap(), createLinalgBodyCalculationForElementwiseOp(), declareReduction(), mlir::failableParallelForEach(), foldExtractStridedOpFromInsertChain(), genLocals(), mlir::quant::CalibratedQuantizedType::get(), getBestVarToEliminate(), mlir::quant::CalibratedQuantizedType::getChecked(), mlir::getConstantTripCount(), getDefaultStorageParams(), mlir::quant::detail::CalibratedQuantizedTypeStorage::KeyTy::getHashValue(), mlir::getInnermostCommonLoopDepth(), getInsertExtractValueElementType(), getLLVMAtomicBinOp(), getMaxLoopDepth(), getNeutralElement(), mlir::detail::OpResultImpl::getNextResultAtOffset(), getNumCommonLoops(), mlir::getNumCommonSurroundingLoops(), isIntegerArrayAttrConfinedToShape(), isSumOfIntegerArrayAttrConfinedToShape(), mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::ConversionPattern::matchAndRewrite(), ClampClampOptimization::matchAndRewrite(), parseCalibratedType(), populateDialectQuantSubmodule(), mlir::raw_indented_ostream::printReindented(), mlir::quant::UniformQuantizedValueConverter::quantizeFloatToInt64(), specializeForLoopForUnrolling(), specializeParallelLoopForUnrolling(), mlir::substWithMin(), mlir::linalg::detail::verifyStructuredOpInterface(), and mlir::detail::IntRangeAnalysisImpl::visitNonControlFlowArguments().

◆ vectorShape() [1/2]

static ArrayRef<int64_t> vectorShape ( Type  type)
static

◆ vectorShape() [2/2]

static ArrayRef<int64_t> vectorShape ( Value  value)
static

Definition at line 47 of file PolynomialApproximation.cpp.

References mlir::Value::getType(), and vectorShape().