tvm
|
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/compilation_config.h>
#include <tvm/target/target.h>
#include <tvm/target/virtual_device.h>
#include <string>
Go to the source code of this file.
Namespaces | |
tvm | |
runtime implementation for LibTorch/TorchScript. | |
tvm::relay | |
Relay: a high level functional IR for TVM. | |
tvm::relay::transform | |
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, bool ignore_purity=false) |
Remove let-bound expressions which do 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 (bool fold_qnn=false) |
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... | |
Type | tvm::relay::transform::InferTypeLocal (const Expr &expr) |
Infer the type of an expression, reusing existing type information. 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::MetaScheduleLayoutRewrite () |
Do layout rewrite according to the tile structure created by meta-schedule. 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 (CompilationConfig config) |
Run any custom passes registered under "RelayToTIR" attributes on TargetKinds. More... | |
Pass | tvm::relay::transform::ManifestAlloc (VirtualDevice cpu_virtual_device) |
A pass for manifesting explicit memory allocations and rewriting specific dialects. More... | |
Pass | tvm::relay::transform::ManifestLifetimes () |
A pass for manifesting variable lifetimes by inserting kill operations when variables become dead. This pass should be run after ManifestAlloc, and should not be run more than once. More... | |
Pass | tvm::relay::transform::PlanDevices (CompilationConfig config) |
Uses existing "on_device" and "device_copy" CallNodes to infer the VirtualDevice 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. More... | |
Pass | tvm::relay::transform::FlattenAtrousConv () |
This transform flattens atrous convolution, which corresponds to the sequence of operations: "space_to_batch_nd"->"conv2d"->"batch_to_space_nd" and convert them into subgraphs with a convolution with the modified "dilation" and recalculated "padding" parameters. More... | |
Pass | tvm::relay::transform::AnnotateUsedMemory () |
Annotates the minimum required memory of each primitive function callsite by analyzing the liveness of the input/output tensors at each function callsite and calculating the total amount of memory these tensors require. This is added as a "used_memory" annotation to the function in question as a list of the number of bytes for each callsite. In addition, the containing function is annotated with an "io_used_memory" annotation which refers to the total memory required for the IO tensors. 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. If any free variables are introduced into a function, those are added to the functoin parameters. Additionally this may change the order of parameters if you map a variable to a variable. More... | |
Function | tvm::relay::SubstituteBoundVars (const Function &func, const tvm::Map< Var, Expr > &binds) |
Substitute variables with new variables (including function parameters) in a function. This is a helper function usually called by other pass functions to help optimizations. Expects all values in the bind map to be Vars. 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... | |
Relay specific transformation passes.