From 250f11c57217431952f750e59de99661b786065a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Wed, 17 Feb 2021 14:16:18 -0800 Subject: [PATCH] Fix build of wasi-nn --- .gitmodules | 3 ++- crates/wasi-nn/spec | 2 +- crates/wasi-nn/src/impl.rs | 2 +- crates/wasi-nn/src/lib.rs | 1 - crates/wasi-nn/src/witx.rs | 12 ++++++------ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 305858152d..17229a28ce 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,7 +10,8 @@ branch = abis [submodule "crates/wasi-nn/spec"] path = crates/wasi-nn/spec - url = https://github.com/WebAssembly/wasi-nn + url = https://github.com/alexcrichton/wasi-nn + branch = witx-next [submodule "crates/wasi-crypto/spec"] path = crates/wasi-crypto/spec url = https://github.com/WebAssembly/wasi-crypto.git diff --git a/crates/wasi-nn/spec b/crates/wasi-nn/spec index 793d4cd888..9e7c3277ca 160000 --- a/crates/wasi-nn/spec +++ b/crates/wasi-nn/spec @@ -1 +1 @@ -Subproject commit 793d4cd888ab74e3b7bf018bcc6ab2a2426a1004 +Subproject commit 9e7c3277ca995d1ae07967b3298d6d3958914214 diff --git a/crates/wasi-nn/src/impl.rs b/crates/wasi-nn/src/impl.rs index fb8e781dd1..e18caafdc2 100644 --- a/crates/wasi-nn/src/impl.rs +++ b/crates/wasi-nn/src/impl.rs @@ -12,7 +12,7 @@ use wiggle::GuestPtr; #[derive(Debug, Error)] pub enum UsageError { - #[error("Only OpenVINO's IR is currently supported, passed encoding: {0}")] + #[error("Only OpenVINO's IR is currently supported, passed encoding: {0:?}")] InvalidEncoding(GraphEncoding), #[error("OpenVINO expects only two buffers (i.e. [ir, weights]), passed: {0}")] InvalidNumberOfBuilders(u32), diff --git a/crates/wasi-nn/src/lib.rs b/crates/wasi-nn/src/lib.rs index 2e2c08b037..68999d9310 100644 --- a/crates/wasi-nn/src/lib.rs +++ b/crates/wasi-nn/src/lib.rs @@ -18,7 +18,6 @@ wasmtime_wiggle::wasmtime_integration!({ wasi_ephemeral_nn => { name: WasiNn, docs: "An instantiated instance of the wasi-nn exports.", - function_override: {} } }, }); diff --git a/crates/wasi-nn/src/witx.rs b/crates/wasi-nn/src/witx.rs index b686fcd091..011c173ad8 100644 --- a/crates/wasi-nn/src/witx.rs +++ b/crates/wasi-nn/src/witx.rs @@ -6,23 +6,23 @@ use crate::ctx::WasiNnError; wiggle::from_witx!({ witx: ["$WASI_ROOT/phases/ephemeral/witx/wasi_ephemeral_nn.witx"], ctx: WasiNnCtx, - errors: { errno => WasiNnError } + errors: { nn_errno => WasiNnError } }); -use types::Errno; +use types::NnErrno; /// Wiggle generates code that performs some input validation on the arguments passed in by users of /// wasi-nn. Here we convert the validation error into one (or more, eventually) of the error /// variants defined in the witx. impl types::GuestErrorConversion for WasiNnCtx { - fn into_errno(&self, e: wiggle::GuestError) -> Errno { + fn into_nn_errno(&self, e: wiggle::GuestError) -> NnErrno { eprintln!("Guest error: {:?}", e); - Errno::InvalidArgument + NnErrno::InvalidArgument } } impl<'a> types::UserErrorConversion for WasiNnCtx { - fn errno_from_wasi_nn_error(&self, e: WasiNnError) -> Result { + fn nn_errno_from_wasi_nn_error(&self, e: WasiNnError) -> Result { eprintln!("Host error: {:?}", e); match e { WasiNnError::OpenvinoError(_) => unimplemented!(), @@ -33,7 +33,7 @@ impl<'a> types::UserErrorConversion for WasiNnCtx { } /// Additionally, we must let Wiggle know which of our error codes represents a successful operation. -impl wiggle::GuestErrorType for Errno { +impl wiggle::GuestErrorType for NnErrno { fn success() -> Self { Self::Success }