tvm
Classes | Functions
tvm::script::ir_builder::relax Namespace Reference

Classes

class  RelaxFrameNode
 The base ir_builder frame for the relax dialect. More...
 
class  RelaxFrame
 
class  SeqExprFrameNode
 The base ir_builder frame for frames with SeqExpr i.e. Functions, If branches. More...
 
class  SeqExprFrame
 
class  FunctionFrameNode
 The ir_builder frame for the relax function. More...
 
class  FunctionFrame
 
class  BindingBlockFrameNode
 The ir_builder frame for relax binding blocks. More...
 
class  BindingBlockFrame
 
class  IfFrameNode
 A frame that represents if statement. More...
 
class  IfFrame
 Managed reference to IfFrameNode. More...
 
class  ThenFrameNode
 A frame that represents then. More...
 
class  ThenFrame
 Managed reference to ThenFrameNode. More...
 
class  ElseFrameNode
 A frame that represents else. More...
 
class  ElseFrame
 Managed reference to ElseFrameNode. More...
 

Functions

FunctionFrame Function (bool is_pure, bool is_private)
 Start a function frame. More...
 
tvm::relax::Var Arg (const ffi::String &name, const tvm::Type &ty)
 Add a parameter to the last function frame. More...
 
void FuncName (const ffi::String &name)
 Specify the name of the last function frame. More...
 
void FuncAttrs (ffi::Map< ffi::String, Any > attrs)
 Specify the attrs of the last function frame. More...
 
void FuncRetType (const tvm::Type &ret_ty)
 Specify the return type of the last function frame. More...
 
void FuncRetValue (const tvm::relax::Expr &value)
 Specify the return value of the last function frame. More...
 
BindingBlockFrame BindingBlock ()
 Start a binding block frame. More...
 
BindingBlockFrame Dataflow ()
 Start a dataflow binding block frame. More...
 
void DataflowBlockOutput (const ffi::Array< tvm::relax::Var > &vars)
 Expose the dataflow block output variables as global ones. More...
 
tvm::relax::Var Emit (const tvm::relax::Expr &value, const ffi::Optional< tvm::Type > &annotate_ty=std::nullopt)
 Emit a binding to the last binding block frame. More...
 
tvm::relax::Var EmitMatchCast (const tvm::relax::Expr &value, const tvm::Type &ty)
 Emit a match_cast binding to the last binding block frame. More...
 
tvm::relax::Var EmitVarBinding (const tvm::relax::VarBinding &binding)
 Emit a binding to the last binding block frame. More...
 
IfFrame If (tvm::relax::Expr condition)
 Create an if statement. More...
 
ThenFrame Then ()
 Create a then. More...
 
ElseFrame Else ()
 Create an else. More...
 

Function Documentation

◆ Arg()

tvm::relax::Var tvm::script::ir_builder::relax::Arg ( const ffi::String &  name,
const tvm::Type ty 
)

Add a parameter to the last function frame.

Parameters
nameThe name of the parameter.
tyThe ty of the parameter.
Returns
The created function parameter var.

◆ BindingBlock()

BindingBlockFrame tvm::script::ir_builder::relax::BindingBlock ( )

Start a binding block frame.

Returns
The created ir_builder Block frame.

◆ Dataflow()

BindingBlockFrame tvm::script::ir_builder::relax::Dataflow ( )

Start a dataflow binding block frame.

Returns
The created ir_builder Block frame.

◆ DataflowBlockOutput()

void tvm::script::ir_builder::relax::DataflowBlockOutput ( const ffi::Array< tvm::relax::Var > &  vars)

Expose the dataflow block output variables as global ones.

Parameters
varsThe output variables of a dataflow block

◆ Else()

ElseFrame tvm::script::ir_builder::relax::Else ( )

Create an else.

Returns
The result ElseFrame.

◆ Emit()

tvm::relax::Var tvm::script::ir_builder::relax::Emit ( const tvm::relax::Expr value,
const ffi::Optional< tvm::Type > &  annotate_ty = std::nullopt 
)

Emit a binding to the last binding block frame.

Parameters
valueThe right side value of the bindings to be emitted.
annotate_tyThe optional type annotation for the emitted value.
Returns
The left side var of the emitted binding.

◆ EmitMatchCast()

tvm::relax::Var tvm::script::ir_builder::relax::EmitMatchCast ( const tvm::relax::Expr value,
const tvm::Type ty 
)

Emit a match_cast binding to the last binding block frame.

Parameters
valueThe value of the MatchCast to be emitted.
tyThe type of the MatchCast to be emitted.
Returns
The left side var of the emitted binding.

◆ EmitVarBinding()

tvm::relax::Var tvm::script::ir_builder::relax::EmitVarBinding ( const tvm::relax::VarBinding binding)

Emit a binding to the last binding block frame.

Parameters
bindingThe binding to be emitted.
Returns
The left side var of the emitted binding.

◆ FuncAttrs()

void tvm::script::ir_builder::relax::FuncAttrs ( ffi::Map< ffi::String, Any >  attrs)

Specify the attrs of the last function frame.

Parameters
attrsThe function attrs.

◆ FuncName()

void tvm::script::ir_builder::relax::FuncName ( const ffi::String &  name)

Specify the name of the last function frame.

Parameters
nameThe function name.

◆ FuncRetType()

void tvm::script::ir_builder::relax::FuncRetType ( const tvm::Type ret_ty)

Specify the return type of the last function frame.

Parameters
ret_tyThe return type.

◆ FuncRetValue()

void tvm::script::ir_builder::relax::FuncRetValue ( const tvm::relax::Expr value)

Specify the return value of the last function frame.

Parameters
valueThe return value.

◆ Function()

FunctionFrame tvm::script::ir_builder::relax::Function ( bool  is_pure,
bool  is_private 
)

Start a function frame.

Parameters
is_pureWhether the function is annotated as pure.
is_privateWhether the function is annotated as private.
Returns
The created ir_builder Function frame.

◆ If()

IfFrame tvm::script::ir_builder::relax::If ( tvm::relax::Expr  condition)

Create an if statement.

Parameters
conditionThe condition of if statement.
Returns
The result IfFrame.

◆ Then()

ThenFrame tvm::script::ir_builder::relax::Then ( )

Create a then.

Returns
The result ThenFrame.