Add an initial wasi-nn implementation for Wasmtime (#2208)

* Add an initial wasi-nn implementation for Wasmtime

This change adds a crate, `wasmtime-wasi-nn`, that uses `wiggle` to expose the current state of the wasi-nn API and `openvino` to implement the exposed functions. It includes an end-to-end test demonstrating how to do classification using wasi-nn:
 - `crates/wasi-nn/tests/classification-example` contains Rust code that is compiled to the `wasm32-wasi` target and run with a Wasmtime embedding that exposes the wasi-nn calls
 - the example uses Rust bindings for wasi-nn contained in `crates/wasi-nn/tests/wasi-nn-rust-bindings`; this crate contains code generated by `witx-bindgen` and eventually should be its own standalone crate

* Test wasi-nn as a CI step

This change adds:
 - a GitHub action for installing OpenVINO
 - a script, `ci/run-wasi-nn-example.sh`, to run the classification example
This commit is contained in:
Andrew Brown
2020-11-16 10:54:00 -08:00
committed by GitHub
parent 61a0bcbdc6
commit a61f068c64
33 changed files with 1554 additions and 1 deletions

View File

@@ -30,6 +30,7 @@ wasmtime-jit = { path = "crates/jit", version = "0.21.0" }
wasmtime-obj = { path = "crates/obj", version = "0.21.0" }
wasmtime-wast = { path = "crates/wast", version = "0.21.0" }
wasmtime-wasi = { path = "crates/wasi", version = "0.21.0" }
wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.21.0", optional = true }
wasi-common = { path = "crates/wasi-common", version = "0.21.0" }
structopt = { version = "0.3.5", features = ["color", "suggestions"] }
object = { version = "0.22.0", default-features = false, features = ["write"] }
@@ -80,6 +81,7 @@ default = ["jitdump", "wasmtime/wat", "wasmtime/parallel-compilation"]
lightbeam = ["wasmtime/lightbeam"]
jitdump = ["wasmtime/jitdump"]
vtune = ["wasmtime/vtune"]
wasi-nn = ["wasmtime-wasi-nn"]
# Try the experimental, work-in-progress new x86_64 backend. This is not stable
# as of June 2020.