Class PrimType#
Defined in File type.h
Inheritance Relationships#
Base Type#
public tvm::Type(Class Type)
Class Documentation#
-
class PrimType : public tvm::Type#
Public Types
-
using ContainerType = PrimTypeObj#
Public Functions
-
explicit PrimType(DLDataType dtype)#
Construct from a raw DLPack dtype.
- Parameters:
dtype – The corresponding DLPack dtype.
-
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.
-
inline DLDataTypeCode code() const#
- Returns:
The DLPack dtype code.
-
inline int32_t bits() const#
- Returns:
The scalar bit width.
-
inline int32_t lanes() const#
Note
Throws on scalable vector types, where the encoded lane field stores a vscale factor.
- Returns:
The fixed lane count.
-
inline bool MatchesElementType(DLDataTypeCode code, int bits) const#
Check the scalar element code and bit width.
Note
Lane count and scalable-vector encoding are intentionally ignored.
-
template<typename ...Codes>
inline bool MatchesCode(Codes... codes) const# Check whether the dtype code matches any of the provided DLPack codes.
Note
Bit width and lanes are intentionally ignored.
-
inline bool IsScalar() const#
Whether this type is a scalar, excluding fixed and scalable vectors.
-
inline bool IsVoid() const#
Whether this type is the void sentinel
handle(0, 0).
-
inline bool IsScalableVector() const#
Whether this type is a scalable vector.
-
inline bool IsFixedLengthVector() const#
Whether this type is a fixed-length vector.
-
inline size_t StorageBytes() const#
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.
-
inline PrimType WithCode(DLDataTypeCode code) const#
Return the same type with a different dtype code, preserving bits and lanes.
-
inline PrimType WithBits(int bits) const#
Return the same type with a different scalar bit width, preserving code and lanes.
-
inline PrimType WithLanes(int lanes) const#
Return the same scalar element type with a fixed lane count.
-
inline int32_t VScaleFactor() const#
- Returns:
The vscale factor encoded in a scalable vector type.
-
inline explicit PrimType(::tvm::ffi::UnsafeInit tag)#
-
inline __PtrType operator->() const#
-
inline __PtrType get() const#
Public Static Functions
-
using ContainerType = PrimTypeObj#