24 #ifndef TVM_TIR_STMT_H_ 25 #define TVM_TIR_STMT_H_ 30 #include <type_traits> 49 static constexpr
const char*
_type_key =
"tir.Stmt";
75 v->Visit(
"var", &var);
76 v->Visit(
"value", &value);
77 v->Visit(
"body", &body);
78 v->Visit(
"span", &
span);
92 static constexpr
const char*
_type_key =
"tir.LetStmt";
129 v->Visit(
"node", &node);
130 v->Visit(
"attr_key", &attr_key);
131 v->Visit(
"value", &value);
132 v->Visit(
"body", &body);
133 v->Visit(
"span", &
span);
143 hash_reduce(attr_key);
148 static constexpr
const char*
_type_key =
"tir.AttrStmt";
179 v->Visit(
"condition", &condition);
180 v->Visit(
"message", &message);
181 v->Visit(
"body", &body);
182 v->Visit(
"span", &
span);
191 hash_reduce(condition);
192 hash_reduce(message);
196 static constexpr
const char*
_type_key =
"tir.AssertStmt";
241 v->Visit(
"buffer_var", &buffer_var);
242 v->Visit(
"value", &value);
243 v->Visit(
"index", &index);
244 v->Visit(
"predicate", &predicate);
245 v->Visit(
"span", &
span);
254 hash_reduce(buffer_var);
257 hash_reduce(predicate);
296 v->Visit(
"buffer", &buffer);
297 v->Visit(
"value", &value);
298 v->Visit(
"indices", &indices);
299 v->Visit(
"span", &
span);
310 hash_reduce(indices);
313 static constexpr
const char*
_type_key =
"tir.BufferStore";
353 v->Visit(
"buffer", &buffer);
354 v->Visit(
"bounds", &bounds);
355 v->Visit(
"condition", &condition);
356 v->Visit(
"body", &body);
357 v->Visit(
"span", &
span);
368 hash_reduce(condition);
375 :
StmtNode(
span), buffer(buffer), bounds(bounds), condition(condition), body(body) {}
377 static constexpr
const char*
_type_key =
"tir.BufferRealize";
414 v->Visit(
"producer", &producer);
415 v->Visit(
"value", &value);
416 v->Visit(
"indices", &indices);
417 v->Visit(
"span", &
span);
426 hash_reduce(producer);
428 hash_reduce(indices);
431 static constexpr
const char*
_type_key =
"tir.ProducerStore";
472 v->Visit(
"producer", &producer);
473 v->Visit(
"bounds", &bounds);
474 v->Visit(
"condition", &condition);
475 v->Visit(
"body", &body);
476 v->Visit(
"storage_scope", &storage_scope);
477 v->Visit(
"span", &
span);
487 hash_reduce(producer);
489 hash_reduce(condition);
491 hash_reduce(storage_scope);
494 static constexpr
const char*
_type_key =
"tir.ProducerRealize";
534 v->Visit(
"buffer_var", &buffer_var);
535 v->Visit(
"dtype", &dtype);
536 v->Visit(
"extents", &extents);
537 v->Visit(
"condition", &condition);
538 v->Visit(
"body", &body);
539 v->Visit(
"annotations", &annotations);
540 v->Visit(
"span", &
span);
550 hash_reduce.
DefHash(buffer_var);
552 hash_reduce(extents);
553 hash_reduce(condition);
555 hash_reduce(annotations);
570 TVM_DLL
static int64_t ConstantAllocationSize(
const Array<PrimExpr>& extents);
572 static constexpr
const char*
_type_key =
"tir.Allocate";
622 v->Visit(
"buffer_var", &buffer_var);
623 v->Visit(
"data", &data);
624 v->Visit(
"irmod_storage_idx", &irmod_storage_idx);
625 v->Visit(
"dtype", &dtype);
626 v->Visit(
"extents", &extents);
627 v->Visit(
"body", &body);
628 v->Visit(
"annotations", &annotations);
629 v->Visit(
"span", &
span);
639 hash_reduce.
DefHash(buffer_var);
641 hash_reduce(extents);
643 hash_reduce(annotations);
659 TVM_DLL
static int64_t ConstantAllocationSize(
const Array<PrimExpr>& extents);
661 static constexpr
const char*
_type_key =
"tir.AllocateConst";
701 v->Visit(
"seq", &seq);
702 v->Visit(
"span", &
span);
726 size_t size()
const {
return operator->()->size(); }
747 template <
typename... Args>
750 runtime::detail::for_each(
Flattener(&seq), std::forward<Args>(seq_args)...);
751 if (seq.
size() == 1)
return seq[0];
762 operator()(0, op->seq);
764 seq_->push_back(stmt);
768 template <
typename T>
771 this->operator()(0, v);
795 v->Visit(
"condition", &condition);
796 v->Visit(
"then_case", &then_case);
797 v->Visit(
"else_case", &else_case);
798 v->Visit(
"span", &
span);
807 hash_reduce(condition);
808 hash_reduce(then_case);
809 hash_reduce(else_case);
812 static constexpr
const char*
_type_key =
"tir.IfThenElse";
840 v->Visit(
"value", &value);
841 v->Visit(
"span", &
span);
850 static constexpr
const char*
_type_key =
"tir.Evaluate";
933 v->Visit(
"loop_var", &loop_var);
934 v->Visit(
"min", &min);
935 v->Visit(
"extent", &extent);
936 v->Visit(
"kind", &kind);
937 v->Visit(
"body", &body);
938 v->Visit(
"thread_binding", &thread_binding);
939 v->Visit(
"annotations", &annotations);
940 v->Visit(
"span", &
span);
955 hash_reduce(thread_binding);
956 hash_reduce(annotations);
995 v->Visit(
"condition", &condition);
996 v->Visit(
"body", &body);
997 v->Visit(
"span", &
span);
1005 hash_reduce(condition);
1035 v->Visit(
"buffer", &buffer);
1036 v->Visit(
"bounds", &bounds);
1037 v->Visit(
"span", &
span);
1045 hash_reduce(buffer);
1046 hash_reduce(bounds);
1079 v->Visit(
"buffer", &buffer);
1080 v->Visit(
"region", ®ion);
1088 hash_reduce(buffer);
1089 hash_reduce(region);
1092 static constexpr
const char*
_type_key =
"tir.BufferRegion";
1111 TVM_DLL
static BufferRegion FullRegion(
Buffer buffer);
1142 v->Visit(
"buffer", &buffer);
1143 v->Visit(
"source", &source);
1151 hash_reduce(buffer);
1152 hash_reduce(source);
1155 static constexpr
const char*
_type_key =
"tir.MatchBufferRegion";
1221 v->Visit(
"iter_vars", &iter_vars);
1222 v->Visit(
"reads", &reads);
1223 v->Visit(
"writes", &writes);
1224 v->Visit(
"name_hint", &name_hint);
1225 v->Visit(
"body", &body);
1226 v->Visit(
"init", &init);
1227 v->Visit(
"alloc_buffers", &alloc_buffers);
1228 v->Visit(
"match_buffers", &match_buffers);
1229 v->Visit(
"annotations", &annotations);
1242 hash_reduce.
DefHash(iter_vars);
1243 hash_reduce(alloc_buffers);
1244 hash_reduce(match_buffers);
1246 hash_reduce(writes);
1249 hash_reduce(annotations);
1290 v->Visit(
"iter_values", &iter_values);
1291 v->Visit(
"predicate", &predicate);
1292 v->Visit(
"block", &block);
1301 hash_reduce(iter_values);
1302 hash_reduce(predicate);
1306 static constexpr
const char*
_type_key =
"tir.BlockRealize";
1500 "meta_schedule.thread_extent_low_inclusive";
1504 "meta_schedule.thread_extent_high_inclusive";
1508 "meta_schedule.random_compute_producer";
1534 return attr_key.compare(0, 7,
"pragma_") == 0;
1557 return "vectorized";
1561 return "thread_binding";
1563 LOG(FATAL) <<
"Unknown ForKind" << t;
1569 #endif // TVM_TIR_STMT_H_ tvm::Span Span
Definition: base.h:65
bool SEqualReduce(const WhileNode *other, SEqualReducer equal) const
Definition: stmt.h:1000
constexpr const char * pragma_import_c
Import C source or file into the final code gen module.
Definition: stmt.h:1369
Managed reference to StoreNode.
Definition: stmt.h:268
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:425
Define certain auxiliary attribute for the body to be a symbolic value. This provide auxiliary inform...
Definition: stmt.h:117
PrimExpr index
The index locations to be stored.
Definition: stmt.h:236
String attr_key
the type key of the attribute
Definition: stmt.h:122
constexpr const char * pipeline_exec_scope
pipeline execution scope, implies the scope can be pipelined.
Definition: stmt.h:1439
Store value into mult-dimensional array that will be read by the consumer of the producer.
Definition: stmt.h:404
Buffer buffer
The buffer variable.
Definition: stmt.h:289
bool DefEqual(const ObjectRef &lhs, const ObjectRef &rhs)
Reduce condition to comparison of two definitions, where free vars can be mapped. ...
Definition: structural_equal.h:165
PrimExpr value
The expression to be evaluated.
Definition: stmt.h:837
constexpr const char * device_type
The device type.
Definition: stmt.h:1357
Buffer buffer
The function to be prefetched.
Definition: stmt.h:1030
A prefetch hint for a buffer.
Definition: stmt.h:1027
Base node of all statements.
Definition: stmt.h:38
constexpr const char * scan_init_scope
Mark of scan init scope.
Definition: stmt.h:1407
Managed reference to BlockNode.
Definition: stmt.h:1260
PrimExpr min(PrimExpr a, PrimExpr b, Span span=Span())
take minimum of two values
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1044
Array< Buffer > alloc_buffers
The buffer allocated in the block.
Definition: stmt.h:1214
Array< PrimExpr > indices
The indices location to be stored.
Definition: stmt.h:293
Stmt operator[](size_t index) const
Get the index-th element in the sequence.
Definition: stmt.h:730
PrimExpr value
The value to be stored.
Definition: stmt.h:234
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:128
A block realization node represents execution of the block at the binding values. ...
Definition: stmt.h:1277
constexpr const char * channel_read_advance
Advance step of channel after end of scope.
Definition: stmt.h:1431
Optional< Integer > irmod_storage_idx
If the PrimFunc containing the Stmt is added to IRModule, this is an optional index to indicate the i...
Definition: stmt.h:606
constexpr const char * realize_scope
Mark storage scope of realization.
Definition: stmt.h:1353
PrimExpr value
The value to be binded.
Definition: stmt.h:70
Stmt body
The body of realization.
Definition: stmt.h:467
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:102
Optional< IterVar > thread_binding
Only valid when kind == ForKind::kThreadBinding The context thread that this loop variable bounds to...
Definition: stmt.h:921
bool SEqualReduce(const AssertStmtNode *other, SEqualReducer equal) const
Definition: stmt.h:185
Managed reference to PrefetchNode.
Definition: stmt.h:1061
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:253
constexpr const char * buffer_dim_align
Mark alignment of buffer dimension stmt.node is Tensor stmt.value is tvm_tuple(dim, align, offset) This gives hint to require stride of dim to be k * align + offset.
Definition: stmt.h:1414
Managed reference to AllocateConstNode.
Definition: stmt.h:671
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:413
Helper class to flatten sequence of arguments into Array.
Definition: stmt.h:755
constexpr const char * meta_schedule_layout_rewrite_preproc
Mark that a block is a preprocessor block for layout rewrite.
Definition: stmt.h:1526
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:102
static constexpr const bool _type_has_method_sequal_reduce
Definition: stmt.h:50
constexpr const char * coproc_scope
Mark region is processed by a co-proccesor.
Definition: stmt.h:1331
Managed reference to ProducerRealizeNode.
Definition: stmt.h:502
Managed reference to IfThenElseNode.
Definition: stmt.h:820
constexpr const char * meta_schedule_auto_tensorize
Mark that a block should be further rewritten using tensorization.
Definition: stmt.h:1523
PrimExpr condition
Only realize if condition holds.
Definition: stmt.h:348
constexpr const char * buffer_bound
Mark stores/loads with theirs bounds.
Definition: stmt.h:1416
StmtNode(Span span)
Definition: stmt.h:47
bool SEqualReduce(const BufferStoreNode *other, SEqualReducer equal) const
Definition: stmt.h:302
The container of seq statement. Represent a sequence of statements.
Definition: stmt.h:688
constexpr const char * buffer_bind_scope
Bind the buffer specification to the region of the op When this scope occurs, the stmt...
Definition: stmt.h:1426
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
bool SEqualReduce(const StoreNode *other, SEqualReducer equal) const
Definition: stmt.h:248
constexpr const char * meta_schedule_unroll_explicit
Mark auto-unroll setting on the block.
Definition: stmt.h:1517
a named variable in TIR
Definition: var.h:88
Evaluate(int value, Span span=Span())
Definition: stmt.h:862
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:178
Var var
The variable.
Definition: stmt.h:68
IfThenElse statment.
Definition: stmt.h:785
Array< PrimExpr > extents
The extents of the buffer.
Definition: stmt.h:610
bool SEqualReduce(const IfThenElseNode *other, SEqualReducer equal) const
Definition: stmt.h:801
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:994
DataProducer producer
The producer that produces the data.
Definition: stmt.h:461
constexpr const char * compute_scope
Mark the scope as when computation start to happen This can hint some code generator to create a new ...
Definition: stmt.h:1349
constexpr const char * channel_read_scope
channel read scope
Definition: stmt.h:1429
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1087
Match introduces a constraint that the source buffer region can be remapped to the data layout specif...
Definition: stmt.h:1134
ForKind kind
The kind of the for loop.
Definition: stmt.h:914
constexpr const char * meta_schedule_thread_extent_high_inclusive
The allowed range of thread extent in thread bindings.
Definition: stmt.h:1503
constexpr const char * pragma_import_llvm
Import llvm source or file into the final code gen module.
Definition: stmt.h:1371
bool IsPragmaKey(const std::string &attr_key)
Check if attr_key is a pragma key extension.
Definition: stmt.h:1533
bool SEqualReduce(const AllocateNode *other, SEqualReducer equal) const
Definition: stmt.h:543
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:932
bool SEqualReduce(const BufferRealizeNode *other, SEqualReducer equal) const
Definition: stmt.h:360
Managed reference to ForNode.
Definition: stmt.h:967
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:471
Array< IterVar > iter_vars
The variables of the block.
Definition: stmt.h:1196
Block block
The block to be realized.
Definition: stmt.h:1287
DataType dtype
The type of the buffer.
Definition: stmt.h:608
Array< BufferRegion > reads
The read buffer regions of the block.
Definition: stmt.h:1198
static constexpr const char * _type_key
Definition: stmt.h:49
Managed reference to BufferRegionNode.
Definition: stmt.h:1102
base class of all object containers.
Definition: object.h:167
constexpr const char * script_parsing_detect_access
Mark whether the script-completer need to fill in missing access region during script parsing...
Definition: stmt.h:1473
Stmt body
The body statement to be executed.
Definition: stmt.h:126
Array< Stmt > seq
internal sequence content.
Definition: stmt.h:691
constexpr const char * extern_scope
Mark the scope as generated by extern primitive. such scope can contain arbitrary ir program and we n...
Definition: stmt.h:1344
PrimExpr value
The value to be stored.
Definition: stmt.h:409
PrimExpr condition
Only realize if condition holds.
Definition: stmt.h:465
void operator()(size_t i, const Stmt &stmt) const
Definition: stmt.h:759
Buffer buffer
The buffer of the buffer region.
Definition: stmt.h:1074
Var buffer_var
The buffer variable.
Definition: stmt.h:516
constexpr const char * pragma_auto_unroll_max_step
Pragma: auto-unroll, max_step.
Definition: stmt.h:1363
Managed reference to AssertStmtNode.
Definition: stmt.h:204
DataProducer producer
The producer to store the results into.
Definition: stmt.h:407
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:1078
constexpr const char * meta_schedule_vectorize
Mark auto-vectorize setting on the block.
Definition: stmt.h:1514
constexpr const char * device_id
The allocation device for global malloc in host.
Definition: stmt.h:1355
bool SEqualReduce(const LetStmtNode *other, SEqualReducer equal) const
Definition: stmt.h:81
Representing the region of multi-dimensional buffer access.
Definition: stmt.h:1071
Map< String, ObjectRef > annotations
Additional annotations about the loop.
Definition: stmt.h:930
constexpr const char * rolling_buffer_scope
Mark realization for rolling buffer optimization.
Definition: stmt.h:1403
Array< PrimExpr > indices
The index arguments of the function.
Definition: stmt.h:411
Buffer buffer
The buffer variable.
Definition: stmt.h:344
bool SEqualReduce(const PrefetchNode *other, SEqualReducer equal) const
Definition: stmt.h:1040
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
size_t size() const
Definition: stmt.h:726
static constexpr const uint32_t _type_child_slots
Definition: stmt.h:52
ObjectRef node
this is attribute about certain node
Definition: stmt.h:120
String storage_scope
The storage scope associated with this realization.
Definition: stmt.h:469
DataType dtype
The type of the buffer.
Definition: stmt.h:518
Annotate the bounds where the data produced by the producer need to be written and read in body...
Definition: stmt.h:458
PrimExpr TypeAnnotation(DataType dtype, Span span=Span())
Create a type annotation expression.
constexpr const char * layout_free_buffers
Mark the buffers which is const access and can be transformed layout.
Definition: stmt.h:1487
default semantics – serial execution.
PrimExpr condition
Only allocate buffer when condition is satisfied.
Definition: stmt.h:522
constexpr const char * channel_write_advance
Advance step of channel after end of scope.
Definition: stmt.h:1435
PrimExpr predicate
The predicate to mask which lanes would be stored.
Definition: stmt.h:238
constexpr const char * device_scope
Mark that it is in the device scope.
Definition: stmt.h:1444
Parallel execution on CPU.
static Stmt Flatten(Args &&... seq_args)
Construct a sequence statement by flattening all the arrays and sequences in the arguments recursivel...
Definition: stmt.h:748
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1300
BufferRegion source
The source buffer region.
Definition: stmt.h:1139
size_t size() const
Definition: array.h:399
Array< Range > region
The region array of the buffer region.
Definition: stmt.h:1076
Stmt body
The body to be executed.
Definition: stmt.h:612
bool defined() const
Definition: object.h:544
Runtime primitive data type.
Definition: data_type.h:41
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:295
String name_hint
The name_hint of the block.
Definition: stmt.h:1202
PrimExpr min
The minimum value of iteration.
Definition: stmt.h:910
constexpr const char * coproc_uop_scope
Mark region creates coprocessor micro ops, can be reused if corresponding variable is independent...
Definition: stmt.h:1336
bool SEqualReduce(const ForNode *other, SEqualReducer equal) const
Definition: stmt.h:943
bool SEqualReduce(const ProducerStoreNode *other, SEqualReducer equal) const
Definition: stmt.h:420
PrimExpr predicate
The predicate of the block realization, the block will only be executed when the predicate is true...
Definition: stmt.h:1285
PrimExpr condition
The condition.
Definition: stmt.h:788
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:621
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:270
constexpr const char * fragment_layout
Mark that the layout of TensorCore fragment.
Definition: stmt.h:1459
constexpr const char * reduce_scope
Mark of reduce scope.
Definition: stmt.h:1361
int64_t ConstantAllocationSize() const
If the buffer size is constant, return the size. Otherwise return 0.
Definition: stmt.h:563
A While loop.
Definition: stmt.h:987
Stmt body
The body of the for loop.
Definition: stmt.h:916
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:709
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:141
constexpr const char * meta_schedule_thread_extent_low_inclusive
The allowed range of thread extent in thread bindings.
Definition: stmt.h:1499
constexpr const char * prefetch_scope
Mark of prefetch scope, value=offset, run prefetch of Tensor on the current loop scope.
Definition: stmt.h:1378
Stmt body
The body of the while loop.
Definition: stmt.h:992
Stmt body
The body of realization.
Definition: stmt.h:350
constexpr const char * layout_transforms
Marks the layout transforms to be used for a tensor.
Definition: stmt.h:1385
constexpr const char * volatile_scope
Mark the scope as volatile access for certain handle.
Definition: stmt.h:1338
Container of all statements.
Definition: stmt.h:57
Stmt body
Body which this assertion holds true. Will be executed after the assertion.
Definition: stmt.h:176
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:1141
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:700
constexpr const char * meta_schedule_random_compute_producer
Mark the block whose producer needs to be applied by rule Random-Compute-Location.
Definition: stmt.h:1507
static constexpr const bool _type_has_method_shash_reduce
Definition: stmt.h:51
The loop variable is bound to a thread in an environment. In the final stage of lowering, the loop is simply removed and the loop variable is mapped to the corresponding context thread.
Reference to string objects.
Definition: string.h:124
constexpr const char * async_scope
Mark that the attached statement runs asynchronously.
Definition: stmt.h:1449
constexpr const char * double_buffer_scope
Marks production of double buffer data.
Definition: stmt.h:1397
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:1289
Managed reference to BufferRealizeNode.
Definition: stmt.h:385
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
Allocate a buffer that can be used in body.
Definition: stmt.h:513
The loop is vectorized.
Definition: var.h:230
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:794
size_t size() const
Definition: stmt.h:694
Evaluates an expression. This is mostly used for putting a Call node into Stmt.
Definition: stmt.h:834
The execution is unrolled.
Definition: var.h:226
PrimExpr condition
The termination condition.
Definition: stmt.h:990
constexpr const char * pragma_unroll_explicit
Pragma: unroll explicit.
Definition: stmt.h:1365
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1150
Managed reference to AllocateNode.
Definition: stmt.h:582
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1004
A block is a basic schedule unit in TIR.
Definition: stmt.h:1193
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:240
constexpr const char * thread_extent
Mark launching extent of thread, used by device API.
Definition: stmt.h:1327
Optional< runtime::NDArray > data
The optional data associated to the constant.
Definition: stmt.h:601
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:949
Array< MatchBufferRegion > match_buffers
The match buffer regions.
Definition: stmt.h:1216
Managed reference to BlockRealizeNode.
Definition: stmt.h:1314
Managed reference to MatchBufferRegionNode.
Definition: stmt.h:1165
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
ForKind
The kind of the loop.
Definition: stmt.h:874
Allocate a buffer that can be used in body.
Definition: stmt.h:595
bool SEqualReduce(const EvaluateNode *other, SEqualReducer equal) const
Definition: stmt.h:844
Map< String, ObjectRef > annotations
Additional annotations about the allocation.
Definition: stmt.h:619
BufferRealizeNode(Buffer buffer, Array< Range > bounds, PrimExpr condition, Stmt body, Span span=Span())
Definition: stmt.h:373
Base class of all object reference.
Definition: object.h:511
#define TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName)
Define CopyOnWrite function in an ObjectRef.
Definition: object.h:785
constexpr const char * software_pipeline_order
Mark the order of a statement in the software pipeline.
Definition: stmt.h:1484
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:848
Store value to the buffer.
Definition: stmt.h:229
Managed reference to DataProducerNode.
Definition: buffer.h:293
constexpr const char * axis_separators
Marks the physical axis separators.
Definition: stmt.h:1393
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:365
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:806
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types...
Definition: buffer.h:160
#define TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)
helper macro to declare type information in a final class.
Definition: object.h:671
bool SEqualReduce(const MatchBufferRegionNode *other, SEqualReducer equal) const
Definition: stmt.h:1146
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:1034
PrimExpr value
The attribute value, value is well defined at current scope.
Definition: stmt.h:124
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:1241
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:549
constexpr const char * software_pipeline_stage
Mark the stage of a statement in the software pipeline.
Definition: stmt.h:1481
Span span
Span that points to the original source code. Reserved debug information.
Definition: stmt.h:44
Store value to the high dimension buffer.
Definition: stmt.h:286
Managed reference to BufferStoreNode.
Definition: stmt.h:321
Region bounds
Bounds to be realized.
Definition: stmt.h:463
Var buffer_var
The buffer variable.
Definition: stmt.h:598
Stmt then_case
The branch to be executed when condition is true.
Definition: stmt.h:790
Managed reference to WhileNode.
Definition: stmt.h:1017
void operator()(size_t i, const T &seq) const
Definition: stmt.h:769
Assert condition, if an error occurs, return the error message.
Definition: stmt.h:166
bool SEqualReduce(const ProducerRealizeNode *other, SEqualReducer equal) const
Definition: stmt.h:480
Managed reference to ProducerStoreNode.
Definition: stmt.h:439
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:352
PrimExpr condition
Condition to be checked.
Definition: stmt.h:169
constexpr const char * meta_schedule_parallel
Mark auto-parallel setting on the block.
Definition: stmt.h:1511
bool SEqualReduce(const BlockRealizeNode *other, SEqualReducer equal) const
Definition: stmt.h:1295
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics, which means map is mutable but copy will happen when array is referenced in more than two places.
Definition: map.h:1268
constexpr const char * double_buffer_write
Marks region used by double buffer write.
Definition: stmt.h:1401
Stmt body
The body to be executed.
Definition: stmt.h:524
constexpr const char * hand_threaded
Mark that the kernel is hand threaded and doesn't need syncs inserted.
Definition: stmt.h:1464
constexpr const char * meta_schedule_unroll_implicit
Mark auto-unroll setting on the block.
Definition: stmt.h:1520
Array< BufferRegion > writes
The write buffer regions of the block.
Definition: stmt.h:1200
Stmt body
The body block.
Definition: stmt.h:72
constexpr const char * loop_scope
Mark of loop scope.
Definition: stmt.h:1359
Stmt body
The body of the block.
Definition: stmt.h:1204
Stmt else_case
The branch to be executed when condition is false, can be null.
Definition: stmt.h:792
constexpr const char * pipeline_stage_scope
pipeline stage scope, implies always execution
Definition: stmt.h:1437
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
bool SEqualReduce(const AttrStmtNode *other, SEqualReducer equal) const
Definition: stmt.h:136
A for loop, with poissible type annotations.
Definition: stmt.h:905
Array< PrimExpr > iter_values
The corresponding values of the iter vars.
Definition: stmt.h:1280
Var loop_var
The loop variable.
Definition: stmt.h:908
bool SEqualReduce(const AllocateConstNode *other, SEqualReducer equal) const
Definition: stmt.h:632
std::ostream & operator<<(std::ostream &os, ForKind kind)
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:307
Flattener(Array< Stmt > *seq)
Definition: stmt.h:757
PrimExpr value
The value to be stored.
Definition: stmt.h:291
bool SEqualReduce(const BlockNode *other, SEqualReducer equal) const
Definition: stmt.h:1232
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:86
TVM_DECLARE_BASE_OBJECT_INFO(StmtNode, Object)
constexpr const char * channel_write_scope
channel write scope
Definition: stmt.h:1433
PrefetchNode(Buffer buffer, Array< Range > bounds, Span span=Span())
Definition: stmt.h:1050
Let binding, bind var to value, then run body.
Definition: stmt.h:65
PrimExpr message
Error message when assertion failed.
Definition: stmt.h:171
Reference to PrimExprNode.
Definition: expr.h:112
Sequence statement.
Definition: stmt.h:716
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:533
constexpr runtime::NullOptType NullOpt
Definition: optional.h:160
constexpr const char * meta_schedule_cooperative_fetch
Mark that the loop should be further skip and bound to environment threads to enable cooperative fetc...
Definition: stmt.h:1496
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:638
bool SEqualReduce(const BufferRegionNode *other, SEqualReducer equal) const
Definition: stmt.h:1083
constexpr const char * meta_schedule_tiling_structure
Mark the tiling structure of blocks that are applied by rule Multi-Level-Tiling.
Definition: stmt.h:1490
Managed reference to EvaluateNode.
Definition: stmt.h:858
constexpr const char * fragment_shape
Mark that the shape of TensorCore fragment.
Definition: stmt.h:1454
PrimExpr extent
The extent of the iteration.
Definition: stmt.h:912
const ObjectType * as() const
Try to downcast the internal Object to a raw pointer of a corresponding type.
Definition: object.h:865
const char * ForKind2String(ForKind t)
Definition: stmt.h:1550
constexpr const char * pragma_scope_prefix
Mark region is guarded by the pragma extension.
Definition: stmt.h:1367
Array< Range > bounds
Bounds to be realized.
Definition: stmt.h:346
constexpr const char * scan_update_scope
Mark of scan update scope.
Definition: stmt.h:1405
Buffer buffer
The target buffer.
Definition: stmt.h:1137
Annotate the region where the buffer need to be read and write in the body. We only need to allocate ...
Definition: stmt.h:341
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:1220
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:486
Stmt operator[](size_t index) const
Get the index-th element in the sequence.
Definition: stmt.h:698
void SHashReduce(SHashReducer hash_reduce) const
Definition: stmt.h:190
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:74
#define TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:728
Managed reference to AttrStmtNode.
Definition: stmt.h:156
Array< Range > bounds
Bounds to be prefetched.
Definition: stmt.h:1032
Map< String, ObjectRef > annotations
The annotation of the block.
Definition: stmt.h:1218
constexpr const char * pragma_tensor_core
Try to modify the AST to support Tensor Core.
Definition: stmt.h:1373
Optional< Stmt > init
The init statement is executed during the first iteration of reduction loops in a reduction block...
Definition: stmt.h:1212
Map< String, ObjectRef > annotations
Additional annotations about the allocation.
Definition: stmt.h:531
Array< PrimExpr > extents
The extents of the buffer.
Definition: stmt.h:520
constexpr const char * storage_alignment
Mark storage alignment requirement of buffers.
Definition: stmt.h:1351
Managed reference to LetStmtNode.
Definition: stmt.h:100
void VisitAttrs(AttrVisitor *v)
Definition: stmt.h:839
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:179
bool SEqualReduce(const SeqStmtNode *other, SEqualReducer equal) const
Definition: stmt.h:705
Var buffer_var
The buffer variable.
Definition: stmt.h:232
constexpr const char * virtual_thread
Mark launching of a virtual thread.
Definition: stmt.h:1329
int64_t ConstantAllocationSize() const
If the buffer size is constant, return the size. Otherwise return 0.
Definition: stmt.h:652
constexpr const char * pragma_loop_partition_hint
Mark that the loop should be partitioned.
Definition: stmt.h:1478