Commit adc06e6f by Tianqi Chen Committed by GitHub

[RUNTIME][ABI] Remove TVMValue as argument, use address (#236)

parent cd29c18c
......@@ -243,10 +243,12 @@ TVM_DLL int TVMFuncCall(TVMFunctionHandle func,
* \param ret The return value handle, pass by ret in TVMPackedCFunc
* \param value The value to be returned.
* \param type_code The type of the value to be returned.
* \param num_ret Number of return values, for now only 1 is supported.
*/
TVM_DLL int TVMCFuncSetReturn(TVMRetValueHandle ret,
TVMValue value,
int type_code);
TVMValue* value,
int* type_code,
int num_ret);
/*!
* \brief Inplace translate callback argument value to return value.
......
......@@ -64,7 +64,7 @@ def convert_to_tvm_func(pyfunc):
values, tcodes, _ = _make_tvm_args((rv,), temp_args)
if not isinstance(ret, TVMRetValueHandle):
ret = TVMRetValueHandle(ret)
check_call(_LIB.TVMCFuncSetReturn(ret, values[0], ctypes.c_int(tcodes[0])))
check_call(_LIB.TVMCFuncSetReturn(ret, values, tcodes, ctypes.c_int(1)))
_ = temp_args
_ = rv
return 0
......
......@@ -73,8 +73,9 @@ cdef extern from "tvm/runtime/c_runtime_api.h":
int* ret_type_code)
int TVMFuncFree(TVMFunctionHandle func)
int TVMCFuncSetReturn(TVMRetValueHandle ret,
TVMValue value,
int type_code)
TVMValue* value,
int* type_code,
int num_ret)
int TVMFuncCreateFromCFunc(TVMPackedCFunc func,
void* resource_handle,
TVMPackedCFuncFinalizer fin,
......
......@@ -44,7 +44,7 @@ cdef int tvm_callback(TVMValue* args,
raise ValueError("PackedFunction can only support one return value")
temp_args = []
make_arg(rv, &value, &tcode, temp_args)
CALL(TVMCFuncSetReturn(ret, value, tcode))
CALL(TVMCFuncSetReturn(ret, &value, &tcode, 1))
return 0
......
......@@ -323,11 +323,13 @@ int TVMFuncCall(TVMFunctionHandle func,
}
int TVMCFuncSetReturn(TVMRetValueHandle ret,
TVMValue value,
int type_code) {
TVMValue* value,
int* type_code,
int num_ret) {
API_BEGIN();
CHECK_EQ(num_ret, 1);
TVMRetValue* rv = static_cast<TVMRetValue*>(ret);
*rv = TVMArgValue(value, type_code);
*rv = TVMArgValue(value[0], type_code[0]);
API_END();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment