Page MenuHomePhabricator

[mlir][Transforms][NFC] CSE: Add non-pass entry point
Needs ReviewPublic

Authored by springerm on Mar 3 2023, 3:04 AM.

Details

Summary

Add an additional entry point so that CSE can be used without a pass.

Diff Detail

Event Timeline

springerm created this revision.Mar 3 2023, 3:04 AM
Herald added a project: Restricted Project. · View Herald Transcript
springerm requested review of this revision.Mar 3 2023, 3:04 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2023, 3:04 AM

I am not sure I understand the overall direction: is the goal to instrument every single transformation manually by injecting listeners that way?
That seems a bit ad-how to me and I am not convinced that we should just scale this approach in an uncoordinated fashion. I would like to have a more comprehensive idea of the general pattern we aim for.

This is also intersecting with the IR listener discussions on Discourse.

I am not sure I understand the overall direction: is the goal to instrument every single transformation manually by injecting listeners that way?
That seems a bit ad-how to me and I am not convinced that we should just scale this approach in an uncoordinated fashion. I would like to have a more comprehensive idea of the general pattern we aim for.

This is also intersecting with the IR listener discussions on Discourse.

Yes IR listeners would be ideal here. Then we wouldn't need any of this.

We currently maintain a copy of the CSE pass in IREE because we cannot get notifications for the transform dialect. This was the only transform I was going to add this to (apart from the GreedyPatternRewriteDriver which already has it). But it does leave some asymmetry because some transforms have a listener and other do not.

An alternative would be to give the eliminateCommonSubExpressions a RewriterBase & argument instead of a listener. The rewriter could already come with a listener attached (or not). Or we could just wait until IR listeners have landed... (There would still be some benefit of being able to run CSE without building a pass pipeline with a single pass and running the pipeline.)

springerm planned changes to this revision.Mar 3 2023, 4:26 AM
springerm updated this revision to Diff 502124.Mar 3 2023, 7:04 AM

remove config and listener

springerm retitled this revision from [mlir][Transforms][NFC] CSE: Add CSERewriteConfig and non-pass entry point to [mlir][Transforms][NFC] CSE: Add non-pass entry point.Mar 3 2023, 7:05 AM
springerm edited the summary of this revision. (Show Details)