Skip to content
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

[SYCL] Fix return type of relational functions on scalars #5975

Merged
merged 10 commits into from
May 2, 2022

Conversation

aelovikov-intel
Copy link
Contributor

@aelovikov-intel aelovikov-intel commented Apr 6, 2022

The fix is ABI-breaking and is put under SYCL2020_CONFORMANT_APIS guard.

This fix updates scalar versions of relation functions that now return "bool"
instead of a signed integer in SYCL 2020 mode.
@aelovikov-intel aelovikov-intel marked this pull request as ready for review April 6, 2022 18:45
@aelovikov-intel aelovikov-intel requested a review from a team as a code owner April 6, 2022 18:45
@aelovikov-intel aelovikov-intel marked this pull request as draft April 6, 2022 19:01
The standard only references half support by redirecting to the OpenCL
extensions and it's "int" there.
To the best of my reading of the standard previous implementation had a bug:

SYCL 1.2.1, 4.13.1 Description of the built-in types available for SYCL host
and device, table 4.109:

  genfloatd | double, doublen

SYCL 1.2.1 4.13.7 Relational functions, table 4.116:

  igeninteger32bit isequal (genfloatf x, genfloatf y)
  igeninteger64bit isequal (genfloatd x, genfloatd y)
@aelovikov-intel aelovikov-intel changed the title [SYCL] Update return type of relation functions according to SYCL 2020 [SYCL] Fix return type of relation functions Apr 6, 2022
@aelovikov-intel aelovikov-intel changed the title [SYCL] Fix return type of relation functions [SYCL] Fix return type of relation functions on scalars Apr 6, 2022
@aelovikov-intel aelovikov-intel changed the title [SYCL] Fix return type of relation functions on scalars [SYCL] Fix return type of relational functions on scalars Apr 6, 2022
template <typename T,
typename = detail::enable_if_t<detail::is_genfloat<T>::value, T>>
detail::common_rel_ret_t<T> signbit(T x) __NOEXC {
return detail::RelConverter<T>::apply(
__sycl_std::__invoke_SignBitSet<detail::rel_ret_t<T>>(x));
}

// int any (sigeninteger x)
// The standard is being corrected for "any" at
// https://github.com/KhronosGroup/SYCL-Docs/pull/234. Scalar/marray version
Copy link
Contributor

Choose a reason for hiding this comment

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

That PR hasn't landed yet, so why it is OK to assume it will land and and in the way it is spelled currently?
@gmlueck : could you also confirm that this implementation change is valid now?

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed this in the Khronos SYCL workgroup, and there was general agreement on the direction. I cannot say for sure that it will be accepted until it is merged, though. I do not mind if we put this PR on hold until the spec changes is accepted. There is a Khronos meeting today, but our next regular "issue" meeting is on April 14. There is some chance the spec PR will get merged today, but most likely it won't happen until April 14.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @gmlueck .

@aelovikov-intel : please hold this PR until spec change lands.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aelovikov-intel : please hold this PR until spec change lands.

That's fine but I'd like to know if there are any issues with the code in advance. Can you both please do the actual review but hold on on approving it?

Copy link
Contributor

Choose a reason for hiding this comment

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

I did review and it looks good to me.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that the Khronos spec PR (KhronosGroup/SYCL-Docs#234) was accepted by the committee and merged.

@aelovikov-intel aelovikov-intel marked this pull request as ready for review April 28, 2022 19:13
@aelovikov-intel
Copy link
Contributor Author

Ping @smaslov-intel .

@aelovikov-intel
Copy link
Contributor Author

Would you please help to merge this in? I don't have write access.

@pvchupin pvchupin merged commit fd2aa65 into intel:sycl May 2, 2022
@pvchupin
Copy link
Contributor

pvchupin commented May 2, 2022

@aelovikov-intel, 1 LIT fail on windows in post-commit. Please follow up.

pvchupin pushed a commit that referenced this pull request May 2, 2022
pvchupin pushed a commit that referenced this pull request May 2, 2022
@aelovikov-intel aelovikov-intel deleted the rel-func-ret-type branch November 8, 2022 20:56
steffenlarsen pushed a commit to steffenlarsen/llvm that referenced this pull request Nov 16, 2022
This fix updates scalar versions of relation functions that now return "bool"
instead of a signed integer in SYCL 2020 mode.

The fix is ABI-breaking and is put under SYCL2020_CONFORMANT_APIS guard.
steffenlarsen added a commit that referenced this pull request Nov 18, 2022
This fix updates scalar versions of relation functions that now return
"bool"
instead of a signed integer in SYCL 2020 mode.

The fix is ABI-breaking and is put under SYCL2020_CONFORMANT_APIS guard.

This is a revival of the reverted patch
#5975.

Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Co-authored-by: aelovikov-intel <andrei.elovikov@intel.com>
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.

4 participants