This is an archive of the discontinued LLVM Phabricator instance.

[mlir][affine] add python bindings for affine ops
AbandonedPublic

Authored by ashay-github on Aug 11 2022, 12:19 PM.

Details

Summary

Effectively, this patch makes it possible to reference
MLIRPythonSources.Dialects.affine when adding a dependency on the
affine dialect.

Diff Detail

Event Timeline

ashay-github created this revision.Aug 11 2022, 12:19 PM
ashay-github requested review of this revision.Aug 11 2022, 12:19 PM

[nfc] signing commit

I would prefer us to land op API customizations either in this patch, or very soon after. Generated API for affine ops will be quite raw and low-level, and we will likely grow uses for which the API will be broken when we land the improvements. Look at how SCF loops are supported in https://github.com/llvm/llvm-project/blob/main/mlir/python/mlir/dialects/_scf_ops_ext.py#L13. Also, load/store with non-trivial maps may get nasty and deserve some API work.

mlir/test/python/dialects/affine_dialect.py
17–24

It is preferable to create this structure programmatically than to rely on parsing string IR. API updates are mechanical, embedded string updates -- not so much.

Note that it is possible to construct operations from any registered dialect using the generic Operation.create which is barely more verbose than the generated APIs in this case.

ashay-github abandoned this revision.Sep 7 2022, 7:19 PM

Apologies for the much delayed response. I'm abandoning this revision since I found a workaround, but I will come back to this with a proper fix later.