| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A general inference engine for the AMD XDNA2 (Strix) NPU, written in Rust with hand-written AIE kernels. It runs transformer and conv models - ASR, embeddings, small LLMs, and vision - on the NPU under Linux via the open MLIR-AIE / IRON kernel stack, with a host-CPU fallback for ops that are not yet on-device.
ASR was the first target, but the engine is not ASR-specific: the same primitives (resident dataflow, fused decode, KV cache, multi-precision GEMM/GEMV) serve every front through one Frontend / Encoder / Head pipeline.
This pipeline is data-movement-bound, not compute-bound. The NPU's cores sit mostly idle; the cost is bytes streamed from LPDDR and array shape-reloads. The engine is built around that fact: keep weights and activations on-chip, fuse op sequences into few dispatches, and quantize to cut the bytes moved. The payoff is latency, energy, and freeing the CPU - see docs/data-movement-thesis.md.
Weights convert and match a reference for MiniLM, E5, ModernBERT, ViT, DINOv2, ResNet-18, opt-125m and Gemma 3, but their forward pass still runs on the host. The rails those models need are the ones the LLM decode work is building now, so finishing them is wiring, not research.
Representative measured results (host: AMD Ryzen AI 9 465, XDNA2, Linux):
| Result | Number |
|---|---|
| GigaAM encoder, NPU vs CPU | 651 ms vs 890 ms |
| Parakeet resident engine | 4.0 s -> 0.70-0.92 s / clip, WER-lossless |
| BGE embeddings, NPU vs host | 2.5-4x |
| Qwen3-0.6B decode, on NPU | 74.6 -> 54.8 ms/token in one day (13.4 -> 18.3 tok/s) |
| Qwen3-0.6B dispatch count | 366 -> 170 configures/token, 14 -> 8 designs |
| aiecc kernel build | 536 s -> ~7 min cold, < 10 s warm |
install.sh builds the Rust workspace, installs the npu binary to ~/.local/bin, and writes a systemd --user unit. It starts nothing and touches no device (the NPU is single-tenant and may be in use).
Prerequisites, all checked by the preflight before anything is built:
ONNX_ASR_VENV=/path/to/venv ./install.sh # build + install the service npu serve # start the engine npu transcribe audio.wav # run ASR npu embed "some text" # run embeddings npu models # list loaded models
Weight checkpoints are baked from Hugging Face checkpoints with npu bake (see rust/npu-weights). Model export/convert scripts live in scripts/.
Building the AIE kernels themselves is a separate path with its own toolchain: the fork instance pinned by toolchain.lock, brought up by scripts/toolchain_up.sh and gated by scripts/toolchain_smoke.sh. The engine runs against prebuilt xclbins in artifacts/ and does not need it.
AMD Ryzen AI 9 465 (Krackan, XDNA2), Linux with the amdxdna driver and /dev/accel/accel0. The open IRON / MLIR-AIE path is distro-agnostic.
Apache-2.0. See LICENSE.
| Back | FazBrowse Home | New Git URL |