-
Notifications
You must be signed in to change notification settings - Fork 194
220 lines (190 loc) · 10 KB
/
Copy pathbuildAndTestRyzenAIWindows.yml
File metadata and controls
220 lines (190 loc) · 10 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# 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 (Windows)
permissions:
contents: read
on:
# No `push` on main: the merge queue already tests the exact commit that
# merging pushes there, so a postsubmit run re-tests an identical SHA. main is
# admin-enforced with a required merge queue and no force pushes, so nothing
# can reach it without a merge_group run having tested it first. The nightly
# schedule below still covers main for environment drift.
#
# test-ryzen-ai is kept: it is a manual push target that does not go through
# the queue, so it has no merge_group run to inherit.
push:
branches:
- test-ryzen-ai
pull_request:
types: [opened, synchronize, reopened]
merge_group:
schedule:
# Runs at midnight (00:00) every day
- cron: '0 0 * * *'
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-windows-${{ github.event.number || github.sha }}-${{ github.event_name }}
cancel-in-progress: true
env:
# Peano only: Vitis/xchesscc is not part of the supported native-Windows
# toolchain (see docs/buildHostWinNative.md); AIE_BUILD_CHESS_CLANG is
# force-disabled on WIN32 in the top-level CMakeLists.txt regardless.
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, Windows)
# Mirrors buildAndTestRyzenAI.yml's Linux job: build mlir-aie from source
# against a published MLIR wheel and run the lit suite on real NPU
# hardware. Windows has no Makefile (`make`) on PATH by default, so
# Makefile-based programming_examples/programming_guide tests are
# automatically skipped by lit (see the "makefile_examples" feature gate
# in python/aie_lit_utils/lit_config_helpers.py); JIT-style Python
# examples (@iron.jit) still run and cover the NPU end to end.
runs-on: [self-hosted, windows, ryzenai, npu2]
env:
NPU_CACHE_HOME: ${{ github.workspace }}\iron-cache-${{ github.run_id }}
PIP_CACHE_DIR: ${{ github.workspace }}\.pip-cache-${{ github.run_id }}
# Force matplotlib's non-interactive backend: taplib visualize() calls
# plt.show(), which blocks forever on this headless runner (Linux CI has
# no DISPLAY, so it already falls back to Agg).
MPLBACKEND: Agg
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: "true"
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
- name: Verify Python
# actions/setup-python isn't used here: its installer invokes a
# setup.ps1 under Windows PowerShell, which is blocked by this
# runner's default script execution policy. Python 3.13 is already
# provisioned on the runner as a host prerequisite (see
# Windows_runner_setup_mlir-aie.md), matching how the Linux
# self-hosted job also relies on a pre-provisioned interpreter
# instead of actions/setup-python.
shell: cmd
run: |
python --version
if errorlevel 1 exit /b 1
- name: Setup IRON environment
shell: cmd
run: |
REM Avoid git "dubious ownership" rejection when --dev's pre-commit
REM hook install shells out to git in the runner-owned work tree.
git config --global --add safe.directory "%CD%"
if errorlevel 1 exit /b 1
python utils\iron_setup.py --dev
if errorlevel 1 exit /b 1
- name: Download MLIR wheel and build mlir-aie
shell: cmd
run: |
call .\iron_env.cmd
if errorlevel 1 exit /b 1
REM utils\clone-llvm.sh is a bash script; Git for Windows ships its
REM own bash.exe (installed as part of "Git for Windows" in the
REM runner setup guide) that can run it directly. Its bin directory
REM isn't on PATH by default (only Git\cmd, for git.exe itself is),
REM so call it by its default winget install path.
if not exist "C:\Program Files\Git\bin\bash.exe" (
echo ##[error]C:\Program Files\Git\bin\bash.exe not found - install Git for Windows per the runner setup guide
exit /b 1
)
for /f "usebackq delims=" %%v in (`"C:\Program Files\Git\bin\bash.exe" utils/clone-llvm.sh --get-wheel-version`) do set MLIR_VERSION=%%v
if not defined MLIR_VERSION exit /b 1
mkdir my_install
pushd my_install
python -m pip -q download mlir==%MLIR_VERSION% -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
if errorlevel 1 exit /b 1
dir mlir-*.whl
python -c "import zipfile,glob; zipfile.ZipFile(glob.glob('mlir-*.whl')[0]).extractall('.')"
if errorlevel 1 exit /b 1
REM llvm-debuginfod.exe has gone missing post-extraction here (likely
REM AV quarantine); fail early with a clear message, not a later
REM confusing CMake error.
if not exist "mlir\bin\llvm-debuginfod.exe" (
echo ##[error]mlir\bin\llvm-debuginfod.exe is missing after wheel extraction - check endpoint security/antivirus quarantine logs on the runner
dir mlir\bin\llvm-debuginfod* 2>nul
exit /b 1
)
REM LLVMExports.cmake bakes in a diaguids.lib (DIA SDK) path from the
REM VS edition that built the wheel; rewrite it for this runner.
python -c "import sys; sys.path.insert(0, r'..\utils\mlir_aie_wheels\scripts'); from pathlib import Path; import download_mlir; download_mlir._fixup_llvm_diaguids(Path('mlir'))"
if errorlevel 1 exit /b 1
REM Future-dated wheel timestamps make ninja loop; stamp them to the past.
python -c "import os,time; [os.utime(os.path.join(r,f),(315600000,315600000)) for r,_,fs in os.walk('mlir') for f in fs]"
if errorlevel 1 exit /b 1
popd
if not defined PEANO_INSTALL_DIR (
echo ##[error]PEANO_INSTALL_DIR is not set - ensure the runner is provisioned per the runner setup guide
exit /b 1
)
if not exist "%PEANO_INSTALL_DIR%" (
echo ##[error]PEANO_INSTALL_DIR="%PEANO_INSTALL_DIR%" does not exist - check runner provisioning
exit /b 1
)
if not defined XRT_ROOT (
echo ##[error]XRT_ROOT is not set - ensure XRT is installed and XRT_ROOT is set per the runner setup guide
exit /b 1
)
if not exist "%XRT_ROOT%" (
echo ##[error]XRT_ROOT="%XRT_ROOT%" does not exist - check XRT installation on the runner
exit /b 1
)
REM tools/bootgen unconditionally requires OpenSSL (used by aiecc
REM for in-process PDI generation). Per docs/buildHostWinNative.md
REM Addendum B.1, this must be the full Win64 OpenSSL package from
REM Shining Light Productions (NOT the "Light" variant, which lacks
REM dev headers), installed at its default location on the runner.
if not exist "C:\Program Files\OpenSSL-Win64" (
echo ##[error]C:\Program Files\OpenSSL-Win64 not found - install the full Win64 OpenSSL package per docs/buildHostWinNative.md Addendum B.1
exit /b 1
)
for /f "usebackq delims=" %%p in (`python -c "import sys; print(sys.executable)"`) do set PYTHON_EXE=%%p
REM Build with the same script as the Linux job (one source of truth).
REM Wheel is already prepped above, so pass it as arg 1 to skip the
REM script's own download. EXTRA_CMAKE_ARGS carries the Windows-only
REM -D flags; paths are forward-slashed and space-free (OpenSSL via 8.3
REM short name) since the script expands args unquoted.
set "XRT_ROOT_FWD=%XRT_ROOT:\=/%"
set "PYTHON_EXE_FWD=%PYTHON_EXE:\=/%"
set "PEANO_INSTALL_DIR_FWD=%PEANO_INSTALL_DIR:\=/%"
for %%I in ("C:\Program Files\OpenSSL-Win64") do set "OPENSSL_ROOT=%%~sI"
set "OPENSSL_ROOT_FWD=%OPENSSL_ROOT:\=/%"
set "EXTRA_CMAKE_ARGS=-DAIE_ENABLE_PYTHON_PASSES=OFF -DAIE_ENABLE_XRT_PYTHON_BINDINGS=ON -DXRT_ROOT=%XRT_ROOT_FWD% -DPython3_EXECUTABLE=%PYTHON_EXE_FWD% -DOPENSSL_ROOT_DIR=%OPENSSL_ROOT_FWD% -DOPENSSL_USE_STATIC_LIBS=TRUE"
REM arg 4 = provisioned Peano, else the script derives its own.
"C:\Program Files\Git\bin\bash.exe" utils/build-mlir-aie-from-wheels.sh my_install/mlir build install "%PEANO_INSTALL_DIR_FWD%"
if errorlevel 1 exit /b 1
- name: Run tests and examples
shell: cmd
run: |
call .\iron_env.cmd
if errorlevel 1 exit /b 1
if exist "%NPU_CACHE_HOME%" rmdir /s /q "%NPU_CACHE_HOME%"
mkdir "%NPU_CACHE_HOME%"
set XRT_CONTEXT_CACHE_SIZE=2
pushd build
echo ===== Running tests =====
ninja check-aie
if errorlevel 1 exit /b 1
echo ===== Running concurrency tests =====
ninja check-aie-concurrency
if errorlevel 1 exit /b 1
echo ===== Running examples =====
ninja check-reference-designs
if errorlevel 1 exit /b 1
ninja check-programming-guide
if errorlevel 1 exit /b 1
popd
- name: Cleanup workspace
if: always()
shell: cmd
run: |
if exist "%NPU_CACHE_HOME%" rmdir /s /q "%NPU_CACHE_HOME%"
if exist "%PIP_CACHE_DIR%" rmdir /s /q "%PIP_CACHE_DIR%"
REM Fixed-name build trees the next checkout's git-clean can miss on
REM Windows (locked files / long paths); remove them here so a partial
REM clean can't leave a poisoned tree on this persistent runner.
if exist "build" rmdir /s /q "build"
if exist "install" rmdir /s /q "install"
if exist "my_install" rmdir /s /q "my_install"