From e73fef6f9c1f0a8e70d983e0e3b8aca81b8b879d Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Mon, 16 Oct 2023 14:20:09 -0500 Subject: [PATCH] Update libcudacxx to 2.1.0 (#464) 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 (https://github.com/rapidsai/rmm/pull/1095) and quite a few planned changes for cuCollections (such as https://github.com/NVIDIA/cuCollections/issues/332, https://github.com/NVIDIA/cuCollections/issues/331, https://github.com/NVIDIA/cuCollections/issues/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: https://github.com/rapidsai/rapids-cmake/pull/464 --- .../cpm/patches/command_template.cmake.in | 10 +++ .../cpm/patches/libcudacxx/install_rules.diff | 47 +++--------- ...aim_return_type_nv_exec_check_disable.diff | 74 +++++++++++++++++++ .../patches/libcudacxx/reroot_support.diff | 8 +- rapids-cmake/cpm/versions.json | 14 ++-- 5 files changed, 108 insertions(+), 45 deletions(-) create mode 100644 rapids-cmake/cpm/patches/libcudacxx/proclaim_return_type_nv_exec_check_disable.diff diff --git a/rapids-cmake/cpm/patches/command_template.cmake.in b/rapids-cmake/cpm/patches/command_template.cmake.in index 76980b9e..00249ab8 100644 --- a/rapids-cmake/cpm/patches/command_template.cmake.in +++ b/rapids-cmake/cpm/patches/command_template.cmake.in @@ -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@") diff --git a/rapids-cmake/cpm/patches/libcudacxx/install_rules.diff b/rapids-cmake/cpm/patches/libcudacxx/install_rules.diff index b2c7f2a3..601c2f14 100644 --- a/rapids-cmake/cpm/patches/libcudacxx/install_rules.diff +++ b/rapids-cmake/cpm/patches/libcudacxx/install_rules.diff @@ -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 @@ -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: diff --git a/rapids-cmake/cpm/patches/libcudacxx/proclaim_return_type_nv_exec_check_disable.diff b/rapids-cmake/cpm/patches/libcudacxx/proclaim_return_type_nv_exec_check_disable.diff new file mode 100644 index 00000000..df889828 --- /dev/null +++ b/rapids-cmake/cpm/patches/libcudacxx/proclaim_return_type_nv_exec_check_disable.diff @@ -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 > + 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 > + 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 > + 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 > + 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 > + 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 > + inline _LIBCUDACXX_INLINE_VISIBILITY +@@ -394,6 +412,9 @@ __invoke(_Fp&& __f, _A0&& __a0) + + // bullet 7 + ++#ifdef __CUDACC__ ++#pragma nv_exec_check_disable ++#endif + template + inline _LIBCUDACXX_INLINE_VISIBILITY + _LIBCUDACXX_CONSTEXPR decltype(_CUDA_VSTD::declval<_Fp>()(_CUDA_VSTD::declval<_Args>()...)) diff --git a/rapids-cmake/cpm/patches/libcudacxx/reroot_support.diff b/rapids-cmake/cpm/patches/libcudacxx/reroot_support.diff index 2b623988..7cadb9d5 100644 --- a/rapids-cmake/cpm/patches/libcudacxx/reroot_support.diff +++ b/rapids-cmake/cpm/patches/libcudacxx/reroot_support.diff @@ -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: diff --git a/rapids-cmake/cpm/versions.json b/rapids-cmake/cpm/versions.json index d1a7dcbc..e7f90489 100644 --- a/rapids-cmake/cpm/versions.json +++ b/rapids-cmake/cpm/versions.json @@ -1,4 +1,3 @@ - { "packages" : { "benchmark" : { @@ -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" } ]