-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExternalPass API #248
Comments
Thank you for making the issue!
Of course! I would love to merge such a pull request.
I would love to see the implementation. But probably modifying |
My code is currently on GitLab (https://gitlab.com/Danacus/melior and https://gitlab.com/Danacus/mlir-sys), but it's not ready for merging yet, and contains several other changes I made while experimenting. I'll create a fork here on Github with only the changes related to the external pass API and make a pull requrest. You can find the implementation of PDL here (I have not tested it yet):
I agree that adding these CAPI extensions upstream would be better, but I'm not sure how easy this would be. As an alternative, a separate |
Closed by #251. |
Let's move on discussions about PDL here. #260 |
As mentioned in #24, support for the ExternalPass API is considered future work.
Since I wanted to explore the possibility of writing MLIR passes in Rust, I have made a working implementation of this as a prototype. I've created an
ExternalPass
trait with the pass callbacks as methods. Any struct that implements theExternalPass
trait can be converted into aPass
using a provided method. I would like to extend this implementation in the future to maybe even allow Rust closures to be converted into aPass
using this API (e.g. by implementingExternalPass
for any stuct that implementsFn
/FnMut
/FnOnce
).Would you be interested in merging such implementation? If so, I will clean up the code and create a merge request soon.
As a side note, I've been experimenting with PDL, which enables declarative passes using pattern description. Unfortunately, this is not supported by the MLIR CAPI, but beaver has extended the CAPI to enable this. I've done a similar thing and extended both
mlir-sys
andmelior
to support PDL modules and pattern sets. However, I'm not sure if it is desirable to extendmlir-sys
with features that are not already part of the CAPI. I might make a separate issue for this.The text was updated successfully, but these errors were encountered: