Skip to content

Commit 90de2cb

Browse files
committed
[eudsl-tile] Start
1 parent 549fd26 commit 90de2cb

File tree

7 files changed

+629
-12
lines changed

7 files changed

+629
-12
lines changed
Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,331 @@
1+
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
2+
# See https://llvm.org/LICENSE.txt for license information.
3+
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4+
# Copyright (c) 2024.
5+
6+
name: "Build, test, release eudsl-tile"
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
force_debug_with_tmate:
12+
type: boolean
13+
description: 'Run the build with tmate session'
14+
required: false
15+
default: false
16+
debug_with_tmate:
17+
type: boolean
18+
description: 'Run the build with a tmate session ONLY in case of failure'
19+
required: false
20+
default: false
21+
workflow_call:
22+
inputs:
23+
wheel_version:
24+
description: 'wheel version'
25+
type: string
26+
required: false
27+
default: ''
28+
workflow_call:
29+
description: 'To distinguish workflow_call from regular push'
30+
type: boolean
31+
required: false
32+
default: true
33+
workflow_caller_run_id:
34+
description: ''
35+
type: string
36+
required: false
37+
default: ''
38+
pull_request:
39+
branches:
40+
- main
41+
paths:
42+
- ".github/workflows/build_test_release_eudsl_tile.yml"
43+
- "projects/eudsl-tile/**"
44+
push:
45+
branches:
46+
- main
47+
paths:
48+
- ".github/workflows/build_test_release_eudsl_tile.yml"
49+
- "projects/eudsl-tile/**"
50+
51+
concurrency:
52+
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}-build_test_release_eudsl_tile
53+
cancel-in-progress: true
54+
55+
jobs:
56+
build-eudsl-tile:
57+
58+
strategy:
59+
fail-fast: false
60+
matrix:
61+
include:
62+
- name: "ubuntu_x86_64"
63+
runs-on: "ubuntu-22.04"
64+
os: "ubuntu"
65+
host-arch: "x86_64"
66+
target-arch: "x86_64"
67+
68+
- name: "ubuntu_aarch64"
69+
runs-on: "ubuntu-22.04-arm"
70+
os: "ubuntu"
71+
host-arch: "aarch64"
72+
target-arch: "aarch64"
73+
74+
- name: "windows_amd64"
75+
runs-on: "windows-2022"
76+
os: "windows"
77+
host-arch: "amd64"
78+
target-arch: "amd64"
79+
80+
- name: "macos_arm64"
81+
runs-on: "macos-14"
82+
os: "macos"
83+
host-arch: "arm64"
84+
target-arch: "arm64"
85+
86+
runs-on: ${{ matrix.runs-on }}
87+
88+
name: "Build eudsl-tile ${{ matrix.name }}"
89+
90+
defaults:
91+
run:
92+
shell: bash
93+
94+
permissions:
95+
id-token: write
96+
contents: write
97+
98+
env:
99+
# either the PR number or `branch-N` where N always increments
100+
cache-key: eudsl_tile_${{ matrix.name }}_clang_${{ format('{0}-{1}', github.ref_name, github.run_number) }}
101+
102+
steps:
103+
- name: "Check out repository"
104+
uses: actions/checkout@v4.2.2
105+
with:
106+
submodules: false
107+
108+
- name: "Get submodules"
109+
run: git submodule update --init --depth=1
110+
111+
- name: "Setup base"
112+
uses: ./.github/actions/setup_base
113+
id: setup_base
114+
with:
115+
cache-key: ${{ env.cache-key }}
116+
restore-key: "eudsl_tile_${{ matrix.name }}_clang"
117+
os: ${{ matrix.os }}
118+
host-arch: ${{ matrix.host-arch }}
119+
target-arch: ${{ matrix.target-arch }}
120+
runs-on: ${{ matrix.runs-on }}
121+
122+
- name: "Pip download MLIR from releases"
123+
if: ${{ !inputs.workflow_call }}
124+
run: |
125+
126+
pip download mlir-wheel -f https://llvm.github.io/eudsl
127+
WHEEL_NAME=$(ls mlir_wheel*)
128+
$python3_command -m pip install pkginfo
129+
WHEEL_VERSION=$($python3_command -c "from pkginfo import Wheel; print(Wheel('$WHEEL_NAME').version)")
130+
echo "WHEEL_VERSION=$WHEEL_VERSION" >> $GITHUB_ENV
131+
132+
- name: Download LLVM distro artifacts
133+
if: ${{ inputs.workflow_call }}
134+
uses: dawidd6/action-download-artifact@v11
135+
with:
136+
name: mlir_wheel_${{ (matrix.name == 'ubuntu_x86_64' || matrix.name == 'ubuntu_aarch64') && 'manylinux' || matrix.os }}_${{ matrix.target-arch }}_artifact
137+
path: "./"
138+
run_id: ${{ inputs.workflow_caller_run_id }}
139+
140+
- name: "Set WHEEL_VERSION env var"
141+
if: ${{ inputs.workflow_call }}
142+
run: |
143+
144+
echo "WHEEL_VERSION=${{ inputs.wheel_version }}" >> $GITHUB_ENV
145+
146+
- name: "Configure build"
147+
run: |
148+
149+
unzip -q mlir_wheel*.whl
150+
mv mlir_wheel llvm-install
151+
152+
if [[ "${{ matrix.os }}" == "ubuntu" ]]; then
153+
echo "LLVM_DIR=/host/$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
154+
echo "MLIR_DIR=/host/$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
155+
echo "Clang_DIR=/host/$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
156+
echo "CMAKE_PREFIX_PATH=/host/$PWD/llvm-install" >> $GITHUB_ENV
157+
else
158+
echo "LLVM_DIR=$PWD/llvm-install/lib/cmake/llvm" >> $GITHUB_ENV
159+
echo "MLIR_DIR=$PWD/llvm-install/lib/cmake/mlir" >> $GITHUB_ENV
160+
echo "Clang_DIR=$PWD/llvm-install/lib/cmake/clang" >> $GITHUB_ENV
161+
echo "CMAKE_PREFIX_PATH=$PWD/llvm-install" >> $GITHUB_ENV
162+
fi
163+
164+
$python3_command -m pip install cibuildwheel
165+
166+
if [[ "${{ matrix.os }}" == "ubuntu" ]] && [[ "${{ matrix.host-arch }}" == "aarch64" ]]; then
167+
sudo apt-get install libarchive-dev antlr libxml2-dev libxslt-dev libcurl4-openssl-dev
168+
fi
169+
if [[ "${{ matrix.os }}" == "macos" ]]; then
170+
brew install antlr boost libarchive
171+
fi
172+
173+
- name: "Build eudsl-tile"
174+
run: |
175+
176+
# combine eudsl-python-extras and eudsl-tile
177+
cp -R "$PWD/projects/eudsl-python-extras/mlir/extras" "$PWD/projects/eudsl-tile/eudsl-tile"
178+
$python3_command -m cibuildwheel "$PWD/projects/eudsl-tile" --output-dir wheelhouse
179+
180+
- name: Upload artifacts
181+
uses: actions/upload-artifact@v4
182+
with:
183+
name: eudsl_tile_${{ matrix.name }}_artifact
184+
path: wheelhouse/*.whl
185+
if-no-files-found: error
186+
187+
- name: "Setup tmate session"
188+
if: (failure() && inputs.debug_with_tmate) || inputs.force_debug_with_tmate
189+
uses: mxschmitt/action-tmate@v3.18
190+
with:
191+
limit-access-to-actor: true
192+
install-dependencies: ${{ startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'ubuntu') }}
193+
194+
test-eudsl-tile:
195+
196+
if: github.event_name == 'pull_request'
197+
198+
needs: [build-eudsl-tile]
199+
200+
strategy:
201+
fail-fast: false
202+
matrix:
203+
runs-on: [
204+
"ubuntu-22.04",
205+
"ubuntu-22.04-arm",
206+
"macos-14",
207+
"windows-2022"
208+
]
209+
python-version: [
210+
"3.10", "3.11", "3.12",
211+
"3.13", "3.14", "3.14t"
212+
]
213+
include: [
214+
{runs-on: "ubuntu-22.04", name: "ubuntu_x86_64", os: "ubuntu"},
215+
{runs-on: "ubuntu-22.04-arm", name: "ubuntu_aarch64", os: "ubuntu"},
216+
{runs-on: "windows-2022", name: "windows_amd64", os: "windows"},
217+
{runs-on: "macos-14", name: "macos_arm64", os: "macos"},
218+
]
219+
exclude:
220+
# <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.
221+
- runs-on: windows-2022
222+
python-version: "3.14"
223+
224+
- runs-on: windows-2022
225+
python-version: "3.14t"
226+
227+
- runs-on: macos-14
228+
python-version: "3.10"
229+
230+
- runs-on: macos-14
231+
python-version: "3.11"
232+
233+
- runs-on: macos-14
234+
python-version: "3.12"
235+
236+
- runs-on: macos-14
237+
python-version: "3.13"
238+
239+
- runs-on: macos-14
240+
python-version: "3.14"
241+
242+
runs-on: ${{ matrix.runs-on }}
243+
244+
name: "Test eudsl-tile ${{ matrix.name }} ${{ matrix.python-version }}"
245+
246+
defaults:
247+
run:
248+
shell: bash
249+
250+
steps:
251+
- name: "Check out repository"
252+
uses: actions/checkout@v4.2.2
253+
with:
254+
submodules: false
255+
256+
- name: "Get submodules"
257+
run: git submodule update --init --depth=1
258+
259+
- name: "Install Python"
260+
uses: actions/setup-python@v6.0.0
261+
with:
262+
python-version: "${{ matrix.python-version }}"
263+
264+
- uses: actions/download-artifact@v4
265+
with:
266+
name: eudsl_tile_${{ matrix.name }}_artifact
267+
path: wheelhouse
268+
269+
- name: "Test eudsl-tile"
270+
run: |
271+
272+
exit -1
273+
274+
release-eudsl-tile:
275+
276+
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
277+
278+
needs: [build-eudsl-tile]
279+
280+
runs-on: "ubuntu-22.04"
281+
282+
permissions:
283+
id-token: write
284+
contents: write
285+
286+
strategy:
287+
fail-fast: false
288+
matrix:
289+
name: [
290+
"ubuntu_x86_64",
291+
"ubuntu_aarch64",
292+
"ubuntu_wasm32",
293+
"macos_arm64",
294+
"windows_amd64"
295+
]
296+
297+
name: "Release eudsl-tile ${{ matrix.name }}"
298+
299+
steps:
300+
301+
- uses: actions/download-artifact@v4
302+
with:
303+
name: eudsl_tile_${{ matrix.name }}_artifact
304+
path: wheelhouse
305+
306+
- name: Release current commit
307+
uses: ncipollo/release-action@v1.12.0
308+
with:
309+
artifacts: "wheelhouse/eudsl_tile*.whl"
310+
token: "${{ secrets.GITHUB_TOKEN }}"
311+
tag: eudsl-tile
312+
name: eudsl-tile
313+
removeArtifacts: false
314+
allowUpdates: true
315+
replacesArtifacts: true
316+
makeLatest: true
317+
omitBody: true
318+
319+
call-deploy-pip-page:
320+
321+
if: (github.event_name == 'push' && github.ref_name == 'main') || github.event_name == 'workflow_dispatch'
322+
323+
needs: [release-eudsl-tile]
324+
325+
permissions:
326+
contents: read
327+
id-token: write
328+
pages: write
329+
330+
uses: ./.github/workflows/deploy_pip_page.yml
331+
secrets: inherit # pass all secrets

.github/workflows/deploy_pip_page.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl
4949
wget https://github.com/llvm/eudsl/releases/expanded_assets/llvm
5050
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-python-extras
51+
wget https://github.com/llvm/eudsl/releases/expanded_assets/eudsl-tile
52+
5153
cat mlir-python-bindings eudsl llvm eudsl-python-extras > index.html
5254
sed -i.bak 's/\/llvm\/eudsl/https:\/\/github.com\/llvm\/eudsl/g' index.html
5355
mkdir -p page && mv index.html page

projects/eudsl-python-extras/README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -169,18 +169,6 @@ jax[cpu]
169169
eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir
170170
```
171171

172-
or
173-
174-
```toml
175-
# pyproject.toml
176-
[project]
177-
name = ...
178-
dependencies = [
179-
"jax[cpu]",
180-
"eudsl-python-extras; --config-settings=EUDSL_PYTHON_EXTRAS_HOST_PACKAGE_PREFIX=jaxlib.mlir"
181-
]
182-
```
183-
184172
## Examples/Demo
185173

186174
Check [examples](examples) and [tests](tests) for a plethora of example code.

0 commit comments

Comments
 (0)