MLIR 22.0.0git
QuantUtils.cpp File Reference

Go to the source code of this file.

Macros

#define GET_UQTYPE(inputType)
#define GET_QTYPE(inputType)

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.
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.
static std::optional< std::pair< std::int64_t, std::int64_t > > getConvZeroPoints (Value input, Value weight)

Macro Definition Documentation

◆ GET_QTYPE

#define GET_QTYPE ( inputType)
Value:
(llvm::dyn_cast<quant::QuantizedType>((inputType).getElementType()))
static Type getElementType(Type type)
Determine the element type of type.

Definition at line 119 of file QuantUtils.cpp.

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

◆ GET_UQTYPE

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

Definition at line 117 of file QuantUtils.cpp.

Referenced by mlir::tosa::buildMatMulOpQuantizationAttr(), mlir::tosa::buildPadOpQuantizationAttr(), mlir::tosa::buildUnaryOpQuantizationAttr(), and getConvZeroPoints().

Function Documentation

◆ computeMultiplierAndShiftTosaScale16()

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.

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

◆ computeMultiplierAndShiftTosaScale32()

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.

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

◆ getConvZeroPoints()

std::optional< std::pair< std::int64_t, std::int64_t > > getConvZeroPoints ( Value input,
Value weight )
static