Skip to content

Commit 3a388b7

Browse files
Fix issues with nvrtc compilation (#3666) (#3674)
* 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` (cherry picked from commit 7229e0b) Co-authored-by: Michael Schellenberger Costa <[email protected]>
1 parent 612f475 commit 3a388b7

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
@@ -61,7 +61,7 @@
6161
# define CUB_CPP_DIALECT _CCCL_STD_VER
6262

6363
// Define CUB_COMPILER_DEPRECATION macro:
64-
# if _CCCL_COMPILER(MSVC)
64+
# if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
6565
# define CUB_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
6666
# else // clang / gcc:
6767
# 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
@@ -722,6 +722,10 @@
722722
# define _CCCL_BUILTIN_REMOVE_CVREF(...) __remove_cvref(__VA_ARGS__)
723723
#endif // _CCCL_HAS_BUILTIN(__remove_cvref)
724724

725+
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile that builtin
726+
# undef _CCCL_BUILTIN_REMOVE_CVREF
727+
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
728+
725729
#if _CCCL_HAS_BUILTIN(__remove_extent) && _CCCL_CUDA_COMPILER(CLANG)
726730
# define _CCCL_BUILTIN_REMOVE_EXTENT(...) __remove_extent(__VA_ARGS__)
727731
#endif // _CCCL_HAS_BUILTIN(__remove_extent)
@@ -736,6 +740,10 @@
736740
# define _CCCL_BUILTIN_REMOVE_REFERENCE_T(...) __remove_reference_t(__VA_ARGS__)
737741
#endif // _CCCL_HAS_BUILTIN(__remove_reference_t)
738742

743+
#if _CCCL_COMPILER(NVRTC, <, 12, 4) // NVRTC below 12.4 fails to properly compile cuda::std::move with that
744+
# undef _CCCL_BUILTIN_REMOVE_REFERENCE_T
745+
#endif // _CCCL_COMPILER(NVRTC, <, 12, 4)
746+
739747
#if _CCCL_HAS_BUILTIN(__remove_volatile) && _CCCL_CUDA_COMPILER(CLANG)
740748
# define _CCCL_BUILTIN_REMOVE_VOLATILE(...) __remove_volatile(__VA_ARGS__)
741749
#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
@@ -49,7 +49,7 @@
4949
#define THRUST_CPP_DIALECT _CCCL_STD_VER
5050

5151
// Define THRUST_COMPILER_DEPRECATION macro:
52-
#if _CCCL_COMPILER(MSVC)
52+
#if _CCCL_COMPILER(MSVC) || _CCCL_COMPILER(NVRTC)
5353
# define THRUST_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(message(__FILE__ ":" _CCCL_TO_STRING(__LINE__) ": warning: " #msg))
5454
#else // clang / gcc:
5555
# define THRUST_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)

0 commit comments

Comments
 (0)