-
Notifications
You must be signed in to change notification settings - Fork 79
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: (arith) Use the SameOperandsAndResultType
trait in arith
dialect
#3824
base: main
Are you sure you want to change the base?
dialects: (arith) Use the SameOperandsAndResultType
trait in arith
dialect
#3824
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3824 +/- ##
==========================================
- Coverage 91.25% 91.24% -0.02%
==========================================
Files 461 461
Lines 57557 57629 +72
Branches 5549 5567 +18
==========================================
+ Hits 52523 52581 +58
- Misses 3609 3620 +11
- Partials 1425 1428 +3 ☔ View full report in Codecov by Sentry. |
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.
I'm not sure this does much, we already enforce (too strictly) that the operands and results must be the same if my understanding is correct
It's the same as in #3761 and here's an earlier relevant discussion #3751 (comment) |
Right, I would have made the same comment on the other one if I had got round to reviewing it. I believe the operation is already more constrained by the current constraints. |
Sorry I don't understand, even for shapes? |
I believe the current constraint enforces that the types (including shapes) are exactly the same. |
Maybe a better question is do you have a test case which has different behaviour with this change? |
Maybe I wasn't clear, but my annoyance for what I'm trying out here is that it is overly constrained, especially with dynamic shapes: %0 = "test.op"() : () -> tensor<1x?xi64>
%1 = "test.op"() : () -> tensor<1x3xi64>
%2 = "arith.addi"(%0, %1) <{overflowFlags = #arith.overflow<none>}> : (tensor<1x?xi64>, tensor<1x3xi64>) -> tensor<1x?xi64> This passes from My idea was to add the attribute and then relax this. If there is a way to do this with constraints, I'll gladly drop this. |
This is a great example, could it be added to this PR? |
Might as well relax in one go, no? |
Yeah, sure, wdyt @alexarice ? |
I agree, with the caveat that I'm almost certain this will mess up the assembly format in a way I don't know how to fix |
what would the custom format look like for your example, as |
%0 = "test.op"() : () -> tensor<1x?xi64>
%1 = "test.op"() : () -> tensor<1x3xi64>
%2 = arith.addi %0, %1 : tensor<1x?xi64 We get a different error then, because it assumes that
which I find even more confusing. |
I just tried it myself,
|
SameOperandsAndResultType
trait in arith
dialect
This PR:
SameOperandsAndResultsType
trait in the relevantarith
ops