EPFL-LAP / dynamatic

DHLS (Dynamic High-Level Synthesis) compiler based on MLIR
Other
65 stars 19 forks source link

[Handshake] Add canonicalization patterns and folders #148

Open lucas-rami opened 2 months ago

lucas-rami commented 2 months ago

The HandshakeCanonicalize transformation pass contains canonicalization patterns for some Handshake operations. It was introduced when we still depended on CIRCT for the Handshake dialect to separate the "proper" canonicalization patterns on Handshake operations that were defined by CIRCT (and that are normally registered as part of the dialect definition itself) from our "unofficial" ones, defined in an independent pass. This separation no longer makes sense now that we no longer depend on CIRCT and have full control over the Handshake dialect.

All the canonicalization patterns that this pass contains should be "promoted to proper canonicalization patterns" that are attached to Handshake operations themselves and defined as part of the Handshake dialect. The HandshakeCanonicalize pass should then be deleted altogether (in the compile.sh script, --handshake-canonicalize should be replaced with --canonicalize to invoke the default MLIR canonicalizer instead of our pass). At the same time, we should think about whether we can implement some other canonicalizations and/or folders for basic Handshake operations. In fact some existing patterns should be transformed into folders when it is possible (e.g., EraseUnconditionalBranches).

MLIR documentation on canonicalzation/operation folding.