[Fix][TVMScript]TVMScript BinOP printing refactor #14200
Merged
junrushao merged 4 commits intoapache:mainfrom Mar 8, 2023
Merged
[Fix][TVMScript]TVMScript BinOP printing refactor #14200junrushao merged 4 commits intoapache:mainfrom
junrushao merged 4 commits intoapache:mainfrom
Conversation
Collaborator
|
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 |
Member
|
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.
junrushao
reviewed
Mar 7, 2023
Member
|
Feel free to merge it yourself as soon as it turns green |
Lunderberg
added a commit
to Lunderberg/tvm
that referenced
this pull request
Mar 16, 2023
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.