This is an archive of the discontinued LLVM Phabricator instance.

[MLIR] Allow dialects to disable CSE for certain operations
AbandonedPublic

Authored by skatrak on Aug 30 2023, 8:41 AM.

Details

Summary

This patch adds the DialectCSEInterface, which dialects can implement and register to prevent the common sub-expression elimination (CSE) pass from modifying regions of certain operations.

The result is that these operations would be treated by CSE as if they were IsolatedFromAbove, but without the restrictions that come with that trait.

Diff Detail

Event Timeline

skatrak created this revision.Aug 30 2023, 8:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2023, 8:41 AM
skatrak requested review of this revision.Aug 30 2023, 8:41 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald Transcript

I'm not sure if we want to add an interface for every transform. Is there a way to have a generic solution to this, like a new trait or more general interface? It would be nice to avoid the case where a new transform will have to touch all the dialects, or a new op will require implementing/modifying a bunch of interfaces expressing basically the same thing.

I think this requires an RFC in MLIR discourse to get some feedback from the experts.

Thank you for your comments @jsjodin and @kiranchandramohan , I created an RFC here to try to get consensus on what the best solution should be.

skatrak abandoned this revision.Sep 18 2023, 4:53 AM

I'll close this patch now, since the agreed approach has been to try using the IsolatedFromAbove trait and not to add an interface modifying the CSE pass behavior.