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

Add support for external custom dispatch rewrite patterns #15235

Closed
wants to merge 2 commits into from

Conversation

qedawkins
Copy link
Contributor

Currently custom dispatches must be written in as a part of downstream flows (targeting hal.dispatch.extern or Flow ops directly). This limits how lightweight deployment of custom dispatches with nearly stock IREE flows. This adds a mechanism to plugin and apply pdl patterns completely separate from other IR. This allows hermetically sealing the details of a custom dispatch as a separate IR module that is easy to reuse across models.

The intent is to follow up to this patch with similar passes in the various input dialects to allow different potential rewrite points, as well as turn some of the rewriting utilities into transform operations as another way to represent the dispatch + rewrite logic without the need for C++ and a downstram project.

@qedawkins qedawkins force-pushed the custom_matching_pass branch from 5d9d65c to 7e5f809 Compare October 19, 2023 06:31
Copy link
Collaborator

@benvanik benvanik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@qedawkins qedawkins force-pushed the custom_matching_pass branch from bb370ac to afc2a24 Compare October 23, 2023 00:28
@qedawkins qedawkins marked this pull request as ready for review October 23, 2023 00:41
}

module {
pdl.pattern : benefit(1) {
Copy link
Contributor Author

@qedawkins qedawkins Oct 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stellaraccident with nod-ai/SHARK-ModelDev#108, I wanted to ask whether this still looks like a good path to go down. Essentially the idea was to allow users to specify patterns to match and replace a (flat) DAG with some custom dispatch call by specifying PDL patterns, but I'm thinking there are probably more user friendly ways to do it.

Currently custom dispatches must be written in as a part of downstream
flows (targeting `hal.dispatch.extern` or Flow ops directly). This
limits how lightweight deployment of custom dispatches with nearly stock
IREE flows. This adds a mechanism to plugin and apply pdl patterns
completely separate from other IR. This allows hermetically sealing the
details of a custom dispatch as a separate IR module that is easy to
reuse across models.

The intent is to follow up to this patch with similar passes in the
various input dialects to allow different potential rewrite points, as
well as turn some of the rewriting utilities into transform operations
as another way to represent the dispatch + rewrite logic without the
need for C++ and a downstream project.
@qedawkins qedawkins force-pushed the custom_matching_pass branch from 83476ee to 1eb5abf Compare October 29, 2023 01:05
@qedawkins
Copy link
Contributor Author

Closing as this is superseded by #16150

@qedawkins qedawkins closed this Jan 21, 2024
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

Successfully merging this pull request may close these issues.

2 participants