-
Notifications
You must be signed in to change notification settings - Fork 87
207 lines (164 loc) · 6.96 KB
/
buildRyzenWheels.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
195
196
197
198
199
200
201
202
203
204
205
206
207
name: Build wheels on/for Ryzen AI
on:
pull_request:
workflow_dispatch:
merge_group:
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. This cancels
# queued and in-progress runs for the same PR (presubmit) or commit
# (postsubmit).
group: ci-build-test-ryzenai-experimental-${{ github.event.number || github.sha }}
cancel-in-progress: true
env:
DEBIAN_FRONTEND: noninteractive
XILINXD_LICENSE_FILE: /opt/xilinx/Xilinx.lic
jobs:
build-repo:
name: Build and upload mlir_aie wheels
runs-on: amd7940hs
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
with:
submodules: "true"
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build mlir-aie distro
run: |
pip cache purge
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
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 -exec touch -a -m -t 201108231405.14 {} \;
export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH
export MLIR_INSTALL_ABS_PATH=$PWD/mlir
export MLIR_AIE_SOURCE_DIR=$PWD
export WHEELHOUSE_DIR=$PWD/wheelhouse
export CMAKE_MODULE_PATH=$PWD/cmake/modulesXilinx
export XRT_ROOT=/opt/xilinx/xrt
export AIE_PROJECT_COMMIT=$(git rev-parse --short HEAD)
export DATETIME=$(date +"%Y%m%d%H")
pushd utils/mlir_aie_wheels
pip install wheel auditwheel patchelf importlib_metadata
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_float16_utils.so
WHL_FN=$(ls $WHEELHOUSE_DIR/repaired_wheel/mlir_aie*whl)
mv "$WHL_FN" "`echo $WHL_FN | sed "s/cp310-cp310/py3-none/"`"
- name: Upload mlir_aie
uses: actions/upload-artifact@v3
with:
path: wheelhouse/repaired_wheel/mlir_aie*whl
name: mlir_aie
- name: Release current commit
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
uses: ncipollo/[email protected]
with:
artifacts: wheelhouse/repaired_wheel/mlir_aie*whl
token: "${{ secrets.GITHUB_TOKEN }}"
tag: 'latest-wheels'
name: 'latest-wheels'
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
build-wheel:
name: Build wheel
runs-on: amd7940hs
needs: build-repo
permissions:
id-token: write
contents: write
strategy:
fail-fast: false
matrix:
python_version: [
# "3.8", "3.9",
"3.10",
# "3.11", "3.12"
]
steps:
- name: Get the project repository
uses: actions/checkout@v4
with:
fetch-depth: 2
submodules: "true"
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: mlir_aie
path: .
- name: Build mlir-aie python bindings
run: |
# faster to do this twice instead of upload the directory with ~4000 files in it...
VERSION=$(utils/clone-llvm.sh --get-wheel-version)
pip -q download mlir==$VERSION \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/mlir-distro
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 -exec touch -a -m -t 201108231405.14 {} \;
unzip -q mlir_aie-*.whl
find mlir_aie -exec touch -a -m -t 201108231405.14 {} \;
python -m venv aie-venv
source aie-venv/bin/activate
pip install -r python/requirements.txt
source aie-venv/bin/activate
export MLIR_INSTALL_ABS_PATH=$PWD/mlir
export MLIR_AIE_INSTALL_ABS_PATH=$PWD/mlir_aie
export WHEELHOUSE_DIR=$PWD/wheelhouse
export CMAKE_MODULE_PATH=$PWD/cmake/modulesXilinx
export PATH=/opt/Xilinx/Vitis/2023.2/bin:/opt/Xilinx/Vitis/2023.2/aietools/bin:$PATH
export XRT_ROOT=/opt/xilinx/xrt
export AIE_PROJECT_COMMIT=$(git rev-parse --short HEAD)
export DATETIME=$(date +"%Y%m%d%H")
cp python/requirements.txt utils/mlir_aie_wheels/python_bindings
pushd utils/mlir_aie_wheels/python_bindings
pip install wheel auditwheel patchelf
CIBW_ARCHS=x86_64 pip wheel . -v -w $WHEELHOUSE_DIR --no-build-isolation
DEBUG=1 CIBW_ARCHS=x86_64 pip wheel . -v -w $WHEELHOUSE_DIR --no-build-isolation
popd
auditwheel repair -w $WHEELHOUSE_DIR/repaired_wheel $WHEELHOUSE_DIR/aie_python_bindings*whl --plat manylinux_2_35_x86_64
- uses: geekyeggo/delete-artifact@v4
if: github.event_name == 'pull_request'
with:
name: mlir_aie
- name: Upload wheels
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
uses: actions/upload-artifact@v3
with:
path: wheelhouse/repaired_wheel/aie_python_bindings*.whl
name: ryzen_ai_wheel
- name: Release current commit
if: github.event_name == 'workflow_dispatch' || github.event_name == 'schedule'
uses: ncipollo/[email protected]
with:
artifacts: wheelhouse/repaired_wheel/aie_python_bindings*.whl
token: "${{ secrets.GITHUB_TOKEN }}"
tag: 'latest-wheels'
name: 'latest-wheels'
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true