Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tic
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenyuanbo
tic
Commits
adc06e6f
Commit
adc06e6f
authored
Jul 09, 2017
by
Tianqi Chen
Committed by
GitHub
Jul 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RUNTIME][ABI] Remove TVMValue as argument, use address (#236)
parent
cd29c18c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
9 deletions
+14
-9
include/tvm/runtime/c_runtime_api.h
+4
-2
python/tvm/_ffi/_ctypes/function.py
+1
-1
python/tvm/_ffi/_cython/base.pxi
+3
-2
python/tvm/_ffi/_cython/function.pxi
+1
-1
src/runtime/c_runtime_api.cc
+5
-3
No files found.
include/tvm/runtime/c_runtime_api.h
View file @
adc06e6f
...
@@ -243,10 +243,12 @@ TVM_DLL int TVMFuncCall(TVMFunctionHandle func,
...
@@ -243,10 +243,12 @@ TVM_DLL int TVMFuncCall(TVMFunctionHandle func,
* \param ret The return value handle, pass by ret in TVMPackedCFunc
* \param ret The return value handle, pass by ret in TVMPackedCFunc
* \param value The value to be returned.
* \param value The value to be returned.
* \param type_code The type of 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
,
TVM_DLL
int
TVMCFuncSetReturn
(
TVMRetValueHandle
ret
,
TVMValue
value
,
TVMValue
*
value
,
int
type_code
);
int
*
type_code
,
int
num_ret
);
/*!
/*!
* \brief Inplace translate callback argument value to return value.
* \brief Inplace translate callback argument value to return value.
...
...
python/tvm/_ffi/_ctypes/function.py
View file @
adc06e6f
...
@@ -64,7 +64,7 @@ def convert_to_tvm_func(pyfunc):
...
@@ -64,7 +64,7 @@ def convert_to_tvm_func(pyfunc):
values
,
tcodes
,
_
=
_make_tvm_args
((
rv
,),
temp_args
)
values
,
tcodes
,
_
=
_make_tvm_args
((
rv
,),
temp_args
)
if
not
isinstance
(
ret
,
TVMRetValueHandle
):
if
not
isinstance
(
ret
,
TVMRetValueHandle
):
ret
=
TVMRetValueHandle
(
ret
)
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
_
=
temp_args
_
=
rv
_
=
rv
return
0
return
0
...
...
python/tvm/_ffi/_cython/base.pxi
View file @
adc06e6f
...
@@ -73,8 +73,9 @@ cdef extern from "tvm/runtime/c_runtime_api.h":
...
@@ -73,8 +73,9 @@ cdef extern from "tvm/runtime/c_runtime_api.h":
int* ret_type_code)
int* ret_type_code)
int TVMFuncFree(TVMFunctionHandle func)
int TVMFuncFree(TVMFunctionHandle func)
int TVMCFuncSetReturn(TVMRetValueHandle ret,
int TVMCFuncSetReturn(TVMRetValueHandle ret,
TVMValue value,
TVMValue* value,
int type_code)
int* type_code,
int num_ret)
int TVMFuncCreateFromCFunc(TVMPackedCFunc func,
int TVMFuncCreateFromCFunc(TVMPackedCFunc func,
void* resource_handle,
void* resource_handle,
TVMPackedCFuncFinalizer fin,
TVMPackedCFuncFinalizer fin,
...
...
python/tvm/_ffi/_cython/function.pxi
View file @
adc06e6f
...
@@ -44,7 +44,7 @@ cdef int tvm_callback(TVMValue* args,
...
@@ -44,7 +44,7 @@ cdef int tvm_callback(TVMValue* args,
raise ValueError("PackedFunction can only support one return value")
raise ValueError("PackedFunction can only support one return value")
temp_args = []
temp_args = []
make_arg(rv, &value, &tcode, temp_args)
make_arg(rv, &value, &tcode, temp_args)
CALL(TVMCFuncSetReturn(ret,
value, tcode
))
CALL(TVMCFuncSetReturn(ret,
&value, &tcode, 1
))
return 0
return 0
...
...
src/runtime/c_runtime_api.cc
View file @
adc06e6f
...
@@ -323,11 +323,13 @@ int TVMFuncCall(TVMFunctionHandle func,
...
@@ -323,11 +323,13 @@ int TVMFuncCall(TVMFunctionHandle func,
}
}
int
TVMCFuncSetReturn
(
TVMRetValueHandle
ret
,
int
TVMCFuncSetReturn
(
TVMRetValueHandle
ret
,
TVMValue
value
,
TVMValue
*
value
,
int
type_code
)
{
int
*
type_code
,
int
num_ret
)
{
API_BEGIN
();
API_BEGIN
();
CHECK_EQ
(
num_ret
,
1
);
TVMRetValue
*
rv
=
static_cast
<
TVMRetValue
*>
(
ret
);
TVMRetValue
*
rv
=
static_cast
<
TVMRetValue
*>
(
ret
);
*
rv
=
TVMArgValue
(
value
,
type_code
);
*
rv
=
TVMArgValue
(
value
[
0
],
type_code
[
0
]
);
API_END
();
API_END
();
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment