kparzysz-quic opened a new pull request, #15666:
URL: https://github.com/apache/tvm/pull/15666

   When a module with imported modules is exported into a shared library, the 
imported modules are serialized and embedded inside of that library. This is 
done by generating a raw binary from the imported modules, which is then 
assigned to a symbol `__tvm_dev_mblob` in the final shared library.
   
   The way it happens for targets that are not "llvm", is by creating a C 
source file, and defining a statically-initialized array `__tvm_dev_mblob` in 
it. The static initializer is the byte-by-byte hexadecimal represen- tation of 
the serialized modules. While working with Hexagon, this has presented us with 
two issues:
   1. For most models, the embedded data is very large, taking significant 
amout of time to compile the auto-generated C source.
   2. There are some models for which the C source size has exceeded clang's 
limits on the size of the input file, making it impossible to export the 
corresponding module.
   
   This PR allows users to provide a custom serialization routine to 
`Module.export_library`. We then apply it in Hexagon to build the ELF object 
file with `__tvm_dev_mblob` by using the objcopy tool from the Hexagon 
toolchain. This bypasses the C compilation altogether, avoiding both of the 
issues.
   
   Using the same custom mechanism, similar method can be implemented for many 
other targets which have utilities to manipulate object files directly.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to