This is an automated email from the ASF dual-hosted git repository.

lunderberg pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 4a2a3b5669 [TIR] Improved MakePackedAPI error message (#14387)
4a2a3b5669 is described below

commit 4a2a3b5669ecb0a9be2d885c3946fa4ef63d5552
Author: Eric Lunderberg <[email protected]>
AuthorDate: Fri Mar 24 08:13:45 2023 -0500

    [TIR] Improved MakePackedAPI error message (#14387)
    
    If a variable is undefined within a PrimFunc, included the name of the
    PrimFunc in the error message.  Otherwise, in a IRModule with multiple
    functions, it may be unclear which PrimFunc is malformed.
---
 src/tir/transforms/make_packed_api.cc | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/tir/transforms/make_packed_api.cc 
b/src/tir/transforms/make_packed_api.cc
index c1611a23a0..b12d3dd49f 100644
--- a/src/tir/transforms/make_packed_api.cc
+++ b/src/tir/transforms/make_packed_api.cc
@@ -286,14 +286,8 @@ PrimFunc MakePackedAPI(PrimFunc&& func) {
   func_ptr->params = args;
 
   Array<Var> undefined = UndefinedVars(func_ptr->body, func_ptr->params);
-  if (undefined.size() != 0) {
-    std::ostringstream os;
-    for (Var v : undefined) {
-      os << " \'" << v->name_hint << "\' ";
-    }
-    os << " is not bound to any variables";
-    LOG(FATAL) << "Not all Vars are passed in api_args: " << os.str();
-  }
+  ICHECK_EQ(undefined.size(), 0) << "In PrimFunc " << global_symbol << " 
variables " << undefined
+                                 << " are used, but are not passed in as API 
arguments";
 
   func_ptr->buffer_map = Map<Var, Buffer>();
   func_ptr->checked_type_ = func_ptr->func_type_annotation();

Reply via email to