Skip to content

Commit 7707496

Browse files
authored
[FFI] Log and throw in function dup registration (#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 b4a6b73 commit 7707496

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ffi/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)