Make WASI-NN classes send and/or sync (#5077)
* Make send and remove wrapper around WasiNnCtx· This removes the wrapper around WasiNnCtx and no longer requires borrow_mut(). Once send/sync changes in OpenVINO crate are merged in it will allow·use by frameworks that requires this trait. * Bump openvino to compatible version. * BackendExecutionContext should be Send and Sync * Fix rust format issues. * Update Cargo.lock for openvino * Audit changes to openvino crates.
This commit is contained in:
committed by
GitHub
parent
2702619427
commit
f082756643
@@ -7,7 +7,7 @@ use thiserror::Error;
|
||||
use wiggle::GuestError;
|
||||
|
||||
/// A [Backend] contains the necessary state to load [BackendGraph]s.
|
||||
pub(crate) trait Backend {
|
||||
pub(crate) trait Backend: Send {
|
||||
fn name(&self) -> &str;
|
||||
fn load(
|
||||
&mut self,
|
||||
@@ -18,13 +18,13 @@ pub(crate) trait Backend {
|
||||
|
||||
/// A [BackendGraph] can create [BackendExecutionContext]s; this is the backing
|
||||
/// implementation for a [crate::witx::types::Graph].
|
||||
pub(crate) trait BackendGraph {
|
||||
pub(crate) trait BackendGraph: Send {
|
||||
fn init_execution_context(&mut self) -> Result<Box<dyn BackendExecutionContext>, BackendError>;
|
||||
}
|
||||
|
||||
/// A [BackendExecutionContext] performs the actual inference; this is the
|
||||
/// backing implementation for a [crate::witx::types::GraphExecutionContext].
|
||||
pub(crate) trait BackendExecutionContext {
|
||||
pub(crate) trait BackendExecutionContext: Send + Sync {
|
||||
fn set_input(&mut self, index: u32, tensor: &Tensor<'_>) -> Result<(), BackendError>;
|
||||
fn compute(&mut self) -> Result<(), BackendError>;
|
||||
fn get_output(&mut self, index: u32, destination: &mut [u8]) -> Result<u32, BackendError>;
|
||||
|
||||
Reference in New Issue
Block a user