The NPU in this case really seems to just be another cluster of CPU cores (which are heavily optimized for INT Vector instructions). This seems much easier to program compared to the typical NPU which is nice.
# run_on_ai_cores to run a commandline on the K3 AI cores
## Start
Bruce Hoult has a created program and a wrapper script to run commands on the AI cores:
```
superkoning@spacemit:~ ls -al /usr/local/bin/ai*
-rwxr-xr-x 1 root root 73 Jan 29 03:58 /usr/local/bin/ai
-rwxr-xr-x 1 root root 6520 Jan 29 03:09 /usr/local/bin/aix
```
That works on the K3 provided by SpacemiT. The shell script `ai` is the wrapper for `aix`. I think `aix` is written in assembly, but I've no source code and I don't understand RISC-V assembly
## C program run_on_ai_cores
So I used a certain tool to create a C program that does the same: run a commandline on the AI cores (Core 8 -15). See source code [run_on_ai_cores/run_on_ai_cores.c](https://github.com/sanderjo/SpacemiT-K3-X100-A100/blob/main/run_on_ai_cores/run_on_ai_cores.c)
```
superkoning@spacemit:~/run_on_ai_cores$ ll
total 32
drwxrwxr-x 3 superkoning superkoning 4096 Jan 31 11:30 ./
drwxr-x--- 30 superkoning superkoning 4096 Jan 31 11:29 ../
This file has been truncated. show original