🛠 Exploiter le NPU 5 TOPS de l'A311D pour l'inférence embarquée

Banana Pi BPI-CM4 (Amlogic A311D, Raspberry Pi CM4 form factor) · avance · Schéma : IMG-bananapi-cm4-avance-1-npu-5tops-banapi-cm4.svg — BPI-CM4 sur son carrier avec une caméra USB et un écran HDMI affichant une détection d'objets ; la puce A311D est surlignée avec l'étiquette « NPU 5 TOPS ».

Objectives

The Amlogic A311D features a NPU advertised at 5 TOPS — the BPI-CM4's selling point against a Broadcom CM4: the vendor emphasizes the absence of an external accelerator like the Google Coral. However, the NPU stack resides in Amlogic/BSP binaries, not in the mainline kernel: the recommended path according to the wiki is to boot a Khadas VIM3 rootfs image (same A311D SoC), which provides the complete NPU demo chain. You will verify NPU visibility depending on the image, boot the VIM3 rootfs from microSD, run a classification inference, and then compare CPU (6 cores) versus NPU performance.

Hardware

Full Code

# 1) Sur l'image vendor (BSP 4.9) : vérifier la présence de la pile Amlogic
dmesg | grep -i -e npu -e mali
ls /dev/ | grep -i -e npu -e vpu

# 2) Amorcer le rootfs VIM3 sur la microSD (même famille meson-g12b)
sudo dd if=vim3-ubuntu-rootfs.img of=/dev/sdX bs=8M status=progress conv=fsync

# 3) Sur le système VIM3 booté : récupérer la suite de démo NPU Khadas
sudo apt update && sudo apt install -y git build-essential
git clone https://github.com/khadas/khadas-fptl && cd khadas-fptl
./install_dependencies.sh && make
# Exécuter une classification MobileNet sur une image
./demo/demo_classification_mobilenet ./model/mobilenet_v1/fp_np/ ./res/cat.jpg

Expected Verification

The demo prints ImageNet classes with scores and inference time per image; repeating the same workload using TFLite on the 6 CPU cores highlights the difference in latency and power consumption. On a mainline kernel (Armbian), no usable NPU interface is expected: this is a documented limitation, not a failure.

Common Errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials