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 #17697

Merged
merged 2 commits into from
Mar 31, 2025

Conversation

uditagarwal97
Copy link
Contributor

@uditagarwal97 uditagarwal97 commented Mar 27, 2025

This is a cherry-pick of #17656 + changes required to resolve merge conflicts.


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)

AlexeySachkov and others added 2 commits March 27, 2025 13:43
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
@AlexeySachkov
Copy link
Contributor

We do not have regular pre-commit mechanism properly configured for sycl-rel-6_0_0 branch, but we have validated it through the nightly validation run here: https://github.com/intel/llvm/actions/runs/14133470110

There are some failures, but they are known

@AlexeySachkov AlexeySachkov merged commit e42590e into sycl-rel-6_0_0 Mar 31, 2025
16 of 24 checks passed
@AlexeySachkov AlexeySachkov deleted the cherry-pick-vec branch March 31, 2025 12:05
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