Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 0 additions & 98 deletions .github/workflows/sdist.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
sparse-checkout: examples/mlir_python_extras.ipynb

- name: Setup Python
uses: actions/setup-python@v4
Expand All @@ -116,7 +118,7 @@ jobs:
pip install jupyter
sed -i.bak 's/OUTPUT_TIMEOUT = 10/OUTPUT_TIMEOUT = 100/g' \
$(python -c 'import site; print(site.getsitepackages()[0])')/jupyter_client/runapp.py
BRANCH=${{ github.ref_name }} jupyter run examples/mlir_python_utils.ipynb
BRANCH=${{ github.ref_name }} jupyter run examples/mlir_python_extras.ipynb

mlir-bindings-aarch64:

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/mlir_python_utils*.whl
path: ./wheelhouse/mlir_python_extras*.whl

build_sdist:
name: Build source distribution
Expand Down
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mlir-python-utils
# mlir-python-extras

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

Expand Down Expand Up @@ -77,7 +77,7 @@ The few main features/affordances:
1. `region_op`s (like `@func` above)
\
 
1. These are decorators around ops (bindings for MLIR operations) that have regions (e.g., [in_parallel](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/dialects/ext/scf.py#L185)).
1. These are decorators around ops (bindings for MLIR operations) that have regions (e.g., [in_parallel](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/dialects/ext/scf.py#L185)).
They turn decorated functions, by executing them "eagerly", into an instance of such an op, e.g.,
```python
@func
Expand All @@ -87,7 +87,7 @@ The few main features/affordances:
becomes `func.func @foo(%arg0: i32) { }`; if the region carrying op produces a result, the identifier for the python function (`foo`) becomes the corresponding `ir.Value` of the result (if the op doesn't produce a result then the identifier becomes the corresponding `ir.OpView`).
\
\
See [mlir_utils.util.op_region_builder](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/util.py#L123) for details.
See [mlir_extras.util.op_region_builder](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/util.py#L123) for details.
\
 
2. `@canonicalize` (like `@canonicalize(using=scf)` above)
Expand All @@ -96,16 +96,16 @@ The few main features/affordances:
1. These are decorators that **rewrite the python AST**. They transform a select few forms (basically only `if`s) into a more "canonical" form, in order to more easily map to MLIR. If that scares you, fear not; they are not essential and all target MLIR can still be mapped to without using them (by using the slightly more verbose `region_op`).
\
\
See [mlir_utils.ast.canonicalize](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/ast/canonicalize.py) for details.
See [mlir_extras.ast.canonicalize](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/ast/canonicalize.py) for details.
\
 
3. `mlir_utils.types` (like `T.memref(K, K, T.i64)` above)
3. `mlir_extras.types` (like `T.memref(K, K, T.i64)` above)
\
 
1. These are just convenient wrappers around upstream type constructors. Note, because MLIR types are uniqued to a `ir.Context`, these are all actually functions that return the type (yes, even `T.i64`, which uses [`__getattr__` on the module](https://github.com/makslevental/mlir-python-utils/blob/2ca62e9c1540b1624c302bc9efb4666ff5d1c133/mlir_utils/types.py#L98)).
1. These are just convenient wrappers around upstream type constructors. Note, because MLIR types are uniqued to a `ir.Context`, these are all actually functions that return the type (yes, even `T.i64`, which uses [`__getattr__` on the module](https://github.com/makslevental/mlir-python-extras/blob/2ca62e9c1540b1624c302bc9efb4666ff5d1c133/mlir_extras/types.py#L98)).
\
\
See [mlir_utils.types](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/types.py) for details.
See [mlir_extras.types](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/types.py) for details.
\
 
4. `Pipeline()`
Expand All @@ -114,8 +114,8 @@ The few main features/affordances:
1. This is just a (generated) wrapper around available **upstream** passes; it can be used to build pass pipelines (by `str(Pipeline())`). It is mainly convenient with IDEs/editors that will tab-complete the available methods on the `Pipeline` class (which correspond to passes), Note, if your host bindings don't register some upstream passes, then this will generate "illegal" pass pipelines.
\
\
See [mlir_utils._configuration.generate_pass_pipeline.py](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/_configuration/generate_pass_pipeline.py) for details on generation
[mlir_utils.runtime.passes.py](https://github.com/makslevental/mlir-python-utils/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_utils/runtime/passes.py#L80) for the passes themselves.
See [mlir_extras._configuration.generate_pass_pipeline.py](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/_configuration/generate_pass_pipeline.py) for details on generation
[mlir_extras.runtime.passes.py](https://github.com/makslevental/mlir-python-extras/blob/a9885db18096a610d29a26293396d860d40ad213/mlir_extras/runtime/passes.py#L80) for the passes themselves.
\
 

Expand All @@ -133,7 +133,7 @@ Practically speaking that means you need to have *some* package installed that i
So

```shell
$ YOUR_HOST_MLIR_PYTHON_PACKAGE_PREFIX=<YOUR_HOST_MLIR_PYTHON_PACKAGE_PREFIX> pip install git+https://github.com/makslevental/mlir-python-utils
$ YOUR_HOST_MLIR_PYTHON_PACKAGE_PREFIX=<YOUR_HOST_MLIR_PYTHON_PACKAGE_PREFIX> pip install git+https://github.com/makslevental/mlir-python-extras
```

where `YOUR_HOST_MLIR_PYTHON_PACKAGE_PREFIX` is (as it says) the package prefix for your chosen host bindings.
Expand All @@ -148,7 +148,7 @@ $ pip install mlir-python-bindings -f https://makslevental.github.io/wheels/
and then

```shell
$ pip install git+https://github.com/makslevental/mlir-python-utils
$ pip install git+https://github.com/makslevental/mlir-python-extras
```

## Examples/Demo
Expand Down
Loading