google / google/heir

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

Open
#1,616 7 comments 0 reactions 1 assignee Claimed by @AlexanderViand-Intel View on GitHub
Dominant language
MLIR
Stars
906
Forks
171
Avg merge
4d 12h
Merged PRs (30d)
32

Description

Currently, all our dialects and ops are defined using the TableGen-based [Operation Definition Specification (ODS)](https://mlir.llvm.org/docs/DefiningDialects/Operations/) and our canonicalization/folding patterns are expressed as either TableGen-based [Declarative Rewrite Rules (DRR)](https://mlir.llvm.org/docs/DeclarativeRewrites/) 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`](https://mlir.llvm.org/docs/Dialects/IRDL/) and [`pdl`](https://mlir.llvm.org/docs/Dialects/PDLOps/) dialects (for the latter, potentially via the associated DSL [PDLL](https://mlir.llvm.org/docs/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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.