tvm
|
Runtime primitive data type. More...
#include <data_type.h>
Public Types | |
enum | TypeCode { kInt = kDLInt , kUInt = kDLUInt , kFloat = kDLFloat , kHandle = TVMArgTypeCode::kTVMOpaqueHandle , kBFloat = kDLBfloat , kE4M3Float = 6U , kE5M2Float = 7U , kCustomBegin = 129 } |
Type code for the DataType. More... | |
Public Member Functions | |
DataType () | |
default constructor More... | |
DataType (DLDataType dtype) | |
Constructor. More... | |
DataType (int code, int bits, int lanes, bool is_scalable=false) | |
Constructor. More... | |
int | code () const |
int | bits () const |
int | bytes () const |
int | lanes () const |
int | vscale_factor () const |
int | get_lanes_or_vscale_factor () const |
bool | is_scalar () const |
bool | is_bool () const |
bool | is_float () const |
bool | is_float8 () const |
bool | is_e4m3_float8 () const |
bool | is_e5m2_float8 () const |
bool | is_float16 () const |
bool | is_bfloat16 () const |
bool | is_int () const |
bool | is_uint () const |
bool | is_handle () const |
bool | is_scalable_or_fixed_length_vector () const |
bool | is_fixed_length_vector () const |
bool | is_scalable_vector () const |
bool | is_vector_bool () const |
bool | is_void () const |
DataType | with_lanes (int lanes) const |
Create a new data type by change lanes to a specified value. More... | |
DataType | with_scalable_vscale_factor (int vscale_factor) const |
Create a new scalable vector data type by changing the vscale multiplier to a specified value. We'll use the data_.lanes field for this value. More... | |
DataType | with_bits (int bits) const |
Create a new data type by change bits to a specified value. More... | |
DataType | element_of () const |
Get the scalar version of the type. More... | |
DataType & | operator= (const DataType &rhs) |
Assignment operator. More... | |
bool | operator== (const DataType &other) const |
Equal comparator. More... | |
bool | operator!= (const DataType &other) const |
NotEqual comparator. More... | |
operator DLDataType () const | |
Converter to DLDataType. More... | |
Static Public Member Functions | |
static DataType | Int (int bits, int lanes=1) |
Construct an int type. More... | |
static DataType | UInt (int bits, int lanes=1, bool is_scalable=false) |
Construct an uint type. More... | |
static DataType | Float (int bits, int lanes=1) |
Construct an float type. More... | |
static DataType | BFloat (int bits, int lanes=1) |
Construct an bfloat type. More... | |
static DataType | NVFloat8E4M3 (int lanes=1) |
Construct NV float8 e4m3 datatype. More... | |
static DataType | NVFloat8E5M2 (int lanes=1) |
Construct NV float8 e5m2 datatype. More... | |
static DataType | Bool (int lanes=1, bool is_scalable=false) |
Construct a bool type. More... | |
static DataType | Handle (int bits=64, int lanes=1) |
Construct a handle type. More... | |
static DataType | Void () |
Construct a Void type. More... | |
static DataType | ShapeIndex () |
Get the corresponding type of TVMShapeIndex. More... | |
Runtime primitive data type.
This class is a thin wrapper of DLDataType. We also make use of DataType in compiler to store quick hint
|
inline |
default constructor
|
inlineexplicit |
dtype | The DLDataType |
|
inline |
code | The type code. |
bits | The number of bits in the type. |
lanes | The number of lanes. |
is_scalable | Whether the data type is scalable. |
|
inlinestatic |
Construct an bfloat type.
bits | The number of bits in the type. |
lanes | The number of lanes |
|
inline |
|
inlinestatic |
Construct a bool type.
lanes | The number of lanes. |
is_scalable | Whether the data type is scalable. |
|
inline |
|
inline |
|
inline |
Get the scalar version of the type.
|
inlinestatic |
Construct an float type.
bits | The number of bits in the type. |
lanes | The number of lanes |
|
inline |
|
inlinestatic |
Construct a handle type.
bits | The number of bits in the type. |
lanes | The number of lanes |
|
inlinestatic |
Construct an int type.
bits | The number of bits in the type. |
lanes | The number of lanes. |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlinestatic |
Construct NV float8 e4m3 datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct NV float8 e5m2 datatype.
lanes | The number of lanes |
|
inline |
Converter to DLDataType.
|
inline |
NotEqual comparator.
other | The data type to compare against. |
|
inline |
Equal comparator.
other | The data type to compare against. |
|
inlinestatic |
Get the corresponding type of TVMShapeIndex.
|
inlinestatic |
Construct an uint type.
bits | The number of bits in the type. |
lanes | The number of lanes. |
is_scalable | Whether the data type is scalable. |
|
inlinestatic |
Construct a Void type.
|
inline |
|
inline |
Create a new data type by change bits to a specified value.
bits | The target number of bits. |
|
inline |
Create a new data type by change lanes to a specified value.
lanes | The target number of lanes. |
|
inline |
Create a new scalable vector data type by changing the vscale multiplier to a specified value. We'll use the data_.lanes field for this value.
vscale_factor | The vscale multiplier. |