Force PIE on bootgen to fix PDI-generation segfault #12733
Workflow file for this run
This file contains hidden or 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
| # Copyright (C) 2024-2026 Advanced Micro Devices, Inc. | |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | |
| name: Build wheels for Ryzen AI | |
| permissions: | |
| contents: read | |
| packages: read | |
| on: | |
| pull_request: | |
| workflow_dispatch: | |
| inputs: | |
| AIE_COMMIT: | |
| description: 'AIE commit to build' | |
| type: string | |
| required: false | |
| default: '' | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| schedule: | |
| # At 04:00. (see https://crontab.guru) | |
| - cron: '0 4 * * *' | |
| defaults: | |
| run: | |
| shell: bash | |
| concurrency: | |
| # A PR number if a pull request and otherwise the commit hash (tag pushes, | |
| # schedule, manual dispatch). This cancels queued and in-progress runs for | |
| # the same PR or ref. | |
| group: ci-build-test-ryzenai-experimental-${{ github.event.number || github.sha }} | |
| cancel-in-progress: true | |
| env: | |
| DEBIAN_FRONTEND: noninteractive | |
| VITIS: /opt/ryzen_ai-1.3.0/vitis_aie_essentials | |
| XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic | |
| PIP_RETRIES: "3" | |
| PIP_RESUME_RETRIES: "3" | |
| PIP_TIMEOUT: "60" | |
| PIP_DISABLE_PIP_VERSION_CHECK: "1" | |
| jobs: | |
| build-repo: | |
| name: Build and upload mlir_aie wheels | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write | |
| contents: write | |
| packages: read | |
| attestations: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python_version: "3.11" | |
| ENABLE_RTTI: "ON" | |
| - python_version: "3.11" | |
| ENABLE_RTTI: "OFF" | |
| - python_version: "3.12" | |
| ENABLE_RTTI: "ON" | |
| - python_version: "3.12" | |
| ENABLE_RTTI: "OFF" | |
| - python_version: "3.13" | |
| ENABLE_RTTI: "ON" | |
| - python_version: "3.13" | |
| ENABLE_RTTI: "OFF" | |
| - python_version: "3.14" | |
| ENABLE_RTTI: "ON" | |
| - python_version: "3.14" | |
| ENABLE_RTTI: "OFF" | |
| 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 | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| submodules: "true" | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Compute wheel version on host | |
| id: wheel_version | |
| env: | |
| REF_TYPE: ${{ github.ref_type }} | |
| REF_NAME: ${{ github.ref_name }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "${REF_TYPE}" == "tag" && "${REF_NAME}" == v* ]]; then | |
| VERSION="${REF_NAME#v}" | |
| else | |
| VERSION=$(AIE_WHEEL_KEEP_LOCAL=1 python utils/mlir_aie_wheels/_version_helper.py) | |
| fi | |
| if [[ -z "${VERSION}" ]]; then | |
| echo "::error::computed wheel version is empty" >&2 | |
| exit 1 | |
| fi | |
| if ! [[ "${VERSION}" =~ ^[A-Za-z0-9][A-Za-z0-9.+_-]*$ ]]; then | |
| echo "::error::computed wheel version contains unexpected characters: ${VERSION}" >&2 | |
| exit 1 | |
| fi | |
| echo "Computed AIE_WHEEL_VERSION=${VERSION}" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| - name: Generate wheel artifact name | |
| id: artifact_name | |
| env: | |
| ENABLE_RTTI: ${{ matrix.ENABLE_RTTI }} | |
| PYTHON_VERSION: ${{ matrix.python_version }} | |
| run: echo "name=mlir_aie_rtti_${ENABLE_RTTI}-${PYTHON_VERSION}" >> "${GITHUB_OUTPUT}" | |
| - uses: uraimo/run-on-arch-action@fd7aa8593480287702b446a273a68f788a9bad3a # v3 | |
| name: Build mlir-aie | |
| id: runcmd | |
| with: | |
| distro: none | |
| arch: none | |
| base_image: ghcr.io/xilinx/mlir-aie/ubuntu22-ryzenai-1.3.0ea:1.2 | |
| githubToken: ${{ github.token }} | |
| dockerRunArgs: | | |
| --mac-address 02:42:ac:11:00:02 | |
| env: | | |
| VITIS: ${{ env.VITIS }} | |
| XILINXD_LICENSE_FILE: ${{ env.XILINXD_LICENSE_FILE }} | |
| PIP_RETRIES: ${{ env.PIP_RETRIES }} | |
| PIP_RESUME_RETRIES: ${{ env.PIP_RESUME_RETRIES }} | |
| PIP_TIMEOUT: ${{ env.PIP_TIMEOUT }} | |
| PIP_DISABLE_PIP_VERSION_CHECK: ${{ env.PIP_DISABLE_PIP_VERSION_CHECK }} | |
| AIE_WHEEL_VERSION: ${{ steps.wheel_version.outputs.version }} | |
| run: | | |
| git config --global --add safe.directory $PWD | |
| MLIR_VERSION=$(git rev-parse --short HEAD) | |
| echo "Building mlir-aie version $MLIR_VERSION" | |
| if ! command -v python${{ matrix.python_version }} &> /dev/null; then | |
| echo "Python ${{ matrix.python_version }} not found, installing..." | |
| apt-get update | |
| apt-get install -y software-properties-common | |
| add-apt-repository -y ppa:deadsnakes/ppa | |
| apt-get update | |
| apt-get install -y python${{ matrix.python_version }} python${{ matrix.python_version }}-venv python${{ matrix.python_version }}-dev | |
| fi | |
| python${{ matrix.python_version }} -m venv ${{ github.workspace }}/aie-venv | |
| source ${{ github.workspace }}/aie-venv/bin/activate | |
| echo "Installing vitis_aie_essentials ..." | |
| pushd /opt | |
| tar xfz /workspace/vaie.tgz | |
| popd | |
| pip install --upgrade pip | |
| pip install -r python/requirements_ml.txt | |
| python -m pip install --require-hashes -r python/requirements_dev.lock | |
| export ENABLE_RTTI=${{ matrix.ENABLE_RTTI }} | |
| NO_RTTI="" # Set a default value | |
| NO_RTTI_UNDERSCORE="" # Set a default value | |
| if [ x"$ENABLE_RTTI" == x"OFF" ]; then | |
| NO_RTTI="-no-rtti" | |
| NO_RTTI_UNDERSCORE="_no_rtti" | |
| fi | |
| VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
| for attempt in 1 2 3; do | |
| rm -f mlir*.whl | |
| if pip -q download mlir$NO_RTTI==$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 | |
| # 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$NO_RTTI_UNDERSCORE -exec touch -a -m -t 201108231405.14 {} \; | |
| export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH | |
| export MLIR_INSTALL_ABS_PATH=$PWD/mlir$NO_RTTI_UNDERSCORE | |
| export MLIR_AIE_SOURCE_DIR=$PWD | |
| export WHEELHOUSE_DIR=$PWD/wheelhouse | |
| export CMAKE_MODULE_PATH=$PWD/cmake/modulesXilinx | |
| export XRT_ROOT=/opt/xilinx/xrt | |
| if [ x"${{ inputs.AIE_COMMIT }}" == x"" ]; then | |
| export AIE_PROJECT_COMMIT=$MLIR_VERSION | |
| else | |
| export AIE_PROJECT_COMMIT="${{ inputs.AIE_COMMIT }}" | |
| export AIE_PROJECT_COMMIT="${AIE_PROJECT_COMMIT:0:7}" | |
| fi | |
| export AIE_VITIS_COMPONENTS='AIE2;AIE2P' | |
| export DATETIME=$(date +"%Y%m%d%H") | |
| export AIE_WHEEL_KEEP_LOCAL=1 | |
| pushd utils/mlir_aie_wheels | |
| python -m pip install --require-hashes -r requirements.lock | |
| python -m pip install --require-hashes -r ci-tools.lock | |
| CIBW_ARCHS=x86_64 pip wheel . -v -w $WHEELHOUSE_DIR --no-build-isolation | |
| popd | |
| auditwheel repair -w $WHEELHOUSE_DIR/repaired_wheel $WHEELHOUSE_DIR/mlir_aie*.whl --plat manylinux_2_35_x86_64 --exclude libcdo_driver.so --exclude libmlir_async_runtime.so --exclude libmlir_c_runner_utils.so --exclude libmlir_float16_utils.so --exclude libmlir_runner_utils.so --exclude libmlir_apfloat_wrappers.so | |
| - name: Validate wheel metadata | |
| shell: bash | |
| run: | | |
| python -m pip install --require-hashes -r utils/mlir_aie_wheels/ci-tools.lock | |
| python -m twine check --strict wheelhouse/repaired_wheel/mlir_aie*whl | |
| - name: Set up Python (host) for smoke test | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| allow-prereleases: true | |
| - name: Smoke test wheel in clean venv | |
| shell: bash | |
| run: | | |
| python${{ matrix.python_version }} -m venv /tmp/smoke-venv | |
| /tmp/smoke-venv/bin/python -m pip install --upgrade pip | |
| /tmp/smoke-venv/bin/python -m pip install wheelhouse/repaired_wheel/mlir_aie*whl | |
| /tmp/smoke-venv/bin/python -c 'import aie.ir; import aie.extras; import aie.helpers' | |
| - name: Generate build provenance attestation | |
| if: github.event_name != 'pull_request' | |
| uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1 | |
| with: | |
| subject-path: wheelhouse/repaired_wheel/mlir_aie*whl | |
| - name: Upload mlir_aie | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| path: wheelhouse/repaired_wheel/mlir_aie*whl | |
| name: ${{ steps.artifact_name.outputs.name }} | |
| smoke-test-npu: | |
| name: Smoke-Test Wheel on Ryzen AI | |
| # Verify the 3.12 / RTTI-ON wheel built from THIS run installs via | |
| # env_install.sh/env_setup.sh and can compile + run basic examples on NPU | |
| # hardware. | |
| # The wheel itself is built on ubuntu-latest by build-repo; only this test | |
| # job uses the self-hosted NPU runners. PR-only: the merge queue and | |
| # nightly still get full from-source NPU coverage via buildAndTestRyzenAI. | |
| needs: build-repo | |
| if: ${{ github.event_name == 'pull_request' }} | |
| runs-on: ${{ matrix.runner_type }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runner_type: [ aie2-4col, aie2p-8col ] | |
| env: | |
| # The self-hosted NPU runners ship Ryzen AI 1.3.0.1; override the | |
| # workflow-level VITIS (which points at the ubuntu build container's | |
| # path) so PATH below resolves the on-runner AIE tools. | |
| VITIS: /opt/ryzen_ai-1.3.0.1/vitis_aie_essentials | |
| 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 }} | |
| SMOKE_PYTHON_VERSION: "3.12" | |
| SMOKE_ENABLE_RTTI: "ON" | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| submodules: "true" | |
| # Pull the 3.12 / RTTI-ON wheel built from this same run (build-repo) so | |
| # the examples test exactly this commit's mlir_aie, not a published tag. | |
| - name: Download same-commit mlir_aie wheel | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: mlir_aie_rtti_${{ env.SMOKE_ENABLE_RTTI }}-${{ env.SMOKE_PYTHON_VERSION }} | |
| path: ${{ github.workspace }}/examples-wheel | |
| - name: Print hostname | |
| run: hostname | |
| - name: Run commands | |
| run: | | |
| 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 | |
| export PATH=$VITIS/bin:$VITIS/aietools/bin:$PATH | |
| # Install the same-commit wheel downloaded above instead of the | |
| # published rolling tag. | |
| export MLIR_AIE_WHEEL_DIR="${{ github.workspace }}/examples-wheel" | |
| # Install the runtime env (venv "ironenv" + mlir_aie wheel + Peano) and | |
| # configure the shell against it, using the same scripts users run. | |
| rm -rf ironenv | |
| source utils/env_install.sh | |
| source utils/env_setup.sh | |
| # env_install installs the runtime prerequisites; add the build tooling | |
| # (cmake, ninja, ...) the examples need to compile host code. | |
| python -m pip install --require-hashes -r python/requirements_dev.lock | |
| # Set number of contexts to maintain in cache per process | |
| export XRT_CONTEXT_CACHE_SIZE=2 | |
| # Create runner-specific cache directory | |
| rm -rf $NPU_CACHE_HOME | |
| mkdir $NPU_CACHE_HOME | |
| # Lightweight check that the mlir_aie wheel installed by env_install | |
| # can actually compile and run designs on the NPU. env_setup put the | |
| # installed package (not a from-source build) on PATH/PYTHONPATH, so | |
| # `make run` here exercises the wheel. The -eo pipefail shell fails the | |
| # job if any example returns non-zero. | |
| for ex in basic/passthrough_kernel basic/vector_scalar_add basic/passthrough_dmas; do | |
| echo "===== $ex =====" | |
| make -C "programming_examples/$ex" clean | |
| make -C "programming_examples/$ex" run | |
| done | |
| - name: Cleanup NPU_CACHE_HOME | |
| if: always() | |
| run: | | |
| rm -rf $NPU_CACHE_HOME | |
| rm -rf $PIP_CACHE_DIR | |
| build-windows: | |
| name: Build and upload mlir_aie wheels (Windows) | |
| runs-on: windows-2022 | |
| permissions: | |
| id-token: write | |
| contents: write | |
| packages: read | |
| attestations: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - python_version: "3.11" | |
| ENABLE_RTTI: ON | |
| - python_version: "3.11" | |
| ENABLE_RTTI: OFF | |
| - python_version: "3.12" | |
| ENABLE_RTTI: ON | |
| - python_version: "3.12" | |
| ENABLE_RTTI: OFF | |
| - python_version: "3.13" | |
| ENABLE_RTTI: ON | |
| - python_version: "3.13" | |
| ENABLE_RTTI: OFF | |
| - python_version: "3.14" | |
| ENABLE_RTTI: ON | |
| - python_version: "3.14" | |
| ENABLE_RTTI: OFF | |
| steps: | |
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| submodules: "true" | |
| fetch-depth: 0 | |
| fetch-tags: true | |
| - name: Set up Python | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: ${{ matrix.python_version }} | |
| allow-prereleases: true | |
| - name: Compute wheel version on host | |
| id: wheel_version | |
| shell: bash | |
| env: | |
| REF_TYPE: ${{ github.ref_type }} | |
| REF_NAME: ${{ github.ref_name }} | |
| run: | | |
| set -euo pipefail | |
| if [[ "${REF_TYPE}" == "tag" && "${REF_NAME}" == v* ]]; then | |
| VERSION="${REF_NAME#v}" | |
| else | |
| VERSION=$(AIE_WHEEL_KEEP_LOCAL=1 python utils/mlir_aie_wheels/_version_helper.py) | |
| fi | |
| if [[ -z "${VERSION}" ]]; then | |
| echo "::error::computed wheel version is empty" >&2 | |
| exit 1 | |
| fi | |
| if ! [[ "${VERSION}" =~ ^[A-Za-z0-9][A-Za-z0-9.+_-]*$ ]]; then | |
| echo "::error::computed wheel version contains unexpected characters: ${VERSION}" >&2 | |
| exit 1 | |
| fi | |
| echo "Computed AIE_WHEEL_VERSION=${VERSION}" | |
| echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" | |
| - name: Set up MSVC dev environment | |
| uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1 | |
| with: | |
| arch: x64 | |
| # We don't get OpenSSL for free on Windows. Manage the pain. | |
| # Try vcpkg's GHA cache to avoid building OpenSSL for every matrix element. | |
| - name: Enable vcpkg binary caching | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL) | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN) | |
| - name: Install OpenSSL | |
| shell: pwsh | |
| run: | | |
| $vcpkgRoot = $env:VCPKG_INSTALLATION_ROOT | |
| if ($vcpkgRoot) { | |
| $vcpkg = Join-Path $vcpkgRoot "vcpkg.exe" | |
| } else { | |
| $vcpkg = (Get-Command vcpkg.exe -ErrorAction Stop).Source | |
| $vcpkgRoot = Split-Path -Parent $vcpkg | |
| } | |
| Remove-Item Env:VCPKG_ROOT -ErrorAction SilentlyContinue | |
| $env:VCPKG_BINARY_SOURCES = "clear;x-gha,readwrite" | |
| & $vcpkg install openssl:x64-windows-static | |
| "OPENSSL_ROOT_DIR=$($vcpkgRoot.Replace('\','/'))/installed/x64-windows-static" | | |
| Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
| - name: Stage XRT SDK | |
| shell: pwsh | |
| run: | | |
| $url = 'https://github.com/Xilinx/XRT/releases/download/2.21.75/xrt_windows_sdk.zip' | |
| for ($attempt = 1; $attempt -le 3; $attempt++) { | |
| try { | |
| Invoke-WebRequest -Uri $url -OutFile xrt_windows_sdk.zip | |
| break | |
| } catch { | |
| if ($attempt -eq 3) { throw } | |
| Start-Sleep -Seconds 5 | |
| } | |
| } | |
| Expand-Archive -Path xrt_windows_sdk.zip -DestinationPath xrt_windows_sdk -Force | |
| New-Item -ItemType Directory -Path C:\Xilinx -Force | Out-Null | |
| Copy-Item xrt_windows_sdk\xrt_sdk\xrt C:\Xilinx\XRT -Recurse -Force | |
| "XRT_ROOT=C:/Xilinx/XRT" >> $env:GITHUB_ENV | |
| - name: Build mlir-aie wheel | |
| shell: bash | |
| env: | |
| AIE_WHEEL_VERSION: ${{ steps.wheel_version.outputs.version }} | |
| ENABLE_RTTI: ${{ matrix.ENABLE_RTTI }} | |
| CMAKE_GENERATOR: Ninja | |
| CMAKE_ARGS: -DAIE_BUILD_CHESS_CLANG=OFF -DOPENSSL_USE_STATIC_LIBS=TRUE -DAIE_ENABLE_XRT_PYTHON_BINDINGS=OFF | |
| run: | | |
| set -euo pipefail | |
| # No Vitis on Windows! | |
| unset VITIS XILINXD_LICENSE_FILE || true | |
| git config --global --add safe.directory "$PWD" | |
| MLIR_VERSION=$(git rev-parse --short HEAD) | |
| echo "Building mlir-aie version $MLIR_VERSION" | |
| python -m venv aie-venv | |
| source aie-venv/Scripts/activate | |
| python -m pip install --upgrade pip | |
| pip install -r python/requirements_ml.txt | |
| python -m pip install --require-hashes -r python/requirements_dev.lock | |
| export ENABLE_RTTI="${ENABLE_RTTI}" | |
| NO_RTTI="" # Set a default value | |
| NO_RTTI_UNDERSCORE="" # Set a default value | |
| if [ x"$ENABLE_RTTI" == x"OFF" ]; then | |
| NO_RTTI="-no-rtti" | |
| NO_RTTI_UNDERSCORE="_no_rtti" | |
| fi | |
| VERSION=$(utils/clone-llvm.sh --get-wheel-version) | |
| # Grab the MLIR distro wheel and extract | |
| for attempt in 1 2 3; do | |
| rm -f mlir*.whl | |
| if pip -q download "mlir${NO_RTTI}==${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 | |
| python -m zipfile -e mlir*.whl . | |
| # Normalize timestamps on the unpacked MLIR wheel so ccache hashes stay stable | |
| # across runs. Per-file `find -exec touch ... \;` blows MSYS bash's env-block | |
| # limit on the Windows runner ("find: The environment is too large for exec()") | |
| # because each spawned `touch` inherits the giant Visual Studio INCLUDE/LIB/Path | |
| # block. One python process avoids the per-file fork and the env explosion. | |
| python -c "import os, pathlib; ts = 1314108314; [os.utime(p, (ts, ts)) for p in pathlib.Path('mlir${NO_RTTI_UNDERSCORE}').rglob('*')]" | |
| # Match Linux wheel version metadata on non-tag builds. | |
| export DATETIME=$(date +"%Y%m%d%H") | |
| if [ x"${{ inputs.AIE_COMMIT }}" == x"" ]; then | |
| export AIE_PROJECT_COMMIT=$MLIR_VERSION | |
| else | |
| export AIE_PROJECT_COMMIT="${{ inputs.AIE_COMMIT }}" | |
| export AIE_PROJECT_COMMIT="${AIE_PROJECT_COMMIT:0:7}" | |
| fi | |
| export AIE_VITIS_COMPONENTS='AIE2;AIE2P' | |
| export AIE_WHEEL_KEEP_LOCAL=1 | |
| # Try to always forward slash paths. | |
| ROOT_WIN=$(python -c "import os; print(os.getcwd().replace('\\\\', '/'))") | |
| export MLIR_INSTALL_ABS_PATH="${ROOT_WIN}/mlir${NO_RTTI_UNDERSCORE}" | |
| export MLIR_AIE_SOURCE_DIR="${ROOT_WIN}" | |
| export WHEELHOUSE_DIR="${ROOT_WIN}/wheelhouse" | |
| export CMAKE_MODULE_PATH="${ROOT_WIN}/cmake/modulesXilinx" | |
| mkdir -p "${WHEELHOUSE_DIR}" | |
| pushd utils/mlir_aie_wheels | |
| python -m pip install --require-hashes -r requirements.lock | |
| python -m pip install --require-hashes -r ci-tools.lock | |
| CIBW_ARCHS=AMD64 pip wheel . -v -w "${WHEELHOUSE_DIR}" --no-build-isolation | |
| popd | |
| # Try to repair the wheel on Windows using delvewheel (closest auditwheel equivalent). | |
| pip install delvewheel | |
| python -m delvewheel repair --ignore-existing --analyze-existing-exes -w "${WHEELHOUSE_DIR}/repaired_wheel" "${WHEELHOUSE_DIR}"/mlir_aie*.whl | |
| - name: Validate wheel metadata | |
| shell: bash | |
| run: | | |
| python -m pip install --require-hashes -r utils/mlir_aie_wheels/ci-tools.lock | |
| python -m twine check --strict wheelhouse/repaired_wheel/mlir_aie*whl | |
| - name: Smoke test wheel in clean venv | |
| shell: bash | |
| run: | | |
| python -m venv /tmp/smoke-venv | |
| /tmp/smoke-venv/Scripts/python -m pip install --upgrade pip | |
| /tmp/smoke-venv/Scripts/python -m pip install wheelhouse/repaired_wheel/mlir_aie*whl | |
| /tmp/smoke-venv/Scripts/python -c 'import aie.ir; import aie.extras; import aie.helpers' | |
| - name: Generate build provenance attestation | |
| if: github.event_name != 'pull_request' | |
| uses: actions/attest-build-provenance@0f67c3f4856b2e3261c31976d6725780e5e4c373 # v4.1.1 | |
| with: | |
| subject-path: wheelhouse/repaired_wheel/mlir_aie*whl | |
| - name: Upload mlir_aie | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| path: wheelhouse/repaired_wheel/mlir_aie*whl | |
| name: mlir_aie_windows_rtti_${{ matrix.ENABLE_RTTI }}-${{ matrix.python_version }} | |
| publish: | |
| name: Publish wheels | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| github.event_name == 'schedule' || | |
| (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) | |
| runs-on: ubuntu-latest | |
| needs: [build-repo, build-windows] | |
| permissions: | |
| contents: write | |
| actions: read | |
| steps: | |
| - name: Checkout rehearsal script + ci-tools.lock | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| sparse-checkout: | | |
| utils/mlir_aie_wheels/scripts/pypi_rehearsal.sh | |
| utils/mlir_aie_wheels/ci-tools.lock | |
| - name: Download wheels (RTTI ON) | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| pattern: mlir_aie*_rtti_ON-* | |
| path: wheels_on | |
| merge-multiple: true | |
| - name: Download wheels (RTTI OFF) | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| pattern: mlir_aie*_rtti_OFF-* | |
| path: wheels_off | |
| merge-multiple: true | |
| - name: Flatten wheels (RTTI ON) | |
| run: | | |
| set -euo pipefail | |
| mkdir -p wheels_on_flat | |
| find wheels_on -name 'mlir_aie*whl' -exec cp -f {} wheels_on_flat/ \; | |
| - name: Flatten wheels (RTTI OFF) | |
| run: | | |
| set -euo pipefail | |
| mkdir -p wheels_off_flat | |
| find wheels_off -name 'mlir_aie*whl' -exec cp -f {} wheels_off_flat/ \; | |
| - name: Set up Python (host) for rehearsal | |
| uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: '3.12' | |
| - name: PyPI publish rehearsal (RTTI ON) | |
| shell: bash | |
| run: | | |
| python -m pip install --require-hashes -r utils/mlir_aie_wheels/ci-tools.lock | |
| bash utils/mlir_aie_wheels/scripts/pypi_rehearsal.sh wheels_on_flat wheels_on_stripped 'buildRyzenWheels / RTTI ON' | |
| - name: PyPI publish rehearsal (RTTI OFF) | |
| shell: bash | |
| run: | | |
| bash utils/mlir_aie_wheels/scripts/pypi_rehearsal.sh wheels_off_flat wheels_off_stripped 'buildRyzenWheels / RTTI OFF' | |
| - name: Combine wheels | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| set -euo pipefail | |
| mkdir -p wheels_all | |
| cp wheels_on_flat/mlir_aie*whl wheels_all/ | |
| cp wheels_off_flat/mlir_aie*whl wheels_all/ | |
| - name: Release | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 | |
| with: | |
| artifacts: wheels_all/mlir_aie*whl | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| tag: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| allowUpdates: true | |
| replacesArtifacts: true | |
| omitBodyDuringUpdate: true | |
| prerelease: ${{ contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta') }} | |
| makeLatest: ${{ !(contains(github.ref_name, 'rc') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'beta')) }} | |
| - name: Release latest wheels (RTTI ON) | |
| # Only publish from the nightly schedule or an intentional manual | |
| # refresh. Excludes pull_request so PRs no longer overwrite the shared | |
| # rolling tag with unmerged branch content. | |
| if: ${{ contains(fromJSON('["schedule","workflow_dispatch"]'), github.event_name) }} | |
| uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 | |
| with: | |
| artifacts: wheels_on_flat/mlir_aie*whl | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| tag: latest-wheels-4 | |
| name: latest-wheels-4 | |
| allowUpdates: true | |
| replacesArtifacts: false | |
| omitBodyDuringUpdate: true | |
| makeLatest: false | |
| - name: Release latest wheels (RTTI OFF) | |
| if: ${{ contains(fromJSON('["schedule","workflow_dispatch"]'), github.event_name) }} | |
| uses: ncipollo/release-action@339a81892b84b4eeb0f6e744e4574d79d0d9b8dd # v1.21.0 | |
| with: | |
| artifacts: wheels_off_flat/mlir_aie*whl | |
| token: "${{ secrets.GITHUB_TOKEN }}" | |
| tag: latest-wheels-no-rtti-2 | |
| name: latest-wheels-no-rtti-2 | |
| allowUpdates: true | |
| replacesArtifacts: false | |
| omitBodyDuringUpdate: true | |
| makeLatest: false |