You are not logged in.

#1 2025-04-16 06:47:19

tategotoazarasi
Member
Registered: 2022-07-04
Posts: 5

[Package Request] AMD NPU / Ryzen AI Userspace Stack

I would like to request the packaging of several userspace components required to enable support for the Neural Processing Unit (NPU), also known as XDNA, present in recent AMD Ryzen AI processors (like Phoenix, Hawk Point, and the upcoming Strix Point series).

The necessary kernel driver (amdxdna) has been mainlined and is available starting with Linux kernel 6.14, making Arch well-positioned to support this hardware. However, the userspace runtime, compiler toolchain, and ML framework integration are currently missing from the official repositories and the existing AUR packages are either outdated, -git versions, or potentially incomplete/broken.

Having these packages available would allow Arch users with AMD Ryzen AI laptops/devices to leverage the NPU for hardware-accelerated machine learning tasks using frameworks like IREE.

The required components form a stack:

1.  Xilinx Runtime (XRT): The core runtime library for interacting with the NPU hardware.
2.  XRT AMD XDNA Shim: A plugin for XRT, built from the `amd/xdna-driver` repository, that provides the NPU-specific backend implementation.
3.  LLVM-AIE (Peano): A fork of LLVM required by IREE to compile code specifically for the AIEngine architecture used in the NPU.
4.  IREE AMD-AIE Plugin: A plugin for the IREE compiler/runtime that allows ML models to be compiled and executed on the AMD NPU via XRT.

Package Details:

1. Xilinx Runtime (XRT)

2. XRT AMD XDNA Shim

  • Package Name Suggestion:

    xrt-plugin-amdxdna

    (or similar, designed to install alongside `xrt`)

  • Upstream URL: https://github.com/amd/xdna-driver (Note: Built from this repo, not the main XRT repo)

  • Description: XRT SHIM library plugin providing the backend implementation for AMD XDNA NPUs.

  • License: AMD Proprietary

3. LLVM-AIE (Peano)

  • Package Name Suggestion:

    llvm-aie

    or

    peano-llvm
  • Upstream URL: https://github.com/Xilinx/llvm-aie

  • Description: AMD/Xilinx AI Engine LLVM fork. Required compiler backend for generating NPU executable code used by frameworks like IREE.

  • License: Apache-2.0 with LLVM exceptions

4. IREE AMD-AIE Plugin

  • Package Name Suggestion:

    iree-amd-aie

    (or perhaps integrated into a main `iree` package via build options)

  • Upstream URL: https://github.com/nod-ai/iree-amd-aie

  • Description: IREE (Intermediate Representation Execution Environment) compiler and runtime plugin for targeting AMD AIE/NPU devices.

  • License: Apache-2.0

With the kernel driver mainlined, providing these userspace packages in Arch Linux repositories (or well-maintained in the AUR) would enable users with the latest AMD hardware to utilize the NPU for AI acceleration out-of-the-box, which is a significant feature of these new platforms. It would lower the barrier to entry compared to manually building the entire stack.

There are some related AUR packages like

xrt-npu-git

,

xrt-xocl-dkms-npu-git

and

amdxdna-driver-bin

. However, these appear to be outdated or broken. Having official or actively maintained AUR packages for the stable releases would be preferable.

References

Last edited by tategotoazarasi (2025-04-17 04:50:26)

Offline

#2 2025-04-16 14:33:38

twelveeighty
Member
Registered: 2011-09-04
Posts: 1,381

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

[...] and the existing AUR packages are either outdated, -git versions, or potentially incomplete/broken.

That's not how the AUR works. If the package is broken on the AUR, it needs to be either fixed by you contacting its maintainer and help them with patches, or you make the request to have the package disowned and transferred to you as a maintainer.

Offline

#3 2025-06-02 16:09:47

tpkessler
Package Maintainer (PM)
From: Germany
Registered: 2022-11-20
Posts: 4

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

Thank you very much for your suggestions. I've started with XRT but ran into a couple of issues, see the issue on GitHub.

Offline

#4 2025-06-02 18:50:34

topcat01
Member
Registered: 2019-09-17
Posts: 238

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

Having gone through a boost upgrade for work, I think we should insist on upstream supporting it. Unfortunately Ubuntu seems to only include 1.83.

Offline

#5 2025-06-06 15:34:17

tpkessler
Package Maintainer (PM)
From: Germany
Registered: 2022-11-20
Posts: 4

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

XRT and xrt-plugin-amdxdna have landed in [extra-testing]! I get missing symbol errors, so they need more testing.

Offline

#6 2025-10-07 14:30:14

hnws
Member
Registered: 2010-05-08
Posts: 12

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

Thanks a lot for the package. And it got updated in the repo some time ago! That's really nice.
I think the issue now is that /usr/src/xrt-2.20.0/dkms.conf cannot compile on the latest stable kernel...
And hopefully it would not have this constantly as other out of tree modules..

https://github.com/Xilinx/XRT/issues/9300

I opened a ticket with upstream.

Last edited by hnws (2025-10-07 14:37:39)

Offline

#7 2025-10-07 18:43:48

gromit
Administrator
From: Germany
Registered: 2024-02-10
Posts: 1,312
Website

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

The issue also is right now that it does not seem to recognize any devices on my system:

$ clinfo
XRT build version: 2.20.0
Build hash: 94841f40a048fbcdd0749644ec13b4f902492996
Build date: 2025-09-22 21:10:16
Git branch: makepkg
PID: 113931
UID: 1000
[Tue Oct  7 18:43:07 2025 GMT]
HOST: framework
EXE: /usr/bin/clinfo
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found
[XRT] ERROR: No devices found

So if you have any idea about this feel free to let me know!

Offline

#8 2025-10-08 15:16:44

hnws
Member
Registered: 2010-05-08
Posts: 12

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

I believe it needs to have the kernel modules from xrt dkms compiled and loaded.

/opt/xilinx/xrt/bin/xrt-smi examine

Offline

#9 2025-10-08 16:07:39

hnws
Member
Registered: 2010-05-08
Posts: 12

Re: [Package Request] AMD NPU / Ryzen AI Userspace Stack

git clone git@github.com:amd/xdna-driver.git
cd xdna-driver/
git submodule update --init --recursive

Then
modify

CMake/pkg.cmake

After line 147, add a section for arch:

elseif("${XDNA_CPACK_LINUX_PKG_FLAVOR}" MATCHES "arch")
  set(CPACK_GENERATOR "DEB")
  set(CPACK_DEB_COMPONENT_INSTALL ON)
  set(CPACK_DEBIAN_PACKAGE_DEPENDS "xrt-base (>= ${XDNA_CPACK_XRT_BASE_VERSION}), xrt-base (<< ${XDNA_CPACK_XRT_BASE_NEXT_VERSION})")
  if(NOT SKIP_KMOD)
    set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_BINARY_DIR}/package/postinst"
      "${CMAKE_CURRENT_BINARY_DIR}/package/prerm")
  endif()

Then proceed to build it

cd build
./build.sh -release

It should build successfully and produce

build/Release/xrt_plugin.2.20.0_-x86_64-amdxdna.deb

Use whatever way to convert this deb to arch package.
It has a dkms conf. Build the package and load it.

sudo modprobe amdxdna
sudo modprobe xocl
sudo modprobe xclmgmt

Finally I got the below:

sudo /opt/xilinx/xrt/bin/xrt-smi examine
System Configuration
  OS Name              : Linux
  Release              : 6.12.51-1-lts
  Machine              : x86_64
  CPU Cores            : 12
  Memory               : 47786 MB
  Distribution         : Arch Linux
  GLIBC                : 2.42
  Model                : To be filled by O.E.M.
  BIOS Vendor          : American Megatrends International, LLC.
  BIOS Version         : 21.08
  Processor            : AMD Ryzen 5 8600G w/ Radeon 760M Graphics

XRT
  Version              : 2.20.0
  Branch               : makepkg
  Hash                 : 94841f40a048fbcdd0749644ec13b4f902492996
  Hash Date            : 2025-09-22 21:10:16
  xocl                 : 2.20.0, 94841f40a048fbcdd0749644ec13b4f902492996
  xclmgmt              : 2.20.0, 94841f40a048fbcdd0749644ec13b4f902492996
  amdxdna              : 2.20.0_20251008, c5e45a76533de68ba436640dbb4544b2b0acd8b0
  virtio-pci           : unknown, unknown
  NPU Firmware Version : 1.5.5.391

Device(s) Present
|BDF             |Name         |
|----------------|-------------|
|[0000:10:00.1]  |NPU Phoenix  |

Offline

Board footer

Powered by FluxBB