giuseros commented on a change in pull request #7785:
URL: https://github.com/apache/tvm/pull/7785#discussion_r608194704
##########
File path: src/target/source/codegen_c_host.cc
##########
@@ -211,21 +219,34 @@ void CodeGenCHost::PrintGetFuncFromBackend(const
std::string& func_name,
this->stream << "}\n";
}
-void CodeGenCHost::PrintFuncCall(const std::string& packed_func_name, int
num_args) {
+void CodeGenCHost::PrintFuncCall(const std::string& packed_func_name, PrimExpr
values,
+ int num_args) {
this->PrintIndent();
+ std::string stack_value = "stack_value";
+ if (const VarNode* stack_value_var = values.as<VarNode>()) {
+ stack_value = stack_value_var->name_hint;
+ }
std::string ret_val = GetUniqueName("ret_val");
std::string ret_type_code = GetUniqueName("ret_type_code");
this->stream << "TVMValue " << ret_val << ";\n";
this->PrintIndent();
this->stream << "int " << ret_type_code << ";\n";
this->PrintIndent();
- this->stream << "if (TVMFuncCall(" << packed_func_name << ", "
- << "(TVMValue*) stack_value"
- << ", "
+
+ if (is_aot_executor_) {
+ this->stream << "if (" << packed_func_name << "( "
+ << "(TVMValue*) " << stack_value;
+ } else {
+ this->stream << "if (TVMFuncCall(" << packed_func_name << ", "
+ << "(TVMValue*) stack_value";
+ }
+ this->stream << ", "
<< "(int*) stack_tcode"
<< ", " << num_args << ", "
- << "&" << ret_val << ", "
- << "&" << ret_type_code << ") != 0) {\n";
+ << "&" << ret_val << ", ";
+ this->stream << "&" << ret_type_code;
+ this->stream << (is_aot_executor_ ? ", NULL" : "") << ") != 0) {\n";
Review comment:
So this is because I am calling the operators directly and the last
argument of a packed function is a `context_handle`, which I am setting to
NULL (for now)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]