Skip to content

[SYCL] Fix sycl::atomic regression #19015

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

Open
wants to merge 4 commits into
base: sycl
Choose a base branch
from

Conversation

AlexeySachkov
Copy link
Contributor

@AlexeySachkov AlexeySachkov commented Jun 17, 2025

This is a follow-up for #18839 which broke host compilation of sycl::atomic.

The actual fix is just an addition of #include <sycl/__spirv/spirv_ops.hpp> to sycl/atomic.hpp.

However, I didn't want spirv_ops.hpp to appear again in sycl/detail/core.hpp and therefore I went further to make sure that sycl/atomic.hpp isn't used by sycl/accessor.hpp which prompted other changes in this PR.

This is a follow-up for intel#18839 which broke host compilation of
`sycl::atomic`.

The actual fix is just an addition of `#include
<sycl/__spirv/spirv_ops.hpp>` to `sycl/atomic.hpp`.

However, I didn't want `spirv_ops.hpp` appear again in `sycl/detail/core.hpp`
and therefore I went further to make sure that `sycl/atomic.hpp` isn't used by
`sycl/accessor.hpp` which prompted other changes in this PR.
@AlexeySachkov
Copy link
Contributor Author

Wow, that Windows issue is persistent

I honestly struggle to understand how this patch could cause it at all:

# .---command stderr------------
# | In file included from D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp:10:
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-edge-cases.hpp:24:29: error: constexpr variable 'testcases' must be initialized by a constant expression
# |    24 |   constexpr std::complex<T> testcases[] = {
# |       |                             ^             ~
# |    25 |       /* 0 */ std::complex<T>(1.e-6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    26 |       /* 1 */ std::complex<T>(-1.e-6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    27 |       /* 2 */ std::complex<T>(-1.e-6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    28 |       /* 3 */ std::complex<T>(1.e-6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    29 | 
# |    30 |       /* 4 */ std::complex<T>(1.e+6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    31 |       /* 5 */ std::complex<T>(-1.e+6, 1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    32 |       /* 6 */ std::complex<T>(-1.e+6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    33 |       /* 7 */ std::complex<T>(1.e+6, -1.e-6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    34 | 
# |    35 |       /* 8 */ std::complex<T>(1.e-6, 1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    36 |       /* 9 */ std::complex<T>(-1.e-6, 1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    37 |       /* 10 */ std::complex<T>(-1.e-6, -1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    38 |       /* 11 */ std::complex<T>(1.e-6, -1.e+6),
# |       |       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# |    39 | 
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-float-edge-cases.cpp:12:21: note: in instantiation of function template specialization 'test<float>' requested here
# |    12 | int main() { return test<float>(); }
# |       |                     ^
# | D:\github\_work\llvm\llvm\llvm\sycl\test-e2e\DeviceLib\exp\exp-std-complex-edge-cases.hpp:63:32: note: floating point arithmetic produces a NaN
# |    63 |       /* 32 */ std::complex<T>(NAN, NAN),
# |       |                                ^
# | C:\Program Files (x86)\Windows Kits\10\include\10.0.22[621](https://github.com/intel/llvm/actions/runs/15729393865/job/44326718876?pr=19015#step:27:636).0\ucrt\corecrt_math.h:94:39: note: expanded from macro 'NAN'
# |    94 | #define NAN        (-(float)(INFINITY * 0.0F))
# |       |                                       ^
# | 1 error generated.
# `-----------------------------
# error: command failed with exit status: 1

And I haven't been able to reproduce it so far, but I will make more attempts

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