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

EXAMPLE Op fusion #1660

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

EXAMPLE Op fusion #1660

wants to merge 2 commits into from

Conversation

LPanosTT
Copy link
Contributor

@LPanosTT LPanosTT commented Dec 23, 2024

In this PR I've created a fusion pass and added a few patterns. They are:

  • Fuse exp(x) / sum(exp(x)) to softmax(x)
  • Fuse reshape(reduce(x)) to reduce(x) if the target shape of the reshape is equivalent to just setting the keepdim attribute of reduce to true/false (We'll have to disable this one until we get a metal uplift)
  • Fuse broadcast(x) to x when the broadcast does nothing
  • Fuse maximum(x, 0) to relu(x)

Issue: #1059

I do not expect this to be upstreamed to main anytime soon if ever. I was hoping this could be a used as an example.

@LPanosTT LPanosTT marked this pull request as draft December 24, 2024 15:48
@LPanosTT LPanosTT changed the title Op fusion pass EXAMPLE Op fusion Dec 24, 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.

1 participant