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

tqchen pushed a commit to branch refactor-s3
in repository https://gitbox.apache.org/repos/asf/tvm.git

commit e15c9aaf0c9139cd443bb2b22ccea945d2264b05
Author: tqchen <[email protected]>
AuthorDate: Mon May 5 09:24:27 2025 -0400

    Fix C codegen caller convention
---
 src/support/ffi_testing.cc          | 1 -
 src/target/source/codegen_c_host.cc | 6 +++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/support/ffi_testing.cc b/src/support/ffi_testing.cc
index cfd5c42f6e..9e727f06d4 100644
--- a/src/support/ffi_testing.cc
+++ b/src/support/ffi_testing.cc
@@ -71,7 +71,6 @@ TVM_REGISTER_GLOBAL("testing.test_wrap_callback_suppress_err")
       *ret = result;
     });
 
-
 TVM_REGISTER_GLOBAL("testing.test_check_eq_callback")
     .set_body_packed([](TVMArgs args, TVMRetValue* ret) {
       auto msg = args[0].cast<std::string>();
diff --git a/src/target/source/codegen_c_host.cc 
b/src/target/source/codegen_c_host.cc
index 815904c946..ef86f09ca2 100644
--- a/src/target/source/codegen_c_host.cc
+++ b/src/target/source/codegen_c_host.cc
@@ -242,7 +242,11 @@ void CodeGenCHost::PrintCallPacked(const CallNode* op) {
   std::string result = name_supply_->FreshName("result");
   this->stream << "TVMFFIAny " << result << ";\n";
   this->PrintIndent();
-
+  // must make sure type_index is set to none
+  this->stream << result << ".type_index = kTVMFFINone;\n";
+  this->PrintIndent();
+  this->stream << result << ".v_int64 = 0;\n";
+  this->PrintIndent();
   if (op->op.same_as(builtin::tvm_call_packed_lowered())) {
     this->stream << "if (TVMFFIFunctionCall(" << packed_func_name << ", ";
   } else {

Reply via email to