-
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
[RELAY][PASS] Bind, FoldConstant #2100
Conversation
cc @yzhliu @zhiics @ZihengJiang @jroesch @MarisaKirisame @PariksheetPinjari909 please review |
@@ -324,7 +329,7 @@ def codegen(self, func): | |||
self.heads = self.visit(func.body) | |||
graph_json = self._get_json() | |||
lowered_funcs = list(self.lowered_funcs) | |||
return graph_json, lowered_funcs | |||
return graph_json, lowered_funcs, self.params |
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.
add returns in pydoc above
python/tvm/relay/build_module.py
Outdated
"""Perform target invariant optimizations. | ||
|
||
Parameters | ||
---------- | ||
func : tvm.relay.Function | ||
The input to optimization. | ||
|
||
params : dict of str to NDArray |
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.
Optional[Dict[str, NDArray]]
I did a quick pass of the code, LGTM |
The side effect is checked by is_stateful, I think the folding pass should work with functions of recursion, by ignoring recursive calls. But indeed they don't unroll the recursion if that is what you mean |
@tqchen tuplegetitem(tuplenode(...)) will just take the expr |
I see, indeed, we will need side effect check pass and possibly combine dead code elim into folding. For now it is fine as the program is side-effect free |
Looks good to me we can follow up on those issues afterwards. |
The general flow now becomes: