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

mshr 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 7707496a66 [FFI] Log and throw in function dup registration (#18149)
7707496a66 is described below

commit 7707496a6601796393557087d2bef3d2f5513a34
Author: Tianqi Chen <[email protected]>
AuthorDate: Wed Jul 16 05:27:43 2025 -0400

    [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.
---
 ffi/src/ffi/function.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/ffi/src/ffi/function.cc b/ffi/src/ffi/function.cc
index 3db651fe11..a2d3fb9db3 100644
--- a/ffi/src/ffi/function.cc
+++ b/ffi/src/ffi/function.cc
@@ -92,7 +92,10 @@ class GlobalFunctionTable {
     String name(method_info->name.data, method_info->name.size);
     if (table_.count(name)) {
       if (!can_override) {
-        TVM_FFI_THROW(RuntimeError) << "Global Function `" << name << "` is 
already registered";
+        TVM_FFI_LOG_AND_THROW(RuntimeError)
+            << "Global Function `" << name << "` is already registered, 
possible causes:\n"
+            << "- Two GlobalDef().def registrations for the same function \n"
+            << "Please remove the duplicate registration.";
       }
     }
     table_.Set(name, ObjectRef(make_object<Entry>(method_info)));

Reply via email to