From aa9b0ec1d06d0d998a620cf27a3094d9be4e734d Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Tue, 19 Sep 2023 12:50:10 +0000 Subject: [PATCH 1/7] feat(rust-sys): new API `PluginManager::nn_preload` Signed-off-by: Xin Liu --- crates/wasmedge-sys/src/plugin.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/crates/wasmedge-sys/src/plugin.rs b/crates/wasmedge-sys/src/plugin.rs index 890bc3c17..f279d1e82 100644 --- a/crates/wasmedge-sys/src/plugin.rs +++ b/crates/wasmedge-sys/src/plugin.rs @@ -7,7 +7,10 @@ use crate::{ utils, AsImport, Instance, WasmEdgeResult, }; use parking_lot::Mutex; -use std::{ffi::CString, os::raw::c_void, sync::Arc}; +use std::{ + ffi::{c_void, CString}, + sync::Arc, +}; use wasmedge_types::error::{InstanceError, PluginError, WasmEdgeError}; /// Defines the APIs for loading plugins and check the basic information of the loaded plugins. @@ -45,6 +48,18 @@ impl PluginManager { Ok(()) } + #[cfg(feature = "wasi_nn")] + #[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))] + pub fn nn_preload(preloads: Vec<&str>) { + let c_args: Vec = preloads + .iter() + .map(|&x| std::ffi::CString::new(x).unwrap()) + .collect(); + let c_strs: Vec<*const i8> = c_args.iter().map(|x| x.as_ptr()).collect(); + let len = c_strs.len() as u32; + unsafe { ffi::WasmEdge_ModuleInstanceInitWASINN(c_strs.as_ptr(), len) } + } + /// Returns the count of loaded plugins. pub fn count() -> u32 { unsafe { ffi::WasmEdge_PluginListPluginsLength() } From 126297b24659ce24812569bc7f4413d40fdf90fb Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Tue, 19 Sep 2023 12:50:29 +0000 Subject: [PATCH 2/7] feat(rust-sdk): new API `PluginManager::nn_preload` Signed-off-by: Xin Liu --- src/plugin.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugin.rs b/src/plugin.rs index 6250abfab..ee28b9d18 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -46,6 +46,12 @@ impl PluginManager { } } + #[cfg(feature = "wasi_nn")] + #[cfg_attr(docsrs, doc(cfg(feature = "wasi_nn")))] + pub fn nn_preload(preloads: Vec<&str>) { + sys::plugin::PluginManager::nn_preload(preloads); + } + /// Returns the count of loaded plugins. pub fn count() -> u32 { sys::plugin::PluginManager::count() From 54990d67e36e8b17cb68d3b44190063fc8e67ae6 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 20 Sep 2023 21:08:25 +0800 Subject: [PATCH 3/7] version(rust-sys): bump to `0.17.2` Signed-off-by: Xin Liu --- crates/wasmedge-sys/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-sys/Cargo.toml b/crates/wasmedge-sys/Cargo.toml index 9db816429..ced9b9451 100644 --- a/crates/wasmedge-sys/Cargo.toml +++ b/crates/wasmedge-sys/Cargo.toml @@ -10,7 +10,7 @@ links = "wasmedge" name = "wasmedge-sys" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.17.1" +version = "0.17.2" [dependencies] fiber-for-wasmedge = { version = "8.0.1", optional = true } From 0b86bc9344d9a22db004c80d709142a431907cfe Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Wed, 20 Sep 2023 21:08:42 +0800 Subject: [PATCH 4/7] version(rust-sdk): bump to `0.12.2` Signed-off-by: Xin Liu --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index a7be9848f..35900cdd4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" name = "wasmedge-sdk" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.12.1" +version = "0.12.2" [dependencies] anyhow = "1.0" From 2030bbb5ea8130e02c0da2024c516adc3bb028ff Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 21 Sep 2023 06:54:28 +0000 Subject: [PATCH 5/7] ci: update rust to `1.72` Signed-off-by: Xin Liu --- .github/workflows/ci-build.yml | 8 ++++---- .github/workflows/standalone.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 3c8461cea..ad083ac67 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -21,7 +21,7 @@ jobs: strategy: matrix: os: [ubuntu-22.04, ubuntu-20.04] - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] container: image: wasmedge/wasmedge:ubuntu-build-clang @@ -90,7 +90,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] container: image: fedora:latest @@ -167,7 +167,7 @@ jobs: strategy: matrix: os: [macos-11, macos-12] - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] steps: - name: Checkout sources @@ -222,7 +222,7 @@ jobs: runs-on: windows-2022 strategy: matrix: - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] env: WASMEDGE_DIR: ${{ github.workspace }}\WasmEdge WASMEDGE_BUILD_DIR: ${{ github.workspace }}\WasmEdge\build diff --git a/.github/workflows/standalone.yml b/.github/workflows/standalone.yml index 5d2818f72..8d172e6a3 100644 --- a/.github/workflows/standalone.yml +++ b/.github/workflows/standalone.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] steps: - name: Checkout WasmEdge Rust SDK @@ -55,7 +55,7 @@ jobs: runs-on: ubuntu-20.04 strategy: matrix: - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] steps: - name: Checkout WasmEdge Rust SDK @@ -90,7 +90,7 @@ jobs: strategy: matrix: os: [macos-11, macos-12] - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] steps: - name: Checkout sources @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rust: [1.71, 1.70.0, 1.69] + rust: [1.72, 1.71, 1.70.0] container: image: fedora:latest From 83906b12cbb3340c3c828f7da670dcdb8f963c7a Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 21 Sep 2023 07:05:03 +0000 Subject: [PATCH 6/7] chore(rust-sys): update `PluginManager::nn_preload` Signed-off-by: Xin Liu --- crates/wasmedge-sys/src/plugin.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wasmedge-sys/src/plugin.rs b/crates/wasmedge-sys/src/plugin.rs index f279d1e82..cf139842d 100644 --- a/crates/wasmedge-sys/src/plugin.rs +++ b/crates/wasmedge-sys/src/plugin.rs @@ -57,7 +57,7 @@ impl PluginManager { .collect(); let c_strs: Vec<*const i8> = c_args.iter().map(|x| x.as_ptr()).collect(); let len = c_strs.len() as u32; - unsafe { ffi::WasmEdge_ModuleInstanceInitWASINN(c_strs.as_ptr(), len) } + unsafe { ffi::WasmEdge_PluginInitWASINN(c_strs.as_ptr(), len) } } /// Returns the count of loaded plugins. From 723ec2e51eed2da0e6d6973c029fc071bcb33f61 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Thu, 21 Sep 2023 07:07:38 +0000 Subject: [PATCH 7/7] version(rust-sdk): bump to `0.12.2-dev` Signed-off-by: Xin Liu --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 35900cdd4..f729e8d32 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" name = "wasmedge-sdk" readme = "README.md" repository = "https://github.com/WasmEdge/wasmedge-rust-sdk" -version = "0.12.2" +version = "0.12.2-dev" [dependencies] anyhow = "1.0"