You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "sunggg (via GitHub)" <gi...@apache.org> on 2023/08/08 05:29:43 UTC

[GitHub] [tvm] sunggg commented on pull request #15244: [Runtime] Serialization/Deserialization of runtime module

sunggg commented on PR #15244:
URL: https://github.com/apache/tvm/pull/15244#issuecomment-1668933220

   Thank you, @tqchen for the suggestion. By reflecting your feedback, the latest commit cleans-up the APIs as follows:
   ```C++
   // support full roundtrip of `runtime::Module` if the root and its all submodules are binary serializable
   // These are used for structural hash of `runtime::Module` and thus also used for `SaveJson` and `LoadJson`
   // Please note that `SerializeModuleToBytes` supports `include_dso` to keep the existing usage (e.g., `PackImportsToC`). 
   // When `include_dso` is disabled and it encounters `DSOModules`, error will be raised.  
   std::string SerializeModuleToBytes(const runtime::Module& mod, bool include_dso = true);
   runtime::Module DeserializeModuleFromBytes(std::string blob);
   
   // supports export/import of `runtime::Module` if the root and all submodules are either binary serializable or dso exportable
   // this is currently used for pytorch integration: https://github.com/apache/tvm/pull/12232
   std::string ExportModuleToBase64(tvm::runtime::Module module);
   runtime::Module ImportModuleFromBase64(std::string base64str);
   ```
   Whenever each API faces module/submodule that is not expected, the error will be triggered. 
   
   Also, `SHashReduce` and `SEqualReduce` are defined to enable structural equality check. 
   Thus, new test-cases verify roundtrippability via structural equality check. 


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org