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


##########
src/printer/tvmscript_printer.cc:
##########
@@ -1275,16 +1275,11 @@ Doc TVMScriptPrinter::VisitStmt_(const SeqStmtNode* op) 
{
 }
 
 Doc TVMScriptPrinter::VisitStmt_(const EvaluateNode* op) {
-  if (auto* call = op->value.as<CallNode>()) {
-    if (call->op.same_as(builtin::assume())) {
-      Doc doc;
-      doc << tir_prefix_ << ".assume(" << Print(call->args[0]) << ")";
-      return doc;
-    }
-  }
-
+  // When parsing TVMScript, a PrimExpr that occurs as a statement is
+  // automatically wrapped in `tir::Evaluate`.  Therefore, when
+  // printing we only need to print the value.
   Doc doc;
-  doc << tir_prefix_ << ".evaluate(" << Print(op->value) << ")";
+  doc << Print(op->value);

Review Comment:
   I like that idea for the printing.  Maybe best of both worlds, to have the 
sugar apply all the time when parsing, but only `CallNode` drops the printing 
of `T.evaluate(...)` when generating TVMScript.



-- 
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-unsubscr...@tvm.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to