tqchen commented on a change in pull request #7084:
URL: https://github.com/apache/tvm/pull/7084#discussion_r544772948
##########
File path: src/tir/transforms/make_packed_api.cc
##########
@@ -41,6 +41,56 @@
namespace tvm {
namespace tir {
+class ReturnRewriter : public StmtMutator {
+ public:
+ explicit ReturnRewriter(Var ret_var, Var ret_tcode) : ret_var_(ret_var),
ret_tcode_(ret_tcode) {}
+
+ Stmt VisitStmt_(const EvaluateNode* node) override {
+ Stmt ret = StmtMutator::VisitStmt_(node);
+ const EvaluateNode* eval = ret.as<EvaluateNode>();
+ CHECK(eval);
+ if (const CallNode* call = eval->value.as<CallNode>()) {
+ if (call->op.same_as(builtin::ret())) {
+ CHECK_EQ(call->args.size(), 1);
Review comment:
I think the rule of thumb is whether or not a user might hit the error,
and we should look at the context of the check.
Notably, we encourage putting ICHECK deliberately in many places and the
ease of adding checks quickly facilitate development. Notably, if it is an
ICHECK, it usually means it is not a user facing error. We need to consider the
context in each case
In this particular case, an error could be hit when the call is incorrectly
constructed and the IR being invalid. Which is a rare case, but user could hit
it in certain cases when invalid IR is constructed , so I would say an error
message would be helpful. Although we should also think to which point is
helpful.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]