RPC remote compilation?


I’ve got an question regarding the RPC. If I rename lib.tar to lib.so TVM will try to compile for my target which fails as I don’t have an suitable cross compiler on my machine. My inital thought was that if I use tar TVM will just use the module systems SaveToBinary/LoadFromBinary infrastructure in order to avoid compilation, however after inspecting the uploaded lib.tar on the rpc device I discovered that it contains object files(devc.o,lib0.o) which makes me wonder how those came to be, were they compiled on the rpc and why? Ist it possible to just rely on SaveToBinary/LoadFromBinary or does the GraphExecutor require compilation?

Hi, shimun, maybe here is what you are looking for https://github.com/apache/tvm/blob/main/python/tvm/meta_schedule/builder/local_builder.py#L264 TVM generate tarball by default and compile them at rpcserver side, you can override this export function to generate library at host side like this:

@register_func("export_target_lib", override=True)
     def export_target_lib(mod) -> str:
         import tvm
         import tempfile
         artifact_path = os.path.join(tempfile.mkdtemp(), "tvm_tmp_mod.so")
         return artifact_path