19 #ifndef TVM_SCRIPT_IR_BUILDER_RELAX_FRAME_H_
20 #define TVM_SCRIPT_IR_BUILDER_RELAX_FRAME_H_
22 #include <tvm/ffi/reflection/registry.h>
33 namespace ir_builder {
41 refl::ObjectDef<RelaxFrameNode>();
50 TVM_FFI_ICHECK(data !=
nullptr);
51 data_ = std::move(data);
67 ffi::Optional<tvm::relax::Expr>
output;
71 refl::ObjectDef<SeqExprFrameNode>()
86 TVM_FFI_ICHECK(data !=
nullptr);
99 ffi::Optional<ffi::String>
name;
123 refl::ObjectDef<FunctionFrameNode>()
144 TVM_FFI_ICHECK(data !=
nullptr);
170 refl::ObjectDef<BlockFrameNode>()
187 TVM_FFI_ICHECK(data !=
nullptr);
212 refl::ObjectDef<IfFrameNode>()
242 TVM_FFI_ICHECK(data !=
nullptr);
256 refl::ObjectDef<ThenFrameNode>();
282 TVM_FFI_ICHECK(data !=
nullptr);
296 refl::ObjectDef<ElseFrameNode>();
322 TVM_FFI_ICHECK(data !=
nullptr);
The utility for constructing Relax binding blocks.
Managed reference to RelaxExprNode.
Definition: expr.h:439
Definition: block_builder.h:264
Managed reference to an IRBuilderFrameNode.
Definition: base.h:104
The ir_builder frame for relax binding blocks.
Definition: frame.h:150
void EnterWithScope() final
The method called when entering RAII scope.
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.BlockFrame", BlockFrameNode, RelaxFrameNode)
ffi::Array< tvm::relax::Var > emitted_vars
The variables emitted in this block.
Definition: frame.h:155
ffi::Array< tvm::relax::Var > output_vars
The output vars of the dataflow block.
Definition: frame.h:166
static void RegisterReflection()
Definition: frame.h:168
bool is_dataflow
The flag that indicates whether the block is a dataflow block.
Definition: frame.h:153
bool block_ended
A boolean indicating if the dataflow block is ended of construction. If it is true,...
Definition: frame.h:161
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BlockFrame, RelaxFrame, BlockFrameNode)
BlockFrame(ObjectPtr< BlockFrameNode > data)
Definition: frame.h:186
A frame that represents else.
Definition: frame.h:292
static void RegisterReflection()
Definition: frame.h:294
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.ElseFrame", ElseFrameNode, SeqExprFrameNode)
void EnterWithScope() final
The method called when entering RAII scope.
Managed reference to ElseFrameNode.
Definition: frame.h:319
ElseFrame(ObjectPtr< ElseFrameNode > data)
Definition: frame.h:321
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ElseFrame, SeqExprFrame, ElseFrameNode)
The ir_builder frame for the relax function.
Definition: frame.h:92
tvm::relax::BlockBuilder block_builder
The block builder to create Relax function.
Definition: frame.h:119
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.FunctionFrame", FunctionFrameNode, SeqExprFrameNode)
void EnterWithScope() final
The method called when entering RAII scope.
ffi::Optional< Bool > is_pure
Whether the function is annotated as pure.
Definition: frame.h:113
static void RegisterReflection()
Definition: frame.h:121
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Array< tvm::relax::Var > params
The function params.
Definition: frame.h:101
ffi::Optional< ffi::String > name
The function name.
Definition: frame.h:99
ffi::Map< ffi::String, Any > attrs
The function attributes.
Definition: frame.h:117
ffi::Optional< Bool > is_private
Whether the function is annotated as private.
Definition: frame.h:115
ffi::Optional< tvm::relax::StructInfo > ret_struct_info
The function return struct info.
Definition: frame.h:111
FunctionFrame(ObjectPtr< FunctionFrameNode > data)
Definition: frame.h:143
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(FunctionFrame, SeqExprFrame, FunctionFrameNode)
A frame that represents if statement.
Definition: frame.h:197
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.IfFrame", IfFrameNode, RelaxFrameNode)
ffi::Optional< tvm::relax::Expr > then_expr
The Bindings in the true branch.
Definition: frame.h:202
void EnterWithScope() final
The method called when entering RAII scope.
static void RegisterReflection()
Definition: frame.h:210
tvm::relax::Var var
The Binding var.
Definition: frame.h:206
tvm::relax::Expr condition
The condition of the if statement.
Definition: frame.h:200
ffi::String var_name
The binding var name.
Definition: frame.h:208
ffi::Optional< tvm::relax::Expr > else_expr
The Bindings in the false branch.
Definition: frame.h:204
Managed reference to IfFrameNode.
Definition: frame.h:239
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfFrame, RelaxFrame, IfFrameNode)
IfFrame(ObjectPtr< IfFrameNode > data)
Definition: frame.h:241
The base ir_builder frame for the relax dialect.
Definition: frame.h:37
static void RegisterReflection()
Definition: frame.h:39
TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.relax.RelaxFrame", RelaxFrameNode, IRBuilderFrameNode)
RelaxFrame(ObjectPtr< RelaxFrameNode > data)
Definition: frame.h:49
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(RelaxFrame, IRBuilderFrame, RelaxFrameNode)
The base ir_builder frame for frames with SeqExpr i.e. Functions, If branches.
Definition: frame.h:62
void EnterWithScope() override
The method called when entering RAII scope.
ffi::Optional< tvm::relax::Expr > output
The frame output expr. std::nullopt when undefined.
Definition: frame.h:67
static void RegisterReflection()
Definition: frame.h:69
void ExitWithScope() override
The method called when exiting RAII scope.
TVM_FFI_DECLARE_OBJECT_INFO("script.ir_builder.relax.SeqExprFrame", SeqExprFrameNode, RelaxFrameNode)
ffi::Array< tvm::relax::BindingBlock > binding_blocks
The binding blocks inside the frame.
Definition: frame.h:65
SeqExprFrame(ObjectPtr< SeqExprFrameNode > data)
Definition: frame.h:85
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(SeqExprFrame, RelaxFrame, SeqExprFrameNode)
A frame that represents then.
Definition: frame.h:252
void EnterWithScope() final
The method called when entering RAII scope.
static void RegisterReflection()
Definition: frame.h:254
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.ThenFrame", ThenFrameNode, SeqExprFrameNode)
Managed reference to ThenFrameNode.
Definition: frame.h:279
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(ThenFrame, SeqExprFrame, ThenFrameNode)
ThenFrame(ObjectPtr< ThenFrameNode > data)
Definition: frame.h:281
Definition: repr_printer.h:91
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:37