19 #ifndef TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_ 20 #define TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_ 28 namespace ir_builder {
43 v->Visit(
"stmts", &stmts);
46 static constexpr
const char*
_type_key =
"script.ir_builder.tir.TIRFrame";
87 v->Visit(
"name", &name);
88 v->Visit(
"args", &args);
89 v->Visit(
"ret_type", &ret_type);
90 v->Visit(
"buffer_map", &buffer_map);
91 v->Visit(
"attrs", &attrs);
92 v->Visit(
"env_threads", &env_threads);
93 v->Visit(
"root_alloc_buffers", &root_alloc_buffers);
96 static constexpr
const char*
_type_key =
"script.ir_builder.tir.PrimFuncFrame";
152 v->Visit(
"name", &name);
153 v->Visit(
"iter_vars", &iter_vars);
154 v->Visit(
"reads", &reads);
155 v->Visit(
"writes", &writes);
156 v->Visit(
"init", &init);
157 v->Visit(
"alloc_buffers", &alloc_buffers);
158 v->Visit(
"match_buffers", &match_buffers);
159 v->Visit(
"annotations", &annotations);
160 v->Visit(
"iter_values", &iter_values);
161 v->Visit(
"predicate", &predicate);
162 v->Visit(
"no_realize", &no_realize);
165 static constexpr
const char* _type_key =
"script.ir_builder.tir.BlockFrame";
196 static constexpr
const char* _type_key =
"script.ir_builder.tir.BlockInitFrame";
247 v->Visit(
"vars", &vars);
248 v->Visit(
"doms", &doms);
252 static constexpr
const char* _type_key =
"script.ir_builder.tir.ForFrame";
288 v->Visit(
"condition", &condition);
289 v->Visit(
"message", &message);
292 static constexpr
const char* _type_key =
"script.ir_builder.tir.AssertFrame";
327 v->Visit(
"var", &var);
328 v->Visit(
"value", &value);
331 static constexpr
const char* _type_key =
"script.ir_builder.tir.LetFrame";
367 v->Visit(
"extent", &extent);
368 v->Visit(
"attr_key", &attr_key);
369 v->Visit(
"iter_var", &iter_var);
372 static constexpr
const char* _type_key =
"script.ir_builder.tir.LaunchThreadFrame";
410 v->Visit(
"buffer_slice", &buffer_slice);
411 v->Visit(
"storage_scope", &storage_scope);
412 v->Visit(
"condition", &condition);
415 static constexpr
const char* _type_key =
"script.ir_builder.tir.RealizeFrame";
458 v->Visit(
"extents", &extents);
459 v->Visit(
"dtype", &dtype);
460 v->Visit(
"storage_scope", &storage_scope);
461 v->Visit(
"condition", &condition);
462 v->Visit(
"annotations", &annotations);
463 v->Visit(
"buffer_var", &buffer_var);
466 static constexpr
const char* _type_key =
"script.ir_builder.tir.AllocateFrame";
507 v->Visit(
"dtype", &dtype);
508 v->Visit(
"extents", &extents);
509 v->Visit(
"data", &data);
510 v->Visit(
"buffer_var", &buffer_var);
511 v->Visit(
"annotations", &annotations);
514 static constexpr
const char* _type_key =
"script.ir_builder.tir.AllocateConstFrame";
551 v->Visit(
"node", &node);
552 v->Visit(
"attr_key", &attr_key);
553 v->Visit(
"value", &value);
556 static constexpr
const char* _type_key =
"script.ir_builder.tir.AttrFrame";
589 v->Visit(
"condition", &condition);
592 static constexpr
const char* _type_key =
"script.ir_builder.tir.WhileFrame";
629 v->Visit(
"condition", &condition);
630 v->Visit(
"then_stmts", &then_stmts);
631 v->Visit(
"else_stmts", &else_stmts);
634 static constexpr
const char* _type_key =
"script.ir_builder.tir.IfFrame";
662 static constexpr
const char* _type_key =
"script.ir_builder.tir.ThenFrame";
695 static constexpr
const char* _type_key =
"script.ir_builder.tir.ElseFrame";
730 v->Visit(
"buffer", &buffer);
731 v->Visit(
"allocated", &allocated);
734 static constexpr
const char* _type_key =
"script.ir_builder.tir.DeclBufferFrame";
751 #endif // TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_ void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:549
A frame represents the allocate constant.
Definition: frame.h:492
A frame represents the allocate.
Definition: frame.h:441
Managed reference to IfFrameNode.
Definition: frame.h:650
Managed reference to PrimFuncFrameNode.
Definition: frame.h:112
Managed reference to an IRBuilderFrameNode.
Definition: base.h:100
Optional< Map< String, ObjectRef > > attrs
Additional attributes storing the meta-data.
Definition: frame.h:79
virtual void EnterWithScope()
The method called when entering RAII scope.
A frame that represents attribute node.
Definition: frame.h:540
#define TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:758
Map< String, ObjectRef > annotations
Additional annotation hints.
Definition: frame.h:452
A frame that represents the block.
Definition: frame.h:122
tvm::runtime::NDArray data
The data associated with the constant.
Definition: frame.h:499
Map< tvm::tir::Var, tvm::tir::Buffer > buffer_map
Maps some parameters to specific Buffer data structures.
Definition: frame.h:77
Array< tvm::tir::Buffer > root_alloc_buffers
The buffer allocated in root block.
Definition: frame.h:83
Optional< tvm::tir::Stmt > init
The init statement of the bolck.
Definition: frame.h:133
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:587
Optional< Array< tvm::tir::BufferRegion > > reads
The read buffer regions of the block.
Definition: frame.h:129
Managed reference to LaunchThreadFrameNode.
Definition: frame.h:388
Managed reference to AllocateConstFrameNode.
Definition: frame.h:530
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:728
Managed reference to BlockFrameNode.
Definition: frame.h:182
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
Managed reference to RealizeFrameNode.
Definition: frame.h:431
PrimExpr message
The output error message when the assertion failed.
Definition: frame.h:284
Managed reference to WhileFrameNode.
Definition: frame.h:608
PrimExpr value
The value of the attribute.
Definition: frame.h:547
TVM_DECLARE_BASE_OBJECT_INFO(TIRFrameNode, IRBuilderFrameNode)
String storage_scope
The storage scope associated with this realization.
Definition: frame.h:404
a named variable in TIR
Definition: var.h:88
Array< Range > doms
The domains of iteration.
Definition: frame.h:241
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:308
Array< tvm::tir::Var > vars
The loop variable.
Definition: frame.h:239
Array< tvm::tir::IterVar > iter_vars
The variables of the block.
Definition: frame.h:127
PrimExpr condition
The PrimExpr to test.
Definition: frame.h:282
Array< PrimExpr > extents
The extents of the allocate.
Definition: frame.h:497
String attr_key
The attribute key, could be either virtual_thread or thread_extent.
Definition: frame.h:361
A frame that represents the for loop.
Definition: frame.h:227
Managed reference to BufferRegionNode.
Definition: stmt.h:1099
ObjectRef node
The node to annotate the attribute.
Definition: frame.h:543
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.h:51
A frame that represents while loop.
Definition: frame.h:582
Array< tvm::tir::Stmt > stmts
The Stmt within in this frame.
Definition: frame.h:39
Optional< Array< tvm::tir::Stmt > > else_stmts
The stetements in the false branch.
Definition: frame.h:625
A frame that represents else.
Definition: frame.h:693
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:505
Map< tvm::tir::Var, tvm::tir::IterVar > env_threads
The variable map bound to thread env.
Definition: frame.h:81
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:286
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
Managed reference to LetFrameNode.
Definition: frame.h:347
Optional< Array< tvm::tir::Stmt > > then_stmts
The statements in the true branch.
Definition: frame.h:623
String attr_key
Attribute type key.
Definition: frame.h:545
Runtime primitive data type.
Definition: data_type.h:41
Managed reference to ForFrameNode.
Definition: frame.h:268
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:408
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:325
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:627
Array< tvm::tir::Var > args
Function parameters.
Definition: frame.h:73
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
void VisitAttrs(tvm::AttrVisitor *v)
Definition: base.h:69
A frame represents the let binding expression, which binds a var.
Definition: frame.h:318
A frame that represents the assert statement. Proceeds if the condition is true, otherwise aborts wit...
Definition: frame.h:279
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:365
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:150
Managed reference to TIRFrameNode.
Definition: frame.h:55
Container of all statements.
Definition: stmt.h:59
String storage_scope
The storage scope.
Definition: frame.h:448
Optional< Map< String, ObjectRef > > annotations
The annotation of the block.
Definition: frame.h:139
tvm::tir::Buffer buffer
The declared buffer.
Definition: frame.h:724
PrimExpr extent
The extent of environment thread.
Definition: frame.h:359
Reference to string objects.
Definition: string.h:98
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:85
Array< PrimExpr > iter_values
The corresponding values of the iter vars.
Definition: frame.h:141
Optional< String > name
The name of the block.
Definition: frame.h:71
PrimExpr value
The value we bind var to.
Definition: frame.h:323
Array< PrimExpr > extents
The extents of the allocate.
Definition: frame.h:444
Array< tvm::tir::Buffer > alloc_buffers
The buffer allocated in the block.
Definition: frame.h:135
Optional< Type > ret_type
The return type of the function.
Definition: frame.h:75
PrimExpr condition
The termination condition of while.
Definition: frame.h:585
A frame that represents the PrimFunc containing TIR statements.
Definition: frame.h:68
bool no_realize
The flag whether to construct BlockRealize or Block.
Definition: frame.h:148
DataType dtype
The data type of the buffer.
Definition: frame.h:495
tvm::tir::Var var
The variable we bind to.
Definition: frame.h:321
PrimExpr condition
The condition of the if statement.
Definition: frame.h:621
Base class of all object reference.
Definition: object.h:511
A frame that represents if statement.
Definition: frame.h:618
DataType dtype
The data type of the buffer.
Definition: frame.h:446
Array< tvm::tir::MatchBufferRegion > match_buffers
The match buffer regions.
Definition: frame.h:137
Managed reference to AssertFrameNode.
Definition: frame.h:308
Map< String, ObjectRef > annotations
Additional annotations about the allocation.
Definition: frame.h:503
tvm::tir::BufferRegion buffer_slice
The region of buffer access.
Definition: frame.h:402
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
A frame that represents the block initialization statment.
Definition: frame.h:192
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:194
String name
The name of the block.
Definition: frame.h:125
Managed reference to ThenFrameNode.
Definition: frame.h:683
FMakeForLoop f_make_for_loop
The for loop generating function.
Definition: frame.h:243
PrimExpr condition
The condition.
Definition: frame.h:450
tvm::tir::Var buffer_var
The buffer var.
Definition: frame.h:454
The LaunchThreadFrameNode.
Definition: frame.h:356
A frame that represents then.
Definition: frame.h:660
bool allocated
The buffer allocated or not.
Definition: frame.h:726
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:1271
virtual void ExitWithScope()
The method called when exiting RAII scope.
Optional< PrimExpr > predicate
The predicate of the block realization, the block will only be executed when the predicate is true...
Definition: frame.h:146
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
PrimExpr condition
The condition expression.
Definition: frame.h:406
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:245
Reference to PrimExprNode.
Definition: expr.h:114
static constexpr const char * _type_key
Definition: frame.h:46
Managed reference to AttrFrameNode.
Definition: frame.h:572
Managed reference to ElseFrameNode.
Definition: frame.h:716
Optional< Array< tvm::tir::BufferRegion > > writes
The write buffer regions of the block.
Definition: frame.h:131
A frame that represents realization.
Definition: frame.h:399
Managed reference to AllocateFrameNode.
Definition: frame.h:482
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:456
tvm::tir::IterVar iter_var
The iteration variable.
Definition: frame.h:363
Managed reference to BlockInitFrameNode.
Definition: frame.h:217
tvm::tir::Var buffer_var
The buffer var.
Definition: frame.h:501
A base frame that represents the TIR fame with body of statements.
Definition: frame.h:36
void VisitAttrs(tvm::AttrVisitor *v)
Definition: frame.h:41