MCPcopy Index your code
hub / github.com/apache/tvm / download_linked_module

Function download_linked_module

python/tvm/rpc/server.py:86–112  ·  view source on GitHub ↗

Load module from remote side.

(file_name)

Source from the content-addressed store, hash-verified

84
85 @tvm_ffi.register_global_func("tvm.rpc.server.download_linked_module", override=True)
86 def download_linked_module(file_name):
87 """Load module from remote side."""
88 # pylint: disable=import-outside-toplevel
89 path = temp.relpath(file_name)
90
91 if path.endswith(".o"):
92 # Extra dependencies during runtime.
93 from tvm.support import cc as _cc
94
95 _cc.create_shared(path + ".so", path)
96 path += ".so"
97 elif path.endswith(".tar"):
98 # Extra dependencies during runtime.
99 from tvm.support import cc as _cc
100 from tvm.support import tar as _tar
101
102 tar_temp = utils.tempdir(custom_path=path.replace(".tar", ""))
103 _tar.untar(path, tar_temp.temp_dir)
104 files = [tar_temp.relpath(x) for x in tar_temp.listdir()]
105 _cc.create_shared(path + ".so", files)
106 path += ".so"
107 elif path.endswith(".dylib") or path.endswith(".so"):
108 pass
109 else:
110 raise RuntimeError(f"Do not know how to link {file_name}")
111 logger.info("Send linked module %s to client", path)
112 return bytearray(open(path, "rb").read())
113
114 libs = []
115 load_library = load_library.split(":") if load_library else []

Callers

nothing calls this directly

Calls 5

relpathMethod · 0.80
infoMethod · 0.80
readMethod · 0.65
replaceMethod · 0.45
listdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…