24#ifndef TVM_TIRX_TYPE_H_
25#define TVM_TIRX_TYPE_H_
35#ifndef TVM_INDEX_DEFAULT_I64
36#define TVM_INDEX_DEFAULT_I64 1
40#if TVM_INDEX_DEFAULT_I64
45 return default_index_ty;
49#if TVM_INDEX_DEFAULT_I64
50 return DLDataType{kDLInt, 64, 1};
52 return DLDataType{kDLInt, 32, 1};
99 namespace refl = tvm::ffi::reflection;
100 refl::ObjectDef<TensorTypeNode>()
106 refl::AttachFieldFlag::SEqHashDefSimple())
138 ffi::Array<PrimExpr>
ElemOffset(ffi::Array<PrimExpr> index,
bool inner =
false)
const;
149 ffi::Array<PrimExpr> strides, ffi::Optional<PrimExpr> elem_offset,
150 int data_alignment,
int offset_factor,
155 explicit TensorType(ffi::ObjectPtr<TensorTypeNode> n) :
Type(ffi::UnsafeInit{}) {
156 TVM_FFI_ICHECK(n !=
nullptr);
157 data_ = std::move(n);
168 namespace refl = tvm::ffi::reflection;
169 refl::ObjectDef<TensorMapTypeNode>();
Non-nullable source-location metadata.
Definition location.h:91
Typed reference/view over any Expr whose ExprNode::ty is PrimType.
Definition base_expr.h:447
Definition base_expr.h:161
static TVM_TIRX_DLL PrimType Void()
Construct the void sentinel type, encoded as handle(0, 0).
static TVM_TIRX_DLL PrimType Int(int bits, int lanes=1)
Construct a signed integer type with fixed lanes.
Type is the base type of all types.
Definition base_expr.h:54
Managed reference to TypeNode.
Definition base_expr.h:80
Reference to the shared immutable unknown location.
Definition location.h:105
The type of tensor map.
Definition type.h:165
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.TensorMapType", TensorMapTypeNode, TypeNode)
static void RegisterReflection()
Definition type.h:167
Managed reference to TensorMapTypeNode.
Definition type.h:178
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TensorMapType, Type, TensorMapTypeNode)
TVM_TIRX_DLL TensorMapType(Location loc=UnknownLoc())
Structural type of a TIRx tensor variable.
Definition type.h:64
PtrType DataPtrType() const
Definition type.h:121
ffi::Optional< Layout > layout
The layout of the tensor.
Definition type.h:96
DLDataType DefaultIndexType() const
Definition type.h:113
ffi::Array< PrimExpr > ElemOffset(ffi::Array< PrimExpr > index, bool inner=false) const
Determine the offset in the tensor of the given index.
PrimExpr elem_offset
The offset in terms of number of dtype elements (including lanes)
Definition type.h:87
int data_alignment
Alignment requirement of data pointer in bytes.
Definition type.h:89
ffi::Array< PrimExpr > shape
The type of the tensor prior to flattening.
Definition type.h:80
static void RegisterReflection()
Definition type.h:98
TensorTypeNode(ffi::UnsafeInit tag)
Definition type.h:66
int offset_factor
Factor of elem_offset field, elem_offset is guaranteed to be multiple of offset_factor.
Definition type.h:94
PrimType dtype
dtype in the content of the tensor
Definition type.h:71
ffi::Array< PrimExpr > strides
The strides of each dimension This can be an empty array, indicating array is contiguous.
Definition type.h:85
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.TensorType", TensorTypeNode, TypeNode)
PrimType ElementType() const
Definition type.h:118
TVM_TIRX_DLL bool IsScalar(bool alloc_or_decl=true) const
Whether this type supports scalar tensor syntax.
ffi::String storage_scope
Storage scope/address space of the tensor.
Definition type.h:73
TensorTypeNode(PrimExpr elem_offset)
Definition type.h:68
TVM_TIRX_DLL std::optional< int64_t > ConstantAllocationSize() const
Return the constant element count, or nullopt for symbolic extents or overflow.
Managed reference to TensorTypeNode.
Definition type.h:146
TensorType(ffi::ObjectPtr< TensorTypeNode > n)
Definition type.h:155
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(TensorType, Type, TensorTypeNode)
TVM_TIRX_DLL TensorType(ffi::String storage_scope, PrimType dtype, ffi::Array< PrimExpr > shape, ffi::Array< PrimExpr > strides, ffi::Optional< PrimExpr > elem_offset, int data_alignment, int offset_factor, ffi::Optional< Layout > layout=std::nullopt, Location loc=UnknownLoc())
IR/AST nodes for TVM types shared across IR variants.
Backend-defined execution hierarchy nodes shared by layouts and tile calls.
Definition axis_group_graph.h:41
PrimType DefaultIndexPrimType()
if TVM_INDEX_DEFAULT_I64 is set, return int64, otherwise return int32
Definition type.h:39
DLDataType DefaultIndexType()
Definition type.h:48
#define TVM_TIRX_DLL
Definition base.h:83