Compile, export, load, and run a PrimFunc in the shared disco session.
(sess, prim_func, *args)
| 34 | |
| 35 | |
| 36 | def run_prim_func(sess, prim_func, *args): |
| 37 | """Compile, export, load, and run a PrimFunc in the shared disco session.""" |
| 38 | target = tvm.target.Target("cuda") |
| 39 | with tempfile.TemporaryDirectory() as tmpdir: |
| 40 | path = f"{tmpdir}/test.so" |
| 41 | mod = tvm.compile(prim_func, target=target, tir_pipeline="tirx") |
| 42 | print(mod.mod.imports[0].inspect_source()) |
| 43 | mod.export_library(path) |
| 44 | rt_mod = sess.load_vm_module(path) |
| 45 | rt_mod["main"](*args) |
| 46 | sess._sync_all() |
| 47 | |
| 48 | |
| 49 | def create_nvshmem_array(sess, shape, dtype, init_data_fn=None, zero_out=True): |
no test coverage detected
searching dependent graphs…