MLIR  20.0.0git
Macros | Functions
QuantUtils.cpp File Reference
#include "mlir/Dialect/Tosa/Utils/QuantUtils.h"

Go to the source code of this file.

Macros

#define GET_UQTYPE(inputType)    (llvm::dyn_cast<quant::UniformQuantizedType>((inputType).getElementType()))
 
#define GET_QTYPE(inputType)    (llvm::dyn_cast<quant::QuantizedType>((inputType).getElementType()))
 

Functions

static void computeMultiplierAndShiftTosaScale16 (double scale, int32_t &multiplier, int32_t &shift)
 From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 16-bit scaling. More...
 
static void computeMultiplierAndShiftTosaScale32 (double scale, int32_t &multiplier, int32_t &shift)
 From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 32-bit scaling. More...
 

Macro Definition Documentation

◆ GET_QTYPE

#define GET_QTYPE (   inputType)     (llvm::dyn_cast<quant::QuantizedType>((inputType).getElementType()))

Definition at line 112 of file QuantUtils.cpp.

◆ GET_UQTYPE

#define GET_UQTYPE (   inputType)     (llvm::dyn_cast<quant::UniformQuantizedType>((inputType).getElementType()))

Definition at line 110 of file QuantUtils.cpp.

Function Documentation

◆ computeMultiplierAndShiftTosaScale16()

static void computeMultiplierAndShiftTosaScale16 ( double  scale,
int32_t &  multiplier,
int32_t &  shift 
)
static

From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 16-bit scaling.

Definition at line 22 of file QuantUtils.cpp.

References frexp(), max(), and mlir::presburger::round().

Referenced by mlir::tosa::computeMultiplierAndShift().

◆ computeMultiplierAndShiftTosaScale32()

static void computeMultiplierAndShiftTosaScale32 ( double  scale,
int32_t &  multiplier,
int32_t &  shift 
)
static

From a scale value, generates multiplier and shift values where mantissa is in [-1.0,-0.5] or [0.5, 1.0] such that multiplier = mantissa*2^shift for 32-bit scaling.

Definition at line 60 of file QuantUtils.cpp.

References frexp(), max(), and mlir::presburger::round().

Referenced by mlir::tosa::computeMultiplierAndShift().