Skip to content

Commit 65c0373

Browse files
authored
Ensure that we are actually calling the cuda APIs ... (NVIDIA#4570)
We were dropping them on the floor, which is definitely not the right thing
1 parent 8960237 commit 65c0373

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

libcudacxx/include/cuda/std/__cuda/api_wrapper.h

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,23 @@
2727

2828
#include <cuda/std/__exception/cuda_error.h>
2929

30-
#if _CCCL_HAS_CUDA_COMPILER()
31-
# define _CCCL_TRY_CUDA_API(_NAME, _MSG, ...) \
32-
{ \
33-
const ::cudaError_t __status = _NAME(__VA_ARGS__); \
34-
switch (__status) \
35-
{ \
36-
case ::cudaSuccess: \
37-
break; \
38-
default: \
39-
::cudaGetLastError(); \
40-
::cuda::__throw_cuda_error(__status, _MSG); \
41-
} \
42-
}
43-
44-
# define _CCCL_ASSERT_CUDA_API(_NAME, _MSG, ...) \
45-
{ \
46-
[[maybe_unused]] const ::cudaError_t __status = _NAME(__VA_ARGS__); \
47-
_CCCL_ASSERT(__status == cudaSuccess, _MSG); \
48-
}
49-
#else // ^^^ _CCCL_HAS_CUDA_COMPILER() ^^^ / vvv !_CCCL_HAS_CUDA_COMPILER() vvv
50-
# define _CCCL_TRY_CUDA_API(_NAME, _MSG, ...)
51-
# define _CCCL_ASSERT_CUDA_API(_NAME, _MSG, ...)
52-
#endif // !_CCCL_HAS_CUDA_COMPILER()
30+
#define _CCCL_TRY_CUDA_API(_NAME, _MSG, ...) \
31+
{ \
32+
const ::cudaError_t __status = _NAME(__VA_ARGS__); \
33+
switch (__status) \
34+
{ \
35+
case ::cudaSuccess: \
36+
break; \
37+
default: \
38+
::cudaGetLastError(); \
39+
::cuda::__throw_cuda_error(__status, _MSG); \
40+
} \
41+
}
42+
43+
#define _CCCL_ASSERT_CUDA_API(_NAME, _MSG, ...) \
44+
{ \
45+
[[maybe_unused]] const ::cudaError_t __status = _NAME(__VA_ARGS__); \
46+
_CCCL_ASSERT(__status == cudaSuccess, _MSG); \
47+
}
5348

5449
#endif //_CUDA__STD__CUDA_API_WRAPPER_H

0 commit comments

Comments
 (0)