I have tried the pipeline on resnet model and when running in wasmtime runtime
seems like there are still some symbol that is undefined for example,
`env::TVMArrayCopyFromBytes`.
Here's what I've hone. When I specify `tvm_runtime` path in `Cargo.toml` just
like test_wasm32 did.
[dependencies]
ndarray = "0.12"
image = "0.20"
tvm-runtime = { path = "/path/to/tvm/rust/runtime" }
tvm-frontend = { path = "/path/to/tvm/rust/frontend" }
Cargo couldn't find tvm_runtime library. Thus I manually add these two lines in
`tvm/rust/runtime/Cargo.toml` and `tvm/rust/frontend/Cargo.toml` as follows.
[lib]
crate-type = ["rlib", "staticlib"]
Run `cargo build -target=wasm32-wasi --release` in both runtime and frontend
directory. After doing this, libtvm_runtime.a and libtvm_frontend.a are
successfully generated under `tvm/rust/target/wasm32-wasi/release/` and cargo
is able to find it after specifying path in `build.rs`.
println!(
"cargo:rustc-link-search=native={}/rust/target/wasm32-wasi/release/",
env("TVM_HOME")
);
In my case, I also export the model in python script and archive it with
`llvm-ar-10 rcs libweb_resnet18.a web_resnet18.o`. Since cargo doesn't show any
error message related to `web_resnet18` library unfind. I assume the archived
static file successfully bundle into output wasm file. Unfortunately, when I
execute the generated wasm file with wasmtime runtime, the undefined symbol
error occurs. According to the previous experience, I already check the symbol
in the generated wasm model file.
The most similar symbol in the available static lib including
`libtvm_runtime.a`, `libtvm_frontend.a` and `libweb_resnet18.a` is
`TVMArrayCopyFromTo` in `libtvm_frontend.a`. I doubt that I still lack some
lib to build and search in TVM code base with `TVMArrayCopyFromBytes` keyword.
It turns out the definition of the symbol is in `src/runtime/ndarray.cc`. Does
that mean I have to manually build another runtime static lib from c++ file
under `/src/runtime`? Shouldn't the symbol get included when I build
`libtvm_runtime.a`?
---
[Visit
Topic](https://discuss.tvm.ai/t/how-to-build-runnable-wasm-on-browser/7048/8)
to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
here](https://discuss.tvm.ai/email/unsubscribe/d0fb52a806531996dc66641d7b66412d184130e8e6b008ac713e84d4c9b14d2a).