-
Notifications
You must be signed in to change notification settings - Fork 77
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: (vector) add pure trait to vector.broadcast and vector.fma #3094
dialects: (vector) add pure trait to vector.broadcast and vector.fma #3094
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #3094 +/- ##
=======================================
Coverage 89.91% 89.91%
=======================================
Files 425 425
Lines 53391 53394 +3
Branches 8268 8268
=======================================
+ Hits 48006 48009 +3
Misses 4047 4047
Partials 1338 1338 ☔ View full report in Codecov by Sentry. |
Thank you for this! Could you please add a minimal filecheck test that tests that these get dce'd away? Should be a minimal test with |
Honestly, I am surprised that the broadcast op would be pure. If MLIR models it this way, it's fine to have it here aswell, I guess. |
Is that indicated by the |
Yep! We now have a similar trait in xDSL, if you could add the |
@webmiche @superlopuh As I discovered similarly on #3103 (resolved discussion); MLIR tend to not report some AlwaysSpeculatable operations properly in their documentation. See:
Those ops are indeed Pure and @knickish was right 🙂 |
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.
(Plus, I personally don't think we should check traits' behaviour on dialect operations everytime, those are tested on their own through test operations, just my 2 cents on that front)
We don't need to go into a full debate here but to me they're two separate things, the trait is just one way to achieve the desired behaviour, and are an implementation detail, and I think it's worth having a test for each dialect to make sure that the operations have the expected behaviour, in this case that the operations can be eliminated if their results are not used. |
Ok, so leave as |
Yes, please :) |
4628149
to
975aad9
Compare
I gave the test a shot, not sure if that's exactly what it's supposed to be though |
/// Check that unused results from vector.broadcast and vector.fma are eliminated | ||
|
||
// CHECK: builtin.module { | ||
// CHECK-NEXT: func.func private @vector_cse_test(%0 : memref<4x4xindex>, %1 : vector<1xi1>, %2 : index) { |
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.
ok but now the func is gone so one more change :)
…ctor.fma and vector.broadcast
57b7ca9
to
3bc7b99
Compare
Thank you! |
Add
Pure
trait tovector.broadcast
andvector.fma
, fixes #3019