mlir-rs/melior

PDL API

Opened this issue ยท 3 comments

Problem

  • We don't have the PDL API.
    • PDL dialect is not implemented yet.
    • But it should be available and easy to implement through the usual operation construction API.

Solution

Proposing the C API for PDL

Extending mlir-sys

TBD

References

  • The original discussion is in #248.

We don't really need PDL dialect constructors, since PDL patterns can be written in PDLL and can be converted to the PDL dialect with mlir-pdll.

I think we should either request additions to the C API upstream in MLIR, or implement them in a separate crate with API extensions.

Some additional considerations:

  • How expressive is the pdl dialect (or pdl-interp)? Are there patterns that can only be expressed using C++ RewritePatterns? If so, would it be useful to be able to write such patterns in Rust?
  • Would it be useful to expose an API in MLIR to compile PDLL and avoid needing to run the mlir-pdll command?

I've submitted a revision to LLVM: https://reviews.llvm.org/D156021

Thank you so much!