-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REFACTOR][TIR] Introduce PrimFuncPass. #5139
Conversation
- Introduce PrimFuncPass - Convert one pass to the unified Pass API.
cc @yzhliu @kazum @vinx13 @merrymercy @Hzfengsy @ZihengJiang @wweic @zhiics @icemelon9 @jroesch |
|
||
@tvm._ffi.register_object("tir.PrimFuncPass") | ||
class PrimFuncPass(Pass): | ||
"""A pass that works on each tvm.relay.Function in a module. A function |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tvm.tir.PrimFunc
|
||
Parameters | ||
---------- | ||
pass_func : Optional[Callable[(Function, Module, PassContext) -> Function]] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function->PrimFunc
Module->IRModule
name of the optimization function will be used as the pass name. | ||
|
||
required : Optional[List[str]] | ||
The list of passes that the module pass is dependent on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function pass
src/tir/ir/transform.cc
Outdated
* \brief Run a function pass on given pass context. | ||
* | ||
* \param mod The module that an optimization pass is applied on. | ||
* \param mod The context that an optimization pass executes on. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mod -> pass_ctx
assert f.body.value.dtype == "handle" | ||
assert f.body.body.value.dtype == "handle" | ||
|
||
# temp adapter t convert loweredFunc to IRModule |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t -> to?
Thanks @zhiics @siju-samue哈 |
* [REFACTOR][TIR] Introduce PrimFuncPass. - Introduce PrimFuncPass - Convert one pass to the unified Pass API. * Address comments * Fix comments
* [REFACTOR][TIR] Introduce PrimFuncPass. - Introduce PrimFuncPass - Convert one pass to the unified Pass API. * Address comments * Fix comments
As part of the unified IR refactor. We will convert all TIR passes into tir.transform and tir.analysis namespace. The passes under tir.transform shares the same Pass infra as relay. Which takes a IRModule(with PrimFuncs) and return a updated IRModule
In order to keep things backward compatible, we will keep the old API around until most of the passes has been converted. Then we will do a bulk remove of the legacy API