|
1 | 1 | # Getting Started and Running on Linux Ryzen™ AI |
2 | 2 |
|
3 | | -## Quick Start: Build with Prebuilt Wheels |
| 3 | +## Install Prebuilt Wheels (Recommended) |
| 4 | + |
| 5 | +The fastest way to get MLIR-AIR is to install the prebuilt wheel — no source build, no CMake, no LLVM clone. Use this path unless you need to modify MLIR-AIR itself or run on an unsupported Python/platform. |
| 6 | + |
| 7 | +### Prerequisites |
| 8 | + |
| 9 | +- **Python 3.10–3.14** on Linux x86_64, or **Python 3.10–3.12** on Windows AMD64 |
| 10 | +- **pip** |
| 11 | +- **XRT** (optional, required only for running on hardware) — see [mlir-aie's XRT install instructions](https://github.com/Xilinx/mlir-aie#install-the-xdna-driver-and-xrt) |
| 12 | + |
| 13 | +### Steps |
| 14 | + |
| 15 | +1. **Create a virtual environment:** |
| 16 | + ```bash |
| 17 | + python3 -m venv airenv |
| 18 | + source airenv/bin/activate |
| 19 | + pip install --upgrade pip |
| 20 | + ``` |
| 21 | + |
| 22 | +2. **Install MLIR-AIR and its companion wheels:** |
| 23 | + ```bash |
| 24 | + # MLIR-AIR (default: RTTI-enabled) |
| 25 | + pip install mlir_air -f https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-air-wheels |
| 26 | + |
| 27 | + # MLIR-AIE |
| 28 | + pip install mlir_aie -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels-3 |
| 29 | + |
| 30 | + # Peano (llvm-aie) — AIE backend compiler |
| 31 | + pip install llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly |
| 32 | + ``` |
| 33 | + |
| 34 | +3. **Set up environment variables** (paths derived from `pip show`): |
| 35 | + ```bash |
| 36 | + export MLIR_AIR_INSTALL_DIR=$(python3 -m pip show mlir_air | grep ^Location: | awk '{print $2}')/mlir_air |
| 37 | + export MLIR_AIE_INSTALL_DIR=$(python3 -m pip show mlir_aie | grep ^Location: | awk '{print $2}')/mlir_aie |
| 38 | + export PEANO_INSTALL_DIR=$(python3 -m pip show llvm-aie | grep ^Location: | awk '{print $2}')/llvm-aie |
| 39 | + |
| 40 | + export PATH=$MLIR_AIR_INSTALL_DIR/bin:$MLIR_AIE_INSTALL_DIR/bin:$PATH |
| 41 | + export PYTHONPATH=$MLIR_AIR_INSTALL_DIR/python:$MLIR_AIE_INSTALL_DIR/python:$PYTHONPATH |
| 42 | + export LD_LIBRARY_PATH=$MLIR_AIR_INSTALL_DIR/lib:$MLIR_AIE_INSTALL_DIR/lib:$LD_LIBRARY_PATH |
| 43 | + |
| 44 | + # Only if you have XRT installed: |
| 45 | + source /opt/xilinx/xrt/setup.sh |
| 46 | + ``` |
| 47 | + |
| 48 | +4. **Verify the install:** |
| 49 | + ```bash |
| 50 | + air-opt --help |
| 51 | + ``` |
| 52 | + |
| 53 | +You can now jump to [Running a Quick Example](#running-a-quick-example) below. |
| 54 | + |
| 55 | +### Choosing a Wheel Release |
| 56 | + |
| 57 | +| Tag | When to use | |
| 58 | +|-----|-------------| |
| 59 | +| [`latest-air-wheels`](https://github.com/Xilinx/mlir-air/releases/tag/latest-air-wheels) | Default. RTTI enabled. Use this for standalone development. | |
| 60 | +| [`latest-air-wheels-no-rtti`](https://github.com/Xilinx/mlir-air/releases/tag/latest-air-wheels-no-rtti) | For integrating MLIR-AIR into a downstream project whose LLVM is built with `-DLLVM_ENABLE_RTTI=OFF`. Pair with `mlir_aie` from `latest-wheels-no-rtti`. | |
| 61 | +| [`v*.*.*`](https://github.com/Xilinx/mlir-air/releases) (e.g. `v1.0.0`) | Pinned tagged release, for reproducible builds: `pip install mlir_air==<ver> -f https://github.com/Xilinx/mlir-air/releases/expanded_assets/v<ver>` | |
| 62 | + |
| 63 | +We release **both RTTI and no-RTTI variants** so downstream projects can match their LLVM build configuration without having to rebuild MLIR-AIR from source. When mixing wheels into a downstream build, all three (`mlir`, `mlir_aie`, `mlir_air`) must agree on RTTI. |
| 64 | + |
| 65 | +### Running Examples Against a Wheel Install |
| 66 | + |
| 67 | +When checking out the MLIR-AIR repo to run programming examples, sync to the commit hash embedded in the wheel filename (`mlir_air-0.0.1.{DATETIME}+{HASH}-...`) so the example sources match the installed compiler. |
| 68 | + |
| 69 | +If the wheel install path doesn't fit your needs, see the source-build instructions below. |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Build From Source Using Prebuilt Dependencies |
| 74 | + |
| 75 | +This path builds MLIR-AIR from source but installs LLVM, MLIR-AIE, and Peano from prebuilt wheels — useful when you're hacking on MLIR-AIR itself but don't want to also rebuild its dependencies. |
4 | 76 |
|
5 | 77 | ### Prerequisites |
6 | 78 |
|
|
0 commit comments