Optimize for multi-module support in AOT mode#3563
Merged
wenyongh merged 7 commits intobytecodealliance:mainfrom Jun 26, 2024
Merged
Optimize for multi-module support in AOT mode#3563wenyongh merged 7 commits intobytecodealliance:mainfrom
wenyongh merged 7 commits intobytecodealliance:mainfrom
Conversation
* split the `aot_loader_resolve_function` into two functions to prevent redundant module lookups and loads * access pre-associated module instances from `func_module_insts`, avoiding unnecessary instances lookups and improving performance
* removed redundant NULL assignments * avoided emitting warning logs for failed function linking when multi-module is enabled
lum1n0us
reviewed
Jun 24, 2024
lum1n0us
reviewed
Jun 24, 2024
lum1n0us
reviewed
Jun 24, 2024
core/iwasm/aot/aot_runtime.h
Outdated
| #if WASM_ENABLE_MULTI_MODULE != 0 | ||
| bh_list sub_module_inst_list_head; | ||
| bh_list *sub_module_inst_list; | ||
| WASMModuleInstanceCommon **func_module_insts; |
Contributor
There was a problem hiding this comment.
IMU, sub_module_inst_list is a list to store all AOTSubModInstNode. Why need a new WASMModuleInstanceCommon[] to do the same thing?
Contributor
Author
There was a problem hiding this comment.
You are right, sub_module_inst_list and func_module_insts store the same data. But func_module_insts is indexed by the function index, which allows us to directly access the module instance without having to go through sub_module_inst_list and lookup by name each time. sub_module_inst_list is kept because there are still some places that require a complete and non-duplicated sub-module instances list.
wenyongh
reviewed
Jun 25, 2024
* rename `func_module_insts` to `import_func_module_insts` * allocate individual memory for `import_func_module_insts` * add a function `init_import_func_module_insts` to initialize module instances of import functions, and invoke it when initializing `sub_module_list_node`
wenyongh
reviewed
Jun 25, 2024
wenyongh
reviewed
Jun 25, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
aot_loader_resolve_functioninto two functions to prevent redundant module lookups and loadsfunc_module_insts, avoiding unnecessary instances lookups and improving performance