NPU configuration need to make it work in a VM

Hi all
I’m experimenting to get my NPU working inside a VM (using incusos on framework Desktop).
My config is looking like:
- driver: ‘’
driver_version: ‘’
numa_node: 0
pci_address: 0000:c2:00.1
vendor: Advanced Micro Devices, Inc. [AMD]
vendor_id: ‘1022’
product: Strix/Krackan/Strix Halo Neural Processing Unit
product_id: 17f0
iommu_group: 22
vpd: {}

So the incusos host seems to be missing drivers. Is there a way to this working?

Are the drivers fully open source and redistributable? If so, maybe an application similar to gpu-support (npu-support?) could be a way to add the drivers to IncusOS.

That is a bit of an issue:

https://account.amd.com/en/forms/downloads/xef.html?filename=RAI_1.7.1_Linux_NPU_XRT.zip

requires a login at AMD due to export restrictions (U.S. Government Export Approval)

Unfortunately this means it likely won’t be possible for IncusOS to support your NPU. :slightly_frowning_face: The immutable nature of IncusOS prevents you from copying the drivers to the host system manually, and we handle GPU drivers via a special “application”, but all the drivers it includes are freely redistributable.

Depending on the IOMMU layout, you may be able to pass the NPU to a VM though given it’s likely a part of the CPU/SoC, I’d be kinda surprised if it was nicely isolated in its own IOMMU group…

Anyway, worth checking what else you have in group 22 if it’s the only device, then passing it to a VM which then loads the AMD driver should be fine.

res.txt (77.5 KB)
Looks like it is isolated in group 22

Okay, so on a VM you could try incus config device add MY-VM npu pci address=0000:c2:00.1 and see if that lets you pass it to the VM.

Looks promising. I do need more time to check (which I do not have on the short term :frowning: )

Hi all
It seems that it is not possible to run the npu driver in a VM:

kernel: amdxdna 0000:06:00.0: [drm] *ERROR* aie2_init: Running under hypervisor not supported
kernel: amdxdna 0000:06:00.0: [drm] *ERROR* amdxdna_probe: Hardware init failed, ret -22
kernel: amdxdna 0000:06:00.0: probe with driver amdxdna failed with error -22

A workaround/solution could be to use a system container.
This requires the npu drivers to be loaded in incusOS.

As stated above

https://account.amd.com/en/forms/downloads/xef.html?filename=RAI_1.7.1_Linux_NPU_XRT.zip

cannot be used as its not public.
However the NPU driver (only) can also be downloaded using the following public url:

https://download.amd.com/opendownload/RyzenAI/Driver/RAI_1.8_Linux_NPU_XRT.zip

I guess this requires some new application like ‘ryzen_npu’ containing this driver.

Is there a way, what can be done, to make this work?