|
My Project
|
#include <QuantTypes.h>


Public Types | |
| using | ImplType = detail::QuantizedTypeStorage |
Public Types inherited from mlir::Type | |
| enum | Kind { Function, Opaque, LAST_BUILTIN_TYPE = Opaque, DEFINE_SYM_KIND_RANGE, DEFINE_SYM_KIND_RANGE } |
| template<typename ConcreteType , typename BaseType , typename StorageType = DefaultTypeStorage> | |
| using | TypeBase = detail::StorageUserBase< ConcreteType, BaseType, StorageType, detail::TypeUniquer > |
| Utility class for implementing types. More... | |
| using | ImplType = TypeStorage |
Public Member Functions | |
| Type | getExpressedType () const |
| unsigned | getFlags () const |
| bool | isSigned () const |
| Type | getStorageType () const |
| int64_t | getStorageTypeMin () const |
| The minimum value that storageType can take. More... | |
| int64_t | getStorageTypeMax () const |
| The maximum value that storageType can take. More... | |
| unsigned | getStorageTypeIntegralWidth () const |
| bool | isCompatibleExpressedType (Type candidateExpressedType) |
| Type | castFromStorageType (Type candidateType) |
| Type | castFromExpressedType (Type candidateType) |
| Type | castExpressedToStorageType (Type candidateType) |
Public Member Functions inherited from mlir::Type | |
| Type () | |
| Type (const ImplType *impl) | |
| Type (const Type &other)=default | |
| Type & | operator= (const Type &other)=default |
| bool | operator== (Type other) const |
| bool | operator!= (Type other) const |
| operator bool () const | |
| bool | operator! () const |
| template<typename U > | |
| bool | isa () const |
| template<typename U > | |
| U | dyn_cast () const |
| template<typename U > | |
| U | dyn_cast_or_null () const |
| template<typename U > | |
| U | cast () const |
| unsigned | getKind () const |
| Return the classification for this type. More... | |
| MLIRContext * | getContext () const |
| Return the LLVMContext in which this type was uniqued. More... | |
| Dialect & | getDialect () const |
| Get the dialect this type is registered to. More... | |
| bool | isIndex () |
| bool | isBF16 () |
| bool | isF16 () |
| bool | isF32 () |
| bool | isF64 () |
| bool | isInteger (unsigned width) |
| Return true if this is an integer type with the specified width. More... | |
| unsigned | getIntOrFloatBitWidth () |
| bool | isIntOrIndex () |
| Return true if this is an integer or index type. More... | |
| bool | isIntOrIndexOrFloat () |
| Return true if this is an integer, index, or float type. More... | |
| bool | isIntOrFloat () |
| Return true of this is an integer or a float type. More... | |
| void | print (raw_ostream &os) |
| Print the current type. More... | |
| void | dump () |
| unsigned | getSubclassData () const |
| void | setSubclassData (unsigned val) |
| const void * | getAsOpaquePointer () const |
| Methods for supporting PointerLikeTypeTraits. More... | |
Static Public Member Functions | |
| static LogicalResult | verifyConstructionInvariants (Optional< Location > loc, MLIRContext *context, unsigned flags, Type storageType, Type expressedType, int64_t storageTypeMin, int64_t storageTypeMax) |
| static bool | classof (Type type) |
| Support method to enable LLVM-style type casting. More... | |
| static int64_t | getDefaultMinimumForInteger (bool isSigned, unsigned integralWidth) |
| static int64_t | getDefaultMaximumForInteger (bool isSigned, unsigned integralWidth) |
| static QuantizedType | getQuantizedElementType (Type primitiveOrContainerType) |
| static Type | castToStorageType (Type quantizedType) |
| static Type | castToExpressedType (Type quantizedType) |
Static Public Member Functions inherited from mlir::Type | |
| static bool | classof (Type) |
| static Type | getFromOpaquePointer (const void *pointer) |
Static Public Attributes | |
| static constexpr unsigned | MaxStorageBits = 32 |
| The maximum number of bits supported for storage types. More... | |
Additional Inherited Members | |
Protected Attributes inherited from mlir::Type | |
| ImplType * | impl |
Base class for all quantized types known to this dialect. All quantized types have:
The base class provides generic support for manipulating the types based on these fields.
Casts from a type based on the expressedType to the equivalent type based on storageType by way of this QuantizedType. Equivalent to: QuantizedType::castToStorageType(castFromExpressedType(candidateType)) (but with validity checks). Example (for this = !quant.uniform<i8:f32, 1.0>): tensor<4xf32> -> tensor<4xi8>
Casts from a type based on the expressedType to a corresponding type based on this type (returns nullptr if the cast is not valid). Examples: f32 -> !quant.uniform<i8:f32, 1.0> tensor<4xf32> -> tensor<4x!quant.uniform<i8:f32, 1.0>> vector<4xf32> -> vector<4x!quant.uniform<i8:f32, 1.0>>
Casts from a type based on the storageType to a corresponding type based on this type (returns nullptr if the cast is not valid). Examples: i8 -> !quant.uniform<i8:f32, 1.0> tensor<4xi8> -> tensor<4x!quant.uniform<i8:f32, 1.0}>> vector<4xi8> -> vector<4x!quant.uniform<i8:f32, 1.0>>
Casts from a type based on QuantizedType to a corresponding type based on the expressedType (returns nullptr if the cast is not valid). This is the inverse of castFromExpressedType.
Casts from a type based on a QuantizedType to a corresponding type based on the storageType (returns nullptr if the cast is not valid). This is the inverse of castFromStorageType().
|
inlinestatic |
Support method to enable LLVM-style type casting.
|
inlinestatic |
Gets the maximum possible stored by a storageType. storageTypeMax must be less than or equal to this value.
|
inlinestatic |
Gets the minimum possible stored by a storageType. storageTypeMin must be greater than or equal to this value.
| Type QuantizedType::getExpressedType | ( | ) | const |
Gets the original expressed type that this quantized type approximates. Note that this presumes that the quantized type was always derived from a floating point type, which in the broadest definition, is not true (i.e. it could be some form of integral, fixed type or affine type in its own right); however, at the high level, no examples of such usage are presently known and the restriction serves some useful purposes (such as always being able to reverse a transformation or measure error). In most cases, this will be f32.
| unsigned QuantizedType::getFlags | ( | ) | const |
Gets the flags associated with this type. Typically a more specific accessor is appropriate.
|
static |
Returns the element type as a QuantizedType or nullptr if it is not a quantized type. If the type is primitive, returns that. If it is a container (vector/tensor), return the element type. Examples: !quant.uniform<i8:f32, 1.0> -> !quant.uniform<i8:f32, 1.0> tensor<4x!quant.uniform<i8:f32, 1.0> -> quant.uniform<i8:f32, 1.0>
| Type QuantizedType::getStorageType | ( | ) | const |
Gets the underlying type used for to store values. Note that this may be signed or unsigned. Use the isSigned() accessor to differentiate.
| unsigned QuantizedType::getStorageTypeIntegralWidth | ( | ) | const |
Gets the integral bit width that the underlying storage type can exactly represent. For integral storage types, this will just be their width.
| int64_t QuantizedType::getStorageTypeMax | ( | ) | const |
The maximum value that storageType can take.
| int64_t QuantizedType::getStorageTypeMin | ( | ) | const |
The minimum value that storageType can take.
| bool QuantizedType::isCompatibleExpressedType | ( | Type | candidateExpressedType | ) |
Returns whether the candidateExpressedType is a match for this QuantizedType. This will be true if the candidate type is either a primitive type or a container type whose element type equals this QuantizedType's expressed type. Examples of compatible candidateExpressedType: !quant.uniform<i8:f32, 1.0> =~ f32 !quant.uniform<i8:f32, 1.0> =~ tensor<4xf32>
|
inline |
Whether the storage type should be interpreted as a signed quantity (true) or an unsigned value (false).
|
static |
|
static |
The maximum number of bits supported for storage types.
1.8.13