I am not sure if the clarification of packaging part is clear enough, but there 
is actually a potential problem. The goal is to be able to conveniently 
assemble code and metadata separately from the frontend in a modular way. The 
generated artifact is intended to be usable by AOT, graph runtime, and VM for 
both CSourceModule and JSON style runtime.

Here we need to pass  back code and weight to the Python side. They may have to 
be part of the lib because we only return bytecode/(graph, params) and lib for 
VM and graph runtime, respectively. We are trying to use the so-called 
`PackagingModule` (TBD) to do this. They will be imported to the lib after 
compilation. Therefore, the module with external library code would look like 
the following for `CSourceModule` after compilation for graph runtime and VM:

```
DSO (A)
    |---PackageModule(code, {var_name, metadata}) (B)
```

>From the Python side, we can assemble it by extracting code and metadata from 
>the imported `PackageModule` B (i.e. code = code of A.imported_modules[0], 
>metadata = metadata of A.imported_modules[0]).

Then, we can assembly the modules and compile/interpret them. But I do have one 
question when we are assembling them. The DSO module (A) contains the other 
part of the graph that should be handled by TVM. We now actually want to 
replace (B) with the newly created module (i.e. the `ModuleMetaDataWrapper`) 
and then do `export_library` and load them back for execution. It seems we are 
not really able to remove/replace it. One possible way I can think of is that 
we can add a `ClearImports` method to `Module` to clear the imports for the DSO 
and then we can package the new modules. @tqchen Does this sound good? Or do 
you have any comments/suggestions?





---
[Visit 
Topic](https://discuss.tvm.ai/t/byoc-runtime-json-runtime-for-byoc/6579/14) to 
respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/4ec0b8d69d553458bfa95d240324b8c9ed6e7c2164f6133c98fbf5edf584ea89).

Reply via email to