MLIR  20.0.0git
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
mlir::quant::ExpressedToQuantizedConverter Struct Reference

Performs type conversion from an arbitrary input type to a type that is expressed by a QuantizedType. More...

#include "mlir/Dialect/Quant/Utils/UniformSupport.h"

Public Member Functions

Type convert (QuantizedType elementalType) const
 Converts the inputType to be based on the given elemental type, returning the new type (or nullptr and emit an error on failure). More...
 
 operator bool () const
 Whether the conversion is legal. More...
 

Static Public Member Functions

static ExpressedToQuantizedConverter forInputType (Type inputType)
 Creates a converter for the given input type. More...
 

Public Attributes

const Type inputType
 The input type that is being converted from. More...
 
const Type expressedType
 Supported, elemental expressed type (i.e. More...
 

Detailed Description

Performs type conversion from an arbitrary input type to a type that is expressed by a QuantizedType.

This handles cases where the inputType is a supported primitive type (i.e. f32, bf16, etc) or a vector/tensor type based on a supported elemental type.

Since conversion often involves introspecting some attributes of the input type in order to determine how to represent it, this is a two step process.

Definition at line 34 of file UniformSupport.h.

Member Function Documentation

◆ convert()

Type ExpressedToQuantizedConverter::convert ( QuantizedType  elementalType) const

Converts the inputType to be based on the given elemental type, returning the new type (or nullptr and emit an error on failure).

Definition at line 35 of file UniformSupport.cpp.

References expressedType, mlir::get(), mlir::quant::QuantizedType::getExpressedType(), and inputType.

◆ forInputType()

ExpressedToQuantizedConverter ExpressedToQuantizedConverter::forInputType ( Type  inputType)
static

Creates a converter for the given input type.

Definition at line 21 of file UniformSupport.cpp.

References inputType, and isQuantizablePrimitiveType().

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

◆ operator bool()

mlir::quant::ExpressedToQuantizedConverter::operator bool ( ) const
inlineexplicit

Whether the conversion is legal.

Definition at line 43 of file UniformSupport.h.

References expressedType.

Member Data Documentation

◆ expressedType

const Type mlir::quant::ExpressedToQuantizedConverter::expressedType

Supported, elemental expressed type (i.e.

f32). Will be nullptr if conversion is not supported.

Definition at line 51 of file UniformSupport.h.

Referenced by convert(), and operator bool().

◆ inputType

const Type mlir::quant::ExpressedToQuantizedConverter::inputType

The input type that is being converted from.

This may be an elemental or composite type.

Definition at line 47 of file UniformSupport.h.

Referenced by convert(), and forInputType().


The documentation for this struct was generated from the following files: