Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Rust gen to use .wit spec #97

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Regenerate bindings
run: rust/scripts/regenerate-bindings-from-witx.sh
run: rust/scripts/regenerate-bindings-from-wit.sh
- name: Verify no changes
run: git diff --ignore-submodules --no-ext-diff --name-only --exit-code

Expand Down
12 changes: 5 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,15 @@ else
echo "The first argument: $1"
FIXTURE=https://github.com/intel/openvino-rs/raw/main/crates/openvino/tests/fixtures/mobilenet
pushd $WASI_NN_DIR/rust/
cargo build --release --target=wasm32-wasi
cargo build --release --target wasm32-wasi
mkdir -p $WASI_NN_DIR/rust/examples/classification-example/build
RUST_BUILD_DIR=$(realpath $WASI_NN_DIR/rust/examples/classification-example/build/)
cp -rn examples/images $RUST_BUILD_DIR
pushd examples/classification-example
cargo build --release --target=wasm32-wasi
cp target/wasm32-wasi/release/wasi-nn-example.wasm $RUST_BUILD_DIR
pushd build
cp -r examples/images $RUST_BUILD_DIR
wget --no-clobber --directory-prefix=$RUST_BUILD_DIR $FIXTURE/mobilenet.bin
wget --no-clobber --directory-prefix=$RUST_BUILD_DIR $FIXTURE/mobilenet.xml
wasmtime run --mapdir fixture::$RUST_BUILD_DIR wasi-nn-example.wasm --wasi-modules=experimental-wasi-nn
pushd examples/classification-example
cargo component build -p wasi-nn-example-lib --release
cargo run -p wasi-nn-example-bin --release
;;
*)
echo "Unknown build type $BUILD_TYPE"
Expand Down
281 changes: 274 additions & 7 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "wasi-nn"
version = "0.6.0"
version = "0.7.0"
authors = ["The Bytecode Alliance Developers"]
description = "High-level Rust bindings for wasi-nn"
license = "Apache-2.0"
Expand All @@ -19,5 +19,6 @@ targets = ["wasm32-wasi"]

[dependencies]
thiserror = "1"
wit-bindgen = { version = "0.22.0", default-features = true, features = ['macros'] }

[workspace]
4 changes: 2 additions & 2 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ To build this crate from source, use: `cargo build --target wasm32-wasi`.
### Generation

This crate contains code ([`src/generated.rs`](src/generated.rs)) generated by
[`witx-bindgen`](https://github.com/bytecodealliance/wasi/tree/main/crates/witx-bindgen). To
[`wit-bindgen`](https://github.com/bytecodealliance/wasi/tree/main/crates/wit-bindgen). To
regenerate this code, run the following script:

```console
$ scripts/regenerate-bindings-from-witx.sh
$ scripts/regenerate-bindings-from-wit.sh
```


Expand Down
Loading
Loading