-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL] Add missing marray binary operator overloads #8276
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
Conversation
This commit does the following for marray: 1. Add overloads on all binary operators with scalars as the left operand. 2. Allow half, float, double in && and || operators. Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
@intel/llvm-reviewers-runtime, could you please take a look? |
sycl/include/sycl/marray.hpp
Outdated
template <typename T> \ | ||
friend typename std::enable_if< \ | ||
std::is_convertible<DataT, T>::value && \ | ||
(std::is_fundamental<T>::value || \ | ||
std::is_same<typename std::remove_const<T>::type, half>::value), \ | ||
marray>::type \ |
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.
Are there any issues if using std::is_convertible_v
/std::is_same_v
/std::enable_if_t
?
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.
It is just in line with the existing definitions. I've changed them for this and the other definitions to keep them consistent.
@@ -23,11 +23,45 @@ using namespace sycl; | |||
CHECK_ALIAS_BY_SIZE(ALIAS_MTYPE, ELEM_TYPE, 8) \ | |||
CHECK_ALIAS_BY_SIZE(ALIAS_MTYPE, ELEM_TYPE, 16) | |||
|
|||
#define CHECK_BINOP(OP, LHS, RHS) \ | |||
assert((LHS[0] * RHS) == (LHS * RHS) && (LHS * RHS[0]) == (LHS * RHS)); |
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.
Do we need to add LHS[0] * RHS[0] == LHS * RHS
? In either case, I think some comment would be helpful here to the reader.
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.
Added case and comment.
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
@@ -23,11 +23,49 @@ using namespace sycl; | |||
CHECK_ALIAS_BY_SIZE(ALIAS_MTYPE, ELEM_TYPE, 8) \ |
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.
Test doesn't pass on Windows - https://github.com/intel/llvm/actions/runs/4248665760/jobs/7388084313.
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.
Fixed with #8449.
This commit does the following for marray:
fixes #8331