Skip to content

Commit 5b0cceb

Browse files
committed
[FFI] Log and throw in function dup registration (apache#18149)
This PR changes the function global dup registration to log and throw so we have clear error message about the function duplication.
1 parent 26b68b0 commit 5b0cceb

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/ffi/function.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,10 @@ class GlobalFunctionTable {
9292
String name(method_info->name.data, method_info->name.size);
9393
if (table_.count(name)) {
9494
if (!can_override) {
95-
TVM_FFI_THROW(RuntimeError) << "Global Function `" << name << "` is already registered";
95+
TVM_FFI_LOG_AND_THROW(RuntimeError)
96+
<< "Global Function `" << name << "` is already registered, possible causes:\n"
97+
<< "- Two GlobalDef().def registrations for the same function \n"
98+
<< "Please remove the duplicate registration.";
9699
}
97100
}
98101
table_.Set(name, ObjectRef(make_object<Entry>(method_info)));

0 commit comments

Comments
 (0)