This is an automated email from the ASF dual-hosted git repository.

paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/sedona-db.git


The following commit(s) were added to refs/heads/main by this push:
     new 7a71e528 feat(c/libgpuspatial): Upgrade RAPIDS RMM to 25.12 (#718)
7a71e528 is described below

commit 7a71e52815ceeb2b6dc5312af83303cde8fa8d71
Author: Liang Geng <[email protected]>
AuthorDate: Tue Mar 17 23:51:30 2026 +0800

    feat(c/libgpuspatial): Upgrade RAPIDS RMM to 25.12 (#718)
---
 .../libgpuspatial/cmake/RAPIDS.cmake               |  7 +++---
 .../libgpuspatial/cmake/RAPIDS_VERSION             |  2 +-
 .../cmake/patches/rmm_race_condition.patch         | 17 +++++++++++++
 .../libgpuspatial/cmake/thirdparty/get_rmm.cmake   | 29 ++++++++++++++++++++++
 dev/release/rat_exclude_files.txt                  |  1 +
 5 files changed, 51 insertions(+), 5 deletions(-)

diff --git a/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS.cmake 
b/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS.cmake
index cddd4eff..c945a3ef 100644
--- a/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS.cmake
+++ b/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS.cmake
@@ -18,9 +18,8 @@
 cmake_minimum_required(VERSION 3.30.4 FATAL_ERROR)
 
 # Allow users to control which version is used
-if(NOT rapids-cmake-version OR NOT rapids-cmake-version MATCHES
-                               [[^([0-9][0-9])\.([0-9][0-9])$]])
-  message(FATAL_ERROR "The CMake variable rapids-cmake-version must be defined 
in the format MAJOR.MINOR."
+if(NOT (rapids-cmake-branch OR rapids-cmake-version))
+  message(FATAL_ERROR "The CMake variable `rapids-cmake-branch` or 
`rapids-cmake-version` must be defined"
   )
 endif()
 
@@ -33,7 +32,7 @@ endif()
 # Allow users to control which branch is fetched
 if(NOT rapids-cmake-branch)
   # Define a default branch if the user doesn't set one
-  set(rapids-cmake-branch "branch-${rapids-cmake-version}")
+  set(rapids-cmake-branch "release/${rapids-cmake-version}")
 endif()
 
 # Allow users to control the exact URL passed to FetchContent
diff --git a/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS_VERSION 
b/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS_VERSION
index cc83d7ab..7924af61 100644
--- a/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS_VERSION
+++ b/c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS_VERSION
@@ -1 +1 @@
-25.06.00
+25.12.00
diff --git 
a/c/sedona-libgpuspatial/libgpuspatial/cmake/patches/rmm_race_condition.patch 
b/c/sedona-libgpuspatial/libgpuspatial/cmake/patches/rmm_race_condition.patch
new file mode 100644
index 00000000..910baa4a
--- /dev/null
+++ 
b/c/sedona-libgpuspatial/libgpuspatial/cmake/patches/rmm_race_condition.patch
@@ -0,0 +1,17 @@
+--- tracking_resource_adaptor.hpp.org  2026-02-23 19:38:45.088401318 -0500
++++ tracking_resource_adaptor.hpp      2026-02-23 19:38:24.505094659 -0500
+@@ -215,7 +215,6 @@
+    */
+   void do_deallocate(void* ptr, std::size_t bytes, cuda_stream_view stream) 
noexcept override
+   {
+-    get_upstream_resource().deallocate(stream, ptr, bytes);
+     {
+       write_lock_t lock(mtx_);
+
+@@ -246,6 +245,7 @@
+         }
+       }
+     }
++    get_upstream_resource().deallocate(stream, ptr, bytes);
+     allocated_bytes_ -= bytes;
+   }
diff --git 
a/c/sedona-libgpuspatial/libgpuspatial/cmake/thirdparty/get_rmm.cmake 
b/c/sedona-libgpuspatial/libgpuspatial/cmake/thirdparty/get_rmm.cmake
index 1105163c..b2a5e47a 100644
--- a/c/sedona-libgpuspatial/libgpuspatial/cmake/thirdparty/get_rmm.cmake
+++ b/c/sedona-libgpuspatial/libgpuspatial/cmake/thirdparty/get_rmm.cmake
@@ -37,6 +37,35 @@ function(find_and_configure_rmm)
   rapids_cpm_rmm(BUILD_EXPORT_SET gpuspatial-exports INSTALL_EXPORT_SET
                  gpuspatial-exports)
 
+  # --- INJECT RMM HOTFIX ---
+  # We only want to apply the patch if CPM actually fetched RMM from source.
+  # If rmm_SOURCE_DIR is defined, it means it was downloaded into the build 
tree.
+  message("rmm_SOURCE_DIR: ${rmm_SOURCE_DIR}")
+  if(DEFINED rmm_SOURCE_DIR)
+    set(RMM_PATCH_TARGET_DIR "${rmm_SOURCE_DIR}/cpp/include/rmm/mr")
+    set(RMM_PATCH_MARKER "${rmm_SOURCE_DIR}/.rmm_race_condition_patched")
+
+    # If the target directory exists and hasn't been patched yet
+    if(EXISTS "${RMM_PATCH_TARGET_DIR}" AND NOT EXISTS "${RMM_PATCH_MARKER}")
+      message(STATUS "RAPIDS-CMAKE BYPASS: Applying custom race-condition 
patch to RMM..."
+      )
+
+      execute_process(# Assuming the patch file is located in the root 
'cmake/patches/' directory
+                      COMMAND patch -p0 -i
+                              
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/patches/rmm_race_condition.patch"
+                      WORKING_DIRECTORY "${RMM_PATCH_TARGET_DIR}"
+                      RESULT_VARIABLE PATCH_RESULT)
+
+      if(PATCH_RESULT EQUAL 0)
+        file(TOUCH "${RMM_PATCH_MARKER}")
+        message(STATUS "Successfully patched RMM tracking adaptor.")
+      else()
+        message(FATAL_ERROR "Failed to apply RMM patch. Check the patch file 
formatting.")
+      endif()
+    endif()
+  endif()
+  # -------------------------
+
 endfunction()
 
 find_and_configure_rmm()
diff --git a/dev/release/rat_exclude_files.txt 
b/dev/release/rat_exclude_files.txt
index d89d3b9a..3ecde641 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -10,6 +10,7 @@ c/sedona-geoarrow-c/src/nanoarrow/*
 c/sedona-s2geography/s2geography/*
 c/sedona-s2geography/s2geometry/*
 c/sedona-libgpuspatial/libgpuspatial/cmake/RAPIDS_VERSION
+c/sedona-libgpuspatial/libgpuspatial/cmake/patches/rmm_race_condition.patch
 c/sedona-libgpuspatial/libgpuspatial/include/gpuspatial/relate/relate.hpp
 c/sedona-libgpuspatial/libgpuspatial/include/gpuspatial/utils/thread_pool.hpp
 c/sedona-tg/src/tg/*

Reply via email to