From e6934a79319cbb00d4f379a2e81b16cb03edd55f Mon Sep 17 00:00:00 2001 From: Bradley Dice Date: Mon, 24 Nov 2025 08:40:24 -0600 Subject: [PATCH 1/2] Updates for RMM 25.12 compatibility --- src/common/device_vector.cuh | 9 ++++----- tests/cpp/helpers.cc | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/common/device_vector.cuh b/src/common/device_vector.cuh index b8ffda0d10fe..8adba5738a7b 100644 --- a/src/common/device_vector.cuh +++ b/src/common/device_vector.cuh @@ -7,10 +7,9 @@ #include // for device_vector #if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 -#include // for async_resource_ref -#include // for stream_ref -#include // for device_memory_resource -#include // for get_current_device_resource +#include // for async_resource_ref +#include // for stream_ref +#include // for get_current_device_resource #include "xgboost/global_config.h" // for GlobalConfigThreadLocalStore @@ -266,7 +265,7 @@ namespace detail { */ template class ThrustAllocMrAdapter : public thrust::device_malloc_allocator { - DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource()}; + DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource_ref()}; public: using Super = thrust::device_malloc_allocator; diff --git a/tests/cpp/helpers.cc b/tests/cpp/helpers.cc index cd79ca66c589..b8c8dc46b809 100644 --- a/tests/cpp/helpers.cc +++ b/tests/cpp/helpers.cc @@ -29,9 +29,9 @@ #if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 #include #include -#include "rmm/mr/device/per_device_resource.hpp" -#include "rmm/mr/device/cuda_memory_resource.hpp" -#include "rmm/mr/device/pool_memory_resource.hpp" +#include "rmm/mr/per_device_resource.hpp" +#include "rmm/mr/cuda_memory_resource.hpp" +#include "rmm/mr/pool_memory_resource.hpp" #endif // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 bool FileExists(const std::string& filename) { From 1797581d7af57642da3794d947e803970b31d7cc Mon Sep 17 00:00:00 2001 From: Hyunsu Cho Date: Mon, 24 Nov 2025 12:17:33 -0800 Subject: [PATCH 2/2] Add macros to support building with RMM 25.10 --- src/common/device_vector.cuh | 13 +++++++++++++ tests/cpp/helpers.cc | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/src/common/device_vector.cuh b/src/common/device_vector.cuh index 8adba5738a7b..865a153bbe23 100644 --- a/src/common/device_vector.cuh +++ b/src/common/device_vector.cuh @@ -9,7 +9,14 @@ #if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 #include // for async_resource_ref #include // for stream_ref + +// TODO(hcho3): Remove this guard once we require Rapids 25.12+ +#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 #include // for get_current_device_resource +#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 +#include // for device_memory_resource +#include // for get_current_device_resource +#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 #include "xgboost/global_config.h" // for GlobalConfigThreadLocalStore @@ -265,7 +272,13 @@ namespace detail { */ template class ThrustAllocMrAdapter : public thrust::device_malloc_allocator { + +// TODO(hcho3): Remove this guard once we require Rapids 25.12+ +#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource_ref()}; +#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 + DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource()}; +#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 public: using Super = thrust::device_malloc_allocator; diff --git a/tests/cpp/helpers.cc b/tests/cpp/helpers.cc index b8c8dc46b809..5d8ca2b58aea 100644 --- a/tests/cpp/helpers.cc +++ b/tests/cpp/helpers.cc @@ -29,9 +29,18 @@ #if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 #include #include + +// TODO(hcho3): Remove this guard once we require Rapids 25.12+ +#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 #include "rmm/mr/per_device_resource.hpp" #include "rmm/mr/cuda_memory_resource.hpp" #include "rmm/mr/pool_memory_resource.hpp" +#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 +#include "rmm/mr/device/per_device_resource.hpp" +#include "rmm/mr/device/cuda_memory_resource.hpp" +#include "rmm/mr/device/pool_memory_resource.hpp" +#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26 + #endif // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1 bool FileExists(const std::string& filename) {