Skip to content

Commit

Permalink
[Relax][Pass] FuseOps (tlc-pack#15)
Browse files Browse the repository at this point in the history
* [Relax][Pass] FuseOps

* Fix 2 bugs
  • Loading branch information
MasterJH5574 committed Apr 13, 2022
1 parent acd1327 commit 523a815
Show file tree
Hide file tree
Showing 3 changed files with 642 additions and 552 deletions.
7 changes: 6 additions & 1 deletion include/tvm/relax/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ TVM_DLL Pass LayoutRewrite();
TVM_DLL Pass FoldConstant();

/*!
* \brief Fuse operators in an expr to a larger operator according to some rules.
* \brief This pass groups bindings in a dataflow block of Relaxfunctions and generate 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.
*
* A follow-up pass named "FuseTIR" will generate a TIR PrimFunc for each grouped function.
* \param fuse_opt_level The level of fuse optimization.
* -1 indicates that the level will be inferred from pass context.
* \return The Pass.
Expand Down
7 changes: 6 additions & 1 deletion python/tvm/relax/transform/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ def LayoutRewrite() -> tvm.ir.transform.Pass:


def FuseOps(fuse_opt_level=-1) -> tvm.ir.transform.Pass:
"""Fuse operators in an expr to a larger operator according to some rules.
"""This pass groups bindings in a dataflow block of Relax functions and generate 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.
A follow-up pass named "FuseTIR" will generate a TIR PrimFunc for each grouped function.
Parameters
----------
Expand Down
Loading

0 comments on commit 523a815

Please sign in to comment.