(base_path)
| 43 | |
| 44 | |
| 45 | def 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 | |
| 61 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…