-
Notifications
You must be signed in to change notification settings - Fork 27
288 lines (240 loc) · 8.82 KB
/
distro.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: Distro
on:
workflow_dispatch:
inputs:
DEBUG_ENABLED:
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
type: boolean
required: false
default: false
DEBUG_OS:
description: 'which runner os to run the tmate action in (if the tmate action is run)'
type: string
default: 'windows-2019'
required: false
DEBUG_ARCH:
description: 'which runner arch to run the tmate action in (if the tmate action is run)'
type: string
default: 'x86_64'
required: false
DEBUG_DETACHED:
description: 'whether to launch tmate in detached mode (if the tmate action is run)'
type: boolean
required: false
default: true
AIR_COMMIT:
description: 'which air commit to build'
type: string
required: false
default: ''
pull_request:
release:
types:
- published
jobs:
build_wheels:
name: ${{ matrix.OS }} ${{ matrix.ARCH }}
continue-on-error: true
runs-on: ${{ matrix.OS }}
strategy:
fail-fast: false
matrix:
include:
- OS: ubuntu-20.04
ARCH: x86_64
- OS: ubuntu-20.04
ARCH: aarch64
- OS: macos-11
ARCH: x86_64
- OS: macos-11
ARCH: arm64
# - OS: windows-2019
# ARCH: AMD64
steps:
# Enable tmate debugging of manually-triggered workflows if the input option was provided
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.DEBUG_ENABLED && inputs.DEBUG_OS == matrix.OS && inputs.DEBUG_ARCH == matrix.ARCH }}
with:
limit-access-to-actor: true
detached: ${{ inputs.DEBUG_DETACHED }}
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: Xilinx/mlir-air
ref: ${{ inputs.AIR_COMMIT != '' && inputs.AIR_COMMIT || 'main' }}
submodules: recursive
path: mlir-air
- uses: ilammy/[email protected]
if: ${{ matrix.OS == 'windows-2019' }}
- name: Set up Visual Studio shell
if: ${{ matrix.OS == 'windows-2019' }}
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: MS Build
if: ${{ matrix.OS == 'windows-2019' }}
uses: microsoft/[email protected]
- name: Free disk space
if: contains(matrix.OS, 'ubuntu')
uses: jlumbroso/free-disk-space@76866dbe54312617f00798d1762df7f43def6e5c # v1.2.0
with:
android: true
dotnet: true
haskell: true
large-packages: true
swap-storage: false # This frees space on the wrong partition.
tool-cache: false # This includes Python, which we need.
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ github.job }}-${{ matrix.OS }}-${{ matrix.ARCH }} # Make cache specific to OS
max-size: "5G"
- name: Configure ccache dir on host
id: configure_ccache_dir_on_host
if: ${{ matrix.OS == 'ubuntu-20.04' }}
run: |
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
mkdir -p $HOST_CCACHE_DIR
echo "HOST_CCACHE_DIR=$HOST_CCACHE_DIR" | tee -a $GITHUB_ENV
echo "HOST_CCACHE_DIR=$HOST_CCACHE_DIR" | tee -a $GITHUB_OUTPUT
- name: Configure ccache
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
shell: bash
run: |
if [ x"${{ matrix.OS }}" == x"macos-11" ]; then
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
else
echo "/usr/lib/ccache:/usr/lib64/ccache:/usr/lib/ccache/bin" >> $GITHUB_PATH
fi
- name: Install Ninja
uses: llvm/actions/install-ninja@6a57890d0e3f9f35dfc72e7e48bc5e1e527cdd6c # Jan 17
- name: Install cross-compilation toolchain
if: ${{ matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'aarch64' }}
run: |
sudo apt-get update
sudo apt-get install -y binutils-aarch64-linux-gnu \
g++-aarch64-linux-gnu gcc-aarch64-linux-gnu
- name: set datetime
shell: bash
run: |
DATETIME=$(date +"%Y%m%d%H")
echo "DATETIME=${DATETIME}" | tee -a $GITHUB_ENV
# https://stackoverflow.com/a/73467112
- name: Split os
shell: bash
env:
OS: ${{ matrix.OS }}
id: split
run: echo "platform_version=${OS##*-}" | tee -a $GITHUB_OUTPUT
- name: Install boost
uses: MarkusJx/[email protected]
id: install-boost
with:
boost_version: 1.72.0
platform_version: ${{ steps.split.outputs.platform_version }}
arch: ${{ matrix.ARCH == 'x86_64' && 'x86' || 'aarch64' }}
- name: cibuildwheel
if: ${{ matrix.OS != 'ubuntu-20.04' || matrix.ARCH != 'aarch64' }}
shell: bash
run: |
pip install cibuildwheel
BOOST_ROOT="${{ steps.install-boost.outputs.BOOST_ROOT }}" \
CIBW_ARCHS=${{ matrix.ARCH }} \
CMAKE_GENERATOR="Ninja" \
HOST_CCACHE_DIR=${{ steps.configure_ccache_dir_on_host.outputs.HOST_CCACHE_DIR }} \
MATRIX_OS=${{ matrix.OS }} \
MLIR_WHEEL_VERSION="18.0.0.2023091015+780b046b" \
MLIR_AIE_WHEEL_VERSION="0.0.1.2023091105+a0cc3d0" \
PARALLEL_LEVEL=${{ matrix.OS == 'windows-2019' && '2' || '4' }} \
cibuildwheel --output-dir wheelhouse
- name: build aarch ubuntu wheel
shell: bash
if: ${{ matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'aarch64' }}
run: |
sudo apt-get install -y python3-dev
export PIP_NO_BUILD_ISOLATION="false"
export CIBW_ARCHS=${{ matrix.ARCH }}
export MLIR_WHEEL_VERSION="18.0.0.2023091015+780b046b"
export MLIR_AIE_WHEEL_VERSION="0.0.1.2023091105+a0cc3d0"
export BOOST_ROOT="${{ steps.install-boost.outputs.BOOST_ROOT }}"
export MATRIX_OS=${{ matrix.OS }}
pip install -r requirements.txt
./scripts/pip_install_mlir.sh
./scripts/pip_install_mlir_aie.sh
CMAKE_GENERATOR=Ninja \
pip wheel . -v -w wheelhouse --no-build-isolation \
-f https://makslevental.github.io/wheels \
-f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels \
-f https://github.com/Xilinx/mlir-air/releases/expanded_assets/latest-wheels
- name: rename
shell: bash
if: ${{ matrix.OS == 'ubuntu-20.04' || matrix.OS == 'macos-11' }}
run: |
if [ x"${{ matrix.OS }}" == x"macos-11" ]; then
brew install rename
else
sudo apt-get install -y rename
fi
rename 's/cp310-cp310/py3-none/' wheelhouse/mlir_air-*whl
rename 's/cp311-cp311/py3-none/' wheelhouse/mlir_air-*whl
if [ x"${{ matrix.OS }}" == x"ubuntu-20.04" ] && [ x"${{ matrix.ARCH }}" == x"aarch64" ]; then
rename 's/x86_64/aarch64/' wheelhouse/mlir_air-*whl
fi
- name: rename
if: ${{ matrix.OS == 'windows-2019' }}
run: |
ls wheelhouse/mlir_air-*whl | Rename-Item -NewName {$_ -replace 'cp311-cp311', 'py3-none' }
- name: Download cache from container ubuntu
if: (matrix.OS == 'ubuntu-20.04' && matrix.ARCH == 'x86_64') && (success() || failure())
shell: bash
run: |
ccache -s
HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"
rm -rf $HOST_CCACHE_DIR
mv ./wheelhouse/.ccache $HOST_CCACHE_DIR
ls -la $HOST_CCACHE_DIR
ccache -s
- name: Upload wheels
if: success() || failure()
uses: actions/upload-artifact@v3
with:
path: wheelhouse/*.whl
name: build_artifact
upload_distro_wheels:
name: Upload wheels
needs: [build_wheels]
runs-on: ubuntu-latest
# environment: pypi
# if: github.event_name == 'release' && github.event.action == 'published'
permissions:
id-token: write
contents: write
steps:
- uses: actions/download-artifact@v3
with:
# unpacks default artifact into dist/
# if `name: artifact` is omitted, the action will create extra parent dir
name: build_artifact
path: dist
- name: Release current commit
uses: ncipollo/[email protected]
with:
artifacts: "dist/*.whl,dist/*.tar.xz"
token: "${{ secrets.GITHUB_TOKEN }}"
tag: "latest-wheels"
name: "latest-wheels"
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
call-build-python-bindings:
needs: [upload_distro_wheels]
uses: Xilinx/mlir-air/.github/workflows/wheels.yml@wheels_1
permissions:
contents: write
id-token: write
secrets: inherit # pass all secrets