IRON is an open-source & close-to-metal Python API enabling fast and efficient execution on AMD Ryzenβ’ AI NPUs. It relies on language bindings around the MLIR-AIE dialect.
Key Features:
- Close-to-metal NPU programming via MLIR-AIE Python bindings
- Pre-built operator library (GEMM, MHA, RMSNorm, RoPE, activations, etc.)
- Operator fusion for optimal performance
- Extensible architecture for custom operators
- End-to-end LLM inference (Llama 3.2 1B example included)
The IRON Python API for Ryzenβ’ AI NPUs is described in the following paper:
E. Hunhoff, J. Melber, K. Denolf, A. Bisca, S. Bayliss, S. Neuendorffer, J. Fifield, J. Lo, P. Vasireddy, P. James-Roxby, E. Keller. "Efficiency, Expressivity, and Extensibility in a Close-to-Metal NPU Programming Interface". In 33rd IEEE International Symposium On Field-Programmable Custom Computing Machines, May 2025.
| Section | Description | Datatype | AIE2 | AIE2P | Status | Design Example |
|---|---|---|---|---|---|---|
| Element-wise Add | Element-wise addition kernel | bfloat16 | β | β | π’ | iron/operators/elementwise_add/ |
| Element-wise Mul | Element-wise multiplication kernel | bfloat16 | β | β | π’ | iron/operators/elementwise_mul/ |
| GEMM | General Matrix Multiplication kernel | bfloat16 | β | β | π’ | iron/operators/gemm/ |
| GEMM INT8 | INT8 General Matrix Multiplication (i8βi8/i16/i32) | int8 | β | β | π’ | iron/operators/gemm/ |
| GEMV | General Matrix-Vector Multiplication kernel | bfloat16 | β | β | π’ | iron/operators/gemv/ |
| GQA | Grouped Query Attention kernel (Single pipeline) | bfloat16 | β | π’ | iron/operators/mha/ | |
| MHA | Multi-Head Attention kernel & Grouped Query Attention | bfloat16 | β | π’ | iron/operators/mha/ | |
| RMSNorm | RMSNorm kernel | bfloat16 | β | β | π’ | iron/operators/rms_norm/ |
| RoPE | Rotary Positional Embedding kernel | bfloat16 | β | β | π’ | iron/operators/rope/ |
| SiLU | Sigmoid Linear Unit activation kernel | bfloat16 | β | β | π’ | iron/operators/silu/ |
| Softmax | Softmax kernel | bfloat16 | β | β | π’ | iron/operators/softmax/ |
| Weighted RMSNorm | Weighted RMSNorm kernel | bfloat16 | β | β | π’ | iron/operators/rms_norm/ |
| Copy | Copy | bfloat16 | β | β | π’ | iron/operators/mem_copy/ |
| Transpose | Transpose | bfloat16 | β | β | π’ | iron/operators/transpose/ |
| AXPY | AXPY | bfloat16 | β | β | π’ | iron/operators/axpy/ |
| Reduction | Reduction | bfloat16 | π‘ | |||
| Dequant | Dequant Q4NX from AWQ to bfloat16 | bfloat16 | β | β | π’ | iron/operators/dequant/ |
| RELU | RELU | bfloat16 | β | β | π’ | iron/operators/relu/ |
| Leaky RELU (WIP) | Leaky RELU kernel | bfloat16 | β | βͺ | iron/operators/leaky_relu/ | |
| GELU | GELU | bfloat16 | β | β | π’ | iron/operators/gelu/ |
| LayerNorm | LayerNorm | bfloat16 | β | β | π’ | iron/operators/layer_norm/ |
| Convolution | Convolution | bfloat16 | π‘ | |||
| MaxPool | MaxPool | bfloat16 | βͺ | |||
| AveragePool | AveragePool | bfloat16 | βͺ | |||
| Tanh | Tanh kernel | bfloat16 | β | β | π’ | iron/operators/tanh/ |
| Sigmoid | Sigmoid kernel | bfloat16 | β | β | π’ | iron/operators/sigmoid/ |
Use this dashboard to quickly check the status of each kernel and locate relevant setup, build, and usage information.
| Status | Meaning |
|---|---|
| π’ | Done |
| π‘ | In Development |
| βͺ | Not Assigned |
These instructions will guide you through everything required for building and executing a program on the Ryzenβ’ AI NPU, starting from a fresh bare-bones Ubuntu 24.04 or Ubuntu 24.10 install.
Important: Ensure your system has the latest BIOS version that enables NPU support. Check your laptop/mini-PC manufacturer's support website for BIOS updates.
If starting from Ubuntu 24.04 you may need to update the Linux kernel to 6.11+ by installing the Hardware Enablement (HWE) stack:
sudo apt update
sudo apt install --install-recommends linux-generic-hwe-24.04
sudo reboot-
Install XDNAβ’ Driver and XRT:
-
Install the packages needed for IRON and MLIR-AIE:
# Python versions 3.10, 3.12 and 3.13 are currently supported by our wheels sudo apt install \ build-essential clang clang-14 lld lld-14 python3-venv python3-pip -
Setup a virtual environment and activate it:
python3 -m venv ironenv source ironenv/bin/activate python3 -m pip install --upgrade pip -
Source XRT (installed in step 1):
source /opt/xilinx/xrt/setup.sh -
Install required Python packages (from requirements.txt):
pip install -r requirements.txt
-
To test your installation, you can try to build and run the example below:
pytest ./iron/operators/axpy/
β οΈ Important: Toolchain AvailabilityThe Python code of IRON is fully cross-platform and runs on Windows without modification. However, the upstream
mlir_aiepackage (which providesaiecc.py, MLIR Python bindings, and XRT runtime integration) currently ships Linux-only wheels. Thellvm-aiepackage (Peano compiler:clang++,llvm-ar,llvm-objcopy) does provide Windows wheels.This means:
Component Native Windows Via WSL2 Python IRON code (operators, tests, API) β β Peano compiler ( clang++,llvm-ar)β β aiecc.py(xclbin compilation)β β MLIR Python bindings ( aie.*)β β XRT runtime ( pyxrt)β (separate SDK) β Recommended approach: use WSL2 (Windows Subsystem for Linux) β all tools work identically to native Linux. Follow the Linux instructions above inside WSL2.
For native Windows development (editing, testing CPU-side code, running the Python API), the setup below works as-is.
Important: Ensure your system has the latest BIOS version that enables NPU support. Check your laptop/mini-PC manufacturer's support website for BIOS updates.
-
Install Python 3.10, 3.12, or 3.13 from python.org or the Microsoft Store. During installation, check "Add Python to PATH".
-
Install Visual Studio Build Tools (needed for compilation):
- Download from Visual Studio Build Tools
- Or install the full Visual Studio Community with the "Desktop development with C++" workload.
-
Install Git for Windows from git-scm.com.
-
Install the AMD XDNAβ’ Driver and XRT for Windows:
Follow the AMD Ryzen AI SDK installation guide for Windows.
XRT is typically installed to
C:\Xilinx\XRTorC:\Program Files\AMD\XRT.
-
Open PowerShell or Command Prompt and clone the repository:
git clone https://github.com/amd/IRON.git cd IRON -
Create and activate a virtual environment:
python -m venv ironenv ironenv\Scripts\activate python -m pip install --upgrade pip
-
Set up XRT environment (adjust path to your XRT installation):
call "C:\Xilinx\XRT\setup.bat"
-
Install required Python packages:
pip install -r requirements.txt
-
Test your installation:
pytest .\iron\operators\axpy\
-
Install WSL2 with Ubuntu 24.04:
wsl --install -d Ubuntu-24.04
-
Inside WSL2, follow the Linux installation instructions above. All tools (
mlir_aie,llvm-aie, XRT) work natively in WSL2. -
Access your Windows files from WSL2 at
/mnt/c/if needed.
- The LLVM/Clang tools from the
llvm-aiepip package are used automatically (includingclang++,llvm-objcopy,llvm-nm,llvm-ar). On Windows these ship as.exefiles and are discovered by the build system. - File copy operations during compilation use Python's
shutil.copy2instead of the Unixcpcommand. - Symbol map generation (used by some operators) is done in pure Python on Windows, replacing the
sh | awkpipeline used on Linux. - The
aiecccompiler tool is located via the MLIR-AIE package and handles bothaieccandaiecc.pyentry points on Windows. - When
mlir_aiegains official Windows wheels, full native compilation will work without any code changes β the IRON build system is already prepared.
All available operators can be found in iron/operators. These each contain:
op.py: The Python operator interface -- an easy access point to integrate operators into your project that prescribes how to compile the operator (build artifacts) and how to call it at runtime (buffer sizes, etc.)design.py: The implementation of the operator's NPU code. Often references a kernel inaie_kernelsfor the compute core code and describes the data movement using ObjectFIFOs.reference.py: A reference CPU implementation to validate the correctness of the NPU implementation.test.py: An end-to-end test that instantiates and builds the operator, runs it and verifies its outputs against the reference.
NOTE: Be sure the XRT setup script has been sourced and the Python environment is activated: Linux:
source /opt/xilinx/xrt/setup.sh+source /path/to/ironenv/bin/activateWindows:call "C:\Xilinx\XRT\setup.bat"+ironenv\Scripts\activate
To build and test all the operators:
pytest iron/operators/ -m "not extensive"To run the extensive test suite:
pytest iron/operators/To run a specific operator's tests:
pytest iron/operators/axpy/To ensure your code passes CI linting checks before pushing, install the pre-push hook:
Linux / macOS:
cp scripts/hooks/pre-push .git/hooks/pre-push
chmod +x .git/hooks/pre-pushWindows (PowerShell):
Copy-Item scripts\hooks\pre-push .git\hooks\pre-pushThe hook will run the same linting checks as CI:
- License checks (reuse)
- Python formatting (black)
- C++ formatting (clang-format)
To bypass the hook if needed: git push --no-verify
IRON includes a complete LLM inference example demonstrating NPU acceleration:
- Location:
iron/applications/llama_3.2_1b/ - Model: Meta Llama 3.2 1B
- Features: Multi-head attention, fused operators, bfloat16 quantization
See iron/applications/llama_3.2_1b/README.md for setup and usage instructions.
IRON uses a three-layer architecture:
-
Operators (
iron/operators/): High-level Python API for NPU operations- Each operator has:
op.py(interface),design.py(MLIR-AIE implementation),reference.py(CPU reference),test.py(validation)
- Each operator has:
-
AIE Kernels (
aie_kernels/): Low-level C++ compute kernels- Organized by architecture:
generic/,aie2/,aie2p/ - Vectorized using AIE API for optimal performance
- Organized by architecture:
-
Common Infrastructure (
iron/common/): Compilation, device management, and utilities- MLIR-AIE compilation pipeline
- XRT runtime integration
- Operator fusion framework
IRON operators are designed for maximum NPU utilization:
- Parallel execution across multiple AIE columns
- Optimized data movement via ObjectFIFOs
- Fused operations to minimize host-NPU transfers
- Vectorized kernels using AIE intrinsics
Run benchmarks:
# Run all operators with performance metrics stored in tests_latest.csv
pytest iron/operators/ -m "not extensive" -vThis fork includes a ggml-xdna backend for llama.cpp β enabling LLM inference on AMD XDNA NPUs via the ggml ecosystem.
Based on albiol2004/llama.cpp ggml-xdna branch. See ggml-org/llama.cpp#21725 for the upstream feature request.
- β GEMM/GEMV (prefill & decode)
- β SwiGLU (fused decode, prefill)
- β QKV projection (fused)
- β RMSNorm, RoPE, Softmax
- β Attention (FlowKV decode)
- β INT8 GEMM operator (i8Γi8βi8/i16/i32)
- π INT8 GEMV (decode path)
- π INT8 SwiGLU (W8A16 decode, W8A8 prefill)
ggml-xdna backend ΠΏΠ΅ΡΠ΅Π½Π΅ΡΡΠ½ Π² llama.cpp-xdna (ggml/src/ggml-xdna/).
- π¬ Discord: Join our Discord server for discussions and support
- π Issues: Report bugs and request features via GitHub Issues
- π Contributing: See CONTRIBUTING.md for development guidelines
- π Documentation: Operator examples in
iron/operators/, kernel docs inaie_kernels/README.md
IRON is licensed under the Apache License 2.0. See LICENSE for details.
CopyrightΒ© 2025-2026 Advanced Micro Devices, Inc
