#include <base_expr.h>
|
| | PrimType (DLDataType dtype) |
| | Construct from a raw DLPack dtype. More...
|
| |
| | PrimType (DLDataTypeCode code, int bits, int lanes=1) |
| | Construct from DLPack dtype fields. More...
|
| |
| TVM_FFI_INLINE DLDataTypeCode | code () const |
| |
| TVM_FFI_INLINE int32_t | bits () const |
| |
| TVM_FFI_INLINE int32_t | lanes () const |
| |
| TVM_FFI_INLINE bool | MatchesElementType (DLDataTypeCode code, int bits) const |
| | Check the scalar element code and bit width. More...
|
| |
| template<typename... Codes> |
| TVM_FFI_INLINE bool | MatchesCode (Codes... codes) const |
| | Check whether the dtype code matches any of the provided DLPack codes. More...
|
| |
| TVM_FFI_INLINE bool | IsScalar () const |
| | Whether this type is a scalar, excluding fixed and scalable vectors. More...
|
| |
| TVM_FFI_INLINE bool | IsVoid () const |
| | Whether this type is the void sentinel handle(0, 0). More...
|
| |
| TVM_FFI_INLINE bool | IsScalableVector () const |
| | Whether this type is a scalable vector. More...
|
| |
| TVM_FFI_INLINE bool | IsFixedLengthVector () const |
| | Whether this type is a fixed-length vector. More...
|
| |
| TVM_FFI_INLINE size_t | StorageBytes () const |
| | Return the number of bytes needed to store one value of this type. More...
|
| |
| TVM_FFI_INLINE PrimType | WithCode (DLDataTypeCode code) const |
| | Return the same type with a different dtype code, preserving bits and lanes. More...
|
| |
| TVM_FFI_INLINE PrimType | WithBits (int bits) const |
| | Return the same type with a different scalar bit width, preserving code and lanes. More...
|
| |
| TVM_FFI_INLINE PrimType | WithLanes (int lanes) const |
| | Return the same scalar element type with a fixed lane count. More...
|
| |
| TVM_FFI_INLINE int32_t | VScaleFactor () const |
| |
| | TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE (PrimType, Type, PrimTypeNode) |
| |
| bool | IsMissing () const |
| |
| | TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE (Type, ffi::ObjectRef, TypeNode) |
| |
◆ PrimType() [1/2]
| tvm::PrimType::PrimType |
( |
DLDataType |
dtype | ) |
|
|
explicit |
Construct from a raw DLPack dtype.
- Parameters
-
| dtype | The corresponding DLPack dtype. |
◆ PrimType() [2/2]
| tvm::PrimType::PrimType |
( |
DLDataTypeCode |
code, |
|
|
int |
bits, |
|
|
int |
lanes = 1 |
|
) |
| |
Construct from DLPack dtype fields.
- Parameters
-
| code | The DLPack dtype code. |
| bits | The scalar bit width. |
| lanes | The fixed lane count. |
◆ BFloat()
| static PrimType tvm::PrimType::BFloat |
( |
int |
bits, |
|
|
int |
lanes = 1 |
|
) |
| |
|
static |
Construct a bfloat type with fixed lanes.
◆ bits()
| TVM_FFI_INLINE int32_t tvm::PrimType::bits |
( |
| ) |
const |
|
inline |
- Returns
- The scalar bit width.
◆ Bool()
| static PrimType tvm::PrimType::Bool |
( |
int |
lanes = 1 | ) |
|
|
static |
Construct a boolean type with fixed lanes.
◆ code()
| TVM_FFI_INLINE DLDataTypeCode tvm::PrimType::code |
( |
| ) |
const |
|
inline |
- Returns
- The DLPack dtype code.
◆ Float()
| static PrimType tvm::PrimType::Float |
( |
int |
bits, |
|
|
int |
lanes = 1 |
|
) |
| |
|
static |
Construct a floating-point type with fixed lanes.
◆ Int()
| static PrimType tvm::PrimType::Int |
( |
int |
bits, |
|
|
int |
lanes = 1 |
|
) |
| |
|
static |
Construct a signed integer type with fixed lanes.
◆ IsFixedLengthVector()
| TVM_FFI_INLINE bool tvm::PrimType::IsFixedLengthVector |
( |
| ) |
const |
|
inline |
Whether this type is a fixed-length vector.
◆ IsScalableVector()
| TVM_FFI_INLINE bool tvm::PrimType::IsScalableVector |
( |
| ) |
const |
|
inline |
Whether this type is a scalable vector.
◆ IsScalar()
| TVM_FFI_INLINE bool tvm::PrimType::IsScalar |
( |
| ) |
const |
|
inline |
Whether this type is a scalar, excluding fixed and scalable vectors.
◆ IsVoid()
| TVM_FFI_INLINE bool tvm::PrimType::IsVoid |
( |
| ) |
const |
|
inline |
Whether this type is the void sentinel handle(0, 0).
◆ lanes()
| TVM_FFI_INLINE int32_t tvm::PrimType::lanes |
( |
| ) |
const |
|
inline |
- Returns
- The fixed lane count.
- Note
- Throws on scalable vector types, where the encoded lane field stores a vscale factor.
◆ MatchesCode()
template<typename... Codes>
| TVM_FFI_INLINE bool tvm::PrimType::MatchesCode |
( |
Codes... |
codes | ) |
const |
|
inline |
Check whether the dtype code matches any of the provided DLPack codes.
- Note
- Bit width and lanes are intentionally ignored.
◆ MatchesElementType()
| TVM_FFI_INLINE bool tvm::PrimType::MatchesElementType |
( |
DLDataTypeCode |
code, |
|
|
int |
bits |
|
) |
| const |
|
inline |
Check the scalar element code and bit width.
- Note
- Lane count and scalable-vector encoding are intentionally ignored.
◆ ScalableVector()
| static PrimType tvm::PrimType::ScalableVector |
( |
DLDataTypeCode |
code, |
|
|
int |
bits, |
|
|
int |
lanes |
|
) |
| |
|
static |
Construct a scalable vector type.
- Parameters
-
| code | The DLPack dtype code. |
| bits | The scalar bit width. |
| lanes | The positive vscale factor to encode in the DLPack lane field. |
◆ StorageBytes()
| TVM_FFI_INLINE size_t tvm::PrimType::StorageBytes |
( |
| ) |
const |
|
inline |
Return the number of bytes needed to store one value of this type.
This uses the same packed sub-byte dtype sizing rule as runtime tensors. Scalable vector types have no compile-time storage size and are rejected.
◆ TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE()
◆ UInt()
| static PrimType tvm::PrimType::UInt |
( |
int |
bits, |
|
|
int |
lanes = 1 |
|
) |
| |
|
static |
Construct an unsigned integer type with fixed lanes.
◆ Void()
Construct the void sentinel type, encoded as handle(0, 0).
◆ VScaleFactor()
| TVM_FFI_INLINE int32_t tvm::PrimType::VScaleFactor |
( |
| ) |
const |
|
inline |
- Returns
- The vscale factor encoded in a scalable vector type.
◆ WithBits()
| TVM_FFI_INLINE PrimType tvm::PrimType::WithBits |
( |
int |
bits | ) |
const |
|
inline |
Return the same type with a different scalar bit width, preserving code and lanes.
◆ WithCode()
| TVM_FFI_INLINE PrimType tvm::PrimType::WithCode |
( |
DLDataTypeCode |
code | ) |
const |
|
inline |
Return the same type with a different dtype code, preserving bits and lanes.
◆ WithLanes()
| TVM_FFI_INLINE PrimType tvm::PrimType::WithLanes |
( |
int |
lanes | ) |
const |
|
inline |
Return the same scalar element type with a fixed lane count.
The documentation for this class was generated from the following file: