zhiics opened a new pull request #5770: URL: https://github.com/apache/incubator-tvm/pull/5770
This PR attempts to separate metadata initialization and source code compilation (when necessary). The discussion can be found here: https://discuss.tvm.ai/t/byoc-runtime-json-runtime-for-byoc/6579/15 The goal is to have a standalone wrapper (`ModuleInitWrapper`) to take care of module initialization for different runtimes. In the BYOC case, we save constants and code separately. The constant would be loaded by the wrapper while the code is handled by csourcemodule. The end-to-end flow of using a BYOC example would be like the following: ```python # the pipeline for annotation and partitioning is the same. # Given an already partitioned IRModule, mod graph, lib, params = relay.build(mod, target="llvm", params=params) # new_lib contains the host lib, source_metadata_mods contains a list of modules that wraps # csource or (json for execution engine when needed) and metadata new_lib, source_metadata_mods = lib.unwrap_modules() if source_metadata_mods: ext_mod = tvm.target.SourceMetadataModule(source_metadata_mods[0]) init_mod = runtime.ModuleInitWrapper(metadata) init_mod.import_module(tvm.target.CSourceModule(ext_mod.source)) new_lib.import_module(init_mod) new_lib.export_library("lib.so") ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
