19 #ifndef TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
20 #define TVM_SCRIPT_IR_BUILDER_TIR_FRAME_H_
28 namespace ir_builder {
46 static constexpr
const char*
_type_key =
"script.ir_builder.tir.TIRFrame";
89 refl::ObjectDef<PrimFuncFrameNode>()
100 static constexpr
const char*
_type_key =
"script.ir_builder.tir.PrimFuncFrame";
133 Optional<Array<tvm::tir::BufferRegion>>
reads;
135 Optional<Array<tvm::tir::BufferRegion>>
writes;
156 refl::ObjectDef<BlockFrameNode>()
170 static constexpr
const char*
_type_key =
"script.ir_builder.tir.BlockFrame";
201 refl::ObjectDef<BlockInitFrameNode>();
204 static constexpr
const char*
_type_key =
"script.ir_builder.tir.BlockInitFrame";
245 Array<tvm::tir::Var> loop_vars, Array<Range> loop_extents,
tvm::tir::Stmt loop_body)>;
255 refl::ObjectDef<ForFrameNode>()
261 static constexpr
const char*
_type_key =
"script.ir_builder.tir.ForFrame";
297 refl::ObjectDef<AssertFrameNode>()
302 static constexpr
const char*
_type_key =
"script.ir_builder.tir.AssertFrame";
337 refl::ObjectDef<LetFrameNode>()
342 static constexpr
const char*
_type_key =
"script.ir_builder.tir.LetFrame";
378 refl::ObjectDef<LaunchThreadFrameNode>()
384 static constexpr
const char*
_type_key =
"script.ir_builder.tir.LaunchThreadFrame";
422 refl::ObjectDef<RealizeFrameNode>()
428 static constexpr
const char*
_type_key =
"script.ir_builder.tir.RealizeFrame";
471 refl::ObjectDef<AllocateFrameNode>()
480 static constexpr
const char*
_type_key =
"script.ir_builder.tir.AllocateFrame";
521 refl::ObjectDef<AllocateConstFrameNode>()
529 static constexpr
const char*
_type_key =
"script.ir_builder.tir.AllocateConstFrame";
566 refl::ObjectDef<AttrFrameNode>()
572 static constexpr
const char*
_type_key =
"script.ir_builder.tir.AttrFrame";
608 static constexpr
const char*
_type_key =
"script.ir_builder.tir.WhileFrame";
645 refl::ObjectDef<IfFrameNode>()
651 static constexpr
const char*
_type_key =
"script.ir_builder.tir.IfFrame";
681 refl::ObjectDef<ThenFrameNode>();
684 static constexpr
const char*
_type_key =
"script.ir_builder.tir.ThenFrame";
719 refl::ObjectDef<ElseFrameNode>();
722 static constexpr
const char*
_type_key =
"script.ir_builder.tir.ElseFrame";
757 refl::ObjectDef<DeclBufferFrameNode>()
762 static constexpr
const char*
_type_key =
"script.ir_builder.tir.DeclBufferFrame";
Reference to PrimExprNode.
Definition: expr.h:129
Runtime primitive data type.
Definition: data_type.h:47
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.h:53
Managed reference to an IRBuilderFrameNode.
Definition: base.h:103
A frame represents the allocate constant.
Definition: frame.h:506
tvm::tir::Var buffer_var
The buffer var.
Definition: frame.h:515
Map< String, Any > annotations
Additional annotations about the allocation.
Definition: frame.h:517
Array< PrimExpr > extents
The extents of the allocate.
Definition: frame.h:511
TVM_DECLARE_FINAL_OBJECT_INFO(AllocateConstFrameNode, TIRFrameNode)
tvm::runtime::NDArray data
The data associated with the constant.
Definition: frame.h:513
void ExitWithScope() final
The method called when exiting RAII scope.
DataType dtype
The data type of the buffer.
Definition: frame.h:509
static void RegisterReflection()
Definition: frame.h:519
Managed reference to AllocateConstFrameNode.
Definition: frame.h:545
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(AllocateConstFrame, TIRFrame, AllocateConstFrameNode)
A frame represents the allocate.
Definition: frame.h:454
Map< String, Any > annotations
Additional annotation hints.
Definition: frame.h:465
tvm::tir::Var buffer_var
The buffer var.
Definition: frame.h:467
TVM_DECLARE_FINAL_OBJECT_INFO(AllocateFrameNode, TIRFrameNode)
DataType dtype
The data type of the buffer.
Definition: frame.h:459
PrimExpr condition
The condition.
Definition: frame.h:463
static void RegisterReflection()
Definition: frame.h:469
void ExitWithScope() final
The method called when exiting RAII scope.
String storage_scope
The storage scope.
Definition: frame.h:461
Array< PrimExpr > extents
The extents of the allocate.
Definition: frame.h:457
Managed reference to AllocateFrameNode.
Definition: frame.h:496
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(AllocateFrame, TIRFrame, AllocateFrameNode)
A frame that represents the assert statement. Proceeds if the condition is true, otherwise aborts wit...
Definition: frame.h:288
static void RegisterReflection()
Definition: frame.h:295
TVM_DECLARE_FINAL_OBJECT_INFO(AssertFrameNode, TIRFrameNode)
PrimExpr message
The output error message when the assertion failed.
Definition: frame.h:293
PrimExpr condition
The PrimExpr to test.
Definition: frame.h:291
void ExitWithScope() final
The method called when exiting RAII scope.
Managed reference to AssertFrameNode.
Definition: frame.h:318
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(AssertFrame, TIRFrame, AssertFrameNode)
A frame that represents attribute node.
Definition: frame.h:555
TVM_DECLARE_FINAL_OBJECT_INFO(AttrFrameNode, TIRFrameNode)
String attr_key
Attribute type key.
Definition: frame.h:560
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition: frame.h:564
Any node
The node to annotate the attribute.
Definition: frame.h:558
PrimExpr value
The value of the attribute.
Definition: frame.h:562
Managed reference to AttrFrameNode.
Definition: frame.h:588
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(AttrFrame, TIRFrame, AttrFrameNode)
A frame that represents the block.
Definition: frame.h:126
Optional< tvm::tir::Stmt > init
The init statement of the bolck.
Definition: frame.h:137
String name
The name of the block.
Definition: frame.h:129
void ExitWithScope() final
The method called when exiting RAII scope.
Array< tvm::tir::IterVar > iter_vars
The variables of the block.
Definition: frame.h:131
static void RegisterReflection()
Definition: frame.h:154
Optional< Array< tvm::tir::BufferRegion > > writes
The write buffer regions of the block.
Definition: frame.h:135
Array< tvm::tir::Buffer > alloc_buffers
The buffer allocated in the block.
Definition: frame.h:139
Optional< PrimExpr > predicate
The predicate of the block realization, the block will only be executed when the predicate is true.
Definition: frame.h:150
Array< tvm::tir::MatchBufferRegion > match_buffers
The match buffer regions.
Definition: frame.h:141
Array< PrimExpr > iter_values
The corresponding values of the iter vars.
Definition: frame.h:145
Optional< Array< tvm::tir::BufferRegion > > reads
The read buffer regions of the block.
Definition: frame.h:133
Optional< Map< String, Any > > annotations
The annotation of the block.
Definition: frame.h:143
TVM_DECLARE_FINAL_OBJECT_INFO(BlockFrameNode, TIRFrameNode)
bool no_realize
The flag whether to construct BlockRealize or Block.
Definition: frame.h:152
Managed reference to BlockFrameNode.
Definition: frame.h:187
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(BlockFrame, TIRFrame, BlockFrameNode)
A frame that represents the block initialization statment.
Definition: frame.h:197
TVM_DECLARE_FINAL_OBJECT_INFO(BlockInitFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:199
void EnterWithScope() final
The method called when entering RAII scope.
Managed reference to BlockInitFrameNode.
Definition: frame.h:225
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(BlockInitFrame, TIRFrame, BlockInitFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
static void RegisterReflection()
Definition: frame.h:755
tvm::tir::Buffer buffer
The declared buffer.
Definition: frame.h:751
TVM_DECLARE_FINAL_OBJECT_INFO(DeclBufferFrameNode, TIRFrameNode)
bool allocated
The buffer allocated or not.
Definition: frame.h:753
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(DeclBufferFrame, TIRFrame, DeclBufferFrameNode)
A frame that represents else.
Definition: frame.h:715
static void RegisterReflection()
Definition: frame.h:717
void EnterWithScope() final
The method called when entering RAII scope.
TVM_DECLARE_FINAL_OBJECT_INFO(ElseFrameNode, TIRFrameNode)
Managed reference to ElseFrameNode.
Definition: frame.h:743
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(ElseFrame, TIRFrame, ElseFrameNode)
A frame that represents the for loop.
Definition: frame.h:235
static void RegisterReflection()
Definition: frame.h:253
FMakeForLoop f_make_for_loop
The for loop generating function.
Definition: frame.h:251
Array< Range > doms
The domains of iteration.
Definition: frame.h:249
Array< tvm::tir::Var > vars
The loop variable.
Definition: frame.h:247
ffi::TypedFunction< tvm::tir::Stmt(Array< tvm::tir::Var > loop_vars, Array< Range > loop_extents, tvm::tir::Stmt loop_body)> FMakeForLoop
Functions that generate loop nests.
Definition: frame.h:245
void ExitWithScope() final
The method called when exiting RAII scope.
TVM_DECLARE_FINAL_OBJECT_INFO(ForFrameNode, TIRFrameNode)
Managed reference to ForFrameNode.
Definition: frame.h:277
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(ForFrame, TIRFrame, ForFrameNode)
A frame that represents if statement.
Definition: frame.h:634
TVM_DECLARE_FINAL_OBJECT_INFO(IfFrameNode, TIRFrameNode)
Optional< Array< tvm::tir::Stmt > > else_stmts
The stetements in the false branch.
Definition: frame.h:641
void ExitWithScope() final
The method called when exiting RAII scope.
Optional< Array< tvm::tir::Stmt > > then_stmts
The statements in the true branch.
Definition: frame.h:639
PrimExpr condition
The condition of the if statement.
Definition: frame.h:637
static void RegisterReflection()
Definition: frame.h:643
Managed reference to IfFrameNode.
Definition: frame.h:667
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(IfFrame, TIRFrame, IfFrameNode)
The LaunchThreadFrameNode.
Definition: frame.h:367
void ExitWithScope() final
The method called when exiting RAII scope.
tvm::tir::IterVar iter_var
The iteration variable.
Definition: frame.h:374
TVM_DECLARE_FINAL_OBJECT_INFO(LaunchThreadFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:376
String attr_key
The attribute key, could be either virtual_thread or thread_extent.
Definition: frame.h:372
PrimExpr extent
The extent of environment thread.
Definition: frame.h:370
Managed reference to LaunchThreadFrameNode.
Definition: frame.h:400
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(LaunchThreadFrame, TIRFrame, LaunchThreadFrameNode)
A frame represents the let binding expression, which binds a var.
Definition: frame.h:328
tvm::tir::Var var
The variable we bind to.
Definition: frame.h:331
PrimExpr value
The value we bind var to.
Definition: frame.h:333
static void RegisterReflection()
Definition: frame.h:335
TVM_DECLARE_FINAL_OBJECT_INFO(LetFrameNode, TIRFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
Managed reference to LetFrameNode.
Definition: frame.h:358
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(LetFrame, TIRFrame, LetFrameNode)
A frame that represents the PrimFunc containing TIR statements.
Definition: frame.h:68
static void RegisterReflection()
Definition: frame.h:87
Map< String, Any > attrs
Additional attributes storing the meta-data.
Definition: frame.h:81
void ExitWithScope() final
The method called when exiting RAII scope.
Map< tvm::tir::Var, tvm::tir::Buffer > buffer_map
Maps some parameters to specific Buffer data structures.
Definition: frame.h:79
Map< tvm::tir::Var, tvm::tir::IterVar > env_threads
The variable map bound to thread env.
Definition: frame.h:83
Array< tvm::tir::Buffer > root_alloc_buffers
The buffer allocated in root block.
Definition: frame.h:85
Optional< String > name
The name of the block.
Definition: frame.h:71
static constexpr const char * _type_key
Definition: frame.h:100
TVM_DECLARE_FINAL_OBJECT_INFO(PrimFuncFrameNode, TIRFrameNode)
Array< tvm::tir::Var > args
Function parameters.
Definition: frame.h:73
Optional< Type > ret_type
The return type of the function.
Definition: frame.h:77
bool is_private
Whether the PrimFunc is annotated as private.
Definition: frame.h:75
Managed reference to PrimFuncFrameNode.
Definition: frame.h:116
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(PrimFuncFrame, TIRFrame, PrimFuncFrameNode)
A frame that represents realization.
Definition: frame.h:411
static void RegisterReflection()
Definition: frame.h:420
TVM_DECLARE_FINAL_OBJECT_INFO(RealizeFrameNode, TIRFrameNode)
void ExitWithScope() final
The method called when exiting RAII scope.
String storage_scope
The storage scope associated with this realization.
Definition: frame.h:416
PrimExpr condition
The condition expression.
Definition: frame.h:418
tvm::tir::BufferRegion buffer_slice
The region of buffer access.
Definition: frame.h:414
Managed reference to RealizeFrameNode.
Definition: frame.h:444
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(RealizeFrame, TIRFrame, RealizeFrameNode)
A base frame that represents the TIR fame with body of statements.
Definition: frame.h:36
Array< tvm::tir::Stmt > stmts
The Stmt within in this frame.
Definition: frame.h:39
TVM_DECLARE_BASE_OBJECT_INFO(TIRFrameNode, IRBuilderFrameNode)
static constexpr const char * _type_key
Definition: frame.h:46
static void RegisterReflection()
Definition: frame.h:41
Managed reference to TIRFrameNode.
Definition: frame.h:55
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(TIRFrame, IRBuilderFrame, TIRFrameNode)
A frame that represents then.
Definition: frame.h:677
TVM_DECLARE_FINAL_OBJECT_INFO(ThenFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:679
void EnterWithScope() final
The method called when entering RAII scope.
Managed reference to ThenFrameNode.
Definition: frame.h:705
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(ThenFrame, TIRFrame, ThenFrameNode)
A frame that represents while loop.
Definition: frame.h:598
TVM_DECLARE_FINAL_OBJECT_INFO(WhileFrameNode, TIRFrameNode)
static void RegisterReflection()
Definition: frame.h:603
PrimExpr condition
The termination condition of while.
Definition: frame.h:601
void ExitWithScope() final
The method called when exiting RAII scope.
Managed reference to WhileFrameNode.
Definition: frame.h:624
TVM_DEFINE_MUTABLE_NOTNULLABLE_OBJECT_REF_METHODS(WhileFrame, TIRFrame, WhileFrameNode)
Managed reference to BufferRegionNode.
Definition: stmt.h:871
Buffer is a symbolic n-darray structure. It is a composition of primitive symbolic types,...
Definition: buffer.h:157
Iteration Variable, represents an iteration over an integer interval.
Definition: var.h:298
Container of all statements.
Definition: stmt.h:64
a named variable in TIR
Definition: var.h:78
Definition: repr_printer.h:91
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37