You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/18 14:39:47 UTC
[GitHub] [tvm] Lunderberg opened a new pull request, #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Lunderberg opened a new pull request, #13432:
URL: https://github.com/apache/tvm/pull/13432
Even though the operator precedence of `And` has a higher precedence than `Or`, removing parentheses based on this precedence can harm readability. This commit adds an exception to the TVMScript rules for parentheses, to always insert parentheses between `And` and `Or` operators.
In addition, adding a rewrite rule to preferentially produce And/Or chains that may be expressed in a single left-associative chain of operators.
Between these two changes, the readability of boolean expressions can be improved. Below is the motivating example for this change. In each case, the output had been passed through the `black` formatter. Both expressions are equivalent, but the before-case was much more difficult to read.
```python
x = (
AAA == 0
and BBB < 4
or AAA == 7
and 6 <= BBB
or (CCC == 0 and DDD < 4 or CCC == 7 and 6 <= DDD)
)
x = (
(AAA == 0 and BBB < 4)
or (AAA == 7 and 6 <= BBB)
or (CCC == 0 and DDD < 4)
or (CCC == 7 and 6 <= DDD)
)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] junrushao commented on pull request #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Posted by GitBox <gi...@apache.org>.
junrushao commented on PR #13432:
URL: https://github.com/apache/tvm/pull/13432#issuecomment-1320733799
CC: @yelite
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] Lunderberg commented on pull request #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Posted by GitBox <gi...@apache.org>.
Lunderberg commented on PR #13432:
URL: https://github.com/apache/tvm/pull/13432#issuecomment-1324005080
> This looks good to me! Can you also add some unit tests to the `test_tvmscript_roundtrip.py`?
Certainly, and added!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] junrushao merged pull request #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Posted by GitBox <gi...@apache.org>.
junrushao merged PR #13432:
URL: https://github.com/apache/tvm/pull/13432
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] yelite commented on pull request #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Posted by GitBox <gi...@apache.org>.
yelite commented on PR #13432:
URL: https://github.com/apache/tvm/pull/13432#issuecomment-1322204704
This looks good to me! Can you also add some unit tests to the `test_tvmscript_roundtrip.py`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [tvm] tvm-bot commented on pull request #13432: [TIR][TVMScript] Cleaner printing of And/Or chains
Posted by GitBox <gi...@apache.org>.
tvm-bot commented on PR #13432:
URL: https://github.com/apache/tvm/pull/13432#issuecomment-1320082805
<!---bot-comment-->
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](https://github.com/apache/incubator-tvm/blob/master/CONTRIBUTORS.md#reviewers) by @-ing them in a comment.
<!--bot-comment-ccs-start-->
* cc @Hzfengsy, @junrushao <sub>See [#10317](https://github.com/apache/tvm/issues/10317) for details</sub><!--bot-comment-ccs-end-->
<sub>Generated by [tvm-bot](https://github.com/apache/tvm/blob/main/ci/README.md#github-actions)</sub>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org