File size: 3,661 Bytes
200d040
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
license: agpl-3.0
tags:
- elyan-labs
- llm-inference
- npu
- linux
- edge-inference
---

> Source snapshot of [github.com/Scottcjn/npu-linux-kit](https://github.com/Scottcjn/npu-linux-kit), also on [GitLab](https://gitlab.com/elyan-labs/npu-linux-kit) with full history. Code only: nothing here runs on Hugging Face infrastructure.

<div align="center">

# 🧰 npu-linux-kit

**Practical applications for the AMD XDNA NPU on Linux** β€” the things the NPU is *actually* good at,
in one kit. Built on the [open-xdna](https://github.com/Scottcjn/open-xdna) gen-1 (XDNA1 / Phoenix)
bring-up.

[![License: AGPL v3](https://img.shields.io/badge/License-AGPLv3-blue.svg)](LICENSE)
[![Dual License: Commercial](https://img.shields.io/badge/License-Commercial-green.svg)](COMMERCIAL.md)

</div>

---

## Why

AMD's NPU is underused on Linux: the official LLM stack targets XDNA2, and the NPU's real strengths
(**low-power, conv/vision, batchable compute, offload**) aren't packaged into usable Linux apps. This
kit does that β€” each module plays to a **measured** NPU strength, and the status of each is stated
honestly (no "coming soon" dressed up as done).

## Modules

| Module | What it does | NPU fit | Status |
|--------|--------------|---------|--------|
| **[camera/](camera/)** | Real-time webcam effects β†’ a **v4l2 virtual camera** (Zoom/OBS/browser) | conv/vision β€” its native strength | βœ… **working** (edge-stylize) |
| camera/ β€” background blur | Sharp foreground + blurred background (real MODNet segmentation) | conv/CNN | βœ… **working** (clean CPU blur + real seg; NPU blur path experimental) |
| **[embeddings/](embeddings/)** | Batch sentence/RAG embeddings, offloaded from CPU/iGPU | batchable matmul β†’ amortizes dispatch | πŸ”¬ candidate |
| **[audio/](audio/)** | Wake-word / real-time denoise | the NPU's classic edge job | πŸ”¬ candidate (untested) |
| **[ggml-backend/](ggml-backend/)** | XDNA backend for ggml/llama.cpp | foundational enabler | 🚧 planned (biggest lift) |

## Featured: camera effects (working today)

Live webcam β†’ NPU effect β†’ virtual camera, **measured on a Ryzen 7 8845HS (XDNA1)**:

- Full per-frame conv/colorspace pipeline: **220 FPS @1080p / 451 FPS @720p** (incl. host DMA round-trip).
- In the live daemon the NPU effect adds **~2 ms/frame at ~6.6 W** β€” end-to-end is **camera-capture-bound**, never NPU-bound. So there's large headroom for heavier effects (segmentation).
- Outputs to a **v4l2loopback** device β€” any app sees `NPU Camera`.

```bash
# (after the open-xdna NPU stack is up + this kit's requirements installed)
sudo modprobe v4l2loopback video_nr=10 card_label="NPU Camera" exclusive_caps=1
python3 camera/npu_camera_fps.py                                  # FPS feasibility gate
python3 camera/npu_camera_daemon.py --loopback /dev/video10 --stream-frames 0   # live β†’ virtual cam
# then pick "NPU Camera" in Zoom/OBS/your browser
```

## Requirements

A working **XDNA NPU stack** (XRT + amd/xdna-driver + IRON/mlir-aie + Peano) β€” see
[open-xdna](https://github.com/Scottcjn/open-xdna) for the bring-up. Plus host deps:
`pip install -r requirements.txt` (opencv-python-headless, pyvirtualcam, numpy, ml_dtypes) and
`v4l2loopback` for the virtual camera.

## Honesty / scope

Verified on **XDNA1 (Phoenix)**, Ubuntu 25.10 / kernel 6.17. The **camera module is real and
measured**; the other modules are marked candidate/planned and make **no working claims** until built.
Research/community project, not a production stack.

## License

AGPLv3 + commercial dual-license β€” see [LICENSE](LICENSE) and [COMMERCIAL.md](COMMERCIAL.md).
Β© 2026 Scott Boudreaux / Elyan Labs.