tvm
|
Relax specific transformation passes. More...
#include <tvm/ir/transform.h>
#include <tvm/relax/dataflow_pattern.h>
#include <tvm/relax/expr.h>
#include <tvm/tir/function.h>
#include <tvm/tir/index_map.h>
Go to the source code of this file.
Classes | |
class | tvm::relax::transform::FusionPatternNode |
The pattern object used as the input of FuseOpsByPattern. For bindings to be fused, it needs to be matched with pattern and the check function needs to return true. More... | |
class | tvm::relax::transform::FusionPattern |
class | tvm::relax::transform::PatternCheckContextNode |
The input of FusionPattern::check. More... | |
class | tvm::relax::transform::PatternCheckContext |
Namespaces | |
tvm | |
runtime implementation for LibTorch/TorchScript. | |
tvm::relax | |
tvm::relax::transform | |
Functions | |
Pass | tvm::relax::transform::CreateFunctionPass (const runtime::TypedPackedFunc< Function(Function, IRModule, PassContext)> &pass_func, int opt_level, String name, tvm::Array< String > required, bool traceable=false) |
Create a function pass. More... | |
Pass | tvm::relax::transform::CreateDataflowBlockPass (const runtime::TypedPackedFunc< DataflowBlock(DataflowBlock, IRModule, PassContext)> &pass_func, int opt_level, String name, tvm::Array< String > required, bool traceable=false) |
Create a dataflowblock pass. More... | |
Pass | tvm::relax::transform::LambdaLift () |
Perform lambda lifting to lift functions from nested into global. More... | |
Pass | tvm::relax::transform::ToNonDataflow () |
Transform all dataflow structure to non-dataflow version. More... | |
Pass | tvm::relax::transform::RemovePurityChecking () |
Activate force_pure on all pure functions in the module and unwrap all pure override ops into the normal versions. More... | |
Pass | tvm::relax::transform::CallTIRRewrite () |
Perform explicit tensor allocation for call_tir and call_dps_packed. More... | |
Pass | tvm::relax::transform::RewriteDataflowReshape () |
Convert all reshape-like call_tir whose corresponding binding vars are DataflowVars to relax.reshape operator calls. The relax.reshape calls will be lowered an external builtin function call in a subsequent pass, where the external builtin function does a CreateView operation at runtime, instead of doing real data copy. Here "reshape-like" includes reshape, expand_dims, flatten, etc. More... | |
Pass | tvm::relax::transform::StaticPlanBlockMemory () |
The static memory planning pass on BindingBlock level. The pass will reuse allocated memory to its best effort, in order to reduce the total amount of allocated memory size. More... | |
Pass | tvm::relax::transform::AttachGlobalSymbol () |
Attach global_symbol to Relax functions and TIR Primfuncs for codegen. More... | |
Pass | tvm::relax::transform::Normalize () |
Transform Relax IR to normal form: transform AST to A-normal form, and fill the checked_type_ and shape_ of expressions. More... | |
Pass | tvm::relax::transform::NormalizeGlobalVar () |
Possibly rename the GlobalVar in an IRModule to ensure these properties: More... | |
Pass | tvm::relax::transform::CanonicalizeBindings () |
Simplify a Relax module by folding var bindings and match shape nodes, as well as tuple indices. Best used alongside constant folding and eliminating unused bindings. More... | |
Pass | tvm::relax::transform::EliminateCommonSubexpr (bool call_only=false) |
Pass | tvm::relax::transform::BindParams (String func_name, Map< ObjectRef, ObjectRef > params) |
Bind params of function of the module to constant tensors. More... | |
Pass | tvm::relax::transform::BindSymbolicVars (Map< ObjectRef, PrimExpr > binding_map, Optional< String > func_name=NullOpt) |
Bind symbolic vars to constant shape values. More... | |
Pass | tvm::relax::transform::FoldConstant () |
Fold constant expressions within dataflow blocks. More... | |
Pass | tvm::relax::transform::LegalizeOps (Optional< Map< String, PackedFunc >> cmap, bool enable_warning=false) |
Legalize high-level operator calls in Relax functions to call_tir with corresponding low-level TIR PrimFuncs. More... | |
Pass | tvm::relax::transform::RealizeVDevice () |
Propagate virtual device information. More... | |
Pass | tvm::relax::transform::AttachAttrLayoutFreeBuffers () |
Attach layout free buffers to the tir::PrimFunc. More... | |
Pass | tvm::relax::transform::SplitLayoutRewritePreproc () |
Split the layout rewrite preproc block to a separate tir::PrimFunc. More... | |
Pass | tvm::relax::transform::LiftTransformParams (Variant< Bool, Array< String >> shared_transform=Bool(false)) |
Lift transformation of the parameters of a function. More... | |
Pass | tvm::relax::transform::UpdateVDevice (VDevice new_vdevice, int64_t index) |
Update virtual device. More... | |
Pass | tvm::relax::transform::ExpandTupleArguments () |
Expand tuple arguments to internal functions. More... | |
Pass | tvm::relax::transform::RemoveUnusedParameters () |
Remove unused parameters to internal functions. More... | |
Pass | tvm::relax::transform::RemoveUnusedOutputs () |
Remove unused outputs from internal functions. More... | |
Pass | tvm::relax::transform::AnnotateTIROpPattern () |
Annotate Op Pattern Kind for TIR functions, which is used in FuseOps. More... | |
Pass | tvm::relax::transform::FuseOps (int fuse_opt_level=-1) |
This pass groups bindings in a dataflow block of Relax functions and generates a new grouped Relax function for each group, according to the fusion algorithm described in the pass implementation. By grouping bindings into new Relax functions, we substitute the bindings in the function being manipulated into function calls to the new grouped function. More... | |
Pass | tvm::relax::transform::Gradient (String func_name, Optional< Array< Var >> require_grads=NullOpt, int target_index=0) |
Reverse-mode automatic differentiation. More... | |
Pass | tvm::relax::transform::FuseOpsByPattern (const tvm::Array< FusionPattern > &patterns, bool bind_constants=true, bool annotate_codegen=false, const tvm::Array< String > &entry_function_names={}) |
Apply pattern matching to each function in the given module, and group matched expressions into a new function. The end result is similar to FuseOps, but fusion is driven completely by the provided patterns. More... | |
Pass | tvm::relax::transform::MergeCompositeFunctions () |
Group one or multiple composite functions created by FuseOpsByPattern into a new function. The new function will be annotated with kCodegen and GlobalSymbol attributes, and it is intented to be offloaded to an external backend. More... | |
Pass | tvm::relax::transform::FuseTIR () |
Fuse relax sub-function into a larger TIR function if possible. this pass works together with FuseOps to perform operator fusion. More... | |
Pass | tvm::relax::transform::RunCodegen (Optional< Map< String, Map< String, ObjectRef >>> target_options, Array< runtime::String > entry_functions) |
Run codegen. More... | |
Pass | tvm::relax::transform::DecomposeOpsForInference (Optional< String > func_name) |
Decompose composite operators during inference. For example, The result of batch norm (a triple) will be simplified. Operators like Attention, Erf, etc. can be also simplified into several operators as well. More... | |
Pass | tvm::relax::transform::DecomposeOpsForTraining (Optional< String > func_name) |
Decompose composite operators during training. For example, The result of batch norm (a triple) will be simplified. Operators like Attention, Erf, etc. can be also simplified into several operators as well. More... | |
Pass | tvm::relax::transform::AlterOpImpl (const Map< String, tir::PrimFunc > &op_impl_map, const Map< String, Array< tir::IndexMap >> &op_buffer_transforms, const Map< String, Array< Array< IntImm >>> &axis_separators, const Map< String, Array< Array< IntImm >>> &input_axis_separators) |
Returns a pass which replaces PrimFuncs which have matching kOperatorName attribute in op_impl_map , with replacement PrimFunc that could possibly have different layouts on i/o buffers. The layout transformations on i/o buffers is present in the op_buffer_transforms . The pass inserts the layout transformations in the call sites of PrimFuncs being replaced to transform i/o buffers into expected layout. More... | |
Pass | tvm::relax::transform::ConvertLayout (Map< String, Array< String >> desired_layouts) |
Layout conversion pass. More... | |
Pass | tvm::relax::transform::ConvertToDataflow (int min_size=2) |
A pass that converts consecutive dataflow operations inside binding blocks into dataflow blocks. More... | |
Pass | tvm::relax::transform::DeadCodeElimination (Array< runtime::String > entry_functions={}) |
Dead code elimination. More... | |
Pass | tvm::relax::transform::DataflowUseInplaceCalls () |
Pass that changes calls to operators that can be done in-place (generally, these are elementwise operations) in dataflow blocks into in-place implementations. Supported operators will be replaced by calls to call_tir_inplace that invoke in-place PrimFunc implementations of those operators (which are based on the legalizations of those operators). More... | |
Pass | tvm::relax::transform::ToMixedPrecision (const DataType &out_dtype, Optional< Array< String >> fp16_input_names=NullOpt) |
Automatic mixed precision pass. Currently the pass assumes the input module to be fp32 only, and will automatically cast fp32 to fp16 for certain ops. More... | |
Pass | tvm::relax::transform::RewriteCUDAGraph () |
Rewrite a Relax module for executing with CUDA graph. This pass identifies the regions that can be executed with CUDA graph and lifts them into new functions for runtime graph capturing. More... | |
Pass | tvm::relax::transform::FewShotTuning (int valid_count, bool benchmark) |
The pass is designed for few shot tuning for static shape PrimFuncs. It examines all the blocks within the PrimFunc and conducts loop fusion, splitting, and other transformations based on MetaSchedule schedule rules but directly samples from the search space instead of using the tuning algorithm. User can specify the number of valid counts to try and whether to use runner for benchmarking. More... | |
Relax specific transformation passes.