Skip to content

Commit 21ae1b0

Browse files
authored
upload wheels (#155)
1 parent 96488e4 commit 21ae1b0

13 files changed

+330
-152
lines changed

.github/workflows/release.yml

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types:
7+
- published
8+
push:
9+
branches:
10+
- main
11+
pull_request:
12+
paths:
13+
- .github/workflows/release.yml
14+
15+
concurrency:
16+
group: ci-build-release-${{ github.event.number || github.sha }}
17+
cancel-in-progress: true
18+
19+
env:
20+
SYSTEM_VERSION_COMPAT: 0
21+
PIP_FIND_LINKS: "https://github.com/llvm/eudsl/releases/expanded_assets/latest https://github.com/makslevental/mlir-wheels/releases/expanded_assets/latest"
22+
23+
jobs:
24+
25+
build:
26+
27+
runs-on: ${{ matrix.os }}
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
os: [ ubuntu-22.04, macos-13, macos-14, windows-2022, ubuntu-22.04-arm ]
33+
py_version: [ "3.9", "3.10", "3.11", "3.12", "3.13" ]
34+
gpu: [ "cuda", "amdgpu", "none" ]
35+
36+
exclude:
37+
- os: macos-13
38+
py_version: "3.9"
39+
40+
- os: macos-14
41+
py_version: "3.9"
42+
43+
- os: macos-13
44+
gpu: "cuda"
45+
- os: macos-13
46+
gpu: "amdgpu"
47+
48+
- os: macos-14
49+
gpu: "cuda"
50+
- os: macos-14
51+
gpu: "amdgpu"
52+
53+
- os: windows-2022
54+
gpu: "cuda"
55+
- os: windows-2022
56+
gpu: "amdgpu"
57+
58+
- os: ubuntu-22.04-arm
59+
gpu: "cuda"
60+
- os: ubuntu-22.04-arm
61+
gpu: "amdgpu"
62+
63+
name: Release "${{ matrix.os }}-${{ matrix.py_version }} ${{ matrix.gpu != 'none' && matrix.gpu || '' }}"
64+
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v2
68+
69+
- name: Setup Python
70+
uses: actions/setup-python@v4
71+
with:
72+
python-version: ${{ matrix.py_version }}
73+
allow-prereleases: true
74+
75+
- name: Get bindings metadata
76+
shell: bash
77+
run: |
78+
79+
echo "BINDINGS_VERSION=$(python scripts/get_latest_bindings.py ${{ matrix.gpu }})" >> $GITHUB_ENV
80+
echo "BUNDLE_MLIR_PYTHON_BINDINGS=1" >> $GITHUB_ENV
81+
echo "PLAT=$(python scripts/get_latest_bindings.py ${{ matrix.gpu }} --only-plat)" >> $GITHUB_ENV
82+
echo "GPU=${{ matrix.gpu }}" >> $GITHUB_ENV
83+
84+
- name: Build wheel
85+
shell: bash
86+
run: |
87+
88+
pip install mlir-python-bindings==$BINDINGS_VERSION -t tmp
89+
cp -R tmp/mlir $PWD
90+
pip wheel . -v -w wheelhouse
91+
92+
- name: auditwheel
93+
if: startsWith(matrix.os, 'ubuntu')
94+
shell: bash
95+
run: |
96+
97+
pip install auditwheel
98+
mv wheelhouse/mlir_python_extras-*.whl $PWD
99+
auditwheel repair mlir_python_extras-*.whl -w wheelhouse --plat $PLAT --exclude libmlir_float16_utils* --exclude libcuda*
100+
101+
- name: Upload wheels
102+
uses: actions/upload-artifact@v4
103+
with:
104+
path: wheelhouse/mlir_python_extras-*.whl
105+
name: build_artifact-${{ matrix.os }}-${{ matrix.py_version }}-${{ matrix.gpu }}
106+
107+
upload_bindings_wheels:
108+
109+
if: github.event_name != 'pull_request'
110+
111+
needs: [build]
112+
113+
runs-on: ubuntu-latest
114+
115+
permissions:
116+
id-token: write
117+
contents: write
118+
119+
steps:
120+
- uses: actions/download-artifact@v4
121+
with:
122+
pattern: build_artifact-*
123+
path: dist
124+
merge-multiple: true
125+
126+
- name: Release current commit
127+
uses: ncipollo/[email protected]
128+
with:
129+
artifacts: "dist/*.whl"
130+
token: "${{ secrets.GITHUB_TOKEN }}"
131+
tag: "latest"
132+
name: "latest"
133+
removeArtifacts: false
134+
allowUpdates: true
135+
replacesArtifacts: true
136+
makeLatest: true
137+
artifactErrorsFailBuild: true
138+
139+
- name: Release current commit
140+
uses: ncipollo/[email protected]
141+
with:
142+
owner: makslevental
143+
repo: wheels
144+
artifacts: "dist/*.whl"
145+
token: "${{ secrets.WHEELS_REPO }}"
146+
tag: "i"
147+
name: "i"
148+
removeArtifacts: false
149+
allowUpdates: true
150+
replacesArtifacts: true
151+
makeLatest: true
152+
artifactErrorsFailBuild: true

.github/workflows/test_pypi.yml

Lines changed: 0 additions & 61 deletions
This file was deleted.

MANIFEST.in

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
11
include requirements.txt
22
recursive-include mlir *.py
3-
prune tests
3+
recursive-include mlir *.so*
4+
recursive-include mlir *.dll*
5+
recursive-include mlir *.lib*
6+
recursive-include mlir *.dylib*
7+
recursive-include mlir *.pyd*
8+
recursive-include mlir *.pyi*
9+
recursive-include mlir *.h
10+
recursive-include mlir *.td
11+
prune tests

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# mlir-python-extras
22

33
[![Test](https://github.com/makslevental/mlir-python-extras/actions/workflows/test.yml/badge.svg)](https://github.com/makslevental/mlir-python-extras/actions/workflows/test.yml)
4+
[![Release](https://github.com/makslevental/mlir-python-extras/actions/workflows/release.yml/badge.svg)](https://github.com/makslevental/mlir-python-extras/actions/workflows/release.yml)
45

56
The missing pieces (as far as boilerplate reduction goes) of the MLIR python bindings.
67

@@ -137,8 +138,7 @@ But, open an issue if something isn't clear.
137138
If you want to just get started/play around:
138139

139140
```shell
140-
$ pip install mlir-python-bindings -f https://makslevental.github.io/wheels/
141-
$ pip install git+https://github.com/makslevental/mlir-python-extras
141+
$ pip install mlir-python-extras -f https://makslevental.github.io/wheels
142142
```
143143

144144
Alternatively, this [colab notebook](https://drive.google.com/file/d/1NAtf2Yxj_VVnzwn8u_kxtajfVzgbuWhi/view?usp=sharing) (which is the same as [examples/mlir_python_extras.ipynb](examples/mlir_python_extras.ipynb)) has a MWE if you don't want to install anything even.

examples/cuda_e2e.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
{
3333
"cell_type": "code",
3434
"source": [
35-
"!script_address=\"https://raw.githubusercontent.com/makslevental/mlir-python-extras/refs/heads/$BRANCH/scripts/get_latest_gpu_bindings.py\"\n",
35+
"!script_address=\"https://raw.githubusercontent.com/makslevental/mlir-python-extras/refs/heads/$BRANCH/scripts/get_latest_bindings.py\"\n",
3636
"!latest_cuda_version=$(curl $script_address | python -)\n",
3737
"!pip install -q mlir_python_bindings==$latest_cuda_version -f https://makslevental.github.io/wheels\n",
3838
"!BRANCH=\"${BRANCH:-main}\" && pip install -q git+https://github.com/makslevental/mlir-python-extras@$BRANCH"

examples/mlir_python_extras.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222
}
2323
},
2424
"outputs": [],
25-
"source": [
26-
"!pip install -q mlir-python-bindings -f https://makslevental.github.io/wheels\n",
27-
"!BRANCH=\"${BRANCH:-main}\" && pip install -q git+https://github.com/makslevental/mlir-python-extras@$BRANCH"
28-
]
25+
"source": "!pip install -q mlir-python-extras -f https://makslevental.github.io/wheels"
2926
},
3027
{
3128
"cell_type": "markdown",

examples/vectorization_e2e.ipynb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,7 @@
3636
"cell_type": "code",
3737
"outputs": [],
3838
"execution_count": null,
39-
"source": [
40-
"!pip install -q mlir-python-bindings -f https://makslevental.github.io/wheels\n",
41-
"!BRANCH=\"${BRANCH:-main}\" && pip install -q git+https://github.com/makslevental/mlir-python-extras@$BRANCH\n"
42-
]
39+
"source": "!pip install -q mlir-python-extras -f https://makslevental.github.io/wheels\n"
4340
},
4441
{
4542
"cell_type": "markdown",

pyproject.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
[build-system]
22
# https://stackoverflow.com/a/69711730
33
#requires = ["setuptools>=64.0.0", "wheel", "pip"]
4-
requires = ["setuptools>=42", "wheel", "pip"]
4+
requires = [
5+
"setuptools>=42",
6+
"wheel",
7+
"setuptools_scm==8.3.1",
8+
"pip"
9+
]
510
build-backend = "setuptools.build_meta"
611

712
[tool.pytest.ini_options]

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
black
2+
inflection

requirements.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
PyYAML>=6.0.2
22
astpretty
33
astunparse
4-
black
54
bytecode
65
cloudpickle>=3.0.0
76
einspect @ git+https://github.com/makslevental/einspect@makslevental/bump-py.3.13
8-
inflection
9-
ml_dtypes>=0.1.0, <=0.5.0 # provides several NumPy dtype extensions, including the bf16
107
numpy>=1.19.5, <=2.1.2

0 commit comments

Comments
 (0)