Anyone utilized the NPU?

I’m trying to work with the NPU on linux but running ‘xrt-smi examine’ shows zero devices found. Is there a bios setting I’m not seeing that needs to be changed to enable the NPU?

I see the NPU in lspci, the firmware in /dev/firmware/amdnpu along with /dev/accel.

Have you had a look a this - GitHub - In2infinity/tuxedo-amd-npu-driver: World's first AMD NPU driver for TUXEDO laptops - Enable AI acceleration on Linux ?

(mentioned in another thread here - Status of AMD NPU Support )

1 Like

Yeah, I was trying to use their .deb release package when I was getting the errors.
I’ve gotten it to work now at least with Ubuntu 25.10 by compiling it from source and switching to root before running xrt-smi. Just using sudo clobbers environment variables and Ubuntu doesn’t seem to allow ‘sudo -E’.

2 Likes

I’d like to express my thanks to you for the add’l info. It’s all too common for someone to write “got it working” and end it at that lol. But no insight as to how. You did. So someone else – like me – has some idea of how to as well. thnx!

2 Likes

I did find out that there are LOTS of information on this. There is an IN KERNEL driver that I managed to get up in fedora, but its QUITE difficult to get doing in linux. There also seems to be a lot of ‘dueling banjos’ in the form of userspace firmware vs. in kernel firmware. I am looking at trying the dkms version, just to see if I can get things giong. I will post a partial guide here when I get on my framework desktop. This guide is NOT COMPLETELY WORKING would love some help on this!

NPU & DynaGuard on Strix Halo

I found a very nice model that allows me to load a ‘guard’ model using the NPU on my strix halo. This frees up the gpu from having to process the guard model, which loads on the NPU. This document is for fedora core 43 and uses toolbox for the npu part.

Getting the NPU working inside a toolbox container

I prefer to keep this isolated from the main system, since I have to add all kinds of strange repos that I don’t want polluting my main system. The Gemini and I came up with the following: Which lets you get a working environment to access the NPU. Ensure your user is in the ‘render’ group as this is what the npu uses.

 # toolbox create ryzen-ai -- --device /dev/accel/accel0:/dev/accel/accel0 --group-add keep-groups
 # toolbox enter ryzen-ai
 # Check on the status of the driver
 stat /dev/accel/accel0
 ####Outpu Follows
 File: /dev/accel/accel0
   Size: 0           Blocks: 0          IO Block: 4096   character special file
 Device: 0,6 Inode: 529         Links: 1     Device type: 261,0
 Access: (0666/crw-rw-rw-)  Uid: (65534/  nobody)   Gid: (65534/  nobody)
 Access: 2025-12-24 20:23:59.532992109 -0500
 Modify: 2025-12-24 20:23:59.532992109 -0500
 Change: 2025-12-24 20:23:59.532992109 -0500
  Birth: 2025-12-24 20:22:52.187999977 -0500
 ​

If you see something like the above with no errors, things are working. Basically this puts through the npu with other having read/write access to the device.

Getting the necessary tools to load the models using the XRT tools from AMD

These commands install and eventually correct the library problems that come up with fedora core 43 and the npu userspace tools.

 dnf install -y xrt xdna-driver tcsh
 sudo dnf copr enable xanderlent/amd-npu-driver -y
 sudo dnf install -y xrt xdna-driver tcsh
 # Create a symlink so that 'lib' points directly to 'lib64'
 # This is the cleanest way to fix all XRT library pathing issues at once
 sudo ln -s /usr/xrt/lib64 /usr/xrt/lib
 # Update the linker cache
 ldconfig
 ​

It is CRITICAL that you have IOMMU enabled. It caused me no end of pain. Won’t work in the container OR the main system. To adjust, edit grub.cfg thusly

 vim /etc/default/grub
 GRUB_CMDLINE_LINUX="rhgb quiet amd_iommu=on iommu=pt amdgpu.gttsize=131072 ttm.pages_limit=33554432"
 ####
 sudo grub2-mkconfig -o /boot/grub2/grub.cfg

Just make your cmdline match this the amd_iommu=on is CRITICAL

Also the command to check things may not work too well these fix it:

 sudo ln -sf /usr/xrt/lib/libxrt_driver_xdna.so /usr/xrt/lib/libxrt_plugin_xdna.so
 sudo ln -sf /usr/xrt/lib/libxrt_driver_xdna.so /usr/lib64/libxrt_plugin_xdna.so

To check if everything is happy do the commands below:

 /usr/xrt/bin/xrt-smi examine
 ##remaining is what success looks like!
 System Configuration
   OS Name              : Linux
   Release              : 6.17.12-300.fc43.x86_64
   Machine              : x86_64
   CPU Cores            : 32
   Memory               : 128078 MB
   Distribution         : Fedora Linux 43 (KDE Plasma Desktop Edition)
   GLIBC                : 2.42
   Model                : Desktop (AMD Ryzen AI Max 300 Series)
   BIOS Vendor          : INSYDE Corp.
   BIOS Version         : 03.03
 ​
 XRT
   Version              : 2.19.0
   Branch               : 
   Hash                 : 
   Hash Date            : 2025-04-25 00:00:00
   virtio-pci           : unknown, unknown
   amdxdna              : unknown, unknown
   NPU Firmware Version : 1.0.0.166
 ​
 Device(s) Present
 |BDF             |Name          |
 |----------------|--------------|
 |[0000:c4:00.1]  |RyzenAI-npu5  |

If it looks like above you are ready to proceed with remaining steps. At SOME point I might automate these or let the AI do it for me!

Not quite! More annoyances!

 # make the drivers load our firmware
 cd /usr/lib/firmware/amdnpu/17f0_10/
 sudo xz -d -k npu.sbin.xz
 ​

I got the drivers loaded, but the xrt checks failed because of a mismatch. I also need to convert the dynaguard model to a format that the npu can consume.

1 Like

I spent a lot of time on this. I finally got the hardware working, but it seems that you need to run lemonade server, which by default doesn’t do the npu on linux. It might work with windows, however. You can get ‘early access’ if you apply and beg to amd, but at this point I would wait 6 months for linux support. Drivers are working, however.

Thomas

1 Like
 sudo -E /usr/xrt/bin/xrt-smi examine
[sudo] password for tmunn: 
System Configuration
  OS Name              : Linux
  Release              : 6.17.12-300.fc43.x86_64
  Machine              : x86_64
  CPU Cores            : 32
  Memory               : 128078 MB
  Distribution         : Fedora Linux 43 (KDE Plasma Desktop Edition)
  GLIBC                : 2.42
  Model                : Desktop (AMD Ryzen AI Max 300 Series)
  BIOS Vendor          : INSYDE Corp.
  BIOS Version         : 03.03

XRT
  Version              : 2.19.0
  Branch               : 
  Hash                 : 
  Hash Date            : 2025-04-25 00:00:00
  virtio-pci           : unknown, unknown
  amdxdna              : unknown, unknown
  NPU Firmware Version : 1.0.0.166

Device(s) Present
|BDF             |Name          |
|----------------|--------------|
|[0000:c4:00.1]  |RyzenAI-npu5  |
1 Like

You mentioned CoreOS and toolbox, but were you actually able to get it (xrt-smi) to work inside a toolbx or on CoreOS?

Short answer is its mostly useless unless you can get the userspace stuff giong. Looks like amdumb is hiding the source code for the userspace behind an early access wall.

if you only want to know if driver is working no need to install xrt. amd have add info of the NPU in rocminfo :

# on fedora 43:
$ rocminfo
# [...]
*******                  
Agent 3                  
*******                  
  Name:                    aie2                               
  Uuid:                    AIE-XX                             
  Marketing Name:          AIE-ML                             
  Vendor Name:             AMD                                
  Feature:                 AGENT_DISPATCH                     
  Profile:                 BASE_PROFILE                       
  Float Round Mode:        NEAR                               
  Max Queue Number:        1(0x1)                             
  Queue Min Size:          64(0x40)                           
  Queue Max Size:          64(0x40)                           
  Queue Type:              SINGLE                             
  Node:                    0                                  
  Device Type:             DSP                                
  Cache Info:              
    L2:                      2048(0x800) KB                     
    L3:                      32768(0x8000) KB                   
  Chip ID:                 0(0x0)                             
  ASIC Revision:           0(0x0)                             
  Cacheline Size:          0(0x0)                             
  Max Clock Freq. (MHz):   0                                  
  BDFID:                   0                                  
  Internal Node ID:        0                                  
  Compute Unit:            0                                  
  SIMDs per CU:            0                                  
  Shader Engines:          0                                  
  Shader Arrs. per Eng.:   0                                  
  WatchPts on Addr. Ranges:0                                  
  Memory Properties:       
  Features:                AGENT_DISPATCH
  Pool Info:               
    Pool 1                   
      Segment:                 GLOBAL; FLAGS: KERNARG, COARSE GRAINED
      Size:                    129603748(0x7b998a4) KB            
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Recommended Granule:4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 2                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    65536(0x10000) KB                  
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Recommended Granule:0KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
    Pool 3                   
      Segment:                 GLOBAL; FLAGS: COARSE GRAINED      
      Size:                    129603748(0x7b998a4) KB            
      Allocatable:             TRUE                               
      Alloc Granule:           4KB                                
      Alloc Recommended Granule:4KB                                
      Alloc Alignment:         4KB                                
      Accessible by all:       TRUE                               
  ISA Info:                

(just install sudo dnf install rocminfo … no need for other change.)

now for the usersapce/runtime we may need xrt … or use hsa:
Did not try to test but there is some WIP here:

look some WIP:

1 Like