You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -312,6 +313,87 @@ This can result in significant speedup in encoder performance. Here are the inst
312
313
313
314
For more information about the OpenVINO implementation please refer to PR [#1037](https://github.com/ggml-org/whisper.cpp/pull/1037).
314
315
316
+
## AMD Ryzen™ AI NPU support
317
+
318
+
On AMD Ryzen™ AI 300 and 400 Series processors with a dedicated NPU, whisper.cpp can fully offload the Whisper encoder to the NPU via VitisAI, delivering significant speedup over CPU-only inference.
319
+
320
+
### Prerequisites
321
+
322
+
Supported Platforms
323
+
324
+
-**Windows 11**
325
+
-**Linux** (Ubuntu 24.04 LTS, Python 3.12)
326
+
327
+
Install the XRT runtime and FlexML runtime for your platform:
328
+
329
+
-**XRT**: provides the NPU kernel driver and `xrt-smi` diagnostic tool — on Windows this is bundled with the NPU driver; on Linux install it separately following the [NPU driver installation guide](https://ryzenai.docs.amd.com/en/latest/linux.html#install-npu-drivers)
330
+
-**FlexML runtime** (`flexmlrt`): VitisAI inference engine used by whisper.cpp — download from the [FlexML runtime releases](https://github.com/lemonade-sdk/whisper.cpp-rocm/releases/tag/deps)
331
+
332
+
After installing, source the setup scripts in every shell you use to build or run whisper.cpp:
333
+
334
+
```bash
335
+
# Linux
336
+
source /opt/xilinx/xrt/setup.sh
337
+
source /path/to/flexmlrt/setup.sh
338
+
```
339
+
340
+
```cmd
341
+
:: Windows
342
+
cd /path/to/flexmlrt && call setup.bat
343
+
```
344
+
345
+
You can verify the NPU is visible with:
346
+
347
+
```bash
348
+
xrt-smi examine
349
+
```
350
+
351
+
### Download models
352
+
353
+
Download the ggml model and the matching prebuilt VitisAI encoder cache:
354
+
355
+
```bash
356
+
# Linux / macOS
357
+
sh ./models/download-ggml-model.sh base
358
+
sh ./models/download-vitisai-model.sh base
359
+
```
360
+
361
+
```cmd
362
+
:: Windows
363
+
.\models\download-ggml-model.cmd base
364
+
.\models\download-vitisai-model.cmd base
365
+
```
366
+
367
+
Use the same model name with both scripts. To see all available VitisAI encoder caches:
368
+
369
+
```bash
370
+
sh ./models/download-vitisai-model.sh --list
371
+
```
372
+
373
+
```cmd
374
+
.\models\download-vitisai-model.cmd --list
375
+
```
376
+
377
+
The VitisAI script queries the [AMD Ryzen AI Whisper NPU collection on Hugging Face](https://huggingface.co/collections/amd/ryzen-ai-whisper-npu-optimized-onnx-models) and downloads the `.rai` encoder cache as `models/ggml-<model>-encoder-vitisai.rai`.
378
+
379
+
> Depending on the `.rai` cache, VitisAI may offload the encoder only, or the encoder plus cross-projection layers. whisper.cpp detects this at runtime and logs the selected offload mode during model initialization.
0 commit comments