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

Function check_remote_link_cl

tests/python/runtime/test_runtime_rpc.py:307–335  ·  view source on GitHub ↗

Test function to run remote code such as cl This is not enabled because there is forking issue of TVM runtime when server launches after OpenCL runtime initializes. We leave it as an example on how to do rpc when we want to do linking on remote.

(remote)

Source from the content-addressed store, hash-verified

305 rpc.PopenSession(path_minrpc)
306
307 def check_remote_link_cl(remote):
308 """Test function to run remote code such as cl
309
310 This is not enabled because there is forking issue
311 of TVM runtime when server launches after OpenCL
312 runtime initializes. We leave it as an example
313 on how to do rpc when we want to do linking on remote.
314 """
315 if not tvm.testing.device_enabled("opencl"):
316 print("Skip because opencl is not enabled")
317 return
318 temp = utils.tempdir()
319 dev = remote.cl(0)
320
321 s = tvm.s_tir.Schedule(mod)
322
323 x = s.get_loops(s.get_sblock("B"))
324 xo, xi = s.split(x, factors=[None, 32])
325 s.bind(xo, "blockIdx.x")
326 s.bind(xi, "threadIdx.x")
327 f = tvm.compile(s.mod, tvm.target.Target("opencl", host="llvm"))
328 path_tar = temp.relpath("myadd.tar")
329 f.export_library(path_tar)
330 remote.upload(path_tar)
331 fhost = remote.load_module("myadd.tar")
332 a = tvm.runtime.tensor(np.random.uniform(size=102).astype(A.dtype), dev)
333 b = tvm.runtime.tensor(np.zeros(102, dtype=A.dtype), dev)
334 fhost(a, b)
335 np.testing.assert_equal(b.numpy(), a.numpy() + 1)
336
337 check_remote(rpc.LocalSession())
338 check_remote(client)

Callers

nothing calls this directly

Calls 15

get_loopsMethod · 0.95
get_sblockMethod · 0.95
splitMethod · 0.95
bindMethod · 0.95
printFunction · 0.85
relpathMethod · 0.80
uniformMethod · 0.80
numpyMethod · 0.80
clMethod · 0.45
compileMethod · 0.45
export_libraryMethod · 0.45
uploadMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…