Skip to content

Commit

Permalink
Disable [[no_unique_address]] for mdspan and clang
Browse files Browse the repository at this point in the history
We are experience data corruption when passing structs with nested `[[no_unique_address]]` to kernels.

See nvbug4934171
  • Loading branch information
miscco committed Oct 29, 2024
1 parent a237cc7 commit e798687
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libcudacxx/include/cuda/std/__cccl/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
# define _CCCL_NO_UNIQUE_ADDRESS
#endif

// Passing objects with nested [[no_unique_address]] to kernels leads to data corruption
// This happens up to clang18
#if defined(_CCCL_NO_UNIQUE_ADDRESS) && defined(_CCCL_COMPILER_CLANG)
# define _CCCL_HAS_NO_ATTRIBUTE_NO_UNIQUE_ADDRESS
#endif // _CCCL_NO_UNIQUE_ADDRESS && _CCCL_COMPILER_CLANG

#if _CCCL_HAS_CPP_ATTRIBUTE(nodiscard) || (defined(_CCCL_COMPILER_MSVC) && _CCCL_STD_VER >= 2017)
# define _CCCL_NODISCARD [[nodiscard]]
#else // ^^^ has nodiscard ^^^ / vvv no nodiscard vvv
Expand Down

0 comments on commit e798687

Please sign in to comment.