Fix build of wasi-nn
This commit is contained in:
committed by
Andrew Brown
parent
fa98f0bc91
commit
250f11c572
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -10,7 +10,8 @@
|
|||||||
branch = abis
|
branch = abis
|
||||||
[submodule "crates/wasi-nn/spec"]
|
[submodule "crates/wasi-nn/spec"]
|
||||||
path = 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"]
|
[submodule "crates/wasi-crypto/spec"]
|
||||||
path = crates/wasi-crypto/spec
|
path = crates/wasi-crypto/spec
|
||||||
url = https://github.com/WebAssembly/wasi-crypto.git
|
url = https://github.com/WebAssembly/wasi-crypto.git
|
||||||
|
|||||||
Submodule crates/wasi-nn/spec updated: 793d4cd888...9e7c3277ca
@@ -12,7 +12,7 @@ use wiggle::GuestPtr;
|
|||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum UsageError {
|
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),
|
InvalidEncoding(GraphEncoding),
|
||||||
#[error("OpenVINO expects only two buffers (i.e. [ir, weights]), passed: {0}")]
|
#[error("OpenVINO expects only two buffers (i.e. [ir, weights]), passed: {0}")]
|
||||||
InvalidNumberOfBuilders(u32),
|
InvalidNumberOfBuilders(u32),
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ wasmtime_wiggle::wasmtime_integration!({
|
|||||||
wasi_ephemeral_nn => {
|
wasi_ephemeral_nn => {
|
||||||
name: WasiNn,
|
name: WasiNn,
|
||||||
docs: "An instantiated instance of the wasi-nn exports.",
|
docs: "An instantiated instance of the wasi-nn exports.",
|
||||||
function_override: {}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,23 +6,23 @@ use crate::ctx::WasiNnError;
|
|||||||
wiggle::from_witx!({
|
wiggle::from_witx!({
|
||||||
witx: ["$WASI_ROOT/phases/ephemeral/witx/wasi_ephemeral_nn.witx"],
|
witx: ["$WASI_ROOT/phases/ephemeral/witx/wasi_ephemeral_nn.witx"],
|
||||||
ctx: WasiNnCtx,
|
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
|
/// 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
|
/// wasi-nn. Here we convert the validation error into one (or more, eventually) of the error
|
||||||
/// variants defined in the witx.
|
/// variants defined in the witx.
|
||||||
impl types::GuestErrorConversion for WasiNnCtx {
|
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);
|
eprintln!("Guest error: {:?}", e);
|
||||||
Errno::InvalidArgument
|
NnErrno::InvalidArgument
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> types::UserErrorConversion for WasiNnCtx {
|
impl<'a> types::UserErrorConversion for WasiNnCtx {
|
||||||
fn errno_from_wasi_nn_error(&self, e: WasiNnError) -> Result<Errno, wiggle::Trap> {
|
fn nn_errno_from_wasi_nn_error(&self, e: WasiNnError) -> Result<NnErrno, wiggle::Trap> {
|
||||||
eprintln!("Host error: {:?}", e);
|
eprintln!("Host error: {:?}", e);
|
||||||
match e {
|
match e {
|
||||||
WasiNnError::OpenvinoError(_) => unimplemented!(),
|
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.
|
/// 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 {
|
fn success() -> Self {
|
||||||
Self::Success
|
Self::Success
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user