-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild_test_release_eudsl_python_extras.yml
More file actions
273 lines (209 loc) · 8.64 KB
/
build_test_release_eudsl_python_extras.yml
File metadata and controls
273 lines (209 loc) · 8.64 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
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
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
# Copyright (c) 2024.
name: "Build, test, release eudsl-python-extras"
on:
workflow_dispatch:
workflow_call:
inputs:
workflow_call:
description: 'To distinguish workflow_call from regular push'
type: boolean
required: false
default: true
workflow_caller_run_id:
description: ''
type: string
required: false
default: ''
pull_request:
branches:
- main
paths:
- ".github/workflows/build_test_release_eudsl_python_extras.yml"
- "projects/eudsl-python-extras/**"
push:
branches:
- main
paths:
- ".github/workflows/build_test_release_eudsl_python_extras.yml"
- "projects/eudsl-python-extras/**"
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}-build_test_release_eudsl_python_extras
cancel-in-progress: true
jobs:
build-eudsl-python-extras:
runs-on: ubuntu-22.04
name: "Build eudsl-python-extras sdist"
defaults:
run:
shell: bash
steps:
- name: "Check out repository"
uses: actions/checkout@v4.2.2
with:
submodules: false
- name: "Install Python"
uses: actions/setup-python@v6.0.0
with:
python-version: "3.12"
- name: "Install prereqs"
run: python -m pip install setuptools build
- name: "Build eudsl-python-extras sdist"
run: |
SHA_SHORT="$(git rev-parse --short HEAD)"
WHEEL_VERSION="$(date +'%Y%m%d.%H%M')+$SHA_SHORT"
pushd projects/eudsl-python-extras
sed -i.bak "s/XXXWHEEL_VERSIONXXX/$WHEEL_VERSION/g" setup.py
python -m build . --sdist
popd
- name: Upload eudsl-python-extras sdist
uses: actions/upload-artifact@v4
with:
path: projects/eudsl-python-extras/dist/*.tar.gz
name: eudsl_python_extras_sdist_artifact
test-eudsl-python-extras:
if: github.event_name == 'pull_request'
needs: [build-eudsl-python-extras]
strategy:
fail-fast: false
matrix:
runs-on: [
"ubuntu-22.04",
"ubuntu-22.04-arm",
"macos-14",
"windows-2022"
]
python-version: [
"3.10", "3.11", "3.12",
"3.13", "3.14", "3.14t"
]
include: [
{runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"},
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
{runs-on: "windows-2022", name: "windows_amd64", os: "windows"},
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
]
exclude:
# <frozen importlib._bootstrap>:491: Warning: Numpy built with MINGW-W64 on Windows 64 bits is experimental, and only available for testing. You are advised not to use it for production.
- runs-on: windows-2022
python-version: "3.14"
- runs-on: windows-2022
python-version: "3.14t"
- runs-on: macos-14
python-version: "3.10"
- runs-on: macos-14
python-version: "3.11"
- runs-on: macos-14
python-version: "3.12"
- runs-on: macos-14
python-version: "3.13"
- runs-on: macos-14
python-version: "3.14"
runs-on: ${{ matrix.runs-on }}
name: "Test eudsl-python-extras ${{ matrix.name }} ${{ matrix.python-version }}"
defaults:
run:
shell: bash
steps:
- name: "Check out repository"
uses: actions/checkout@v4.2.2
with:
submodules: false
- name: "Install Python"
uses: actions/setup-python@v6.0.0
with:
python-version: "${{ matrix.python-version }}"
- name: "Download mlir-python-bindings artifacts"
uses: dawidd6/action-download-artifact@v11
if: ${{ inputs.workflow_call }}
with:
name: mlir_python_bindings_${{ matrix.name }}_artifact
path: wheelhouse
run_id: ${{ inputs.workflow_caller_run_id }}
- name: "Install mlir-python-bindings"
run: python -m pip install mlir-python-bindings -f ${{ inputs.workflow_call && 'wheelhouse' || 'https://llvm.github.io/eudsl' }}
- name: "Install development dependencies"
run: python -m pip install pytest mlir-native-tools -f https://llvm.github.io/eudsl
- uses: actions/download-artifact@v4
with:
name: eudsl_python_extras_sdist_artifact
path: dist
- name: "Install eudsl-python-extras"
run: python -m pip install "eudsl-python-extras[test]" -f dist
- name: "Test eudsl-python-extras"
run: |
IGNORE=""
if [[ $(python -c "print(__import__('sys').version_info < (3, 13))") == "True" ]]; then
IGNORE="--ignore projects/eudsl-python-extras/tests/test_generics.py"
fi
python -m pytest projects/eudsl-python-extras/tests $IGNORE
- name: "Test examples"
run: |
python projects/eudsl-python-extras/examples/flash_attention.py
python projects/eudsl-python-extras/examples/mwe.py
python projects/eudsl-python-extras/examples/rdna_matmul_opt.py
if [[ $(python -c "print(__import__('sys').version_info >= (3, 13))") == "True" ]]; then
python projects/eudsl-python-extras/examples/cuda_matmul_opt.py
fi
- name: Test jupyter notebooks
# sed: can't read C:\hostedtoolcache\windows\Python\3.12.10\x64/jupyter_client/runapp.py: No such file or directory
if: matrix.os != 'windows'
shell: bash
env:
BRANCH: ${{ github.head_ref || github.ref_name }}
run: |
pip install -q jupyter
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 1000/g' \
$(python -c 'import site; print(site.getsitepackages()[0])')/jupyter_client/runapp.py
jupyter execute projects/eudsl-python-extras/examples/mlir_python_extras.ipynb --output=mlir_python_extras_output
cat projects/eudsl-python-extras/examples/mlir_python_extras_output.ipynb | jq '.cells[].outputs | select(length > 0) | .[0] | .text'
jupyter execute projects/eudsl-python-extras/examples/vectorization_e2e.ipynb --output=vectorization_e2e_output
cat projects/eudsl-python-extras/examples/vectorization_e2e_output.ipynb | jq '.cells[].outputs | select(length > 0) | .[0] | .text'
# TODO(max): build wheels with nv targets
# if [ ${{ matrix.os }} == 'ubuntu' ]; then
# jupyter execute projects/eudsl-python-extras/examples/cuda_e2e.ipynb --output=cuda_e2e_output
# cat projects/eudsl-python-extras/examples/cuda_e2e_output.ipynb | jq '.cells[].outputs | select(length > 0) | .[0] | .text'
# fi
- name: "Test other hosts"
# ImportError: DLL load failed while importing _mlir: The specified module could not be found.
if: matrix.os != 'windows'
run: |
pip uninstall -y eudsl-python-extras
pip install -r projects/eudsl-python-extras/tests/other_host_reqs.txt -f dist --no-cache-dir
pytest -v --capture=tee-sys projects/eudsl-python-extras/tests/test_other_hosts.py
release-eudsl-python-extras:
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [build-eudsl-python-extras]
runs-on: "ubuntu-22.04"
permissions:
id-token: write
contents: write
name: "Release eudsl-python-extras"
steps:
- uses: actions/download-artifact@v4
with:
name: eudsl_python_extras_sdist_artifact
path: dist
- name: Release current commit
uses: ncipollo/release-action@v1.12.0
with:
artifacts: "dist/eudsl_python_extras*.tar.gz"
token: "${{ secrets.GITHUB_TOKEN }}"
tag: eudsl-python-extras
name: eudsl-python-extras
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
omitBody: true
call-deploy-pip-page:
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
needs: [release-eudsl-python-extras]
permissions:
contents: read
id-token: write
pages: write
uses: ./.github/workflows/deploy_pip_page.yml
secrets: inherit # pass all secrets