Skip to content

Force PIE on bootgen with explicit compiler/linker flags, not just the CMake property #7972

Force PIE on bootgen with explicit compiler/linker flags, not just the CMake property

Force PIE on bootgen with explicit compiler/linker flags, not just the CMake property #7972

# Copyright (C) 2024-2026 Advanced Micro Devices, Inc.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Build and Test with Ryzen AI Sofware
permissions:
contents: read
packages: read
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
inputs:
AIE_COMMIT:
description: 'which aie commit to build'
type: string
required: false
default: ''
schedule:
# Runs at midnight (00:00) every day
- cron: '0 0 * * *'
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-tools-linux-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
jobs:
build-repo:
name: Build and Test with Ryzen AI Software
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu_version: [ "ubuntu22", "ubuntu24" ]
steps:
- name: Free disk space
uses: descriptinc/free-disk-space@1b4b157593c6801212a2ed488c205e0a810b4592 # main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false
- name: Docker prune
shell: bash
run: |
docker system prune -a -f
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: "true"
- uses: uraimo/run-on-arch-action@fd7aa8593480287702b446a273a68f788a9bad3a # v3
name: Build and Test
id: runcmd
with:
distro: none
base_image: ghcr.io/xilinx/mlir-aie/${{ matrix.ubuntu_version }}-ryzenai-1.3.0ea:1.0
githubToken: ${{ github.token }}
dockerRunArgs: |
--mac-address 02:42:ac:11:00:02
env: |
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
run: |
MLIR_DIR=$PWD
pushd /workspace
tar xvf /workspace/ryzen_ai-1.3.0ea1.tgz
pushd /workspace/ryzen_ai-1.3.0
# The ryzen_ai-1.3 wheels are built for python3.10
sed -i 's/python -/python3.10 -/g' install_ryzen_ai_1_3.sh
./install_ryzen_ai_1_3.sh -a yes -p /workspace/venv -l
popd
export LD_LIBRARY_PATH=
export PYTHONPATH=
source /workspace/venv/bin/activate
export LD_LIBRARY_PATH=
source /opt/xilinx/xrt/setup.sh
popd
if [ x"${{ inputs.AIE_COMMIT }}" != x"" ]; then
git reset --hard ${{ inputs.AIE_COMMIT }}
fi
pip install --upgrade pip
pip install onnxruntime==1.17.0
python utils/mlir_aie_wheels/vendor_eudsl.py \
--requirements python/requirements.txt \
--install-non-eudsl
pip install -r python/requirements_ml.txt
# Ryzen AI 1.3 SDK is cp310-only (see python3.10 sed above).
# requirements_dev.lock targets py>=3.11 (drops cibuildwheel 3.x
# transitively); fall back to the loose .txt here.
pip install -r python/requirements_dev.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
cd /workspace
for attempt in 1 2 3; do
rm -f mlir-*.whl
if pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro; then
break
fi
if [ "$attempt" -eq 3 ]; then
echo "Failed to download MLIR wheel after ${attempt} attempts" >&2
exit 1
fi
sleep $((attempt * 5))
done
unzip -q mlir-*.whl
mkdir -p /workspace/install
mkdir -p /workspace/build
pushd /workspace/build
cmake $MLIR_DIR -G Ninja \
-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_VITIS_COMPONENTS='AIE2;AIE2P' \
-DPython3_EXECUTABLE=$(which python) \
-DLLVM_EXTERNAL_LIT=$(which lit) \
-DCMAKE_INSTALL_PREFIX=/workspace/install \
-DCMAKE_MODULE_PATH=$MLIR_DIR/cmake/modulesXilinx \
-DMLIR_DIR=/workspace/mlir/lib/cmake/mlir
ninja install
# filter out slow tests (e.g. create-flows/vecmul_4x4_slow_test.mlir) due to timeout.
export LIT_OPTS="-j1 -sv --timeout 600 --filter-out slow_test"
ninja check-aie
popd