Skip to content

[SYCL] Fix multi_ptr::prefetch regression #19013

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 1 commit into
base: sycl
Choose a base branch
from

Conversation

AlexeySachkov
Copy link
Contributor

The regression was introduced in #18839 and the error looks like:

/include/sycl/multi_ptr.hpp:397:5: error: no matching function for call to '__spirv_ocl_prefetch'
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
/include/sycl/multi_ptr.hpp:397:5: note: candidate function not viable: no known conversion from 'ptr_t' (aka 'const __global char *') to 'const __global signed char *' for 1st argument
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);

We previously switched to use __spirv_ocl_prefetch that is automatically defined by the compiler instead of having its forward-declaration in our headers. However, compiler-provided declaration does not define an overload for plain char for some reason.

Changing that may trigger some unknown and unwanted side effects, so for the meantime the problem is worked around by using unsigned char overload instead which should be safe (from strict aliasing rules point of view).

The regression was introduced in intel#18839 and the error looks
like:

```
/include/sycl/multi_ptr.hpp:397:5: error: no matching function for call to '__spirv_ocl_prefetch'
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
/include/sycl/multi_ptr.hpp:397:5: note: candidate function not viable: no known conversion from 'ptr_t' (aka 'const __global char *') to 'const __global signed char *' for 1st argument
  397 |     __spirv_ocl_prefetch(reinterpret_cast<ptr_t>(get_decorated()), NumBytes);
```

We previously switched to use `__spirv_ocl_prefetch` that is
automatically defined by the compiler instead of having its
forward-declaration in our headers. However, compiler-provided
declaration does not define an overload for plain `char` for some
reason.

Changing that may trigger some unknown and unwanted side effects, so for
the meantime the problem is worked around by using `unsigned char`
overload instead which should be safe (from strict aliasing rules point
of view).
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.

1 participant