Skip to content
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

Investigate feasibility of migrating from ODS to IRDL and DRR to PDL. #1616

Open
AlexanderViand-Intel opened this issue Mar 24, 2025 · 2 comments
Assignees

Comments

@AlexanderViand-Intel
Copy link
Collaborator

Currently, all our dialects and ops are defined using the TableGen-based Operation Definition Specification (ODS) and our canonicalization/folding patterns are expressed as either TableGen-based Declarative Rewrite Rules (DRR) or directly in C++.

While complex rewrites and things such as custom printers/parsers are likely going to always need C++, we have lots of operations and patterns that should be expressible in the irdl and pdl dialects (for the latter, potentially via the associated DSL PDLL).

While its arguable whether those are easier to write/read than their TableGen alternatives, they are certainly more "manipulatable/translatable" which is relevant, for example, to ease the automated extraction of dialect/op definitions and rewrite rules for formal verification (See also #817).

The main issue with IRDL in the past was that it only allowed defining dialects and ops at runtime, but now there's apparently IRDL-to-C++ which means you still get all the autogenerated C++ code assocaited with dialects and ops that we rely upon when we write our passes/etc. The main issue with PDL (and, especially PDLL) is, afaik, one of expressivness, and I'm not sure if there's been any development on this since their initial upstreaming.

The main task of this PR is to investigate which, if any, of our dialects/patterns would be expressible in IRDL/PDL(L) - whether or not we'd actually want to make that switch is probably a discussion for afterwards.

@AlexanderViand-Intel AlexanderViand-Intel self-assigned this Mar 24, 2025
@j2kun
Copy link
Collaborator

j2kun commented Mar 24, 2025

So I wrote a PDLL tutorial about six months ago and I think, if not for one missing feature (support for arithmetic; I asked mgehre if any progress has been made, waiting on a response), we could feasibly convert all of our existing tablegen-based patterns (TensorExt, ModArith, and Polynomial canonicalizations).

For more complex patterns (secret, linalg kernels, etc) we would need support for regions, and possibly dialect conversion, which are big missing features. I had expressed interest in adding support for regions, but I feel it would take quite a long time.

The last time I tried looking into IRDL, I couldn't get anything to work, though I can see in the commit history a lot of new work has been done.

@j2kun
Copy link
Collaborator

j2kun commented Mar 25, 2025

mgehre got back to me: some work has been done in the Xilinx fork of LLVM: Xilinx/llvm-project#98

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants