tvm
Classes | Namespaces | Macros | Functions
stmt_functor.h File Reference

Functors for tirx stmts utility functions to call common functors. More...

#include <tvm/node/functor.h>
#include <tvm/tirx/expr.h>
#include <tvm/tirx/expr_functor.h>
#include <tvm/tirx/function.h>
#include <tvm/tirx/stmt.h>
#include <unordered_map>
#include <utility>
Include dependency graph for stmt_functor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tvm::tirx::StmtFunctor< R(const Stmt &n, Args... args)>
 
class  tvm::tirx::StmtVisitor
 StmtVisitor. More...
 
class  tvm::tirx::StmtMutator
 StmtMutator that mutates the statements. More...
 
class  tvm::tirx::StmtExprVisitor
 Visitor that recursively visit stmts and exprs on them. More...
 
class  tvm::tirx::StmtExprMutator
 Mutator that recursively mutates stmts and exprs on them. More...
 

Namespaces

 tvm
 An object that builds and maintains block scope and StmtSref mapping for Dependence analysis.
 
 tvm::tirx
 

Macros

#define STMT_FUNCTOR_DEFAULT
 
#define IR_STMT_FUNCTOR_DISPATCH(OP)
 

Functions

Stmt tvm::tirx::IRTransform (Stmt stmt, const ffi::Function &preorder, const ffi::Function &postorder, ffi::Optional< ffi::Array< ffi::String >> only_enable=std::nullopt)
 recursively visit the ir nodes in post DFS order, and transform it More...
 
void tvm::tirx::PostOrderVisit (const ObjectRef &node, std::function< void(const ObjectRef &)> fvisit)
 Recursively visit the ir in post DFS order node, apply fvisit Each node is guaranteed to be visited only once. More...
 
Stmt tvm::tirx::Substitute (Stmt stmt, std::function< ffi::Optional< PrimExpr >(const Var &var)> vmap)
 Substitute the var specified by vmap. More...
 
PrimExpr tvm::tirx::Substitute (PrimExpr expr, std::function< ffi::Optional< PrimExpr >(const Var &var)> vmap)
 Substitute the var specified by vmap. More...
 
template<typename T >
ffi::Array< T > tvm::tirx::Substitute (const ffi::Array< T > &arr, std::function< ffi::Optional< PrimExpr >(const Var &var)> vmap)
 Substitute the var specified by vmap. More...
 
Range tvm::tirx::Substitute (const Range &range, std::function< ffi::Optional< PrimExpr >(const Var &var)> vmap)
 Substitute the vars specified by vmap. More...
 
template<typename Obj >
auto tvm::tirx::Substitute (Obj &&obj, const ffi::Map< Var, PrimExpr > &vmap)
 Substitute the vars specified by vmap. More...
 
template<typename Obj , typename Expr , typename = std::enable_if_t<std::is_base_of_v<PrimExpr, Expr>>>
auto tvm::tirx::Substitute (Obj &&obj, const ffi::Map< Var, Expr > &vmap)
 Substitute the vars specified by vmap. More...
 
template<typename Obj , typename Expr , typename = std::enable_if_t<std::is_base_of_v<PrimExpr, Expr>>>
auto tvm::tirx::Substitute (Obj &&obj, const std::unordered_map< const VarNode *, Expr > &vmap)
 Substitute the vars specified by vmap. More...
 
template<typename Obj , typename Expr , typename Hasher , typename EqualityChecker , typename = std::enable_if_t<std::is_base_of_v<PrimExpr, Expr>>>
auto tvm::tirx::Substitute (Obj &&obj, const std::unordered_map< Var, Expr, Hasher, EqualityChecker > &vmap)
 Substitute the vars specified by vmap. More...
 
template<typename Obj , typename Expr , typename = std::enable_if_t<std::is_base_of_v<PrimExpr, Expr>>>
auto tvm::tirx::Substitute (Obj &&obj, const std::unordered_map< IterVar, Expr > &iter_vmap)
 Substitute the vars specified by vmap. More...
 
Stmt tvm::tirx::SubstituteWithDataTypeLegalization (Stmt stmt, std::function< ffi::Optional< PrimExpr >(const Var &)> vmap)
 Substitute the var specified by vmap and legalize data types after substitution. More...
 
PrimExpr tvm::tirx::SubstituteWithDataTypeLegalization (PrimExpr expr, std::function< ffi::Optional< PrimExpr >(const Var &)> vmap)
 Substitute the var specified by vmap and legalize data types after substitution. More...
 
void tvm::tirx::PreOrderVisit (const ObjectRef &stmt_or_expr, const std::function< bool(const ObjectRef &)> &fvisit)
 Recursively visit the IR in pre DFS order node, apply fvisit. If fvisit returns false, it won't visit the children of the node. More...
 
template<typename Node , typename = std::enable_if_t<std::is_base_of_v<StmtNode, Node>>>
bool tvm::tirx::ContainsNode (const Stmt &stmt)
 Check if the statement contains the specified node type. More...
 

Detailed Description

Functors for tirx stmts utility functions to call common functors.

Macro Definition Documentation

◆ IR_STMT_FUNCTOR_DISPATCH

#define IR_STMT_FUNCTOR_DISPATCH (   OP)
Value:
vtable.template set_dispatch<OP>([](const ObjectRef& n, TSelf* self, Args... args) { \
return self->VisitStmt_(static_cast<const OP*>(n.get()), std::forward<Args>(args)...); \
});

◆ STMT_FUNCTOR_DEFAULT

#define STMT_FUNCTOR_DEFAULT
Value:
{ \
return VisitStmtDefault_(op, std::forward<Args>(args)...); \
}