I’m learning how to use call tvm using javascript under the web sub-directory. When reading the following two examples:
- web/tests/node/test_packed_func.js
const EmccWASI = require(path.join(wasmPath, "tvmjs_runtime.wasi.js"));
const wasmSource = fs.readFileSync(path.join(wasmPath, "tvmjs_runtime.wasm"));
let tvm = new tvmjs.Instance(
new WebAssembly.Module(wasmSource),
new EmccWASI()
);
- web/tests/node/test_module_load.js
const EmccWASI = require(path.join(wasmPath, "tvmjs_runtime.wasi.js"));
const wasmSource = fs.readFileSync(path.join(wasmPath, "test_addone.wasm"));
const tvm = new tvmjs.Instance(
new WebAssembly.Module(wasmSource),
new EmccWASI()
);
From the makefile, *.cc → *.bc → tvmjs_runtime.wasm → tvmjs_runtime.js → tvmjs_runtime.wasi.js .
In my think, the tvmjs_runtime.wasm is needed by all example (PackedFunc, Module implement in this wasm file). But when look at the second example, the tvmjs_runtime.wasm not loaded, that confused me – where’s the TVM functionality come from? If tvmjs_runtime.wasm is not necessary, why it is loaded in the fist example.