Skip to content

Commit c182b48

Browse files
committed
use direct package injection
1 parent f9de8bd commit c182b48

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+1280
-1525
lines changed

.github/workflows/wheels.yml renamed to .github/workflows/sdist.yml

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Wheels
1+
name: sdist
22

33
on:
44
workflow_dispatch:
@@ -7,36 +7,40 @@ on:
77
- published
88

99
jobs:
10-
build_wheels:
10+
build_sdist:
1111
runs-on: ubuntu-20.04
1212
outputs:
13-
VERSION: ${{ steps.build_wheel.outputs.version }}
13+
VERSION: ${{ steps.build_sdist.outputs.version }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
os: [ ubuntu-22.04, macos-11, windows-2022 ]
1418
steps:
1519
- uses: actions/checkout@v3
1620

1721
- uses: actions/setup-python@v4
1822
with:
1923
python-version: '3.11'
2024

21-
- name: Build wheel
22-
id: build_wheel
25+
- name: Build sdist
26+
id: build_sdist
2327
run: |
24-
pip wheel -w wheelhouse .
25-
pip install toml
26-
VERSION="$(python -c 'import toml; print(toml.load("pyproject.toml")["project"]["version"])')"
28+
pip install build
29+
python -m build -s
30+
VERSION="$(python setup.py --version)"
2731
echo "version=${VERSION}" | tee -a $GITHUB_OUTPUT
2832
29-
- name: Upload wheels
33+
- name: Upload sdist
3034
uses: actions/upload-artifact@v3
3135
with:
32-
path: wheelhouse/mlir_python_utils*.whl
36+
path: dist/mlir-python-utils-*.tar.gz
3337
name: build_artifact
3438

35-
upload_wheels:
39+
upload_sdist:
3640

37-
name: Upload wheels
41+
name: Upload sdist
3842

39-
needs: [build_wheels]
43+
needs: [build_sdist]
4044

4145
runs-on: ubuntu-latest
4246
permissions: write-all
@@ -51,15 +55,15 @@ jobs:
5155
- name: Set up a release page
5256
id: setup_release
5357
run: |
54-
VERSION=${{ needs.build_wheels.outputs.version }}
58+
VERSION=${{ needs.build_sdist.outputs.version }}
5559
echo "`mlir-python-utils` $VERSION distribution created at $(date)" > body.md
5660
echo "tag_name=${VERSION}" | tee -a $GITHUB_OUTPUT
5761
echo "release_title=mlir-python-utils-${VERSION}" | tee -a $GITHUB_OUTPUT
5862
5963
- name: Release current commit
6064
uses: ncipollo/[email protected]
6165
with:
62-
artifacts: "dist/*.whl"
66+
artifacts: "dist/*.tar.gz,dist/*.zip"
6367
bodyFile: body.md
6468
token: "${{ secrets.GITHUB_TOKEN }}"
6569
tag: "${{ steps.setup_release.outputs.tag_name }}"
@@ -72,7 +76,7 @@ jobs:
7276
- name: Release current commit
7377
uses: ncipollo/[email protected]
7478
with:
75-
artifacts: "dist/*.whl"
79+
artifacts: "dist/*.tar.gz,dist/*.zip"
7680
bodyFile: body.md
7781
token: "${{ secrets.GITHUB_TOKEN }}"
7882
tag: "latest"
@@ -87,7 +91,7 @@ jobs:
8791
with:
8892
owner: makslevental
8993
repo: wheels
90-
artifacts: "dist/*.whl"
94+
artifacts: "dist/*.tar.gz,dist/*.zip"
9195
token: "${{ secrets.WHEELS_REPO }}"
9296
tag: "i"
9397
name: "i"

.github/workflows/test.yml

Lines changed: 39 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ on:
1313

1414
jobs:
1515

16-
mlir-bindings:
16+
test-all:
1717

1818
runs-on: ${{ matrix.os }}
1919

@@ -35,23 +35,56 @@ jobs:
3535
- name: Install and configure
3636
shell: bash
3737
run: |
38-
pip install .[test,mlir] -f https://makslevental.github.io/wheels
39-
configure-mlir-python-utils -y mlir
38+
pip install .[test,mlir] -v -f https://makslevental.github.io/wheels
39+
mlir-python-utils-generate-all-upstream-trampolines
40+
41+
MLIR_PYTHON_PACKAGE_PREFIX=jaxlib.mlir pip install .[jax] -v
42+
jaxlib-mlir-python-utils-generate-all-upstream-trampolines
43+
44+
pip install aie -f https://github.com/Xilinx/mlir-aie/releases/expanded_assets/latest-wheels --no-index
45+
MLIR_PYTHON_PACKAGE_PREFIX=aie.mlir pip install . -v
46+
aie-mlir-python-utils-generate-all-upstream-trampolines
47+
aie-mlir-python-utils-generate-trampolines aie.dialects.aie
4048
4149
- name: Test
4250
shell: bash
4351
run: |
4452
if [ ${{ matrix.os }} == 'windows-2022' ]; then
45-
pytest -s --ignore-glob=*test_smoke* tests
53+
pytest -s tests
4654
else
47-
pytest --capture=tee-sys --ignore-glob=*test_smoke* tests
55+
pytest --capture=tee-sys tests
4856
fi
4957
5058
- name: Test mwe
5159
shell: bash
5260
run: |
5361
python examples/mwe.py
5462
63+
test-jupyter:
64+
65+
runs-on: ${{ matrix.os }}
66+
67+
strategy:
68+
fail-fast: false
69+
matrix:
70+
os: [ ubuntu-22.04 ]
71+
py_version: [ "3.10", "3.11" ]
72+
73+
steps:
74+
- name: Checkout
75+
uses: actions/checkout@v2
76+
77+
- name: Setup Python
78+
uses: actions/setup-python@v4
79+
with:
80+
python-version: ${{ matrix.py_version }}
81+
82+
- name: Run notebook
83+
shell: bash
84+
run: |
85+
pip install jupyter
86+
BRANCH=${{ github.ref_name }} jupyter run examples/mlir_python_utils.ipynb
87+
5588
mlir-bindings-aarch64:
5689

5790
runs-on: ${{ matrix.os }}
@@ -91,76 +124,7 @@ jobs:
91124
cd /workspace
92125
93126
pip install .[test,mlir] -f https://makslevental.github.io/wheels
94-
configure-mlir-python-utils -y mlir
127+
mlir-python-utils-generate-all-upstream-trampolines
95128
96129
pytest --capture=tee-sys --ignore-glob=*test_smoke* tests
97130
python examples/mwe.py
98-
99-
torch-mlir-bindings:
100-
101-
runs-on: ${{ matrix.os }}
102-
103-
strategy:
104-
fail-fast: false
105-
matrix:
106-
os: [ ubuntu-22.04, macos-11, windows-2022 ]
107-
py_version: [ "3.11" ]
108-
109-
steps:
110-
- name: Checkout
111-
uses: actions/checkout@v2
112-
113-
- name: Setup Python
114-
uses: actions/setup-python@v4
115-
with:
116-
python-version: ${{ matrix.py_version }}
117-
118-
- name: Install and configure
119-
shell: bash
120-
run: |
121-
pip install .[test,torch-mlir] -f https://llvm.github.io/torch-mlir/package-index -f https://makslevental.github.io/wheels
122-
configure-mlir-python-utils -y torch_mlir
123-
124-
- name: Test
125-
shell: bash
126-
run: |
127-
if [ ${{ matrix.os }} == 'windows-2022' ]; then
128-
pytest --capture=tee-sys tests/test_smoke.py
129-
else
130-
pytest --capture=tee-sys tests/test_smoke.py
131-
fi
132-
133-
134-
jax-bindings:
135-
136-
runs-on: ${{ matrix.os }}
137-
138-
strategy:
139-
fail-fast: false
140-
matrix:
141-
os: [ ubuntu-22.04, macos-11, windows-2022 ]
142-
py_version: [ "3.10", "3.11" ]
143-
144-
steps:
145-
- name: Checkout
146-
uses: actions/checkout@v2
147-
148-
- name: Setup Python
149-
uses: actions/setup-python@v4
150-
with:
151-
python-version: ${{ matrix.py_version }}
152-
153-
- name: Install and configure
154-
shell: bash
155-
run: |
156-
pip install .[test,jax] -f https://makslevental.github.io/wheels
157-
configure-mlir-python-utils -y jaxlib.mlir
158-
159-
- name: Test
160-
shell: bash
161-
run: |
162-
if [ ${{ matrix.os }} == 'windows-2022' ]; then
163-
pytest --capture=tee-sys tests/test_smoke.py
164-
else
165-
pytest --capture=tee-sys tests/test_smoke.py
166-
fi

MANIFEST.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
include requirements.txt
2+
recursive-include mlir *.py
3+
prune tests

README.md

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,6 @@ This is **not a Python compiler**, but just a (hopefully) nice way to emit MLIR
7474

7575
The few main features/affordances:
7676

77-
1. Generated bindings wrappers (like `constant` above)
78-
\
79-
 
80-
1. During "configuration" of this package (see [Install](#install)), wrappers for all available host ops are generated. These wrappers don't do much except fetch the result `ir.Value` from the `ir.Operation`; so `constant` in the example above is actually the result of `arith.ConstantOp`.
81-
\
82-
\
83-
See [mlir_utils._configuration.generate_trampolines](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/_configuration/generate_trampolines.py) for details.
84-
\
85-
 
8677
1. `region_op`s (like `@func` above)
8778
\
8879
 
@@ -151,34 +142,33 @@ But, open an issue if something isn't clear.
151142
First
152143

153144
```shell
154-
$ pip install mlir-python-utils -f https://makslevental.github.io/wheels/
145+
$ MLIR_PYTHON_PACKAGE_PREFIX=<YOUR_MLIR_PYTHON_PACKAGE_PREFIX> pip install git+https://github.com/makslevental/mlir-python-utils
155146
```
156147

157148
This package is meant to work in concert with host bindings.
158-
Practically speaking that means you need to have *some* package installed that includes mlir python bindings, **and you need to `configure-mlir-python-utils`**.
149+
Practically speaking that means you need to have *some* package installed that includes mlir python bindings, **and you need to `mlir-python-utils-generate-all-upstream-trampolines`**.
159150
So after pip-installing you need to
160151
```shell
161-
$ configure-mlir-python-utils -y <YOUR_MLIR_PYTHON_PACKAGE_PREFIX>
152+
$ <YOUR_MLIR_PYTHON_PACKAGE_PREFIX>-mlir-python-utils-generate-all-upstream-trampolines
162153
```
163154
where `YOUR_MLIR_PYTHON_PACKAGE_PREFIX` is (as it says) the package prefix for your chosen host bindings.
164155
**When in doubt about this prefix**, it is everything up until `ir` when you import your bindings, e.g., in `import torch_mlir.ir`, `torch_mlir` is the `MLIR_PYTHON_PACKAGE_PREFIX` for the torch-mlir bindings.
165-
Thus, for torch-mlir host bindings, you would execute `configure-mlir-python-utils -y torch_mlir`.
156+
Thus, for torch-mlir host bindings, you would execute `torch-mlir-mlir-python-utils-generate-all-upstream-trampolines`.
157+
Note, the underscore in `torch_mlir` becomes a dash in `torch-mlir-mlir-python-utils-generate-all-upstream-trampolines`.
166158

167-
If you don't have any such package, but you want to experiment anyway, you can install this package with the "stock" upstream bindings:
159+
If you don't have any such package, but you want to experiment anyway, you can install the "stock" upstream bindings first:
168160

169161
```shell
170-
$ pip install mlir-python-utils[mlir] -f https://makslevental.github.io/wheels/
171-
$ configure-mlir-python-utils -y mlir
162+
$ pip install mlir-python-bindings -f https://makslevental.github.io/wheels/
172163
```
173164

174-
Note, on Windows, you need to do
165+
and then
175166

176167
```shell
177-
python -m mlir_utils._configuration -y mlir
168+
$ pip install git+https://github.com/makslevental/mlir-python-utils
169+
$ mlir-python-utils-generate-all-upstream-trampolines
178170
```
179171

180-
instead.
181-
182172
## Examples/Demo
183173

184174
Check [tests](tests) for a plethora of example code.

0 commit comments

Comments
 (0)