Skip to content

Commit

Permalink
[TIR] Improved MakePackedAPI error message (#14387)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Lunderberg authored Mar 24, 2023
1 parent b09e72b commit 4a2a3b5
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/tir/transforms/make_packed_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 4a2a3b5

Please sign in to comment.