tvm
Namespaces | Typedefs | Functions
transform.h File Reference

Relay specific transformation passes. More...

#include <tvm/ir/transform.h>
#include <tvm/relay/attrs/transform.h>
#include <tvm/relay/expr.h>
#include <tvm/relay/function.h>
#include <tvm/relay/op.h>
#include <tvm/relay/op_attr_types.h>
#include <tvm/target/target.h>
#include <string>
Include dependency graph for transform.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 tvm
 Performance counters for profiling via the PAPI library.
 
 tvm::relay
 Relay: a high level functional IR for TVM.
 
 tvm::relay::transform
 

Typedefs

using tvm::relay::transform::Pass = tvm::transform::Pass
 
using tvm::relay::transform::PassNode = tvm::transform::PassNode
 
using tvm::relay::transform::PassInfo = tvm::transform::PassInfo
 
using tvm::relay::transform::PassInfoNode = tvm::transform::PassInfoNode
 
using tvm::relay::transform::PassContext = tvm::transform::PassContext
 
using tvm::relay::transform::PassContextNode = tvm::transform::PassContextNode
 
using tvm::relay::transform::Sequential = tvm::transform::Sequential
 

Functions

Pass tvm::relay::transform::CreateFunctionPass (const runtime::TypedPackedFunc< Function(Function, IRModule, PassContext)> &pass_func, int opt_level, String name, tvm::Array< String > required)
 
Pass tvm::relay::transform::DeadCodeElimination (bool inline_once=false)
 Remove expressions which does not effect the program result. More...
 
Pass tvm::relay::transform::LazyGradientInit ()
 Convert all expressions of TensorType into GradCell, an algebraic data type defined in gradient.rly. More...
 
Pass tvm::relay::transform::FoldConstant ()
 Fold constant expressions. More...
 
Pass tvm::relay::transform::SplitArgs (int max_function_args)
 Split function with huge number of arguments to smaller pieces. More...
 
Pass tvm::relay::transform::FuseOps (int fuse_opt_level=-1)
 Fuse operations into expr into seperate functions. More...
 
Pass tvm::relay::transform::DefuseOps ()
 The inverse operation of FuseOps. It transforms a fused program returned by FuseOps into the program before FuseOps. (i.e. x == DefuseOps(FuseOps(x))) More...
 
Pass tvm::relay::transform::RewriteAnnotatedOps (int fallback_device)
 Rewrite the annotated program. More...
 
Pass tvm::relay::transform::ToBasicBlockNormalForm ()
 Turn an expression to Basic Block Normal Form. More...
 
Pass tvm::relay::transform::ToANormalForm ()
 turn a dataflow graph into Administrative Normal Form, or A-Normal Form (ANF). More...
 
Expr tvm::relay::transform::ToANormalForm (const Expr &expr)
 ToANormalForm but on incomplete graph. More...
 
Pass tvm::relay::transform::ToCPS ()
 Turn an expression into continuation passing style(CPS). More...
 
Pass tvm::relay::transform::ToGraphNormalForm ()
 Remove let binding and directly share via pointer instead. More...
 
Pass tvm::relay::transform::PartialEval ()
 Aggressive constant propagation/constant folding/inlining. More...
 
Pass tvm::relay::transform::SimplifyInference ()
 Simplify certain operators during inference. For example, the result of a batch norm which is indexed at tuple index 0 will be unpacked into a number of simplified operators. More...
 
Pass tvm::relay::transform::FastMath ()
 Replaces non linear activation functions with their fast but approximate counterparts. More...
 
Pass tvm::relay::transform::DynamicToStatic ()
 Find Dynamic ops and make them static. More...
 
Pass tvm::relay::transform::InferType ()
 Infer the type of an expression. More...
 
Pass tvm::relay::transform::EliminateCommonSubexpr (runtime::PackedFunc fskip=nullptr)
 Search and eliminate common subexpression. For example, if there are two expressions evaluated to an identical value, a single variable is created and these two expressions are replaced by this variable. More...
 
Pass tvm::relay::transform::CombineParallelConv2D (uint64_t min_num_branches=3)
 Combine parallel 2d convolutions into a single convolution if the number of branches of this conv2d operator is not less than min_num_branch. More...
 
Pass tvm::relay::transform::CombineParallelDense (uint64_t min_num_branches=3, bool to_batch_matmul=true)
 Combine parallel dense ops into a single batch_matmul if the number of branches of this dense operator is not less than min_num_branch. More...
 
Pass tvm::relay::transform::CombineParallelBatchMatmul (uint64_t min_num_branches=3)
 Combine parallel batch_matmul ops into a single batch_matmul if the number of branches of this dense operator is not less than min_num_branch. More...
 
Pass tvm::relay::transform::BackwardFoldScaleAxis ()
 Backward fold axis scaling into weights of conv/dense operators. More...
 
Pass tvm::relay::transform::ForwardFoldScaleAxis ()
 Forward fold axis scaling into weights of conv/dense operators. More...
 
Pass tvm::relay::transform::FoldScaleAxis ()
 A sequential pass that executes ForwardFoldScaleAxis and BackwardFoldScaleAxis passes. More...
 
Pass tvm::relay::transform::CanonicalizeOps ()
 Canonicalize some operators to the simplified operators. For example, bias_add can be canonicalized to expand_dims and broadcast_add. More...
 
Pass tvm::relay::transform::AlterOpLayout ()
 Alternate the layouts of operators or replace primitive operators with other expressions. More...
 
Pass tvm::relay::transform::AutoSchedulerLayoutRewrite ()
 Do layout rewrite according to the tile structure created by auto-scheduler. More...
 
Pass tvm::relay::transform::ConvertLayout (const Map< String, Array< String >> &desired_layouts)
 Given a dest layout, this pass transforms the expr such that most of the ops input data layout is changed to the dest layout. In ideal situation, there are only 2 layout transforms, one at the start and one at the end. More...
 
Pass tvm::relay::transform::Legalize (const String &legalize_map_attr_name="FTVMLegalize")
 Legalizes an expr with another expression. More...
 
Pass tvm::relay::transform::CanonicalizeCast ()
 Canonicalize cast expressions to make operator fusion more efficient. More...
 
Pass tvm::relay::transform::EtaExpand (bool expand_constructor, bool expand_global_var)
 Add abstraction over a constructor or global variable bound to a function. More...
 
Pass tvm::relay::transform::PartitionGraph ()
 Partition a Relay program into regions that can be executed on different backends. More...
 
Pass tvm::relay::transform::Inline ()
 Inline the global functions marked as inline in a given Relay IRModule. More...
 
Pass tvm::relay::transform::RemoveUnusedFunctions (Array< runtime::String > entry_functions)
 Remove the unused functions in the Relay IRModule. More...
 
Pass tvm::relay::transform::SimplifyExpr ()
 Simplify the Relay expression. More...
 
Pass tvm::relay::transform::RelayToTIRTargetHook ()
 Run any registered RelayToTIR passes registered on the functions in a module. More...
 
Pass tvm::relay::transform::ManifestAlloc (Target target_host, Map< tvm::Integer, tvm::Target > targets)
 A pass for manifesting explicit memory allocations and rewriting specific dialects. More...
 
Pass tvm::relay::transform::PlanDevices (DLDeviceType default_device_type)
 Uses existing "on_device" and "device_copy" CallNodes to infer the device on which every Relay sub-expression should run (and the result stored). Captures the result of that analysis using new "on_device" and "device_copy" CallNodes. See tvm::relay::transform::{LexicalOnDeviceMixin,DeviceAwareExprVisitor,DeviceAwareExprMutator} for help recovering the device for an arbitrary sub-expression in downstream transformations. More...
 
Expr tvm::relay::Bind (const Expr &expr, const tvm::Map< Var, Expr > &binds)
 Bind the free variables to a Relay expression. This is a helper function usually called by other pass functions to help optimizations. More...
 
Expr tvm::relay::ForwardRewrite (const Expr &expr, const String &rewrite_map_attr_name, std::function< ObjectRef(const Call &)> fcontext=nullptr, std::function< Expr(const Expr &)> fmulti_ref_trigger=nullptr)
 Apply rewrite rules to rewrite the expr in post DFS order. This function is used as a helper function to rewrtie an expression in a pass. More...
 
Expr tvm::relay::ForwardRewrite (const Expr &expr, const FForwardRewrite &rewrite_func, std::function< ObjectRef(const Call &)> fcontext=nullptr, std::function< Expr(const Expr &)> fmulti_ref_trigger=nullptr)
 Apply rewrite rules to rewrite the expr in post DFS order. This function is used as a helper function to rewrtie an expression in a pass. More...
 
Expr tvm::relay::RewriteAnnotatedOps (const Expr &expr, int fallback_device)
 Rewrite the annotated program. More...
 
Function tvm::relay::ToCPS (const Function &f, const IRModule &mod)
 Turn an expression into continuation passing style(CPS). More...
 
Function tvm::relay::UnCPS (const Function &f)
 Remove the continuation argument of a CPS function. More...
 
Expr tvm::relay::DeDup (const Expr &e)
 Deduplicate the bound variables and type variables in the expression. More...
 

Detailed Description

Relay specific transformation passes.