AMD's Newest Open-Source Surprise: "Peano" - An LLVM Compiler For Ryzen AI NPUs

Written by Michael Larabel in AMD on 8 June 2024 at 07:56 AM EDT. 13 Comments
There was a very exciting Friday evening code drop out of AMD... They announced a new project called Peano that serves as an open-source LLVM compiler back-end for AMD/Xilinx AI engine processors with a particular focus on the Ryzen AI SOCs with existing Phoenix and Hawk Point hardware as well as the upcoming XDNA2 found with the forthcoming Ryzen AI 300 series.

AMD's Ryzen AI NPU on Linux is finally getting interesting! Back in January out of the blue was AMD posting an open-source XDNA Linux kernel driver for supporting the Ryzen AI hardware. That kernel driver though remains out-of-tree and AMD hasn't been entirely clear with the community about its plans, etc. More recently I've begun hearing word that they will work toward upstreaming it in the Linux kernel but to date they haven't sent out any patches for review or go through those other formalities. There also hasn't been much in the way of user-space software or details about Ryzen AI on Linux... So imagine my surprise and joy while working on Friday night and noticing their subtle announcement of this new AMD Peano project.

AMD Peano

"Peano" is the apparent name for their new LLVM compiler back-end supporting the Ryzen AI SoCs and other AMD/Xilinx AI engines. Stephen Neuendorffer of AMD/Xilinx and part of the "Peano team" announced this new back-end to LLVM developers. He explained of AMD Peano in the announcement on LLVM's Discourse:
"On behalf of AMD, I’m pleased to announce the open sourcing of an LLVM backend for AMD/Xilinx AI Engine processors. These processors exist in a number of devices including RyzenAI SoCs. The repository currently focuses on supporting the AIE2 architecture implemented by the XDNA accelerators in “Phoenix” and “Hawk Point” devices.
Note that these accelerators include an array of processors, while the LLVM backend only supports a single processor. Support for devices as a whole is available in open source tools based on MLIR.
In addition to support for LLVM code generation, the repository also includes support for Clang, LLD, binutils (e.g. ‘llvm-objdump’), Compiler-RT, and LLVM-LIBC.
Generally speaking, AI Engine processors are in-order, exposed-pipeline VLIW processors. Each VLIW instruction bundle specifies the behavior of one or more functional units, which begin executing a new instruction at the same time. The processor pipeline does not include stall logic to enforce data dependencies, and instructions will continue executing in order regardless of other instructions in the pipeline. As a result, the compiler is able to schedule machine instructions which access the same register in ways that potentially overlap.

Other key architectural characteristics include varying width instruction slots between different instruction encodings and relatively small address spaces (20-bit pointer registers). The presence of varying-width instruction slots implies some code alignment restrictions for instructions which are branch or return targets."

AMD will be working to upstream the relevant code into the LLVM codebase. For now this Peano AI engine fork is hosted via Xilinx/llvm-aie on GitHub. The XDNA Phoenix / Hawk Point support is fully in place while the XDNA2 support for upcoming Ryzen AI 300 "Strix Point" hardware is still being developed.

Having this open-source compiler back-end for Ryzen AI NPUs is significant in making the accelerators more useful under Linux. Phoronix readers need not be reminded in the versatility and widespread use of the LLVM compiler infrastructure. This open-source user-space code is also important for facilitating the upstreaming of their open-source XDNA driver into the Linux kernel.

Ryzen AI example code

AMD does have documentation on writing a basic code sample now for targeting the Ryzen AI NPU using the XDNA kernel driver and LLVM AIE/Peano compiler.

AMD Ryzen AI logo

I'm still going through this code and announcement with yesterday marking the first time I heard of this AMD Peano project. As for the "Peano" name for this compiler, it looks like it might be a play out of NVIDIA's playbook of mathematician/scientist codenames... Giuseppe Peano was a prominent Italian mathematician who died in Turin in 1932.

This is a great milestone to see albeit something that should have happened months ago... Ryzen AI as a reminder debuted a year ago with the Ryzen 7040 series. As a reminder for comparison, Intel had their IVPU kernel driver upstreamed into the Linux kernel for their NPU even before Meteor Lake shipped. Intel's IVPU driver also already has Arrow Lake and Lunar Lake support upstream. Intel also has their open-source NPU plug-in within OpenVINO, their NPU Python acceleration library, and other code available. Intel's NPU Linux support has been much more punctual than AMD. In any event having this open-source compiler backend should be useful in beginning to jump start the Linux ecosystem/support around leveraging the growing number of Ryzen AI SoCs.

Next up, seeing the AMD XDNA driver in the mainline Linux kernel? In any event a nice (coincidental) birthday surprise with Phoronix turning 20 years old this week of advocating for open-source and Linux hardware support while having this AMD Peano open-source code drop to end out the week.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via

Popular News This Week