[RUNTIME] Introduce RValue reference(move) support to TypedPackedFunc (#5271)
authorTianqi Chen <tqchen@users.noreply.github.com>
Sat, 11 Apr 2020 00:07:20 +0000 (17:07 -0700)
committerGitHub <noreply@github.com>
Sat, 11 Apr 2020 00:07:20 +0000 (17:07 -0700)
commitb72dd9d935ce284d480fd6084f4c9deaee1f9367
tree5d7aa95f7acf836d53a2bdee2665e552af23b9f0
parent575d53698e41aef85360d3445f478df2a8f2a9a2
[RUNTIME] Introduce RValue reference(move) support to TypedPackedFunc (#5271)

* [RUNTIME] Introduce RValue reference(move) support to TypedPackedFunc

This PR introduces RValue reference support the PackedFunc calling convention to address the above issue.
Specifically, when an argument is a r-value reference, we will use a assign a different type code(`kObjectRValueRefArg`),
and pass `Object**`  (the address to the Object pointer) instead through the values array.
The callee can choose to move out this Object pointer and set the original Object pointer from the caller side to be nullptr.

We also add an experimental move support to the python side(marked as _move so to indicate the dev nature).
This enhancement will enable copy on write optimizations through out the TVM stack.

* Address review comments

* fix compilation
26 files changed:
include/tvm/ir/expr.h
include/tvm/node/container.h
include/tvm/runtime/c_runtime_api.h
include/tvm/runtime/container.h
include/tvm/runtime/object.h
include/tvm/runtime/packed_func.h
include/tvm/tir/expr.h
jvm/native/src/main/native/org_apache_tvm_native_c_api.cc
python/tvm/_ffi/_ctypes/object.py
python/tvm/_ffi/_ctypes/packed_func.py
python/tvm/_ffi/_ctypes/types.py
python/tvm/_ffi/_cython/base.pxi
python/tvm/_ffi/_cython/object.pxi
python/tvm/_ffi/_cython/packed_func.pxi
python/tvm/_ffi/runtime_ctypes.py
python/tvm/runtime/object.py
python/tvm/runtime/object_generic.py
rust/frontend/src/function.rs
src/ir/transform.cc
src/node/container.cc
src/runtime/c_runtime_api.cc
src/support/ffi_testing.cc
tests/cpp/packed_func_test.cc
tests/python/unittest/test_runtime_packed_func.py
tests/python/unittest/test_runtime_rpc.py
web/tvm_runtime.js