WACS.WASI.NN.OpenVino 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package WACS.WASI.NN.OpenVino --version 0.1.2
                    
NuGet\Install-Package WACS.WASI.NN.OpenVino -Version 0.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WACS.WASI.NN.OpenVino" Version="0.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WACS.WASI.NN.OpenVino" Version="0.1.2" />
                    
Directory.Packages.props
<PackageReference Include="WACS.WASI.NN.OpenVino" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WACS.WASI.NN.OpenVino --version 0.1.2
                    
#r "nuget: WACS.WASI.NN.OpenVino, 0.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WACS.WASI.NN.OpenVino@0.1.2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WACS.WASI.NN.OpenVino&version=0.1.2
                    
Install as a Cake Addin
#tool nuget:?package=WACS.WASI.NN.OpenVino&version=0.1.2
                    
Install as a Cake Tool

WACS.WASI.NN.OpenVino

OpenVINO backend for WACS.WASI.NN. Implements IBackend for graph-encoding.openvino via OpenVINO.CSharp.API — Intel's C# wrapper around libopenvino.

OpenVINO is the one wasi-nn encoding the spec explicitly designed the multi-builder graph.load shape around: guests pass [IR-XML, IR-bin] to mirror OpenVINO's two-file distribution format (Model + Weights). This backend reads those two builders directly into Core.read_model(xmlBytes, weightsTensor) with no intermediate file I/O.

Install

# 1. Backend DLL (small, RID-agnostic).
dotnet add package WACS.WASI.NN.OpenVino

# 2. Native runtime for your platform (~150-200 MB unpacked).
#    Pick exactly one matching your RID:
dotnet add package OpenVINO.runtime.macos-arm64    # Apple Silicon — 2024.4.0.1 only (see version-skew note)
dotnet add package OpenVINO.runtime.macos-x86_64   # Intel Mac — 2024.4.0.1
dotnet add package OpenVINO.runtime.win            # Windows x64 — 2026.0.0
dotnet add package OpenVINO.runtime.ubuntu.22-x86_64  # — 2024.4.0.1
# (other Linux distros + arm64 variants are published as
#  OpenVINO.runtime.{centos7,rhel8,debian10}-x86_64 /
#  OpenVINO.runtime.ubuntu.{18,20}-arm64 etc. — see
#  https://www.nuget.org/packages?q=openvino.runtime)

The runtime pack is shipped as a sibling NuGet rather than bundled with the backend or CLI because each one is large enough that bundling all four would push the parent NuGet past the 250 MB upload limit. Native binaries land in runtimes/<rid>/native/ of your published output via NuGet's standard RID-aware restore — OpenVINO.CSharp.API P/Invokes against the standard library names (openvino.dylib / openvino.so / openvino.dll) and finds them at load time.

Version skew: bring-your-own native runtime for 2025.x / 2026.x IR

OpenVINO.runtime.macos-arm64, macos-x86_64, and the ubuntu.*-x86_64 packs are stuck at 2024.4.0.1 (Sep 2024). Only OpenVINO.runtime.win has moved forward (2026.0.0). The OpenVINO IR format is backward-compatible within a major version but not forward-compatible — IR exported by pip install openvino==2025.x (or 2026.x) trips Incorrect weights in bin file! at Core.read_model when handed to a 2024.4 runtime.

If your model-export side is on a newer OpenVINO than 2024.4, you have two options:

  1. Pin Python: pip install openvino==2024.4.0 and re-export the IR. Simplest; works as long as the older openvino wheel installs cleanly on your platform.

  2. Drop in Intel's official native runtime: download from storage.openvinotoolkit.org and stage the dylibs over the NuGet-installed runtimes/<rid>/native/ directory. The shipped C# wrapper P/Invokes by soname (libopenvino_c) so a newer Intel runtime is binary-compatible at the wrapper layer.

A turnkey script for option (2) lives at scripts/fetch-openvino-native.sh in this package's repo:

# Downloads OpenVINO 2025.4.1 macOS arm64, auto-detects the wacs install
# location, and stages the dylibs into runtimes/osx-arm64/native/.
./fetch-openvino-native.sh

# Specify version (default 2025.4.1) and destination explicitly:
./fetch-openvino-native.sh -v 2026.1.0 -d /path/to/runtimes/osx-arm64/native

The script currently supports osx-arm64 only — the macOS arm64 + 2025.x pip-export case is the gap that prompted writing it. Linux / Windows users typically have a workable NuGet runtime already; open an issue if you need the script extended.

CLI

The wacs CLI bundle ships Wacs.WASI.NN.OpenVino.dll but not the OpenVINO native runtime (size-bound — see the install note above). You need to drop the native libraries into the WACS install directory's runtimes/<rid>/native/ folder yourself before invoking, or load them via LD_LIBRARY_PATH / DYLD_LIBRARY_PATH / PATH.

The easiest way to get a matched set is to install OpenVINO.runtime.<rid> into a scratch project and copy the unpacked natives:

mkdir openvino-native && cd openvino-native
dotnet new console
dotnet add package OpenVINO.runtime.macos-arm64    # match your RID
dotnet build
cp -R bin/Debug/net*/runtimes "$(dirname $(which wacs))/"

Then invoke:

wacs run my.component.wasm --wasip2 --bind WACS.WASI.NN.OpenVino.dll

The CLI's IBindable-discovery pass auto-picks WasiNNOpenVinoBindable and the guest's graph.load calls with encoding=openvino route through this backend.

Embedder

Interpreter / one-line:

using Wacs.Core.Runtime;
using Wacs.WASI.NN;
using Wacs.WASI.NN.OpenVino;
using Wacs.WASI.NN.Types;

var runtime = new WasmRuntime();
runtime.UseWasiNN(b => b.AddBackend(GraphEncoding.OpenVINO, new OpenVinoBackend()));

Transpiler-direct-link / DI:

services
    .AddWasiPreview2()
    .AddWasiNN(b => b.AddBackend(GraphEncoding.OpenVINO, new OpenVinoBackend()))
    .AddWasiPreview2NNBundle();

What it provides

  • OpenVinoBackend : IBackend — implements LoadGraph(builders, target) for the two-builder OpenVINO IR shape (builders[0] = XML, builders[1] = weights bin). Single-builder calls are tolerated for IRs with constants inlined.
  • OpenVinoBackendOptions / OpenVinoDevice — typed config for device pinning (CPU / GPU / NPU / AUTO) plus an arbitrary OpenVINO-property bag forwarded into compile_model.
  • WasiNNOpenVinoBindable : IBindable — parameterless adapter for --bind.
  • [assembly: WasiHostPackage] — picked up by runtime.AutoDiscoverHostPackages().

Device selection

Default is AUTO — OpenVINO's AUTO plugin picks across whatever is installed. The wasi-nn guest's ExecutionTarget request (CPU / GPU / TPU) maps to OpenVINO device strings only when the typed options are at their default — a host that pinned a device through OpenVinoBackendOptions.Device keeps that pin regardless of the guest.

Guest target OpenVINO device string
ExecutionTarget.CPU CPU
ExecutionTarget.GPU GPU
ExecutionTarget.TPU NPU (Intel Neural Processing Unit)
(default / unset) AUTO

Enable via environment:

WACS_WASINN_OPENVINO_DEVICE=auto wacs run my.wasm --wasip2 --bind WACS.WASI.NN.OpenVino.dll
WACS_WASINN_OPENVINO_DEVICE=cpu  wacs run my.wasm ...
WACS_WASINN_OPENVINO_DEVICE=gpu  wacs run my.wasm ...
WACS_WASINN_OPENVINO_DEVICE=npu  wacs run my.wasm ...

# Forward arbitrary compile_model properties:
WACS_WASINN_OPENVINO_PROPERTIES=PERFORMANCE_HINT=LATENCY,INFERENCE_PRECISION_HINT=f16 \
    wacs run my.wasm ...

# Strict mode — propagate compile failures instead of falling back to CPU:
WACS_WASINN_OPENVINO_FALLBACK_CPU=false wacs run my.wasm ...

Or via typed config:

var backend = new OpenVinoBackend(new OpenVinoBackendOptions
{
    Device = OpenVinoDevice.Gpu,
    FallbackToCpu = true,
    Properties =
    {
        ["PERFORMANCE_HINT"] = "LATENCY",
        ["INFERENCE_PRECISION_HINT"] = "f16",
    },
});

Default FallbackToCpu = true means a compile_model failure on the chosen device (plugin missing, driver issue) silently retries on CPU — the CPU plugin ships in every OpenVINO runtime distribution. Set false to surface compile failures as ErrorCode.RuntimeError at graph.load time.

Tensor element types

OpenVINO covers every primitive type the wasi-nn WIT enum supports:

WIT tensor.tensor-type OpenVinoSharp.ElementType
fp16 F16
fp32 F32
fp64 F64
bf16 BF16
u8 U8
i32 I32
i64 I64

(OpenVINO's enum has many more — F8E4M3, NF4, I4, etc. — but they aren't exposed by the wasi-nn spec, so guest inputs/outputs using them throw InvalidArgument / UnsupportedOperation.)

Backend choice

Use case Package
OpenVINO IR (.xml + .bin) inference WACS.WASI.NN.OpenVino (this)
Standard ONNX inference (image classification, encoder-only LLMs) WACS.WASI.NN.OnnxRuntime
ONNX with ML.NET pipeline integration WACS.WASI.NN.MLNet
GGUF / llama.cpp generative LLMs WACS.WASI.NN.LlamaSharp

Documentation

License

Apache-2.0

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.2 72 5/28/2026
0.2.1 100 5/14/2026
0.2.0 86 5/14/2026
0.1.2 96 5/12/2026
0.1.1 96 5/12/2026
0.1.0 100 5/12/2026