-
Notifications
You must be signed in to change notification settings - Fork 29
194 lines (173 loc) · 6.09 KB
/
ci-windows.yml
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
name: CI Windows
on:
workflow_call:
workflow_dispatch:
inputs:
force_debug_with_tmate:
type: boolean
description: 'Run the build with tmate session'
required: false
default: false
debug_with_tmate:
type: boolean
description: 'Run the build with a tmate session ONLY in case of failure'
required: false
default: false
force_ccache:
type: boolean
description: 'Force save ccache'
required: false
default: false
pull_request:
merge_group:
push:
branches:
- main
concurrency:
group: ci-build-test-cpp-windows-${{ github.event.number || github.sha }}
cancel-in-progress: true
jobs:
build_and_ctest:
name: Build and Test (windows, ASSERTIONS)
runs-on: windows-2019
strategy:
fail-fast: true
env:
CACHE_DIR: ${{ github.workspace }}/.container-cache
CACHE_KEY: windows-build-test-cpp-asserts-v1-${{ format('{0}-{1}', github.ref_name, github.run_number) }}
defaults:
run:
shell: powershell
steps:
- name: Set unified TZ
uses: szenius/set-timezone@v2.0
with:
# this is an arbitrary choice
timezoneLinux: "Asia/Singapore"
timezoneMacos: "Asia/Singapore"
timezoneWindows: "Singapore Standard Time"
- name: "Checking out repository"
env:
BRANCH_NAME: ${{ github.ref }}
REPO_ADDRESS: ${{ github.server_url }}/${{ github.repository }}
shell: bash
run: |
git init
git remote add origin $REPO_ADDRESS
git -c protocol.version=2 fetch --depth 1 origin $BRANCH_NAME
git reset --hard FETCH_HEAD
git -c submodule."third_party/torch-mlir".update=none -c submodule."third_party/stablehlo".update=none -c submodule."src/runtime_src/core/common/aiebu".update=none submodule update --init --recursive --depth 1 --single-branch -j 10
- name: Setup Cpp
uses: aminya/setup-cpp@v1
with:
compiler: llvm
vcvarsall: true
cmake: true
ninja: true
ccache: true
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Python deps
run: |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind
- name: Enable cache
uses: actions/cache/restore@v3
with:
path: ${{ env.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}
restore-keys: windows-build-test-cpp-
- name: Build packages
run: |
$env:cache_dir = "${{ env.CACHE_DIR }}"
$env:CCACHE_COMPILERCHECK = "string:$(clang-cl.exe --version)"
.\build_tools\build_llvm.ps1
# Remove-Item -Path "$pwd\llvm-build" -Force
$env:llvm_install_dir = "$pwd\llvm-install"
echo $env:llvm_install_dir
.\build_tools.\build_test_cpp.ps1
- name: Create artifacts
if: ${{ !cancelled() }}
run: |
pushd third_party/iree/third_party/llvm-project
$llvm_sha_short = "$(git rev-parse --short HEAD)"
popd
tar cf llvm-dist-windows-$llvm_sha_short.tar llvm-install
tar cf iree-dist-windows.tar iree-install
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: windows_x86_64_llvm_packages
path: llvm-dist-*.tar
if-no-files-found: warn
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: windows_x86_64_iree_packages
path: iree-dist-windows.tar
if-no-files-found: warn
- name: Save cache
uses: actions/cache/save@v3
if: ${{ !cancelled() && (inputs.force_ccache || github.event_name == 'push' && github.ref_name == 'main') }}
with:
path: ${{ env.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}
- name: Start tmate session
if: ${{ (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate }}
uses: mxschmitt/action-tmate@v3.18
with:
limit-access-to-actor: true
test_windows:
name: E2E Test windows
runs-on: windows-phoenix
needs: build_and_ctest
env:
XILINX_XRT: "C:\\Xilinx\\XRT"
steps:
- name: "Checking out repository" # for test scripts
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0
with:
submodules: false # not required for testbench
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: windows_x86_64_iree_packages
- name: Extract artifact
run: |
tar -xvf iree-dist-windows.tar
Add-Content -Path $env:GITHUB_ENV -Value "IREE_INSTALL_DIR=$PWD\iree-install"
Add-Content -Path $env:GITHUB_ENV -Value "PYTHONPATH=$PWD\iree-install\python_packages\iree_compiler;$PWD\iree-install\python_packages\iree_runtime"
.\build_tools\download_peano.ps1
Add-Content -Path $env:GITHUB_ENV -Value "PEANO_INSTALL_DIR=$PWD\llvm-aie"
- name: Create venv and install dependencies
run: |
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r tests\requirements.txt
- name: E2E correctness matmul test
shell: bash
run: |
source .venv/Scripts/activate
bash build_tools/ci/run_matmul_test.sh \
/c/test_matmuls \
$PWD/iree-install \
$PWD/llvm-aie
- name : E2E comparison of AIE to llvm-cpu
shell: bash
run: |
source .venv/Scripts/activate
python build_tools/ci/cpu_comparison/run.py \
/c/test_aie_vs_cpu \
$PWD/iree-install \
$PWD/llvm-aie -v
- name: Python tests
run: |
ls $env:XILINX_XRT
.\.venv\Scripts\Activate.ps1
mkdir temp
pytest tests -sv `
--basetemp=$PWD\temp `
--iree-install-dir="$PWD/iree-install" `
--peano-install-dir="$PWD/llvm-aie"