Skip to content

Commit b7be533

Browse files
PointKernelwmaxey
authored andcommitted
Always bypass automatic atomic storage checks to prevent potential compiler issues (#4586)
* Always bypass automatic atomic storage checks to prevent potential compiler issues * Waive atomic.local.pass.cpp if `_LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE` is set. --------- Co-authored-by: Wesley Maxey <[email protected]> (cherry picked from commit 549dd45)
1 parent 54925a3 commit b7be533

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

libcudacxx/include/cuda/std/detail/libcxx/include/__config

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ using char32_t = unsigned int;
257257
# define _LIBCUDACXX_HAS_MSVC_ATOMIC_IMPL
258258
# endif
259259

260+
# define _LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
260261
// Enable bypassing automatic storage checks in atomics when using CTK 12.2 and below and if NDEBUG is defined.
261-
# if _CCCL_CUDACC_BELOW(12, 2) && !defined(NDEBUG)
262-
# define _LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
263-
# endif // _CCCL_CUDACC_BELOW(12, 2)
262+
// # if _CCCL_CUDACC_BELOW(12, 2) && !defined(NDEBUG)
263+
// # define _LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE
264+
// # endif // _CCCL_CUDACC_BELOW(12, 2)
264265

265266
// CUDA Atomics supersede host atomics in order to insert the host/device dispatch layer
266267
# if _CCCL_CUDA_COMPILER(NVCC) || _CCCL_COMPILER(NVRTC) || _CCCL_COMPILER(NVHPC) || _CCCL_HAS_CUDA_COMPILER()

libcudacxx/test/libcudacxx/cuda/atomics/atomic.local.pass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ __device__ inline void tests()
120120

121121
int main(int arg, char** argv)
122122
{
123+
#if !defined(_LIBCUDACXX_ATOMIC_UNSAFE_AUTOMATIC_STORAGE)
123124
NV_IF_ELSE_TARGET(
124125
NV_IS_HOST,
125126
(cuda_thread_count = 64;),
126127
(tests<uint8_t>(); tests<uint16_t>(); tests<uint32_t>(); tests<uint64_t>(); tests<int8_t>(); tests<int16_t>();
127128
tests<int32_t>();
128129
tests<int64_t>();))
130+
#endif
129131
return 0;
130132
}

0 commit comments

Comments
 (0)