From 4a2a3b5669ecb0a9be2d885c3946fa4ef63d5552 Mon Sep 17 00:00:00 2001 From: Eric Lunderberg Date: Fri, 24 Mar 2023 08:13:45 -0500 Subject: [PATCH] [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 c1611a23a05f..b12d3dd49f05 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 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(); func_ptr->checked_type_ = func_ptr->func_type_annotation();