Open wdx04 opened 10 months ago
I added a comment in the Intel thread, but basically this is a serious compiler issue as far as I can tell. My understanding is that the issue is that the two macros in question end up being defined differently in host and device code, something which definitely should not happen. That said we do occasionally work around compiler bugs if you find a fix (I don't have a setup for windows SYCL) feel free to propose one.
I added a comment in the Intel thread, but basically this is a serious compiler issue as far as I can tell. My understanding is that the issue is that the two macros in question end up being defined differently in host and device code, something which definitely should not happen. That said we do occasionally work around compiler bugs if you find a fix (I don't have a setup for windows SYCL) feel free to propose one.
Hi crtrott,
I don't think Intel will fix the compiler issue any time soon, and I have found a workaround for the compiler:
The modified __p0009_bits/config.hpp is verified to work with the DPC++ 2024.0 compiler.
Thanks,
Yeah we can do this or something similar. Possibly restricting this to when SYCL is enabled?
We can use the SYCL_LANGUAGE_VERSION macro to check if SYCL is enabled:
// dpcpp only
#if defined(SYCL_LANGUAGE_VERSION) && defined (__INTEL_LLVM_COMPILER)
// code specific for DPC++ compiler below
// ... ...
// example only
std::cout << "SYCL_LANGUAGE_VERSION: " << SYCL_LANGUAGE_VERSION << std::endl;
std::cout << "__INTEL_LLVM_COMPILER: " << __INTEL_LLVM_COMPILER << std::endl;
std::cout << "__VERSION__: " << __VERSION__ << std::endl;
#endif
Hi,
The latest Intel DPC++ compiler supports C++20 and [[no_unique_address]] attribute, however it does not support feature testing of the [[no_unique_address]] attribute.
When compiling SYCL source code using mdspan with DPC++ and /std:c++20, MDSPAN_HAS_CXX_20 is true, but ((__has_cpp_attribute(no_unique_address) >= 201803L)) is false.
Because of this, _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS and _MDSPAN_NO_UNIQUE_ADDRESS macros in __p0009_bits/config.hpp will not be correctly defined in SYCL host code, causing compilation errors.
Please see https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/Failed-to-use-mdspan-in-SYCL-kernel-code/m-p/1542689 for discussion on the errors.
I think SYCL Unified Shared Memory (USM) is one of the most important use cases of mdspan, and DPC++ is one of the best SYCL compilers, so it would be nice to have a workaround for that compiler.
Thanks,