Environment Setup¶
Prerequisites¶
Before proceeding with the Allo installation, please follow the instructions on the MLIR-AIE website to install the required Vitis and XRT environment. Stop when you reach the “Install IRON for AMD Ryzen™ AI AIE Application” section as we need a separate process to install MLIR-AIE under the Allo environment.
Install from Source¶
Please follow the general instructions in Install from Source to install the LLVM-19 project and the Allo package. In the following, we suppose you have already installed the LLVM-19 project and enable the allo
conda environment.
Below are the exact commands to set up the environment:
Step 1¶
Activate the allo
conda environment
conda activate allo
Step 2¶
We depend on the MLIR-AIE project to compile the Allo IR to AIE. Install release 1.0
# Install IRON library and mlir-aie from a wheel python3 -m pip install mlir_aie -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/v1.0 # Install Peano from a llvm-aie wheel python3 -m pip install https://github.com/Xilinx/llvm-aie/releases/download/nightly/llvm_aie-19.0.0.2025041501+b2a279c1-py3-none-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Warning
The mlir_aie
wheel requires manylinux_2_35
, and some systems (e.g., those with glibc 2.34, confirmed by ldd --version
) do not meet this requirement.
This results in an installation failure such as:
ERROR: mlir_aie-0.0.1.2025042204+24208c0-cp312-cp312-manylinux_2_35_x86_64.whl is not a supported wheel on this platform.
Step 3¶
Clone the mlir-aie repository and checkout to the commit corresponding to release 1.0
git clone https://github.com/Xilinx/mlir-aie.git cd mlir-aie git checkout 07320d6
Then, install python requirements, setup environment and add tools to PATHs (under mlir-aie
)
# Install basic Python requirements python3 -m pip install -r python/requirements.txt # Install the pre-commit hooks defined in .pre-commit-config.yaml pre-commit install # Install MLIR Python Extras HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie python3 -m pip install -r python/requirements_extras.txt # Install Torch for ML examples python3 -m pip install -r python/requirements_ml.txt source utils/env_setup.sh
Step 4¶
Clone the allo repository and install.
You may want to set up environment variables first to use a custom CMake and LLVM build. For example:
export PATH=/opt/cmake-3.31.5-linux-x86_64/bin:/opt/llvm-project-19.x/build/bin:$PATH export LLVM_BUILD_DIR=/opt/llvm-project-19.x/buildThen clone the allo repository and install by running the following commands
git clone https://github.com/cornell-zhang/allo.git cd allo python3 -m pip install -v -e .
Note
See Internal Installation (Cornell) for Zhang Group students.
Step 5¶
Setup Vitis and XRT.
Note
See Internal Installation (Cornell) for Zhang Group students.
Lastly, you can verify the AIE backend by running the following command under the allo
folder.
python3 tests/dataflow/aie/test_vector.py
Patches and Configuration¶
To use components from the MLIR-AIE toolchain as libraries:
Note
The instructions below are based on MLIR-AIE release v1.0, which corresponds to commit 07320d6. For compatibility, make sure to use this commit when copying the following components.
Clone and checkout the specific commit:
git clone https://github.com/Xilinx/mlir-aie.git
cd mlir-aie
git checkout 07320d6
To use external kernels as an AIE kernel library:
export MLIR_AIE_EXTERNAL_KERNEL_DIR=/your/copied/path/aie_kernels
To use runtime_lib for the host:
export RUNTIME_LIB_DIR=/your/copied/path/runtime_lib
If you run into issues when using aiecc.py
such as:
error: expected ')' at end of argument list
declare void @llvm.memcpy.p0.p0.i64(ptr noalias writeonly captures(none), ptr noalias readonly captures(none), i64, i1 immarg) #1
^
You can fix this by modifying downgrade_ir_for_peano
in:
$MLIR_AIE_INSTALL_DIR/python/aie/compiler/aiecc/main.py
Update the function as follows:
Before:
def downgrade_ir_for_peano(llvmir):
llvmir = llvmir.replace("getelementptr inbounds nuw", "getelementptr inbounds")
return llvmir
After:
def downgrade_ir_for_peano(llvmir):
llvmir = llvmir.replace("getelementptr inbounds nuw", "getelementptr inbounds")
llvmir = llvmir.replace("captures(none)", "")
return llvmir
Internal Installation (Cornell)¶
For Zhang Group students, please set up environment variables in Step 4 with the following commands.
export PATH=/opt/cmake-3.31.5-linux-x86_64/bin:/opt/llvm-project-19.x/build/bin:$PATH
export LLVM_BUILD_DIR=/opt/llvm-project-19.x/build
And set up Vitis and XRT in Step 5 by running the following commands.
source /opt/common/setupVitis.sh
source /opt/common/setupXRT.sh
Lastly, to verify the installation, you can run the following command:
python3 tests/dataflow/aie/test_vector.py
If the unit tests pass, then the installation is successful. Otherwise, please contact us for help.