(device)
| 115 | sch.bind(tx, "threadIdx.x") |
| 116 | |
| 117 | def check_device(device): |
| 118 | dev = tvm.device(device, 0) |
| 119 | if not tvm.testing.device_enabled(device): |
| 120 | print(f"Skip because {device} is not enabled") |
| 121 | return |
| 122 | temp = utils.tempdir() |
| 123 | f = tvm.compile(sch.mod, target=device) |
| 124 | |
| 125 | path_dso = temp.relpath("dev_lib.so") |
| 126 | # test cross compiler function |
| 127 | f.export_library(path_dso, fcompile=cc.cross_compiler("g++")) |
| 128 | |
| 129 | def popen_check(): |
| 130 | import tvm |
| 131 | |
| 132 | f1 = tvm.runtime.load_module(path_dso) |
| 133 | a = tvm.runtime.tensor(np.random.uniform(size=1024).astype(A.dtype), dev) |
| 134 | b = tvm.runtime.tensor(np.zeros(1024, dtype=A.dtype), dev) |
| 135 | f1(a, b) |
| 136 | np.testing.assert_equal(b.numpy(), a.numpy() + 1) |
| 137 | |
| 138 | # system lib should be loaded in different process |
| 139 | worker = popen_pool.PopenWorker() |
| 140 | worker.send(popen_check) |
| 141 | worker.recv() |
| 142 | |
| 143 | def check_c(device): |
| 144 | dev = tvm.device(device, 0) |
no test coverage detected
searching dependent graphs…