19#ifndef TVM_RELAX_SCRIPT_BUILDER_FRAME_H_
20#define TVM_RELAX_SCRIPT_BUILDER_FRAME_H_
22#include <tvm/ffi/reflection/registry.h>
40 namespace refl = tvm::ffi::reflection;
41 refl::ObjectDef<RelaxFrameNode>();
51 data_ = std::move(data);
67 ffi::Optional<tvm::relax::Expr>
output;
70 namespace refl = tvm::ffi::reflection;
71 refl::ObjectDef<SeqExprFrameNode>()
99 ffi::Optional<ffi::String>
name;
122 namespace refl = tvm::ffi::reflection;
123 refl::ObjectDef<FunctionFrameNode>()
168 namespace refl = tvm::ffi::reflection;
169 refl::ObjectDef<BindingBlockFrameNode>()
170 .def_ro(
"is_dataflow", &BindingBlockFrameNode::is_dataflow)
171 .def_ro(
"emitted_vars", &BindingBlockFrameNode::emitted_vars)
172 .def_ro(
"output_vars", &BindingBlockFrameNode::output_vars);
211 namespace refl = tvm::ffi::reflection;
212 refl::ObjectDef<IfFrameNode>()
213 .def_ro(
"condition", &IfFrameNode::condition)
214 .def_ro(
"then_expr", &IfFrameNode::then_expr)
215 .def_ro(
"else_expr", &IfFrameNode::else_expr)
216 .def_ro(
"var", &IfFrameNode::var)
217 .def_ro(
"var_name", &IfFrameNode::var_name);
255 namespace refl = tvm::ffi::reflection;
256 refl::ObjectDef<ThenFrameNode>();
295 namespace refl = tvm::ffi::reflection;
296 refl::ObjectDef<ElseFrameNode>();
The utility for constructing Relax binding blocks.
Managed reference to ExprNode.
Definition base_expr.h:335
Managed reference to VarNode.
Definition expr.h:372
RAII wrapper function to enter and exit a context object similar to python's with syntax.
Definition with_context.h:59
Definition block_builder.h:257
Managed reference to an IRBuilderFrameNode.
Definition base.h:103
The ir_builder frame for relax binding blocks.
Definition frame.h:149
ffi::Array< tvm::Var > emitted_vars
The variables emitted in this block.
Definition frame.h:154
TVM_FFI_DECLARE_OBJECT_INFO_FINAL("script.ir_builder.relax.BindingBlockFrame", BindingBlockFrameNode, RelaxFrameNode)
bool block_ended
A boolean indicating if the dataflow block is ended of construction. If it is true,...
Definition frame.h:160
bool is_dataflow
The flag that indicates whether the block is a dataflow block.
Definition frame.h:152
ffi::Array< tvm::Var > output_vars
The output vars of the dataflow block.
Definition frame.h:165
void EnterWithScope() final
The method called when entering RAII scope.
static void RegisterReflection()
Definition frame.h:167
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(BindingBlockFrame, RelaxFrame, BindingBlockFrameNode)
BindingBlockFrame(ffi::ObjectPtr< BindingBlockFrameNode > data)
Definition frame.h:185
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(ffi::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.
static void RegisterReflection()
Definition frame.h:121
void ExitWithScope() final
The method called when exiting RAII scope.
ffi::Optional< tvm::Type > ret_ty
The function return type.
Definition frame.h:111
ffi::Array< tvm::Var > params
The function params.
Definition frame.h:101
ffi::Optional< bool > is_private
Whether the function is annotated as private.
Definition frame.h:115
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_pure
Whether the function is annotated as pure.
Definition frame.h:113
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(FunctionFrame, SeqExprFrame, FunctionFrameNode)
FunctionFrame(ffi::ObjectPtr< FunctionFrameNode > data)
Definition frame.h:142
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::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
tvm::Var var
The Binding var.
Definition frame.h:206
Managed reference to IfFrameNode.
Definition frame.h:239
TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE(IfFrame, RelaxFrame, IfFrameNode)
IfFrame(ffi::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(ffi::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(ffi::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(ffi::ObjectPtr< ThenFrameNode > data)
Definition frame.h:281
An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
Definition analyzer.h:40