Skip to content

[SYCL] Refactor vec::convert implementation #11770

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

AlexeySachkov
Copy link
Contributor

Introduced ability to perform vector conversions using a single instruction instead of doing so per-element.

Introduced ability to perform vector conversions using a single instruction
instead of doing so per-element.
@AlexeySachkov AlexeySachkov requested a review from a team as a code owner November 3, 2023 10:36
Copy link
Contributor

@dm-vodopyanov dm-vodopyanov left a comment

Choose a reason for hiding this comment

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

LGTM!

@againull againull merged commit f634cc9 into intel:sycl Nov 3, 2023
AlexeySachkov added a commit to AlexeySachkov/llvm that referenced this pull request Nov 8, 2023
This is a bugfix for regressions caused by intel#11770

The following cases are fixed/updated:
- Signed to unsigned (and vice versa) conversions are made to always go
  through per-element path, because native SPIR-V instruction behavies
  differently from what SYCL CTS expects.
  Strictly speaking, this could be a CTS issue, because `vec::convert`
  is underspecified (see KhronosGroup/SYCL-Docs#492), but until the spec
  is clarified we will stick with existing behavior;
- Conversions to bool are made to always go through per-element path,
  because under the hood bool is represented as an integer and there is
  no guarantee that regular integer conversion will produce the right
  bit patterns for `true` and `false` which are not defined by any
  specification;

Added an on-device test to check that `vec::convert` for integer types
behaves correctly and consistently on both host and device. The test
uncovered that we have a problem with `std::byte` and `vec::convert`, but it
seems like we have never tested a case like this and it may not be even
a regression. In any case it will be fixed in a separate PR.
AlexeySachkov added a commit to AlexeySachkov/llvm that referenced this pull request Nov 14, 2023
AlexeySachkov added a commit that referenced this pull request Nov 20, 2023
This is a bugfix for regressions caused by #11770

The following cases are fixed/updated:
- Signed to unsigned (and vice versa) conversions are made to always go
through per-element path, because native SPIR-V instruction behavies
differently from what SYCL CTS expects. Strictly speaking, this could be
a CTS issue, because `vec::convert` is underspecified (see
KhronosGroup/SYCL-Docs#492), but until the spec is clarified we will
stick with existing behavior;
- Conversions to bool are made to always go through per-element path,
because under the hood bool is represented as an integer and there is no
guarantee that regular integer conversion will produce the right bit
patterns for `true` and `false` which are not defined by any
specification;

Added an on-device test to check that `vec::convert` for integer types
behaves correctly and consistently on both host and device.
@AlexeySachkov AlexeySachkov deleted the private/asachkov/native-vec-convert-implementation branch December 1, 2023 13:45
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