mdspan icon indicating copy to clipboard operation
mdspan copied to clipboard

Intel DPC++ and [[no_unique_address]

Open wdx04 opened this issue 1 year ago • 4 comments

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,

wdx04 avatar Jan 02 '24 01:01 wdx04