Added all possible elementwise binary ops for #316.#344
Added all possible elementwise binary ops for #316.#344chudur-budur wants to merge 2 commits intointel:mainfrom
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.
Why would we need buildTrivial if we use TOSA?
There was a problem hiding this comment.
@fschlimb That's my thought too, should we just move to TOSA completely?
There was a problem hiding this comment.
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.
Is this the functionality we need? Why is TOSA any better than math and arith?
There was a problem hiding this comment.
@fschlimb I found those logical ops only in TOSA, is there any other alternative?
There was a problem hiding this comment.
I don't think so. An alternative is of course to write them manually.
| NOT_EQUAL, | ||
| OR, | ||
| POWER, | ||
| RSHIFT, |
There was a problem hiding this comment.
I guess LSHIFT and RSHIFT are duplicates of BITWISE_LEFT_SHIFT and BITWISE_RIGHT_SHIFT.
There was a problem hiding this comment.
Well, I actually thought we should not. Any reason for doing so?
There was a problem hiding this comment.
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?
|
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