MCPcopy Create free account
hub / github.com/apache/tvm / run_prim_func

Function run_prim_func

tests/python/tirx/codegen/test_codegen_nvshmem.py:36–46  ·  view source on GitHub ↗

Compile, export, load, and run a PrimFunc in the shared disco session.

(sess, prim_func, *args)

Source from the content-addressed store, hash-verified

34
35
36def 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
49def create_nvshmem_array(sess, shape, dtype, init_data_fn=None, zero_out=True):

Callers 5

test_thread_infoFunction · 0.85
test_transferFunction · 0.85
test_signal_opFunction · 0.85
test_put_signalFunction · 0.85
test_fence_barrierFunction · 0.85

Calls 5

printFunction · 0.85
load_vm_moduleMethod · 0.80
_sync_allMethod · 0.80
compileMethod · 0.45
export_libraryMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…