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

Function prepare_tir_lib

web/tests/python/prepare_test_libs.py:45–58  ·  view source on GitHub ↗
(base_path)

Source from the content-addressed store, hash-verified

43
44
45def prepare_tir_lib(base_path):
46 target = {"kind": "llvm", "mtriple": "wasm32-unknown-unknown-wasm"}
47 if not tvm.runtime.enabled("llvm"):
48 raise RuntimeError(f"Target {target} is not enbaled")
49 n = te.var("n")
50 A = te.placeholder((n,), name="A")
51 B = te.compute(A.shape, lambda *i: A(*i) + 1.0, name="B")
52 mod = tvm.IRModule.from_expr(
53 te.create_prim_func([A, B]).with_attr("global_symbol", "add_one")
54 ).with_attr("system_lib_prefix", "")
55
56 fadd = tvm.build(mod, target)
57 wasm_path = os.path.join(base_path, "test_addone.wasm")
58 fadd.export_library(wasm_path, fcompile=tvmjs.create_tvmjs_wasm)
59
60
61if __name__ == "__main__":

Callers 1

Calls 7

placeholderMethod · 0.80
from_exprMethod · 0.80
enabledMethod · 0.45
with_attrMethod · 0.45
buildMethod · 0.45
joinMethod · 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…