-
Notifications
You must be signed in to change notification settings - Fork 80
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
dialects: (varith) Add varith (variadic arithmetic) dialect #3241
Conversation
8aff34a
to
1835d9d
Compare
1835d9d
to
25e65c3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3241 +/- ##
=======================================
Coverage 89.91% 89.92%
=======================================
Files 440 441 +1
Lines 55392 55417 +25
Branches 8641 8643 +2
=======================================
+ Hits 49808 49832 +24
- Misses 4157 4158 +1
Partials 1427 1427 ☔ View full report in Codecov by Sentry. |
Interesting! What's the advantage of this? Smaller IR? I'm a little worried that it might be more difficult to reason about the individual arithmetic operations that would make up a variadic one |
Imo it looks quite useful for restructuring larger computations. As for specifying what arithmetic operation made up the variadic one, linalg.reduce solves this by having a region:
Though having separate ops seems quite straightforward actually. |
In our usecase, we have a giant sum that we need to split into two. This is much harder if you have a taller def-use tree vs a shorter one:
This allows us to basically "filter" the |
Interesting! I'm curious to see where this goes |
"varith", | ||
[ | ||
VarithAddOp, | ||
VarithMulOp, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about VarithSumOp
and VarithProductOp
?
Add a variadic arithmetic dialect. The goal is to provide a place for nice-to-use arithmetic operations. Also makes re-writing arithmetic easier in some cases, e.g. when you want to split a summation over one set of values into two summations by selecting certain values from the set. Coming next is two rewrites to canonicalize arith to varith, and then to de-canonicalize back.
Add a variadic arithmetic dialect.
The goal is to provide a place for nice-to-use arithmetic operations. Also makes re-writing arithmetic easier in some cases, e.g. when you want to split a summation over one set of values into two summations by selecting certain values from the set.
Coming next is two rewrites to canonicalize arith to varith, and then to de-canonicalize back.