llvm
llvm copied to clipboard
[SYCL] Fix `multi_ptr::prefetch` regression
The regression was introduced in intel/llvm#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).