diff --git a/.github/actions/install-openvino/.gitignore b/.github/actions/install-openvino/.gitignore deleted file mode 100644 index ae775fc25a..0000000000 --- a/.github/actions/install-openvino/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -CHECKSUM -GPG-PUB-KEY* diff --git a/.github/actions/install-openvino/README.md b/.github/actions/install-openvino/README.md deleted file mode 100644 index a494f57fdf..0000000000 --- a/.github/actions/install-openvino/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# install-openvino - -A GitHub action to install OpenVINO from a package repository. This is only necessary for `wasi-nn` support but there -are enough steps here to package the functionality separately and avoid cluttering the CI. - -Future improvements: - - make this installer work for different OS/distributions (e.g. https://docs.openvinotoolkit.org/latest/openvino_docs_install_guides_installing_openvino_windows.html) - - it would be nice to output the install directory (i.e. `/opt/intel/openvino`) diff --git a/.github/actions/install-openvino/action.yml b/.github/actions/install-openvino/action.yml deleted file mode 100644 index f80b841494..0000000000 --- a/.github/actions/install-openvino/action.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: 'Install OpenVINO' -description: 'Install OpenVINO binaries from a package repository; this is significantly faster than building from source' - -inputs: - version: - description: 'The release version of OpenVINO to install' - required: false - -runs: - using: composite - steps: - - run: ${{ github.action_path }}/install.sh ${{ inputs.version }} - shell: bash diff --git a/.github/actions/install-openvino/install.sh b/.github/actions/install-openvino/install.sh deleted file mode 100755 index 54cb1269ec..0000000000 --- a/.github/actions/install-openvino/install.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -set -e - -# Determine the OpenVINO version to install from the first parameter. Also, split out the parts of -# this version; `${version_parts[0]}` should contain the year. E.g.: -# version=2021.4.752 -# version_year=2021 -if [ "$#" -ne 1 ]; then - version="2021.4.752" -else - version="$1" -fi -IFS='.' read -ra version_parts <<< "$version" -version_year="${version_parts[0]}" - -# Determine the OS name and version (Linux-specific for now). E.g.: -# os_name=ubuntu -# os_version=20.04 -# os_version_year=20 -eval $(source /etc/os-release; echo os_name="$ID"; echo os_version="$VERSION_ID";) -IFS='.' read -ra os_version_parts <<< "$os_version" -os_version_year="${os_version_parts[0]}" - -# Determine the directory of this script. E.g.: -# script_dir=/some/directory -scriptdir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -# Retrieve the OpenVINO checksum. -curl -sSL https://apt.repos.intel.com/openvino/$version_year/GPG-PUB-KEY-INTEL-OPENVINO-$version_year > $scriptdir/GPG-PUB-KEY-INTEL-OPENVINO-$version_year -echo "5f5cff8a2d26ba7de91942bd0540fa4d $scriptdir/GPG-PUB-KEY-INTEL-OPENVINO-$version_year" > $scriptdir/CHECKSUM -md5sum --check $scriptdir/CHECKSUM - -# Add the OpenVINO repository (DEB-specific for now). -sudo apt-key add $scriptdir/GPG-PUB-KEY-INTEL-OPENVINO-$version_year -echo "deb https://apt.repos.intel.com/openvino/$version_year all main" | sudo tee /etc/apt/sources.list.d/intel-openvino-$version_year.list -sudo apt update - -# Install the OpenVINO package. -sudo apt install -y intel-openvino-runtime-$os_name$os_version_year-$version diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 63084b04f1..39d7e4514d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -310,7 +310,7 @@ jobs: submodules: true - uses: ./.github/actions/install-rust - run: rustup target add wasm32-wasi - - uses: ./.github/actions/install-openvino + - uses: abrown/install-openvino-action@v3 - run: ./ci/run-wasi-nn-example.sh env: RUST_BACKTRACE: 1 diff --git a/Cargo.lock b/Cargo.lock index 2a4fb4ba39..4d9ab56f34 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -441,15 +441,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "cmake" -version = "0.1.48" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ad8cef104ac57b68b89df3208164d228503abbdce70f6880ffa3d970e7443a" -dependencies = [ - "cc", -] - [[package]] name = "component-macro-test" version = "0.1.0" @@ -1899,9 +1890,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openvino" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61670c4f1f1fbd3889b97d3772462f6f81d959859a9031c5603850b5dfe93a61" +checksum = "d9627908ea4af5766040aa191c8607479af7f70b45fdf6e999b450069fea851a" dependencies = [ "openvino-sys", "thiserror", @@ -1909,9 +1900,9 @@ dependencies = [ [[package]] name = "openvino-finder" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a50d2e3f93a32f4b384583c1623f15eec4268a299ff86228b04c475744b5c6" +checksum = "213893e484dcf3db4af79d498a955f7c4c209d06e7020779cda68fca779c2578" dependencies = [ "cfg-if", "log", @@ -1919,14 +1910,14 @@ dependencies = [ [[package]] name = "openvino-sys" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a35a2728ef9dd1663ed6640fbe329d7c5f334f5867796d4f6840a921b1f40604" +checksum = "e2ba37c26ad2591acc48abee5350d65daa263bf0ab7a79d2ab6999d4b20130ec" dependencies = [ - "cmake", - "lazy_static", "libloading", + "once_cell", "openvino-finder", + "pretty_env_logger", ] [[package]] diff --git a/ci/run-wasi-nn-example.sh b/ci/run-wasi-nn-example.sh index 6639ea949c..6a44c6273a 100755 --- a/ci/run-wasi-nn-example.sh +++ b/ci/run-wasi-nn-example.sh @@ -20,10 +20,10 @@ fi # Inform the environment of OpenVINO library locations. Then we use OPENVINO_INSTALL_DIR below to avoid building all of # OpenVINO from source (quite slow). -source /opt/intel/openvino_2021/bin/setupvars.sh +source /opt/intel/openvino_2022/setupvars.sh # Build Wasmtime with wasi-nn enabled; we attempt this first to avoid extra work if the build fails. -OPENVINO_INSTALL_DIR=/opt/intel/openvino cargo build -p wasmtime-cli --features wasi-nn +OPENVINO_INSTALL_DIR=/opt/intel/openvino_2022 cargo build -p wasmtime-cli --features wasi-nn # Download all necessary test fixtures to the temporary directory. wget --no-clobber $FIXTURE/mobilenet.bin --output-document=$TMP_DIR/model.bin diff --git a/crates/wasi-nn/Cargo.toml b/crates/wasi-nn/Cargo.toml index f922d49bbb..69714bdf09 100644 --- a/crates/wasi-nn/Cargo.toml +++ b/crates/wasi-nn/Cargo.toml @@ -17,7 +17,7 @@ anyhow = "1.0" wiggle = { path = "../wiggle", version = "=0.40.0" } # These dependencies are necessary for the wasi-nn implementation: -openvino = { version = "0.3.3", features = ["runtime-linking"] } +openvino = { version = "0.4.1", features = ["runtime-linking"] } thiserror = "1.0" [build-dependencies] diff --git a/crates/wasi-nn/src/openvino.rs b/crates/wasi-nn/src/openvino.rs index 4d2a017796..89f043455c 100644 --- a/crates/wasi-nn/src/openvino.rs +++ b/crates/wasi-nn/src/openvino.rs @@ -87,10 +87,10 @@ impl BackendExecutionContext for OpenvinoExecutionContext { // should not have to default to NHWC. let desc = TensorDesc::new(Layout::NHWC, &dimensions, precision); let data = tensor.data.as_slice()?; - let blob = openvino::Blob::new(desc, &data)?; + let blob = openvino::Blob::new(&desc, &data)?; // Actually assign the blob to the request. - self.1.set_blob(&input_name, blob)?; + self.1.set_blob(&input_name, &blob)?; Ok(()) }