-
Notifications
You must be signed in to change notification settings - Fork 44
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
Added all possible elementwise binary ops for #316. #344
base: main
Are you sure you want to change the base?
Conversation
// Many TOSA functions take two arguments and do the | ||
// same operation on both arguments. | ||
// TODO: | ||
// 1. Find a way to merge this function with trivialBuilder(). |
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.
Why would we need buildTrivial if we use TOSA?
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.
@fschlimb That's my thought too, should we just move to TOSA completely?
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.
When I investigated I realized that TOSA does not have unsigned types. I could not figure out if that's a gap or a design decision. If we can assume that TOSA can support unsigned ints then the only reason for not using TOSA might be compile-time. But I tend to think that's probably acceptable at this point.
// Many TOSA functions take two arguments and do the | ||
// same operation on both arguments. |
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.
Is this the functionality we need? Why is TOSA any better than math and arith?
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.
@fschlimb I found those logical ops only in TOSA, is there any other alternative?
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 don't think so. An alternative is of course to write them manually.
@@ -53,6 +53,7 @@ enum EWBinOpId : int { | |||
NOT_EQUAL, | |||
OR, | |||
POWER, | |||
RSHIFT, |
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 guess LSHIFT and RSHIFT are duplicates of BITWISE_LEFT_SHIFT and BITWISE_RIGHT_SHIFT.
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.
@fschlimb Okay, we can just duplicate them.
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.
Well, I actually thought we should not. Any reason for doing so?
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.
Well, actually there was LSHIFT
but no RSHIFT
, so I added it. Which ones we should keep? LSHIFT/RSHIFT
or BITWISE_LEFT_SHIFT/BITWISE_RIGHT_SHIFT
?
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 prefer BITWISE_*_SHIFT.
Please also note that the RFC makes the following distinction:
|
Hi, I couldn't find this RFC, where is it? |
docs/rfcs/20220804-ptensor/README.md |
What is the difference between |
The tests return a boolean tensor always. The others return numbers. If we do not need excessive conditionals in the implementation it is probably ok to combine. |
@fschlimb I think it's ready for merge. |
I guess we need tests. I suggest deferring most of this until we resolved #380. @chudur-budur Could you please add one test similar to test/imex-runner/ptensor_arange.mlir using one of the TOSA-backed binbops? You will need to extend test/imex-runner/ptensor.pp with the respective TOSA-passes (or add and use extended copy of it). |
Please review these guidelines to help with the review process:
@diptorupd @fschlimb