Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[microTVM] Add support for host-driven AoT Executor #11044

Merged
merged 45 commits into from
May 10, 2022
Merged

[microTVM] Add support for host-driven AoT Executor #11044

merged 45 commits into from
May 10, 2022

Conversation

alanmacd
Copy link
Contributor

@alanmacd alanmacd commented Apr 18, 2022

It is currently not possible to use the AoT executor with microTVM over the RPC channel. Add support for host-driven AoT executor using the generated AoT metadata to allocate working buffer memory for operations such as get_input(). Add test_aot_executor() test function to test_crt.py to exercise this new functionality.

This PR addresses #10076

cc @gromero @mehrdadh @areusch @mkatanbaf

Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @alanmacd this looks pretty good! some small comments here and there

include/tvm/runtime/crt/aot_executor.h Outdated Show resolved Hide resolved
include/tvm/runtime/crt/aot_executor.h Outdated Show resolved Hide resolved
include/tvm/runtime/crt/aot_executor.h Show resolved Hide resolved
include/tvm/runtime/crt/aot_executor.h Outdated Show resolved Hide resolved
src/runtime/crt/aot_executor/aot_executor.c Outdated Show resolved Hide resolved
src/runtime/crt/aot_executor_module/aot_executor_module.c Outdated Show resolved Hide resolved
src/target/metadata_module.cc Show resolved Hide resolved
src/target/source/source_module.cc Outdated Show resolved Hide resolved
tests/python/unittest/test_crt.py Outdated Show resolved Hide resolved
src/runtime/crt/aot_executor_module/aot_executor_module.c Outdated Show resolved Hide resolved
Copy link
Contributor

@areusch areusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @alanmacd just a few small cleanups now!

cc @mehrdadh @mkatanbaf @gromero @Mousius if you guys have input

cmake/modules/StandaloneCrt.cmake Outdated Show resolved Hide resolved
include/tvm/runtime/crt/aot_executor.h Outdated Show resolved Hide resolved
include/tvm/runtime/metadata_types.h Show resolved Hide resolved
src/target/source/source_module.cc Show resolved Hide resolved
tests/python/unittest/test_crt.py Outdated Show resolved Hide resolved
@areusch areusch merged commit 8d4f4dd into apache:main May 10, 2022
mehrdadh pushed a commit to mehrdadh/tvm that referenced this pull request May 16, 2022
* Generate AOT Metadata when targeting C runtime and packed API.

* Also copy metadata.h and metadata_base.h to standalone_crt.

* add support for get_input_index as well as setting up get_input_info as unsupported

* add support for tvm.aot_executor.create in C runtime

* changes in-progress to unit tests

* Include get_c_metadata in emitted function list

* make CRT error codes generic for graph or AoT executor, fix AoT lib link order

* add AoT executor creation and initializaion, as well as support for get_input_index()

* add allocation of inputs, outputs, and pools; add get_input(), but shape encoded in metadata appears to be incorrect;

* add support to test_aot_executor for get_input()

* fix numpy array shape so that get_input() works properly

* implement run(), get_output(), get_num_inputs(), and get_num_outputs(); test_aot_executor() is now passing;

* fix up some issues from rebase with main

* clean up logging and test_graph_executor()

* lint clean-up

* more lint clean-up

* fix i386 build errors

* first set of changes addressing PR feedback

* more PR feedback: device pass-by-value, docstring entries, return variable name

* add mangling of get_c_metadata() name to avoid function name collisions

* only mangle get_c_metadata() when using C runtime

* add static specifier to all kTvmgenMetadata variables to avoid namespace collisions

* use TVM_IS_CPP_RUNTIME preprocessor define to deteremine whether or not to include metadata.h c++ code

* add TVM_IS_CPP_RUNTIME define for cpptest

* add TVM_IS_CPP_RUNTIME to apps/bundle_deploy

* add TVM_IS_CPP_RUNTIME web/Makefile

* update number of expected generated C files for AoT source files

* break out metadata data structures into separate metadata_types.h header to avoid c/c++ issues and remove the need for the TVM_IS_CPP_RUNTIME define

* remove TVM_IS_CPP_RUNTIME from web makefile

* fix metadata.h include-order lint issue

* correct error mask bits

* address PR feedback

* trigger build

* trigger build

* trigger build

* trigger build

* add alternate name for test_graph_executor() too see if it runs in CI

* fix lint

* revert alternate test code

Co-authored-by: Andrew Reusch <[email protected]>
shtinsa pushed a commit to Deelvin/tvm that referenced this pull request May 17, 2022
* Generate AOT Metadata when targeting C runtime and packed API.

* Also copy metadata.h and metadata_base.h to standalone_crt.

* add support for get_input_index as well as setting up get_input_info as unsupported

* add support for tvm.aot_executor.create in C runtime

* changes in-progress to unit tests

* Include get_c_metadata in emitted function list

* make CRT error codes generic for graph or AoT executor, fix AoT lib link order

* add AoT executor creation and initializaion, as well as support for get_input_index()

* add allocation of inputs, outputs, and pools; add get_input(), but shape encoded in metadata appears to be incorrect;

* add support to test_aot_executor for get_input()

* fix numpy array shape so that get_input() works properly

* implement run(), get_output(), get_num_inputs(), and get_num_outputs(); test_aot_executor() is now passing;

* fix up some issues from rebase with main

* clean up logging and test_graph_executor()

* lint clean-up

* more lint clean-up

* fix i386 build errors

* first set of changes addressing PR feedback

* more PR feedback: device pass-by-value, docstring entries, return variable name

* add mangling of get_c_metadata() name to avoid function name collisions

* only mangle get_c_metadata() when using C runtime

* add static specifier to all kTvmgenMetadata variables to avoid namespace collisions

* use TVM_IS_CPP_RUNTIME preprocessor define to deteremine whether or not to include metadata.h c++ code

* add TVM_IS_CPP_RUNTIME define for cpptest

* add TVM_IS_CPP_RUNTIME to apps/bundle_deploy

* add TVM_IS_CPP_RUNTIME web/Makefile

* update number of expected generated C files for AoT source files

* break out metadata data structures into separate metadata_types.h header to avoid c/c++ issues and remove the need for the TVM_IS_CPP_RUNTIME define

* remove TVM_IS_CPP_RUNTIME from web makefile

* fix metadata.h include-order lint issue

* correct error mask bits

* address PR feedback

* trigger build

* trigger build

* trigger build

* trigger build

* add alternate name for test_graph_executor() too see if it runs in CI

* fix lint

* revert alternate test code

Co-authored-by: Andrew Reusch <[email protected]>
shingjan pushed a commit to shingjan/tvm that referenced this pull request May 17, 2022
* Generate AOT Metadata when targeting C runtime and packed API.

* Also copy metadata.h and metadata_base.h to standalone_crt.

* add support for get_input_index as well as setting up get_input_info as unsupported

* add support for tvm.aot_executor.create in C runtime

* changes in-progress to unit tests

* Include get_c_metadata in emitted function list

* make CRT error codes generic for graph or AoT executor, fix AoT lib link order

* add AoT executor creation and initializaion, as well as support for get_input_index()

* add allocation of inputs, outputs, and pools; add get_input(), but shape encoded in metadata appears to be incorrect;

* add support to test_aot_executor for get_input()

* fix numpy array shape so that get_input() works properly

* implement run(), get_output(), get_num_inputs(), and get_num_outputs(); test_aot_executor() is now passing;

* fix up some issues from rebase with main

* clean up logging and test_graph_executor()

* lint clean-up

* more lint clean-up

* fix i386 build errors

* first set of changes addressing PR feedback

* more PR feedback: device pass-by-value, docstring entries, return variable name

* add mangling of get_c_metadata() name to avoid function name collisions

* only mangle get_c_metadata() when using C runtime

* add static specifier to all kTvmgenMetadata variables to avoid namespace collisions

* use TVM_IS_CPP_RUNTIME preprocessor define to deteremine whether or not to include metadata.h c++ code

* add TVM_IS_CPP_RUNTIME define for cpptest

* add TVM_IS_CPP_RUNTIME to apps/bundle_deploy

* add TVM_IS_CPP_RUNTIME web/Makefile

* update number of expected generated C files for AoT source files

* break out metadata data structures into separate metadata_types.h header to avoid c/c++ issues and remove the need for the TVM_IS_CPP_RUNTIME define

* remove TVM_IS_CPP_RUNTIME from web makefile

* fix metadata.h include-order lint issue

* correct error mask bits

* address PR feedback

* trigger build

* trigger build

* trigger build

* trigger build

* add alternate name for test_graph_executor() too see if it runs in CI

* fix lint

* revert alternate test code

Co-authored-by: Andrew Reusch <[email protected]>
SebastianBoblest pushed a commit to SebastianBoblest/tvm that referenced this pull request May 27, 2022
* Generate AOT Metadata when targeting C runtime and packed API.

* Also copy metadata.h and metadata_base.h to standalone_crt.

* add support for get_input_index as well as setting up get_input_info as unsupported

* add support for tvm.aot_executor.create in C runtime

* changes in-progress to unit tests

* Include get_c_metadata in emitted function list

* make CRT error codes generic for graph or AoT executor, fix AoT lib link order

* add AoT executor creation and initializaion, as well as support for get_input_index()

* add allocation of inputs, outputs, and pools; add get_input(), but shape encoded in metadata appears to be incorrect;

* add support to test_aot_executor for get_input()

* fix numpy array shape so that get_input() works properly

* implement run(), get_output(), get_num_inputs(), and get_num_outputs(); test_aot_executor() is now passing;

* fix up some issues from rebase with main

* clean up logging and test_graph_executor()

* lint clean-up

* more lint clean-up

* fix i386 build errors

* first set of changes addressing PR feedback

* more PR feedback: device pass-by-value, docstring entries, return variable name

* add mangling of get_c_metadata() name to avoid function name collisions

* only mangle get_c_metadata() when using C runtime

* add static specifier to all kTvmgenMetadata variables to avoid namespace collisions

* use TVM_IS_CPP_RUNTIME preprocessor define to deteremine whether or not to include metadata.h c++ code

* add TVM_IS_CPP_RUNTIME define for cpptest

* add TVM_IS_CPP_RUNTIME to apps/bundle_deploy

* add TVM_IS_CPP_RUNTIME web/Makefile

* update number of expected generated C files for AoT source files

* break out metadata data structures into separate metadata_types.h header to avoid c/c++ issues and remove the need for the TVM_IS_CPP_RUNTIME define

* remove TVM_IS_CPP_RUNTIME from web makefile

* fix metadata.h include-order lint issue

* correct error mask bits

* address PR feedback

* trigger build

* trigger build

* trigger build

* trigger build

* add alternate name for test_graph_executor() too see if it runs in CI

* fix lint

* revert alternate test code

Co-authored-by: Andrew Reusch <[email protected]>
@alanmacd alanmacd deleted the host-driven-aot-executor branch June 1, 2022 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants