A Step-by-Step Guide to Testing the AMD AIE4 NPU with the AMDXDNA Linux Driver
Learn how to enable the new AMD AIE4 NPU under Linux by patching, building, and testing the AMDXDNA driver in seven clear steps.
Introduction
AMD's next-generation NPU, codenamed AIE4, is gradually arriving on Linux through continuous hardware enablement patches for the AMDXDNA accelerator driver. For developers and early adopters eager to evaluate this new AI accelerator, understanding the driver setup process is crucial. This guide walks you through obtaining, applying, and testing the latest AIE4 support patches on a Linux system, using real-world steps that reflect the ongoing upstream work. By the end, you'll have a functional test environment to verify NPU detection and basic operations.
What You Need
- A system with an AMD processor that includes an AIE4 NPU (e.g., future Ryzen AI models).
- A Linux distribution with kernel source installed (recommend Ubuntu 24.04 LTS or newer, or Fedora 40+).
- Basic familiarity with compiling a custom Linux kernel.
- Git and patch utilities (
git,patch) installed. - Internet access to fetch patches from the AMD Linux mailing list or AMDGpu Git repository.
- Approximately 20 GB free disk space for kernel build artifacts.
Step-by-Step Instructions
Step 1: Identify the Latest AIE4 Patches
Since March 2025, AMD engineers have been submitting patches to enable the AIE4 NPU. Monitor the linux-amd-drm mailing list or the drm-next branch. For this guide, start from a known patchset tag – for example, drm-next-2025-05-01 – to ensure consistency. Use git log to locate commits containing "AIE4" or "AMDXDNA".
Step 2: Clone and Prepare the Kernel Source
- Clone the AMD GPU kernel tree:
git clone https://git.kernel.org/pub/scm/linux/kernel/git/amdgpu/linux.git - Check out the branch containing AIE4 support:
git checkout drm-next-2025-05-01 - If you have a separate patch series (e.g., from a mailing list), apply them with:
git am *.patchor manuallypatch -p1 < patch_file.
Step 3: Configure the Kernel for AMDXDNA Driver
Run make menuconfig (or nconfig) and navigate to:
Device Drivers → Accelerators. Enable the following options:
- AMD XDNA AI accelerator driver (CONFIG_DRM_AMD_XDNA) – set to Build into kernel or Module.
- AMD AIE4 NPU support (CONFIG_DRM_AMD_XDNA_AIE4) – enable.
- Ensure AMD GPU driver is also enabled (CONFIG_DRM_AMDGPU).
Save and exit.
Step 4: Build and Install the Kernel
- Compile the kernel and modules:
make -j$(nproc) deb-pkg(for Debian/Ubuntu) ormake -j$(nproc) && make modules_install && make install. - Install the generated packages (e.g.,
sudo dpkg -i linux-image-*.deb). - Update the bootloader (
sudo update-gruborsudo grub2-mkconfig). - Reboot into the new kernel.
Step 5: Verify NPU Detection
After reboot, check if the AIE4 NPU is recognized:
dmesg | grep -i aie4– should show "AIE4 NPU detected".ls -l /dev/accel/– should list a device node (e.g.,accel0).cat /sys/kernel/debug/dri/0/amdxdna– shows driver firmware and capabilities.
Step 6: Load the Driver Module (if built as module)
If you chose to build as a module, load it manually:
sudo modprobe amd_xdnaVerify with lsmod | grep amd_xdna. The driver should now attach to the AIE4 hardware.
Step 7: Run a Simple NPU Test
Use the amdxdna-test tool (included in kernel selftests) to validate basic operations:
- Build kernel selftests:
make -C tools/testing/selftests TARGETS=amdxdna - Run the test:
sudo ./tools/testing/selftests/amdxdna/test_basic - Look for "PASS" outputs indicating NPU initialization and inference succeeded.
Tips & Troubleshooting
- Kernel version: The AIE4 patches are based on Linux 7.2-rc1 (as of April 2025). Using earlier kernels may cause compilation errors. Always check the commit message for base requirements.
- Firmware: The AMDXDNA driver requires a firmware blob. If missing, install
linux-firmware-amd-xdnafrom your distribution or copy from the linux-firmware git tree. - Hardware availability: AIE4 NPU is not yet shipping in retail Ryzen AI products (as of mid-2025). The steps above work for development boards or engineering samples. For production hardware, wait for official driver integration.
- Build errors: If build fails due to missing headers, install
linux-headers-$(uname -r)and additional build tools (build-essential,flex,bison,libelf-dev). - Performance tuning: For AI workloads, consider enabling IOMMU and setting
amdxdna.power_management=1kernel parameter for optimal power.
This guide will be updated as new AIE4 patches land in mainline. For the most current information, refer to the Prerequisites section and follow the AMD Linux mailing list.