Skip to content

Commit 7229e0b

Browse files
authored
Fix issues with nvrtc compilation (#3666)
* Disable use of builtin `__remove_reference_t` for nvrtc below 12.4 NVRTC does not support it properly, so remove it to unblock cuPy * Use correct warning pragma for nvrtc * Also suppress `__remove_cvref`
1 parent c3a7f67 commit 7229e0b

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

cub/cub/util_cpp_dialect.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
# define CUB_CPP_DIALECT _CCCL_STD_VER
5252

5353
// Define CUB_COMPILER_DEPRECATION macro:
54-
# if _CCCL_COMPILER(MSVC)
54+
# if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
5555
# define CUB_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
5656
# else // clang / gcc:
5757
# define CUB_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)

libcudacxx/include/cuda/std/__cccl/builtin.h

+8
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,10 @@
870870
# define _CCCL_BUILTIN_REMOVE_CVREF(...) __remove_cvref(__VA_ARGS__)
871871
#endif // _CCCL_HAS_BUILTIN(__remove_cvref)
872872

873+
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile that builtin
874+
# undef _CCCL_BUILTIN_REMOVE_CVREF
875+
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
876+
873877
#if _CCCL_HAS_BUILTIN(__remove_extent) && _CCCL_CUDA_COMPILER(CLANG)
874878
# define _CCCL_BUILTIN_REMOVE_EXTENT(...) __remove_extent(__VA_ARGS__)
875879
#endif // _CCCL_HAS_BUILTIN(__remove_extent)
@@ -884,6 +888,10 @@
884888
# define _CCCL_BUILTIN_REMOVE_REFERENCE_T(...) __remove_reference_t(__VA_ARGS__)
885889
#endif // _CCCL_HAS_BUILTIN(__remove_reference_t)
886890

891+
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile cuda::std::move with that
892+
# undef _CCCL_BUILTIN_REMOVE_REFERENCE_T
893+
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
894+
887895
#if _CCCL_HAS_BUILTIN(__remove_volatile) && _CCCL_CUDA_COMPILER(CLANG)
888896
# define _CCCL_BUILTIN_REMOVE_VOLATILE(...) __remove_volatile(__VA_ARGS__)
889897
#endif // _CCCL_HAS_BUILTIN(__remove_volatile)

libcudacxx/include/cuda/std/__internal/cpp_dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#endif // no system header
2222

2323
// Define LIBCUDACXX_COMPILER_DEPRECATION macro:
24-
#if _CCCL_COMPILER(MSVC)
24+
#if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
2525
# define LIBCUDACXX_COMP_DEPR_IMPL(msg) \
2626
_CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
2727
#else // ^^^ _CCCL_COMPILER(MSVC) ^^^ / vvv !_CCCL_COMPILER(MSVC) vvv

thrust/thrust/detail/config/cpp_dialect.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
#define THRUST_CPP_DIALECT _CCCL_STD_VER
4242

4343
// Define THRUST_COMPILER_DEPRECATION macro:
44-
#if _CCCL_COMPILER(MSVC)
44+
#if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
4545
# define THRUST_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
4646
#else // clang / gcc:
4747
# define THRUST_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)

0 commit comments

Comments
 (0)