-
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
[Fix][TVMScript]TVMScript BinOP printing refactor #14200
Conversation
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment.
Generated by tvm-bot |
Any updates? |
This PR fixes the output for `T.Div(int, int)`. It will print `T.Div(int, int)`, instead of `int / int`, to avoid the integer division ambiguity in parser. And this PR refactors the logic of binary operators printing in TVMScript. The updated TVMScript printer will print the binary operator to avoid constant folding when parsing back.
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.
LGTM!
Feel free to merge it yourself as soon as it turns green |
Avoid folding constants while parsing TVMScript. This bug was introduced as part of the parsing changes implemented in apache#14200. The operator overloads in python delegate to the C++ operator overloads, which perform constant folding. While useful in most circumstances, the script parsing should avoid performing any manipulations while parsing, as this can invalidate unit tests that rely on known TIR inputs. There are a few edge cases that would still be constant-folded while parsing the TVMScript, but these only impact subexpressions that do not contain TVM-specific constructs. For example, `T.evaluate(1 + 2)` would be parsed as `T.evaluate(3)`, because the `1 + 2` subexpression is evaluated during parsing.
This PR fixes the output for
T.Div(int, int)
. It will printT.Div(int, int)
, instead ofint / int
, to avoid the integer division ambiguity in parser.And this PR refactors the logic of binary operators printing in TVMScript. The updated TVMScript printer will print the binary operator to avoid constant folding when parsing back.