kokkos / mdspan

Reference implementation of mdspan targeting C++23
Other
415 stars 69 forks source link

nvcc and use of `[[no_unique_address]]` #198

Open youyu3 opened 2 years ago

youyu3 commented 2 years ago

In config.hpp there are these checks for using [[no_unique_address]] or using an emulation of it.

#if !defined(_MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS)
#  if ((__has_cpp_attribute(no_unique_address) >= 201803L) && \
       (!defined(__NVCC__) || MDSPAN_HAS_CXX_20) && \
       (!defined(_MDSPAN_COMPILER_MSVC) || MDSPAN_HAS_CXX_20))
#    define _MDSPAN_USE_ATTRIBUTE_NO_UNIQUE_ADDRESS 1
#    define _MDSPAN_NO_UNIQUE_ADDRESS [[no_unique_address]]
#  else
#    define _MDSPAN_NO_UNIQUE_ADDRESS
#  endif
#endif

Using of [[no_unique_address]] is disabled if it's compiled by nvcc. Is this just because this was not supported by nvcc at some point?

Current nvcc does support it now (as long as the host compiler supports it).

crtrott commented 2 years ago

There were also issues with working slightly different on host and device, and that leading to mismatched sizes.