* Use stable Rust on CI to test the x64 backend This commit leverages the newly-released 1.51.0 compiler to test the new backend on Windows and Linux with a stable compiler instead of a nightly compiler. This isolates the nightly build to just the nightly documentation generation and fuzzing, both of which rely on nightly for the best results right now. * Use updated stable in book build job * Run rustfmt for new stable * Silence new warnings for wasi-nn * Allow some dead code in the x64 backend Looks like new rustc is better about emitting some dead-code warnings * Update rust in peepmatic job * Fix a test in the pooling allocator * Remove `package.metdata.docs.rs` temporarily Needs resolution of https://github.com/rust-lang/cargo/pull/9300 first * Fix a warning in a wasi-nn example
wasmtime-wasi-nn
This crate enables support for the wasi-nn API in Wasmtime. Currently it contains an implementation of wasi-nn using OpenVINO™ but in the future it could support multiple machine learning backends. Since the wasi-nn API is expected to be an optional feature of WASI, this crate is currently separate from the wasi-common crate. This crate is experimental and its API, functionality, and location could quickly change.
Use
Use the Wasmtime APIs to instantiate a Wasm module and link in the WasiNn implementation as follows:
let wasi_nn = WasiNn::new(&store, WasiNnCtx::new()?);
wasi_nn.add_to_linker(&mut linker)?;
Build
This crate should build as usual (i.e. cargo build) but note that using an existing installation of OpenVINO™, rather
than building from source, will drastically improve the build times. See the openvino crate for more information
Example
An end-to-end example demonstrating ML classification is included in examples:
tests/wasi-nn-rust-bindingscontains ergonomic bindings for writing Rust code against the wasi-nn APIstests/classification-examplecontains a standalone Rust project that uses the wasi-nn APIs and is compiled to thewasm32-wasitarget using thewasi-nn-rust-bindings
Run the example from the Wasmtime project directory:
ci/run-wasi-nn-example.sh