forked from apache/tvm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AOT] Support LLVM backend with C++ runtime (apache#10753)
* add get_c_struct_name() method to Metadata to distinguish struct type name in llvm * add metadata serialization support to llvm codegen * Organize MetadataQueuer into a separate file. * Add DiscoverArraysVisitor to metadata_utils * Fill DLTensor metadata in LegalizePackedCalls. * Improve error message from Call asserts * Pass non-String device_context down to codegen. * this is necessary to allow CodeGenCPU to emit calls that include resource_handle. * Scope usage of lvalue refs in LowerTVMBuiltin to avoid corrupt memory. * test fixes * Also fill preflattened_buffer_map (TODO, maybe don't do this) * Fix C codegen. * Set USMP elem_offset to 0. * Clarify calculation of byte_offset from elem_offset. * fix tests * Fix arm compile warning * Fix hexagon test. * previously I believe we required interface_api == "c", but this really means to generate C API bindings, and we are generating "packed" bindings. * I think "c" was chosen here because the distinction between interface-api and use-unpacked-api is confusing. "c" interface-api means to generate an entrypoint API for microcontrollers that accepts bare data buffers. "packed" interface-api means to generate a TVMBackendPackedCFunc entrypoint. use-unpacked-api forms the same determination for the operator functions. * A further confusion here is that there are two ways to call "packed" operator functions: tir.tvm_builtin_call_packed and tir.tvm_builtin_call_cpacked. This distinction describes whether or not to late-bind calls via TVMBackendGetFuncFromEnv. Right now, AOT only ever requires call_cpacked because target_host == target, and for all suitable target_host, we expect a single DSO-exportable runtime.Module. When we move away from this by introducing heterogeneous target support to AOT, we can use this as a condition to help us choose between call_cpacked and call_packed (and possibly add a compile-time option to assert it is call_cpacked, for situations where we really don't want call_packed). * Document T.preflattened_buffer * Fix test_aot_legalize_packed_calls * Address manupa comments * Fix convert_pool_allocations_to_offsets test. * lint * Fix T.preflattened_buffer * Add preflattened_buffer_map to TIRTextPrinter * Fix tests * Fix BYOC * Fix invoking C device API. * remove comments * Address Mousius comments * lint * lint * Fix GMock linking on new CMake * address masahi comment Co-authored-by: Masahiro Masuda <masahi129@gmail.com>
- Loading branch information
Showing
35 changed files
with
1,667 additions
and
527 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.