A Step-by-Step Guide to Testing the AMD AIE4 NPU with the AMDXDNA Linux Driver

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.

A Step-by-Step Guide to Testing the AMD AIE4 NPU with the AMDXDNA Linux Driver

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

  1. Clone the AMD GPU kernel tree: git clone https://git.kernel.org/pub/scm/linux/kernel/git/amdgpu/linux.git
  2. Check out the branch containing AIE4 support: git checkout drm-next-2025-05-01
  3. If you have a separate patch series (e.g., from a mailing list), apply them with: git am *.patch or manually patch -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

  1. Compile the kernel and modules: make -j$(nproc) deb-pkg (for Debian/Ubuntu) or make -j$(nproc) && make modules_install && make install.
  2. Install the generated packages (e.g., sudo dpkg -i linux-image-*.deb).
  3. Update the bootloader (sudo update-grub or sudo grub2-mkconfig).
  4. 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_xdna

Verify 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:

  1. Build kernel selftests: make -C tools/testing/selftests TARGETS=amdxdna
  2. Run the test: sudo ./tools/testing/selftests/amdxdna/test_basic
  3. 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-xdna from 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=1 kernel 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.

Tags:

Recommended

Discover More

Alienware Area 51 Laptop Review: Blazing Performance Meets Power DemandsThe Daemon Tools Supply-Chain Attack: 6 Key Facts You Must KnowCosmic Blue Flashes: Could Black Hole-Star Collisions Explain Them?Cerebras Systems Raises IPO Ambitions as AI Chip Demand SkyrocketsMastering NetSuite Integration: A Comprehensive Guide to Seamless Data Flow