tvm
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
tvm::relay::MixedModeVisitor Class Reference

A wrapper around ExprVisitor which traverses the Dataflow Normal AST. More...

#include <expr_functor.h>

Inheritance diagram for tvm::relay::MixedModeVisitor:
Collaboration diagram for tvm::relay::MixedModeVisitor:

Public Member Functions

 MixedModeVisitor (int visit_limit=1)
 The constructor of MixedModeVisitor. More...
 
void VisitExpr (const Expr &expr) final
 VisitExpr is finalized to preserve call expansion of dataflow regions. More...
 
void VisitExpr_ (const CallNode *op) override
 
void VisitExpr_ (const TupleNode *op) override
 
void VisitExpr_ (const TupleGetItemNode *op) override
 
void VisitExpr_ (const VarNode *op) override
 
void VisitExpr_ (const GlobalVarNode *op) override
 
void VisitExpr_ (const ConstantNode *op) override
 
void VisitExpr_ (const TupleNode *op) override
 
void VisitExpr_ (const FunctionNode *op) override
 
void VisitExpr_ (const CallNode *op) override
 
void VisitExpr_ (const LetNode *op) override
 
void VisitExpr_ (const IfNode *op) override
 
void VisitExpr_ (const OpNode *op) override
 
void VisitExpr_ (const TupleGetItemNode *op) override
 
void VisitExpr_ (const RefCreateNode *op) override
 
void VisitExpr_ (const RefReadNode *op) override
 
void VisitExpr_ (const RefWriteNode *op) override
 
void VisitExpr_ (const ConstructorNode *op) override
 
void VisitExpr_ (const MatchNode *op) override
 
- Public Member Functions inherited from tvm::relay::ExprVisitor
void VisitExpr (const Expr &expr) override
 
void VisitExpr_ (const VarNode *op) override
 
void VisitExpr_ (const GlobalVarNode *op) override
 
void VisitExpr_ (const ConstantNode *op) override
 
void VisitExpr_ (const TupleNode *op) override
 
void VisitExpr_ (const FunctionNode *op) override
 
void VisitExpr_ (const CallNode *op) override
 
void VisitExpr_ (const LetNode *op) override
 
void VisitExpr_ (const IfNode *op) override
 
void VisitExpr_ (const OpNode *op) override
 
void VisitExpr_ (const TupleGetItemNode *op) override
 
void VisitExpr_ (const RefCreateNode *op) override
 
void VisitExpr_ (const RefReadNode *op) override
 
void VisitExpr_ (const RefWriteNode *op) override
 
void VisitExpr_ (const ConstructorNode *op) override
 
void VisitExpr_ (const MatchNode *op) override
 
virtual void VisitType (const Type &t)
 
virtual void VisitClause (const Clause &c)
 
virtual void VisitPattern (const Pattern &c)
 
virtual void VisitSpan (const Span &span)
 

Protected Member Functions

virtual void VisitLeaf (const Expr &expr)
 A function to apply when reaching a leaf of the graph non-recursively. More...
 
virtual bool CheckVisited (const Expr &expr)
 A function to determine if an expression has already been visited or needs to be re-visited. More...
 

Protected Attributes

size_t visit_limit_
 The max number of times to visit a node. More...
 
- Protected Attributes inherited from tvm::relay::ExprVisitor
std::unordered_map< const Object *, size_t > visit_counter_
 

Detailed Description

A wrapper around ExprVisitor which traverses the Dataflow Normal AST.

MixedModeVisitor treats Expr as dataflow graph, and visits in post-DFS order

MixedModeVisitor provides the same recursive API as ExprVisitor, and uses recursion to traverse most forms of the IR, but under the hood it expands nested dataflow regions of the graph and processes them iteratively to prevent stack overflows

Constructor & Destructor Documentation

◆ MixedModeVisitor()

tvm::relay::MixedModeVisitor::MixedModeVisitor ( int  visit_limit = 1)
explicit

The constructor of MixedModeVisitor.

Parameters
visit_limitThe number of times to allow visitation to a node. Usually 1, ocassionally higher (i.e., 2 for dead code elimiation), limited to 10 as a sanity check.

Member Function Documentation

◆ CheckVisited()

virtual bool tvm::relay::MixedModeVisitor::CheckVisited ( const Expr expr)
protectedvirtual

A function to determine if an expression has already been visited or needs to be re-visited.

◆ VisitExpr()

void tvm::relay::MixedModeVisitor::VisitExpr ( const Expr expr)
final

VisitExpr is finalized to preserve call expansion of dataflow regions.

◆ VisitExpr_() [1/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [2/18]

void tvm::relay::MixedModeVisitor::VisitExpr_ ( const CallNode op)
override

◆ VisitExpr_() [3/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [4/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [5/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [6/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [7/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [8/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [9/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [10/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [11/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [12/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [13/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [14/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [15/18]

void tvm::relay::MixedModeVisitor::VisitExpr_ ( const TupleGetItemNode op)
override

◆ VisitExpr_() [16/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitExpr_() [17/18]

void tvm::relay::MixedModeVisitor::VisitExpr_ ( const TupleNode op)
override

◆ VisitExpr_() [18/18]

void tvm::relay::ExprVisitor::VisitExpr_
override

◆ VisitLeaf()

virtual void tvm::relay::MixedModeVisitor::VisitLeaf ( const Expr expr)
protectedvirtual

A function to apply when reaching a leaf of the graph non-recursively.

Member Data Documentation

◆ visit_limit_

size_t tvm::relay::MixedModeVisitor::visit_limit_
protected

The max number of times to visit a node.


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