Skip to content

Commit

Permalink
Update libcudacxx to 2.1.0 (#464)
Browse files Browse the repository at this point in the history
This PR separates out the libcudacxx update from #399. I am proposing to update only libcudacxx to 2.1.0, and leave thrust/cub pinned at 1.17.2 until all of RAPIDS is ready to update. Then we can move forward with #399 next.

Separating the update for libcudacxx should allow RAPIDS to use some of the new features we want while giving more time to RAPIDS libraries to migrate to CCCL 2.1.0 (particularly for breaking changes in Thrust/CUB).

**Immediate benefits of bumping only libcudacxx to 2.1.0:**
- Enables migration to Thrust/CUB 2.1.0 to be done more incrementally, because we could merge PRs using `cuda::proclaim_return_type` into cudf/etc. which would reduce the amount of unmerged code we're maintaining in the "testing PRs" while waiting for all RAPIDS repos to be ready for Thrust/CUB 2.1.0.
- Unblocks work in rmm (rapidsai/rmm#1095) and quite a few planned changes for cuCollections (such as NVIDIA/cuCollections#332, NVIDIA/cuCollections#331, NVIDIA/cuCollections#289)

**Risk Assessment:**
This should be fairly low risk because libcudacxx 2.1.0 is similar to our current pinning of 1.9.1 -- the major version bump was meant to align with Thrust/CUB and isn't indicative of major breaking changes.

Authors:
  - Bradley Dice (https://github.com/bdice)

Approvers:
  - Robert Maynard (https://github.com/robertmaynard)
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #464
  • Loading branch information
bdice authored Oct 16, 2023
1 parent bd341fb commit e73fef6
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 45 deletions.
10 changes: 10 additions & 0 deletions rapids-cmake/cpm/patches/command_template.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ function(rapids_cpm_run_git_patch file issue)
set(msg_state ${msg_state} PARENT_SCOPE)
endfunction()

# We want to ensure that any patched files have a timestamp
# that is at least 1 second newer compared to the git checkout
# This ensures that all of CMake up-to-date install logic
# considers these files as modified.
#
# This ensures that if our patch contains additional install rules
# they will execute even when an existing install rule exists
# with the same destination ( and our patch is listed last ).
execute_process(COMMAND ${CMAKE_COMMAND} -E sleep 1)

set(files "@patch_files_to_run@")
set(issues "@patch_issues_to_ref@")
set(output_file "@log_file@")
Expand Down
47 changes: 11 additions & 36 deletions rapids-cmake/cpm/patches/libcudacxx/install_rules.diff
Original file line number Diff line number Diff line change
@@ -1,36 +1,18 @@
diff --git a/cmake/libcudacxxInstallRules.cmake b/cmake/libcudacxxInstallRules.cmake
index 446ccb50..ff622bb7 100644
index bd92a3be..f99a5606 100644
--- a/cmake/libcudacxxInstallRules.cmake
+++ b/cmake/libcudacxxInstallRules.cmake
@@ -1,5 +1,5 @@
option(libcudacxx_ENABLE_INSTALL_RULES
- "Enable installation of libcudacxx" ${libcudacxx_TOPLEVEL_PROJECT}
+ "Enable installation of libcudacxx" ${LIBCUDACXX_TOPLEVEL_PROJECT}
)

if (NOT libcudacxx_ENABLE_INSTALL_RULES)
@@ -12,24 +12,27 @@ include(GNUInstallDirs)
# Libcudacxx headers
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/include/cuda"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ PATTERN CMakeLists.txt EXCLUDE
)
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/include/nv"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
+ PATTERN CMakeLists.txt EXCLUDE
)

# Libcudacxx cmake package
install(DIRECTORY "${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake"
- PATTERN libcudacxx-header-search EXCLUDE
+ PATTERN *.cmake.in EXCLUDE
)

@@ -28,10 +28,17 @@ install(DIRECTORY "${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx"
# Need to configure a file to store CMAKE_INSTALL_INCLUDEDIR
# since it can be defined by the user. This is common to work around collisions
# with the CTK installed headers.
+set(install_location "${CMAKE_INSTALL_LIBDIR}/cmake/libcudacxx")
+# Transform to a list of directories, replace each directory with "../"
+# and convert back to a string
+string(REGEX REPLACE "/" ";" from_install_prefix "${install_location}")
+list(TRANSFORM from_install_prefix REPLACE ".+" "../")
+list(JOIN from_install_prefix "" from_install_prefix)
+
configure_file("${libcudacxx_SOURCE_DIR}/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in"
"${libcudacxx_BINARY_DIR}/lib/cmake/libcudacxx/libcudacxx-header-search.cmake"
@ONLY
Expand All @@ -39,23 +21,16 @@ index 446ccb50..ff622bb7 100644
- DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libcudacxx"
+ DESTINATION "${install_location}"
)

diff --git a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
index 9e7e187c..cb3b946f 100644
index 9e7e187c..6130197f 100644
--- a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
+++ b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
@@ -1,8 +1,18 @@
@@ -1,8 +1,12 @@
# Parse version information from version header:
unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
+
+# Find CMAKE_INSTALL_INCLUDEDIR=@CMAKE_INSTALL_INCLUDEDIR@ directory"
+set(from_install_prefix "@install_location@")
+
+# Transform to a list of directories, replace each directory with "../"
+# and convert back to a string
+string(REGEX REPLACE "/" ";" from_install_prefix "${from_install_prefix}")
+list(TRANSFORM from_install_prefix REPLACE ".+" "../")
+list(JOIN from_install_prefix "" from_install_prefix)
+set(from_install_prefix "@from_install_prefix@")
+
find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config
NO_DEFAULT_PATH # Only search explicit paths below:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
diff --git a/include/cuda/std/detail/libcxx/include/__functional/invoke.h b/include/cuda/std/detail/libcxx/include/__functional/invoke.h
index 1ab318d5..850d00a8 100644
--- a/include/cuda/std/detail/libcxx/include/__functional/invoke.h
+++ b/include/cuda/std/detail/libcxx/include/__functional/invoke.h
@@ -342,6 +342,9 @@ _LIBCUDACXX_INLINE_VISIBILITY __nat __invoke(__any, _Args&& ...__args);

// bullets 1, 2 and 3

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0, class ..._Args,
class = __enable_if_bullet1<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -350,6 +353,9 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
_NOEXCEPT_(noexcept((static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...)))
{ return (static_cast<_A0&&>(__a0).*__f)(static_cast<_Args&&>(__args)...); }

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0, class ..._Args,
class = __enable_if_bullet2<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -358,6 +364,9 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
_NOEXCEPT_(noexcept((__a0.get().*__f)(static_cast<_Args&&>(__args)...)))
{ return (__a0.get().*__f)(static_cast<_Args&&>(__args)...); }

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0, class ..._Args,
class = __enable_if_bullet3<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -368,6 +377,9 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)

// bullets 4, 5 and 6

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0,
class = __enable_if_bullet4<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -376,6 +388,9 @@ __invoke(_Fp&& __f, _A0&& __a0)
_NOEXCEPT_(noexcept(static_cast<_A0&&>(__a0).*__f))
{ return static_cast<_A0&&>(__a0).*__f; }

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0,
class = __enable_if_bullet5<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -384,6 +399,9 @@ __invoke(_Fp&& __f, _A0&& __a0)
_NOEXCEPT_(noexcept(__a0.get().*__f))
{ return __a0.get().*__f; }

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class _A0,
class = __enable_if_bullet6<_Fp, _A0> >
inline _LIBCUDACXX_INLINE_VISIBILITY
@@ -394,6 +412,9 @@ __invoke(_Fp&& __f, _A0&& __a0)

// bullet 7

+#ifdef __CUDACC__
+#pragma nv_exec_check_disable
+#endif
template <class _Fp, class ..._Args>
inline _LIBCUDACXX_INLINE_VISIBILITY
_LIBCUDACXX_CONSTEXPR decltype(_CUDA_VSTD::declval<_Fp>()(_CUDA_VSTD::declval<_Args>()...))
8 changes: 4 additions & 4 deletions rapids-cmake/cpm/patches/libcudacxx/reroot_support.diff
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
diff --git a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
index 8c44d990..365b9de0 100644
index 6130197f..ec53d5de 100644
--- a/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
+++ b/lib/cmake/libcudacxx/libcudacxx-header-search.cmake.in
@@ -11,6 +11,7 @@ list(TRANSFORM from_install_prefix REPLACE ".+" "../")
list(JOIN from_install_prefix "" from_install_prefix)

@@ -5,6 +5,7 @@ unset(_libcudacxx_VERSION_INCLUDE_DIR CACHE) # Clear old result to force search
set(from_install_prefix "@from_install_prefix@")
find_path(_libcudacxx_VERSION_INCLUDE_DIR cuda/std/detail/__config
+ NO_CMAKE_FIND_ROOT_PATH # Don't allow CMake to re-root the search
NO_DEFAULT_PATH # Only search explicit paths below:
Expand Down
14 changes: 9 additions & 5 deletions rapids-cmake/cpm/versions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

{
"packages" : {
"benchmark" : {
Expand Down Expand Up @@ -30,18 +29,23 @@
"git_tag" : "v${version}"
},
"libcudacxx" : {
"version" : "1.9.1",
"version" : "2.1.0",
"git_url" : "https://github.com/NVIDIA/libcudacxx.git",
"git_tag" : "branch/${version}",
"git_tag" : "${version}",
"patches" : [
{
"file" : "libcudacxx/install_rules.diff",
"issue" : "libcudacxx 1.X installs incorrect files [https://github.com/NVIDIA/libcudacxx/pull/428]",
"issue" : "libcudacxx installs incorrect files [https://github.com/NVIDIA/libcudacxx/pull/428]",
"fixed_in" : "2.2"
},
{
"file" : "libcudacxx/reroot_support.diff",
"issue" : "Support conda-forge usage of CMake rerooting [https://github.com/NVIDIA/libcudacxx/pull/490]",
"issue" : "Support conda-forge usage of CMake rerooting [https://github.com/NVIDIA/libcudacxx/pull/490], requires libcudacxx/install_rules.diff.",
"fixed_in" : "2.2"
},
{
"file" : "libcudacxx/proclaim_return_type_nv_exec_check_disable.diff",
"issue" : "Use pragma to disable execution checks in cuda::proclaim_return_type. [https://github.com/NVIDIA/libcudacxx/pull/448]",
"fixed_in" : "2.2"
}
]
Expand Down

0 comments on commit e73fef6

Please sign in to comment.