Skip to content

Commit a1a8601

Browse files
docs(wasi-nn): add BitNet backend (#279)
Signed-off-by: Khush Agrawal <khushmagrawal15@gmail.com>
1 parent 68bd9ba commit a1a8601

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

docs/contribute/source/plugin/wasi_nn.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Currently, WasmEdge supports following backends for WASI-NN proposal:
2020
| [Whisper](#build-wasmedge-with-wasi-nn-whisper-backend) | [whisper.cpp](https://github.com/ggerganov/whisper.cpp) | `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=Whisper` |
2121
| [ChatTTS](#build-wasmedge-with-wasi-nn-chattts-backend) | [ChatTTS](https://github.com/2noise/ChatTTS) | `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=ChatTTS` |
2222
| [MLX](#build-wasmedge-with-wasi-nn-mlx-backend) | [MLX](https://github.com/ml-explore/mlx) | `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=MLX` |
23+
| [BitNet](#build-wasmedge-with-wasi-nn-bitnet-backend) | [BitNet.cpp](https://github.com/microsoft/BitNet) | `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND=BitNet` |
2324

2425
Developers can [build the WasmEdge from source](../os/linux.md) with the cmake option `WASMEDGE_PLUGIN_WASI_NN_BACKEND` to enable the backends. For supporting multiple backends, developers can assign the option such as `-DWASMEDGE_PLUGIN_WASI_NN_BACKEND="GGML;Whisper;TensorFlowLite"`.
2526

@@ -409,3 +410,32 @@ cd <path/to/your/wasmedge/source/folder>
409410
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release -DWASMEDGE_PLUGIN_WASI_NN_BACKEND="mlx"
410411
cmake --build build
411412
```
413+
414+
## Build WasmEdge with WASI-NN BitNet Backend
415+
416+
To build this backend, exactly one of the following target-level (TL) optimization flags must be enabled. Enabling both flags simultaneously is not supported and will result in a build failure. If these specific optimizations are not required, we recommend using the `GGML` backend with `llama.cpp` for broader compatibility.
417+
418+
419+
### Build for ARM with TL1 Optimization
420+
421+
For ARM-based systems, use the `WASMEDGE_PLUGIN_WASI_NN_BITNET_ARM_TL1` flag.
422+
423+
```bash
424+
cd <path/to/your/wasmedge/source/folder>
425+
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release \
426+
-DWASMEDGE_PLUGIN_WASI_NN_BACKEND="BitNet" \
427+
-DWASMEDGE_PLUGIN_WASI_NN_BITNET_ARM_TL1=ON
428+
cmake --build build
429+
```
430+
431+
### Build for x86 with TL2 Optimization
432+
433+
For x86-based systems, use the `WASMEDGE_PLUGIN_WASI_NN_BITNET_X86_TL2` flag.
434+
435+
```bash
436+
cd <path/to/your/wasmedge/source/folder>
437+
cmake -GNinja -Bbuild -DCMAKE_BUILD_TYPE=Release \
438+
-DWASMEDGE_PLUGIN_WASI_NN_BACKEND="BitNet" \
439+
-DWASMEDGE_PLUGIN_WASI_NN_BITNET_X86_TL2=ON
440+
cmake --build build
441+
```

0 commit comments

Comments
 (0)