24 #ifndef TVM_TIR_VAR_H_
25 #define TVM_TIR_VAR_H_
66 refl::ObjectDef<VarNode>()
95 TVM_DLL
explicit Var(ffi::String name_hint,
Type type_annotation,
Span span =
Span());
137 refl::ObjectDef<SizeVarNode>();
280 refl::ObjectDef<IterVarNode>()
311 inline IterVar::operator
PrimExpr()
const {
return (*this)->var; }
318 return "ThreadIndex";
330 return "Parallelized";
354 struct std::hash<
tvm::tir::Var> {
356 return tvm::runtime::ObjectPtrHash()(
var);
361 struct std::equal_to<
tvm::tir::Var> {
363 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:154
Managed reference to PrimExprConvertibleNode.
Definition: expr.h:165
Base node of all primitive expressions.
Definition: expr.h:91
Reference to PrimExprNode.
Definition: expr.h:124
DataType dtype() const
Definition: expr.h:138
Range container
Definition: expr.h:689
Definition: source_map.h:111
Managed reference to TypeNode.
Definition: type.h:100
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:274
An iteration variable representing an iteration over a one dimensional interval.
Definition: var.h:254
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:269
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: var.h:287
Var var
The looping variable.
Definition: var.h:262
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.IterVar", IterVarNode, PrimExprConvertibleNode)
Span span
Span that points to the original source code. Reserved debug information.
Definition: var.h:274
static void RegisterReflection()
Definition: var.h:278
PrimExpr ToPrimExpr() const final
Definition: var.h:276
Range dom
the domain of iteration, if known, can be None For the intermediate schedule node,...
Definition: var.h:260
IterVarType iter_type
The type of the IterVar.
Definition: var.h:264
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:297
IterVar(Range dom, Var var, IterVarType iter_type, ffi::String thread_tag="", Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(IterVarNode)
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NULLABLE(IterVar, PrimExprConvertible, IterVarNode)
A variable node represent a tensor index size, whose value must be non-negative.
Definition: var.h:133
static void RegisterReflection()
Definition: var.h:135
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("tir.SizeVar", SizeVarNode, VarNode)
a named variable represents a tensor index size
Definition: var.h:143
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:171
SizeVar(ffi::UnsafeInit tag)
Definition: var.h:146
SizeVar(ffi::String name_hint="s", DataType t=DataType::Int(32), Span span=Span())
constructor
SizeVar(ObjectPtr< SizeVarNode > n)
Definition: var.h:145
const SizeVarNode * operator->() const
Get pointer to the internal value.
Definition: var.h:166
A variable node in the IR.
Definition: var.h:48
ffi::String name_hint
The hint to the variable name.
Definition: var.h:54
static void RegisterReflection()
Definition: var.h:64
Type type_annotation
type annotation of the variable.
Definition: var.h:62
TVM_FFI_DECLARE_OBJECT_INFO("tir.Var", VarNode, PrimExprNode)
static constexpr TVMFFISEqHashKind _type_s_eq_hash_kind
Definition: var.h:71
static constexpr const uint32_t _type_child_slots
Definition: var.h:72
a named variable in TIR
Definition: var.h:77
const VarNode * get() const
Get pointer to the internal value.
Definition: var.h:124
Var(ffi::String name_hint="v", DataType dtype=DataType::Int(32), Span span=Span())
Constructor.
Var(ffi::UnsafeInit tag)
Definition: var.h:79
Var(ffi::String name_hint, Type type_annotation, Span span=Span())
Constructor which provides a more detailed type annotation.
Var copy_with_suffix(const ffi::String &suffix) const
Make a new copy of var with same type, append suffix.
Var(ObjectPtr< VarNode > n)
Definition: var.h:80
const VarNode * operator->() const
Get pointer to the internal value.
Definition: var.h:119
Var copy_with_dtype(DataType dtype) const
Make a new copy of the variable with specified dtype.
Var copy_with_name(const ffi::String &name) const
Make a new copy of var with same type, but a different nam.
Definition: repr_printer.h:91
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
ffi::Array< Range > Region
Definition: var.h:176
IterVarType
Type of iteration variable. Each IterVar have a specific type.
Definition: var.h:185
@ kVectorized
The loop is vectorized.
Definition: var.h:237
@ kThreadIndex
The IterVar itself is a thread-index of a fixed thread launching group. Note that this is already ass...
Definition: var.h:202
@ kUnrolled
The execution is unrolled.
Definition: var.h:233
@ kTensorized
Marks boundary of tensorization intrinsic.
Definition: var.h:245
@ kDataPar
Data parallel iteration. This normally corresponds to axis of Tensor. Allow all IterVar manipulations...
Definition: var.h:194
@ kOrdered
Serial loops with loop carry dependency, the iteration must execute in order. Cannot be re-ordered.
Definition: var.h:217
@ kCommReduce
Communicative reduction. Cannot be directly parallelized.
Definition: var.h:209
@ kParallelized
The loop is parallelized.
Definition: var.h:241
@ kOpaque
IterVar is opaque,.
Definition: var.h:227
const char * IterVarType2String(IterVarType t)
Definition: var.h:313
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37
Definitions and helper macros for IR/AST nodes.