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] Cherry-pick "Switch to use plain array in sycl::vec in more cases" to sycl-rel-6_0_0 #17695

Conversation

uditagarwal97
Copy link
Contributor

The problem with using std::array in sycl::vec is that we cannot compile it in some environments (namely, Windows) because the former may use something that is illegal in SYCL device code.

#17025 fixed that, but only did so under preview breaking changes mode, which does not satisfy some of our customers immediately.

This PR introduces two main changes:

  • it allows to opt-in for new behavior through passing -D__SYCL_USE_NEW_VEC_IMPL=1 macro without using
    -fpreview-breaking-changes flag. That allows for a more gradual opt-in from customers who are interested in this fix
  • it switches the imlpementation to use the new approach with C-style arrays if their size and alignment is the same as for the corresponding std::array - in that case their memory layout is expected to be absolutely the same and therefore it should be safe to use the new approach without fear of some ABI incompatibilities. This allows for customers to benefit from the fix without specifying any extra macro (which should be the case for the most common platforms out there)

This is a cherry-pick of #17656

The problem with using `std::array` in `sycl::vec` is that we cannot
compile it in some environments (namely, Windows) because the former may
use something that is illegal in SYCL device code.

intel#17025 fixed that, but only did so under preview breaking
changes mode, which does not satisfy some of our customers immediately.

This PR introduces two main changes:
- it allows to opt-in for new behavior through passing
`-D__SYCL_USE_NEW_VEC_IMPL=1` macro without using
`-fpreview-breaking-changes` flag. That allows for a more gradual opt-in
from customers who are interested in this fix
- it switches the imlpementation to use the new approach with C-style
arrays if their size and alignment is the same as for the corresponding
`std::array` - in that case their memory layout is expected to be
absolutely the same and therefore it should be safe to use the new
approach without fear of some ABI incompatibilities. This allows for
customers to benefit from the fix without specifying any extra macro
(which should be the case for the most common platforms out there)

This is a cherry-pick of intel#17656
@uditagarwal97 uditagarwal97 self-assigned this Mar 27, 2025
@uditagarwal97 uditagarwal97 requested a review from a team as a code owner March 27, 2025 20:55
@uditagarwal97 uditagarwal97 marked this pull request as draft March 27, 2025 20:59
@uditagarwal97
Copy link
Contributor Author

Closed in favor of #17697

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.

2 participants