tvm
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
tvm::script::ir_builder::relax::FunctionFrameObj Class Reference

The ir_builder frame for the relax function. More...

#include <frame.h>

Inheritance diagram for tvm::script::ir_builder::relax::FunctionFrameObj:
Collaboration diagram for tvm::script::ir_builder::relax::FunctionFrameObj:

Public Member Functions

 FunctionFrameObj (tvm::relax::BlockBuilder builder)
 
 FunctionFrameObj (ffi::UnsafeInit)
 
 TVM_FFI_DECLARE_OBJECT_INFO_FINAL ("script.ir_builder.relax.FunctionFrame", FunctionFrameObj, SeqExprFrameObj)
 
void EnterWithScope () final
 The method called when entering RAII scope.
 
void ExitWithScope () final
 The method called when exiting RAII scope.
 
- Public Member Functions inherited from tvm::script::ir_builder::relax::SeqExprFrameObj
 TVM_FFI_DECLARE_OBJECT_INFO ("script.ir_builder.relax.SeqExprFrame", SeqExprFrameObj, RelaxFrameObj)
 
void EnterWithScope () override
 The method called when entering RAII scope.
 
void ExitWithScope () override
 The method called when exiting RAII scope.
 
- Public Member Functions inherited from tvm::script::ir_builder::relax::RelaxFrameObj
 TVM_FFI_DECLARE_OBJECT_INFO ("script.ir_builder.relax.RelaxFrame", RelaxFrameObj, IRBuilderFrameObj)
 
- Public Member Functions inherited from tvm::script::ir_builder::IRBuilderFrameObj
 IRBuilderFrameObj ()
 Capture the source-call context when this frame is constructed.
 
 TVM_FFI_DECLARE_OBJECT_INFO ("script.ir_builder.IRBuilderFrame", IRBuilderFrameObj, ffi::Object)
 
virtual ~IRBuilderFrameObj ()=default
 Default destructor.
 
void AddCallback (ffi::TypedFunction< void()> callback)
 Add a callback method invoked when exiting the RAII scope.
 

Static Public Member Functions

static void RegisterReflection ()
 
- Static Public Member Functions inherited from tvm::script::ir_builder::relax::SeqExprFrameObj
static void RegisterReflection ()
 
- Static Public Member Functions inherited from tvm::script::ir_builder::relax::RelaxFrameObj
static void RegisterReflection ()
 
- Static Public Member Functions inherited from tvm::script::ir_builder::IRBuilderFrameObj
static void RegisterReflection ()
 

Public Attributes

ffi::Optional< ffi::String > name
 The function name.
 
ffi::Array< tvm::Var > params
 The function params.
 
ffi::Optional< tvm::Type > ret_ty
 The function return type.
 
ffi::Optional< bool > is_pure
 Whether the function is annotated as pure.
 
ffi::Optional< bool > is_private
 Whether the function is annotated as private.
 
ffi::Map< ffi::String, Any > attrs
 The function attributes.
 
tvm::relax::BlockBuilder block_builder
 The block builder to create Relax function.
 
bool declaration = false
 Whether this frame constructs only a function signature.
 
bool local = false
 
ffi::Optional< tvm::Var > local_var
 
ffi::Optional< tvm::relax::Function > function
 Finalized function and its stable module reference.
 
ffi::Optional< tvm::GlobalVar > global_var
 
- Public Attributes inherited from tvm::script::ir_builder::relax::SeqExprFrameObj
ffi::Array< tvm::relax::BindingBlock > binding_blocks
 The binding blocks inside the frame.
 
ffi::Optional< tvm::relax::Expr > output
 The frame output expr. std::nullopt when undefined.
 
- Public Attributes inherited from tvm::script::ir_builder::IRBuilderFrameObj
std::vector< ffi::TypedFunction< void()> > callbacks
 A list of callbacks used when exiting the frame.
 
Location loc = UnknownLoc()
 Source context retained until this frame constructs its result.
 

Additional Inherited Members

- Static Public Attributes inherited from tvm::script::ir_builder::IRBuilderFrameObj
static constexpr const bool _type_mutable = true
 

Detailed Description

The ir_builder frame for the relax function.

Constructor & Destructor Documentation

◆ FunctionFrameObj() [1/2]

tvm::script::ir_builder::relax::FunctionFrameObj::FunctionFrameObj ( tvm::relax::BlockBuilder  builder)
inlineexplicit

◆ FunctionFrameObj() [2/2]

tvm::script::ir_builder::relax::FunctionFrameObj::FunctionFrameObj ( ffi::UnsafeInit  )
inlineexplicit

Member Function Documentation

◆ EnterWithScope()

void tvm::script::ir_builder::relax::FunctionFrameObj::EnterWithScope ( )
finalvirtual

The method called when entering RAII scope.

See also
tvm::support::With

Reimplemented from tvm::script::ir_builder::IRBuilderFrameObj.

◆ ExitWithScope()

void tvm::script::ir_builder::relax::FunctionFrameObj::ExitWithScope ( )
finalvirtual

The method called when exiting RAII scope.

See also
tvm::support::With

Reimplemented from tvm::script::ir_builder::IRBuilderFrameObj.

◆ RegisterReflection()

static void tvm::script::ir_builder::relax::FunctionFrameObj::RegisterReflection ( )
inlinestatic

◆ TVM_FFI_DECLARE_OBJECT_INFO_FINAL()

tvm::script::ir_builder::relax::FunctionFrameObj::TVM_FFI_DECLARE_OBJECT_INFO_FINAL ( "script.ir_builder.relax.FunctionFrame"  ,
FunctionFrameObj  ,
SeqExprFrameObj   
)

Member Data Documentation

◆ attrs

ffi::Map<ffi::String, Any> tvm::script::ir_builder::relax::FunctionFrameObj::attrs

The function attributes.

◆ block_builder

tvm::relax::BlockBuilder tvm::script::ir_builder::relax::FunctionFrameObj::block_builder

The block builder to create Relax function.

◆ declaration

bool tvm::script::ir_builder::relax::FunctionFrameObj::declaration = false

Whether this frame constructs only a function signature.

◆ function

ffi::Optional<tvm::relax::Function> tvm::script::ir_builder::relax::FunctionFrameObj::function

Finalized function and its stable module reference.

◆ global_var

ffi::Optional<tvm::GlobalVar> tvm::script::ir_builder::relax::FunctionFrameObj::global_var

◆ is_private

ffi::Optional<bool> tvm::script::ir_builder::relax::FunctionFrameObj::is_private

Whether the function is annotated as private.

◆ is_pure

ffi::Optional<bool> tvm::script::ir_builder::relax::FunctionFrameObj::is_pure

Whether the function is annotated as pure.

◆ local

bool tvm::script::ir_builder::relax::FunctionFrameObj::local = false

◆ local_var

ffi::Optional<tvm::Var> tvm::script::ir_builder::relax::FunctionFrameObj::local_var

◆ name

ffi::Optional<ffi::String> tvm::script::ir_builder::relax::FunctionFrameObj::name

The function name.

Note
The name will not be specified in constructor, so it is "Optional", However, we must specify the name by R.func_name before exit this frame.

◆ params

ffi::Array<tvm::Var> tvm::script::ir_builder::relax::FunctionFrameObj::params

The function params.

◆ ret_ty

ffi::Optional<tvm::Type> tvm::script::ir_builder::relax::FunctionFrameObj::ret_ty

The function return type.

Note
Usually the function return type can be deduced by the function body. But we can use this field to specify a more "accurate" return type. i.e. If the ret_ty is None, try to use the deduced type from body If the ret_ty is not None, we can still take body.ty if we ret_ty is base of body.ty. If not, we will take the specified ret_ty.

The documentation for this class was generated from the following file: