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/15 21:55:59 UTC
[GitHub] [tvm] Lunderberg commented on a diff in pull request #13396: [TVMScript] Use tir::Evaluate if expression is in statement context
Lunderberg commented on code in PR #13396:
URL: https://github.com/apache/tvm/pull/13396#discussion_r1023296204
##########
python/tvm/script/parser/tir/parser.py:
##########
@@ -411,6 +412,10 @@ def visit_expr_stmt(self: Parser, node: doc.Expr) -> None:
if isinstance(res, Frame):
res.add_callback(partial(res.__exit__, None, None, None))
res.__enter__()
+ elif isinstance(res, PrimExpr):
+ T.evaluate(res)
+ elif isinstance(res, (int, bool)):
+ T.evaluate(tvm.tir.const(res))
Review Comment:
I was going back and forth on it, and I like the idea of printing `T.evaluate()` except in the case of CallNode. The more aggressive sugaring would be to render `tir::Evaluate(0)` as `pass`, which would be even clearer to read from a casual Python reader.
--
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