Skip to content

Force PIE on bootgen to fix PDI-generation segfault #15197

Force PIE on bootgen to fix PDI-generation segfault

Force PIE on bootgen to fix PDI-generation segfault #15197

# Copyright (C) 2023-2026 Advanced Micro Devices, Inc.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
name: Build and Test with AIE tools on Ryzen AI
permissions:
contents: read
on:
push:
branches:
- main
- test-ryzen-ai
pull_request:
types: [opened, synchronize, reopened]
merge_group:
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-${{ 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.1/vitis_aie_essentials
# ccache and lld are auto-detected and enabled by
# utils/build-mlir-aie-from-wheels.sh (LLVM_CCACHE_BUILD / LLVM_USE_LINKER),
# so only the options the script does not set itself are listed here.
CMAKE_ARGS: |
-DXRT_ROOT=/opt/xilinx/xrt \
-DAIE_ENABLE_PYTHON_PASSES=OFF \
-DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON \
LIT_OPTS: -sv --time-tests --timeout 600 --show-unsupported --show-excluded
jobs:
build-and-test-from-source:
name: Run Tests and Examples on Ryzen AI (Built from Source)
# The goal for this job is to run the full test suite, including programming guide and examples, on a freshly built-from-source MLIR-AIE.
# This also exercises the build-mlir-aie-from-wheels.sh script, which is the most common developer-facing way to rebuild MLIR-AIE from source.
runs-on: ${{ matrix.runner_type }}
strategy:
fail-fast: false
matrix:
runner_type: [ aie2-4col, aie2p-8col ]
env:
NPU_CACHE_HOME: ${{ github.workspace }}/iron-cache-${{ matrix.runner_type }}-${{ github.run_id }}
PIP_CACHE_DIR: ${{ github.workspace }}/.pip-cache-${{ matrix.runner_type }}-${{ github.run_id }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: "true"
- name: Print hostname
run: hostname
- name: Setup virtual environment / prerequisites
run: |
source ./utils/env_install.sh aie-venv --dev --extras
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 100/g' \
$(python -c 'import site; print(site.getsitepackages()[0])')/jupyter_client/runapp.py
- name: Run commands
run: |
# aie2-4col runners occasionally hit a transient NPU hardware fault
# (DRM_IOCTL_AMDXDNA_EXEC_CMD I/O error). Re-run the whole step once,
# ONLY on aie2-4col when that specific error appears in the output.
if [ -z "$STEP_RETRIED" ]; then
export STEP_RETRIED=1
log=$(mktemp)
bash -eo pipefail "$0" 2>&1 | tee "$log" && exit 0
if [ "${{ matrix.runner_type }}" = "aie2-4col" ] && \
grep -qF "DRM_IOCTL_AMDXDNA_EXEC_CMD IOCTL failed (err=-5): Input/output error" "$log"; then
echo "::warning::Transient NPU fault detected; retrying the step once"
exec bash -eo pipefail "$0"
fi
exit 1
fi
sudo prlimit -lunlimited --pid $$
# Newer XRT/amdxdna packages no longer ship setup.sh; source it
# only when present so the job works on both old and new XRT.
[ -f /opt/xilinx/xrt/setup.sh ] && source /opt/xilinx/xrt/setup.sh
source aie-venv/bin/activate
# -j here to reduce the number of parallel chess jobs.
# Pick parallelism from the runner's actual RAM rather than its
# label, so backup runners that share a label but have less memory
# don't OOM: -j4 for <48GB RAM, -j12 otherwise.
TOTAL_MEM_GB=$(free -g | awk '/^Mem:/ {print $2}')
if [ "$TOTAL_MEM_GB" -lt 48 ]; then
LIT_OPTS="-j4 $LIT_OPTS"
else
LIT_OPTS="-j12 $LIT_OPTS"
fi
export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH
# Build from source!
export EXTRA_CMAKE_ARGS="-DPython3_EXECUTABLE=$(which python) $CMAKE_ARGS"
./utils/build-mlir-aie-from-wheels.sh "" build mlir_aie
pushd build
# Create runner-specific cache directory
rm -rf $NPU_CACHE_HOME
mkdir $NPU_CACHE_HOME
# Set number of contexts to maintain in cache per process
export XRT_CONTEXT_CACHE_SIZE=2
# Run tests
echo "===== Running tests ====="
ninja check-aie
echo "===== Running concurrency tests ====="
ninja check-aie-concurrency
# Run examples
echo "===== Running examples ====="
# gemm_asymmetric_tile_buffering chess builds peak ~8 GB RSS and
# ~9 min wall time alone on 32 GB. They run serialized via lit's
# atb_chess parallelism group and need a longer timeout than the
# rest of the suite. Split into two invocations so the timeout
# extension applies only to those tests.
LIT_FILTER_OUT="gemm_asymmetric_tile_buffering" ninja check-reference-designs
ninja check-programming-guide
LIT_OPTS="-j4 -sv --time-tests --timeout 1200 --show-unsupported --show-excluded" \
LIT_FILTER="gemm_asymmetric_tile_buffering" \
ninja check-reference-designs
popd
- name: Cleanup NPU_CACHE_HOME
if: always()
run: |
rm -rf $NPU_CACHE_HOME
rm -rf $PIP_CACHE_DIR