24 #ifndef TVM_TIR_VAR_H_
25 #define TVM_TIR_VAR_H_
65 refl::ObjectDef<VarNode>()
94 TVM_DLL
explicit Var(ffi::String name_hint,
Type type_annotation,
Span span =
Span());
136 refl::ObjectDef<SizeVarNode>();
279 refl::ObjectDef<IterVarNode>()
310 inline IterVar::operator
PrimExpr()
const {
return (*this)->var; }
317 return "ThreadIndex";
329 return "Parallelized";
353 struct std::hash<
tvm::tirx::Var> {
355 return tvm::runtime::ObjectPtrHash()(
var);
360 struct std::equal_to<
tvm::tirx::Var> {
362 return tvm::runtime::ObjectPtrEqual()(var_a, var_b);
Base class for other IR constructs that can be converted to PrimExpr. This is useful for the FFI to c...
Definition: expr.h:156
Managed reference to PrimExprConvertibleNode.
Definition: expr.h:167
Base node of all primitive expressions.
Definition: expr.h:93
Reference to PrimExprNode.
Definition: expr.h:126
DataType dtype() const
Definition: expr.h:140
Range container
Definition: expr.h:690
Definition: source_map.h:111
Managed reference to TypeNode.
Definition: type.h:99
Runtime primitive data type.
Definition: data_type.h:47
static DataType Int(int bits, int lanes=1)
Construct an int type.
Definition: data_type.h:278
An iteration variable representing an iteration over a one dimensional interval.
Definition: var.h:253
Range dom
the domain of iteration, if known, can be None For the intermediate schedule node,...
Definition: var.h:259
ffi::String thread_tag
additional tag on the iteration variable, set this if this is bound already to a known thread tag.
Definition: var.h:268
IterVarType iter_type
The type of the IterVar.
Definition: var.h:263
static void RegisterReflection()
Definition: var.h:277
PrimExpr ToPrimExpr() const final
Definition: var.h:275
Span span
Span that points to the original source code. Reserved debug information.
Definition: var.h:273
Var var
The looping variable.
Definition: var.h:261
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: var.h:286
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.IterVar", IterVarNode, PrimExprConvertibleNode)
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:296
IterVar(Range dom, Var var, IterVarType iter_type, ffi::String thread_tag="", Span span=Span())
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(IterVar, PrimExprConvertible, IterVarNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(IterVarNode)
A variable node represent a tensor index size, whose value must be non-negative.
Definition: var.h:132
static void RegisterReflection()
Definition: var.h:134
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tirx.SizeVar", SizeVarNode, VarNode)
a named variable represents a tensor index size
Definition: var.h:142
SizeVar(ffi::String name_hint, Type type_annotation, Span span=Span())
Constructor which provides a more detailed type annotation.
const SizeVarNode * get() const
Get pointer to the internal value.
Definition: var.h:170
SizeVar(ObjectPtr< SizeVarNode > n)
Definition: var.h:144
SizeVar(ffi::UnsafeInit tag)
Definition: var.h:145
SizeVar(ffi::String name_hint="s", DataType t=DataType::Int(32), Span span=Span())
constructor
const SizeVarNode * operator->() const
Get pointer to the internal value.
Definition: var.h:165
A variable node in the IR.
Definition: var.h:47
ffi::String name_hint
The hint to the variable name.
Definition: var.h:53
Type type_annotation
type annotation of the variable.
Definition: var.h:61
TVM_FFI_DECLARE_OBJECT_INFO("tirx.Var", VarNode, PrimExprNode)
static void RegisterReflection()
Definition: var.h:63
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: var.h:70
static constexpr const uint32_t _type_child_slots
Definition: var.h:71
a named variable in TIR
Definition: var.h:76
Var(ObjectPtr< VarNode > n)
Definition: var.h:79
Var copy_with_suffix(const ffi::String &suffix) const
Make a new copy of var with same type, append suffix.
const VarNode * operator->() const
Get pointer to the internal value.
Definition: var.h:118
Var(ffi::String name_hint, Type type_annotation, Span span=Span())
Constructor which provides a more detailed type annotation.
Var(ffi::String name_hint="v", DataType dtype=DataType::Int(32), Span span=Span())
Constructor.
Var copy_with_dtype(DataType dtype) const
Make a new copy of the variable with specified dtype.
Var(ffi::UnsafeInit tag)
Definition: var.h:78
Var copy_with_name(const ffi::String &name) const
Make a new copy of var with same type, but a different nam.
const VarNode * get() const
Get pointer to the internal value.
Definition: var.h:123
Definition: repr_printer.h:91
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
IterVarType
Type of iteration variable. Each IterVar have a specific type.
Definition: var.h:184
@ kThreadIndex
The IterVar itself is a thread-index of a fixed thread launching group. Note that this is already ass...
Definition: var.h:201
@ kUnrolled
The execution is unrolled.
Definition: var.h:232
@ kCommReduce
Communicative reduction. Cannot be directly parallelized.
Definition: var.h:208
@ kTensorized
Marks boundary of tensorization intrinsic.
Definition: var.h:244
@ kVectorized
The loop is vectorized.
Definition: var.h:236
@ kDataPar
Data parallel iteration. This normally corresponds to axis of Tensor. Allow all IterVar manipulations...
Definition: var.h:193
@ kParallelized
The loop is parallelized.
Definition: var.h:240
@ kOpaque
IterVar is opaque,.
Definition: var.h:226
@ kOrdered
Serial loops with loop carry dependency, the iteration must execute in order. Cannot be re-ordered.
Definition: var.h:216
ffi::Array< Range > Region
Definition: var.h:175
const char * IterVarType2String(IterVarType t)
Definition: var.h:312
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition: analyzer.h:37