This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test with AIE tools on Ryzen AI | |
on: | |
push: | |
branches: | |
- main | |
- test-ryzen-ai | |
pull_request: | |
merge_group: | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash | |
concurrency: | |
# A PR number if a pull request and otherwise the commit hash. This cancels | |
# queued and in-progress runs for the same PR (presubmit) or commit | |
# (postsubmit). | |
group: ci-build-test-ryzenai-${{ github.event.number || github.sha }}-${{ github.event_name }} | |
cancel-in-progress: true | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic | |
VITIS: /opt/ryzen_ai-1.3.0/vitis_aie_essentials | |
STATIC_CMAKE_ARGS: | | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DXRT_ROOT=/opt/xilinx/xrt \ | |
-DAIE_ENABLE_PYTHON_PASSES=OFF \ | |
-DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON \ | |
-DAIE_INCLUDE_INTEGRATION_TESTS=OFF | |
# -j12 here to reduce the number of parallel chess jobs. | |
LIT_OPTS: -sv --time-tests -j12 --timeout 600 --show-unsupported --show-excluded | |
jobs: | |
build-mlir-aie: | |
name: Build for Ryzen AI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Free disk space | |
uses: descriptinc/free-disk-space@main | |
with: | |
tool-cache: true | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: false | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: uraimo/[email protected] | |
name: Build mlir-aie | |
id: runcmd | |
with: | |
distro: none | |
arch: none | |
base_image: ghcr.io/xilinx/mlir-aie/ubuntu22-ryzenai-1.3.0ea:1.1 | |
githubToken: ${{ github.token }} | |
dockerRunArgs: | | |
--mac-address ${{ secrets.XILINX_MAC }} | |
env: | | |
VITIS: ${{ env.VITIS }} | |
XILINXD_LICENSE_FILE: ${{ env.XILINXD_LICENSE_FILE }} | |
run: | | |
python -m venv ${{ github.workspace }}/aie-venv | |
source ${{ github.workspace }}/aie-venv/bin/activate | |
# this is the inverse of `base64 -w 1000000 Xilinx.lic` | |
# the -w ("wrap after 1000000 cols") is so that there are no spaces in the XILINX_LIC env var | |
echo -n "${{ secrets.XILINX_LIC }}" | base64 --decode > $XILINXD_LICENSE_FILE | |
echo "Installing vitis_aie_essentials ..." | |
pushd /opt | |
ccrypt -d -K ${{ secrets.RYZEN_AI_SW_KEY }} /workspace/vaie.tgz.cpt -c | tar xz | |
popd | |
echo "Installing llvm-aie ..." | |
pip -q download llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly | |
unzip -q llvm_aie*.whl | |
rm -rf llvm_aie*.whl | |
export PEANO_INSTALL_DIR=`realpath llvm-aie` | |
VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
echo "Installing mlir version $VERSION ..." | |
pip -q download mlir==$VERSION \ | |
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro | |
unzip -q mlir-*.whl | |
rm mlir-*.whl | |
# I have no clue why but the system clock on GHA containers is like 12 hours ahead. | |
# That means wheels have file with time stamps in the future which makes ninja loop | |
# forever when configuring. Set the time to some arbitrary stamp in the past just to be safe. | |
find mlir -exec touch -a -m -t 201108231405.14 {} \; | |
pip install -r python/requirements.txt | |
pip install -r python/requirements_ml.txt | |
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt | |
mkdir build | |
pushd build | |
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH | |
cmake ${{ github.workspace }} -G Ninja \ | |
-DPython3_EXECUTABLE=$(which python) \ | |
-DLLVM_EXTERNAL_LIT=$(which lit) \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/build/install \ | |
-DCMAKE_MODULE_PATH=${{ github.workspace }}/cmake/modulesXilinx \ | |
-DMLIR_DIR=${{ github.workspace }}/mlir/lib/cmake/mlir \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ | |
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DCMAKE_SHARED_LINKER_FLAGS_INIT="-fuse-ld=lld" \ | |
-DXRT_ROOT=/opt/xilinx/xrt \ | |
-DPEANO_INSTALL_DIR=$PEANO_INSTALL_DIR \ | |
-DAIE_ENABLE_PYTHON_PASSES=OFF \ | |
-DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON \ | |
-DAIE_INCLUDE_INTEGRATION_TESTS=OFF \ | |
-DAIE_VITIS_COMPONENTS=AIE2 | |
ninja install | |
chown -R github.github * | |
popd | |
tar cf build.tar build | |
- name: Upload mlir_aie | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mlir_aie | |
path: build.tar | |
test-mlir-aie: | |
name: Test on Ryzen AI | |
runs-on: amd7940hs | |
needs: build-mlir-aie | |
strategy: | |
fail-fast: false | |
matrix: | |
build_type: [ llvm-aie, xchesscc ] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mlir_aie | |
path: . | |
- name: Run mlir-aie tests | |
run: | | |
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH | |
export PEANO_INSTALL_DIR= | |
if [ "${{ matrix.build_type }}" == "llvm-aie" ]; then | |
echo "Installing peano ..." | |
pip -q download llvm-aie -f https://github.com/Xilinx/llvm-aie/releases/expanded_assets/nightly | |
unzip -q llvm_aie*.whl | |
rm -rf llvm_aie*.whl | |
export PEANO_INSTALL_DIR=`realpath llvm-aie` | |
fi | |
python -m venv aie-venv | |
source aie-venv/bin/activate | |
pip install -r python/requirements.txt | |
pip install -r python/requirements_ml.txt | |
HOST_MLIR_PYTHON_PACKAGE_PREFIX=aie pip install -r python/requirements_extras.txt | |
VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
pip -q download mlir==$VERSION \ | |
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro | |
unzip -q mlir-*.whl | |
rm mlir-*.whl | |
# I have no clue why but the system clock on GHA containers is like 12 hours ahead. | |
# That means wheels have file with time stamps in the future which makes ninja loop | |
# forever when configuring. Set the time to some arbitrary stamp in the past just to be safe. | |
find mlir -exec touch -a -m -t 201108231405.14 {} \; | |
tar xf build.tar | |
rm build.tar | |
cd build | |
lit ${{ env.LIT_OPTS }} test | |
build-quick-setup: | |
name: Test Examples on Ryzen AI | |
runs-on: amd7940hs | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: "true" | |
- name: Build and Test mlir-aie | |
run: | | |
pip cache purge | |
source /opt/xilinx/xrt/setup.sh | |
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH | |
source utils/quick_setup.sh | |
# quick_setup changes directory to programming_examples, so we need to return to mlir-aie | |
cd .. | |
./utils/build-mlir-aie-from-wheels.sh ./my_install/mlir build install ./my_install/llvm-aie | |
# build is created by the build-mlir-aie-from-wheels.sh script | |
pushd build | |
ninja install | |
ninja check-reference-designs | |
ninja check-programming-guide | |
popd |