-
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
transform: (stencil-tensorize-z-dimension) Tensorize arith.constant directly #2970
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2970 +/- ##
==========================================
- Coverage 89.86% 89.84% -0.02%
==========================================
Files 409 409
Lines 51085 51167 +82
Branches 7923 7938 +15
==========================================
+ Hits 45908 45972 +64
- Misses 3925 3932 +7
- Partials 1252 1263 +11 ☔ View full report in Codecov by Sentry. |
This PR depends on #2969, re-run test when this is merged. |
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.
Code changes look good, but I'm not sure about the pass in general, and the test file. It seems like there's quite a lot of inspection and rewriting of operands, when the usual approach is to match directly on the uses. This matters a bit for composability of rewrites, and rewriting some of this tensorization as transformations on the uses would make it easier to read and to test. For example, the linalg.fill where the operand is a constant could be replaced with a new arith.constant of a tensor, leaving the original constant in place (and letting it be dce-ed away in a later stage in the pipeline). Similarly for the arith operations.
Thanks, done as discussed :) |
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.
Nice!
Add support for directly tensorising
arith.constant
, e.g.The more generic way of tensorising any scalar operand (independent of its source) would be
linalg.fill
ing the value a newly created empty tensor. This still works as a generic way. However, in the special case that the scalar operand is a constant, this is much shorter.