[RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return val (#4637)
authorTianqi Chen <tqchen@users.noreply.github.com>
Tue, 7 Jan 2020 23:28:26 +0000 (15:28 -0800)
committerGitHub <noreply@github.com>
Tue, 7 Jan 2020 23:28:26 +0000 (15:28 -0800)
commit77c4774857269768e775444dd1e0ac4c22801cb6
tree49ac1f20eb7e79082d21b948ade2af6a4a953631
parent76efece39f836a6cb6ed297b31479007b79a4118
[RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return val (#4637)

* [RUNTIME][DSO] Improve TVMBackendPackedCFunc to allow return value.

Previously the signature of LibraryModule's PackedFunc does not support return value.
This wasn't a limitation for our current usecase but could become one
as we start to generate more interesting functions.

This feature also start to get interesting as we move towards unified
object protocol and start to pass object around.
This PR enhances the function signature to allow return values.

We also created two macros TVM_DLL_EXPORT_PACKED_FUNC and TVM_DLL_EXPORT_TYPED_FUNC
to allow manual creation of functions that can be loaded by a LibraryModule.

Examples are added in apps/dso_plugin_module.
The change to TVMBackendPackedCFunc is backward compatible,
as previous function will simply ignore the return value field.

* address review comments
18 files changed:
apps/dso_plugin_module/.gitignore [new file with mode: 0644]
apps/dso_plugin_module/Makefile [new file with mode: 0644]
apps/dso_plugin_module/README.md [new file with mode: 0644]
apps/dso_plugin_module/plugin_module.cc [new file with mode: 0644]
apps/dso_plugin_module/test_plugin_module.py [new file with mode: 0644]
apps/extension/Makefile
include/tvm/ir_pass.h
include/tvm/runtime/c_backend_api.h
include/tvm/runtime/module.h
include/tvm/runtime/packed_func.h
src/codegen/codegen_source_base.cc
src/codegen/llvm/llvm_module.cc
src/pass/make_api.cc
src/runtime/library_module.cc
src/runtime/library_module.h
src/runtime/runtime_base.h
tests/python/unittest/test_pass_makeapi.py
tests/scripts/task_python_integration.sh