Skip to content

Commit

Permalink
[TIR][Transform] HoistIfThenElse added (apache#6066)
Browse files Browse the repository at this point in the history
* [TIR][Transform] HoistIfThenElse added

* lint error resolved

* Pass position changed

* pylint error resolved

* CI issues resolved

* Frontend tflite test case failure resolved

* [1] Review comment handled

* [2] Review comment handled

* [3] Review comment handled

* Lint error resolved
  • Loading branch information
ANSHUMAN TRIPATHY authored and Trevor Morris committed Aug 26, 2020
1 parent e68bdd0 commit 6d10ac9
Show file tree
Hide file tree
Showing 6 changed files with 652 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/tvm/tir/transform.h
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,14 @@ TVM_DLL Pass BF16Legalize();
*/
TVM_DLL Pass PointerValueTypeRewrite();

/*!
* \brief Hoist loop-invariant IfThenElse nodes to
* outside the elligible loops.
*
* \return The pass.
*/
TVM_DLL Pass HoistIfThenElse();

} // namespace transform
} // namespace tir
} // namespace tvm
Expand Down
1 change: 1 addition & 0 deletions python/tvm/driver/build_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def lower(sch,
tvm.tir.transform.BF16Legalize(),
tvm.tir.transform.NarrowDataType(32),
tvm.tir.transform.Simplify(),
tvm.tir.transform.HoistIfThenElse(),
]
pass_list += lower_phase1

Expand Down
9 changes: 9 additions & 0 deletions python/tvm/tir/transform/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,3 +499,12 @@ def VerifyMemory():
The result pass
"""
return _ffi_api.VerifyMemory()

def HoistIfThenElse():
"""Hoist loop-invariant IfThenElse nodes to outside the elligible loops.
Returns
-------
fpass : tvm.transform.Pass
The result pass
"""
return _ffi_api.HoistIfThenElse()
Loading

0 comments on commit 6d10ac9

Please sign in to comment.