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 e949a9d9c12aaf0d9d4ad7e9af265b5d9987eb31
Author: tqchen <[email protected]>
AuthorDate: Mon May 5 09:24:27 2025 -0400

    Fix C codegen caller convention
---
 src/target/source/codegen_c_host.cc | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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