Skip to content

[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

Merged
merged 5 commits into from
Feb 22, 2023

Conversation

steffenlarsen
Copy link
Contributor

@steffenlarsen steffenlarsen commented Feb 9, 2023

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.

fixes #8331

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]>
@steffenlarsen steffenlarsen requested a review from a team February 9, 2023 17:05
@steffenlarsen steffenlarsen requested a review from a team as a code owner February 9, 2023 17:05
@steffenlarsen steffenlarsen temporarily deployed to aws February 9, 2023 17:52 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 9, 2023 20:28 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 10, 2023 09:37 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 10, 2023 10:09 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 15, 2023 11:11 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 16, 2023 16:33 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 11:07 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 11:58 — with GitHub Actions Inactive
@AlexeySachkov
Copy link
Contributor

@intel/llvm-reviewers-runtime, could you please take a look?

Comment on lines 219 to 224
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 \
Copy link
Contributor

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?

Copy link
Contributor Author

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));
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added case and comment.

@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 17:44 — with GitHub Actions Inactive
@steffenlarsen steffenlarsen temporarily deployed to aws February 22, 2023 18:49 — with GitHub Actions Inactive
@bader bader merged commit a1787de into intel:sycl Feb 22, 2023
@@ -23,11 +23,49 @@ using namespace sycl;
CHECK_ALIAS_BY_SIZE(ALIAS_MTYPE, ELEM_TYPE, 8) \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with #8449.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Method operatorOP(const DataT& lhs, const marray& rhs) for '&&' and '||' ops is not implemented
4 participants