Skip to content

[SYCL] Add SYCL 2020 operators sycl::logical_and and sycl::logical_or #4476

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 1 commit into from
Sep 3, 2021

Conversation

v-klochkov
Copy link
Contributor

Signed-off-by: Vyacheslav N Klochkov [email protected]

@v-klochkov v-klochkov requested a review from Pennycook September 2, 2021 19:52
@v-klochkov v-klochkov marked this pull request as ready for review September 2, 2021 19:52
@v-klochkov v-klochkov requested a review from a team as a code owner September 2, 2021 19:52
@v-klochkov v-klochkov requested a review from s-kanaev September 2, 2021 19:52
static_assert(known_identity<sycl::bit_xor<T>, T>::value == 0);
}

template <typename T> void checkBoolKnownIdentity() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it also be possible to use bit_and, bit_or, bit_xor with bool? I think these operations are well defined.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting question, but I afraid it may be implementation defined. At least this doc does not mention bool type: https://en.cppreference.com/w/cpp/utility/functional/bit_and

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Pennycook - This PR passed testing, it fixes an obvious miss. bit_and for bool is a separate and less obvious (imo). It can be supported by another PR. If you don't mind I'll merge the current PR as is.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the delayed response! Yes, I agree that this can be merged, and we can revisit the question of which type/operator combinations are supported later.

I think things like bit_and do work for bool, but possibly because of weird integer conversion rules in C++. It's not immediately obvious to me which combinations the SYCL specification expects to work; I'll try to get some more clarity on this point, and we can also wait to see if any users actually complain about not being able to use "weird" combinations.

Copy link
Contributor

@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

LGTM

@bader bader changed the title [SYCL] Add SYCL2020 operators sycl::logical_and and sycl::logical_or [SYCL] Add SYCL 2020 operators sycl::logical_and and sycl::logical_or Sep 3, 2021
@bader bader requested a review from Pennycook September 3, 2021 08:42
@v-klochkov v-klochkov merged commit 6c077a0 into intel:sycl Sep 3, 2021
@v-klochkov v-klochkov deleted the public_vklochkov_logical_or branch September 3, 2021 18:01
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.

3 participants