tvm
|
Runtime primitive data type. More...
#include <data_type.h>
Public Types | |
enum | TypeCode { kInt = kDLInt , kUInt = kDLUInt , kFloat = kDLFloat , kHandle = kDLOpaqueHandle , kBFloat = kDLBfloat , kFloat8_e3m4 = kDLFloat8_e3m4 , kFloat8_e4m3 = kDLFloat8_e4m3 , kFloat8_e4m3b11fnuz = kDLFloat8_e4m3b11fnuz , kFloat8_e4m3fn = kDLFloat8_e4m3fn , kFloat8_e4m3fnuz = kDLFloat8_e4m3fnuz , kFloat8_e5m2 = kDLFloat8_e5m2 , kFloat8_e5m2fnuz = kDLFloat8_e5m2fnuz , kFloat8_e8m0fnu = kDLFloat8_e8m0fnu , kFloat6_e2m3fn = kDLFloat6_e2m3fn , kFloat6_e3m2fn = kDLFloat6_e3m2fn , kFloat4_e2m1fn = kDLFloat4_e2m1fn , 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_bfloat () const |
bool | is_float8 () const |
bool | is_float6 () const |
bool | is_float4 () const |
bool | is_float8_e3m4 () const |
bool | is_float8_e4m3 () const |
bool | is_float8_e4m3b11fnuz () const |
bool | is_float8_e4m3fn () const |
bool | is_float8_e4m3fnuz () const |
bool | is_float8_e5m2 () const |
bool | is_float8_e5m2fnuz () const |
bool | is_float8_e8m0fnu () const |
bool | is_float6_e2m3fn () const |
bool | is_float6_e3m2fn () const |
bool | is_float4_e2m1fn () 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 () 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 | Float8E3M4 (int lanes=1) |
Construct float8 e3m4 datatype. More... | |
static DataType | Float8E4M3 (int lanes=1) |
Construct float8 e4m3 datatype. More... | |
static DataType | Float8E4M3B11FNUZ (int lanes=1) |
Construct float8 e4m3b11fnuz datatype. More... | |
static DataType | Float8E4M3FN (int lanes=1) |
Construct float8 e4m3fn datatype. More... | |
static DataType | Float8E4M3FNUZ (int lanes=1) |
Construct float8 e4m3fnuz datatype. More... | |
static DataType | Float8E5M2 (int lanes=1) |
Construct float8 e5m2 datatype. More... | |
static DataType | Float8E5M2FNUZ (int lanes=1) |
Construct float8 e5m2fnuz datatype. More... | |
static DataType | Float8E8M0FNU (int lanes=1) |
Construct float8 e8m0fnu datatype. More... | |
static DataType | Float6E2M3FN (int lanes=1) |
Construct float6 e2m3fn datatype. More... | |
static DataType | Float6E3M2FN (int lanes=1) |
Construct float6 e3m2fn datatype. More... | |
static DataType | Float4E2M1FN (int lanes=1) |
Construct float4 e2m1fn 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
DLPack consistency: 1) kInt is consistent with kDLInt 2) kUInt is consistent with kDLUInt 3) kFloat is consistent with kDLFloat
|
inline |
default constructor
|
inlineexplicit |
Constructor.
dtype | The DLDataType |
|
inline |
Constructor.
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 |
|
inlinestatic |
Construct float4 e2m1fn datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float6 e2m3fn datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float6 e3m2fn datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e3m4 datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e4m3 datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e4m3b11fnuz datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e4m3fn datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e4m3fnuz datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e5m2 datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e5m2fnuz datatype.
lanes | The number of lanes |
|
inlinestatic |
Construct float8 e8m0fnu datatype.
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 |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
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. |