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:08:59 UTC

[GitHub] [tvm] junrushao commented on a diff in pull request #13396: [TVMScript] Use tir::Evaluate if expression is in statement context

junrushao commented on code in PR #13396:
URL: https://github.com/apache/tvm/pull/13396#discussion_r1023258542


##########
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:
   hey i was wondering if we want to explicitly print `T.evaluate(0)` vs `0`? The former one might look a bit clearer from my perspective



##########
tests/python/unittest/test_tvmscript_roundtrip.py:
##########
@@ -3458,6 +3458,15 @@ def func() -> None:
     return func
 
 
+def implicit_evaluate():
+    @T.prim_func
+    def func(A: T.Buffer[1, "int32"]):
+        T.evaluate(T.assume(A[0] == 5))
+        A[0] = 10

Review Comment:
   just curious what's this line for?



-- 
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