Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cpp/include/rmm/detail/cccl_adaptors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#pragma once

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/mr/detail/device_memory_resource_view.hpp>
#include <rmm/mr/device_memory_resource.hpp>
Expand Down
32 changes: 0 additions & 32 deletions cpp/include/rmm/detail/cuda_memory_resource.hpp

This file was deleted.

6 changes: 6 additions & 0 deletions cpp/include/rmm/detail/export.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@

#pragma once

#include <cuda/version>

#if CCCL_MAJOR_VERSION < 3 || (CCCL_MAJOR_VERSION == 3 && CCCL_MINOR_VERSION < 3)
#error "RMM requires CCCL version 3.3 or newer."
#endif

// Macros used for defining symbol visibility, only GLIBC is supported
#if (defined(__GNUC__) && !defined(__MINGW32__) && !defined(__MINGW64__))
#define RMM_EXPORT __attribute__((visibility("default")))
Expand Down
12 changes: 6 additions & 6 deletions cpp/include/rmm/mr/cuda_async_managed_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ class cuda_async_managed_memory_resource final : public device_memory_resource {
};

// static property checks
static_assert(rmm::detail::polyfill::resource<cuda_async_managed_memory_resource>);
static_assert(rmm::detail::polyfill::async_resource<cuda_async_managed_memory_resource>);
static_assert(rmm::detail::polyfill::resource_with<cuda_async_managed_memory_resource,
cuda::mr::device_accessible>);
static_assert(rmm::detail::polyfill::async_resource_with<cuda_async_managed_memory_resource,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource<cuda_async_managed_memory_resource>);
static_assert(cuda::mr::resource<cuda_async_managed_memory_resource>);
static_assert(cuda::mr::synchronous_resource_with<cuda_async_managed_memory_resource,
cuda::mr::device_accessible>);
static_assert(
cuda::mr::resource_with<cuda_async_managed_memory_resource, cuda::mr::device_accessible>);

/** @} */ // end of group
} // namespace mr
Expand Down
12 changes: 6 additions & 6 deletions cpp/include/rmm/mr/device_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

#include <rmm/cuda_stream_view.hpp>
#include <rmm/detail/aligned.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/detail/nvtx/ranges.hpp>

#include <cuda/memory_resource>

#include <cstddef>
#include <memory>

Expand Down Expand Up @@ -276,12 +277,11 @@ class device_memory_resource {
};

// static property checks
static_assert(rmm::detail::polyfill::resource<device_memory_resource>);
static_assert(rmm::detail::polyfill::async_resource<device_memory_resource>);
static_assert(
rmm::detail::polyfill::resource_with<device_memory_resource, cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource<device_memory_resource>);
static_assert(cuda::mr::resource<device_memory_resource>);
static_assert(
rmm::detail::polyfill::async_resource_with<device_memory_resource, cuda::mr::device_accessible>);
cuda::mr::synchronous_resource_with<device_memory_resource, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<device_memory_resource, cuda::mr::device_accessible>);

/** @} */ // end of group
} // namespace mr
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/rmm/mr/is_resource_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once

#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/export.hpp>

#include <cuda/memory_resource>
#include <cuda/std/type_traits>

namespace RMM_NAMESPACE {
Expand All @@ -29,7 +29,7 @@ template <class Resource>
inline constexpr bool is_resource_adaptor<
Resource,
cuda::std::void_t<decltype(cuda::std::declval<Resource>().get_upstream_resource())>> =
rmm::detail::polyfill::resource<Resource>;
cuda::mr::synchronous_resource<Resource>;

/** @} */ // end of group
} // namespace mr
Expand Down
7 changes: 3 additions & 4 deletions cpp/include/rmm/mr/pinned_host_memory_resource.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <rmm/aligned.hpp>
#include <rmm/detail/aligned.hpp>
#include <rmm/detail/cccl_adaptors.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/detail/nvtx/ranges.hpp>
Expand Down Expand Up @@ -132,9 +131,9 @@ class pinned_host_memory_resource final : public device_memory_resource {
}
};

static_assert(rmm::detail::polyfill::async_resource_with<pinned_host_memory_resource,
cuda::mr::device_accessible,
cuda::mr::host_accessible>);
static_assert(cuda::mr::resource_with<pinned_host_memory_resource,
cuda::mr::device_accessible,
cuda::mr::host_accessible>);

/** @} */ // end of group
} // namespace mr
Expand Down
8 changes: 3 additions & 5 deletions cpp/include/rmm/mr/system_memory_resource.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand Down Expand Up @@ -154,10 +154,8 @@ class system_memory_resource final : public device_memory_resource {
};

// static property checks
static_assert(
rmm::detail::polyfill::async_resource_with<system_memory_resource, cuda::mr::device_accessible>);
static_assert(
rmm::detail::polyfill::async_resource_with<system_memory_resource, cuda::mr::host_accessible>);
static_assert(cuda::mr::resource_with<system_memory_resource, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<system_memory_resource, cuda::mr::host_accessible>);
/** @} */ // end of group
} // namespace mr
} // namespace RMM_NAMESPACE
3 changes: 1 addition & 2 deletions cpp/include/rmm/mr/thrust_allocator_adaptor.hpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <rmm/cuda_device.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/export.hpp>
#include <rmm/detail/thrust_namespace.h>
#include <rmm/mr/per_device_resource.hpp>
Expand Down
3 changes: 1 addition & 2 deletions cpp/tests/device_scalar_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2019-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2019-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#include <rmm/cuda_stream.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/device_scalar.hpp>
#include <rmm/mr/device_memory_resource.hpp>
#include <rmm/mr/per_device_resource.hpp>
Expand Down
5 changes: 2 additions & 3 deletions cpp/tests/mock_resource.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2022-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2022-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
Expand All @@ -21,7 +21,6 @@ class mock_resource : public rmm::mr::device_memory_resource {
};

// static property checks
static_assert(
rmm::detail::polyfill::async_resource_with<mock_resource, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<mock_resource, cuda::mr::device_accessible>);

} // namespace rmm::test
24 changes: 17 additions & 7 deletions cpp/tests/mr/adaptor_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

#include "../byte_literals.hpp"

#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/error.hpp>
#include <rmm/mr/aligned_resource_adaptor.hpp>
#include <rmm/mr/cuda_memory_resource.hpp>
#include <rmm/mr/device_memory_resource.hpp>
#include <rmm/mr/failure_callback_resource_adaptor.hpp>
#include <rmm/mr/is_resource_adaptor.hpp>
#include <rmm/mr/limiting_resource_adaptor.hpp>
#include <rmm/mr/logging_resource_adaptor.hpp>
#include <rmm/mr/statistics_resource_adaptor.hpp>
#include <rmm/mr/thread_safe_resource_adaptor.hpp>
#include <rmm/mr/tracking_resource_adaptor.hpp>
#include <rmm/resource_ref.hpp>

#include <gtest/gtest.h>
Expand All @@ -38,12 +40,20 @@ using adaptors = ::testing::Types<failure_callback_resource_adaptor<>,
thread_safe_resource_adaptor>;

// static property checks
static_assert(rmm::detail::polyfill::resource_with<rmm::mr::failure_callback_resource_adaptor<>,
cuda::mr::device_accessible>);
static_assert(rmm::detail::polyfill::resource_with<rmm::mr::limiting_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(rmm::detail::polyfill::resource_with<rmm::mr::thread_safe_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::aligned_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::failure_callback_resource_adaptor<>,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::limiting_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::logging_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::statistics_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::thread_safe_resource_adaptor,
cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::tracking_resource_adaptor,
cuda::mr::device_accessible>);

template <typename MemoryResourceType>
struct AdaptorTest : public ::testing::Test {
Expand Down
3 changes: 1 addition & 2 deletions cpp/tests/mr/arena_mr_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ class mock_memory_resource : public rmm::mr::device_memory_resource {
};

// static property checks
static_assert(
rmm::detail::polyfill::async_resource_with<mock_memory_resource, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<mock_memory_resource, cuda::mr::device_accessible>);

using rmm::mr::detail::arena::block;
using rmm::mr::detail::arena::byte_span;
Expand Down
7 changes: 3 additions & 4 deletions cpp/tests/mr/cuda_async_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand All @@ -16,9 +16,8 @@ namespace {
using cuda_async_mr = rmm::mr::cuda_async_memory_resource;

// static property checks
static_assert(rmm::detail::polyfill::resource_with<cuda_async_mr, cuda::mr::device_accessible>);
static_assert(
rmm::detail::polyfill::async_resource_with<cuda_async_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<cuda_async_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<cuda_async_mr, cuda::mr::device_accessible>);

class AsyncMRTest : public ::testing::Test {
protected:
Expand Down
9 changes: 3 additions & 6 deletions cpp/tests/mr/cuda_async_view_mr_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2021-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2021-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#include <rmm/cuda_device.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/detail/error.hpp>
#include <rmm/mr/cuda_async_view_memory_resource.hpp>

Expand All @@ -16,10 +15,8 @@ namespace {
using cuda_async_view_mr = rmm::mr::cuda_async_view_memory_resource;

// static property checks
static_assert(
rmm::detail::polyfill::resource_with<cuda_async_view_mr, cuda::mr::device_accessible>);
static_assert(
rmm::detail::polyfill::async_resource_with<cuda_async_view_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<cuda_async_view_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<cuda_async_view_mr, cuda::mr::device_accessible>);

TEST(PoolTest, UsePool)
{
Expand Down
7 changes: 3 additions & 4 deletions cpp/tests/mr/host_mr_ref_tests.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2023-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

#include "../byte_literals.hpp"

#include <rmm/aligned.hpp>
#include <rmm/detail/cuda_memory_resource.hpp>
#include <rmm/mr/pinned_host_memory_resource.hpp>
#include <rmm/resource_ref.hpp>

Expand Down Expand Up @@ -81,8 +80,8 @@ struct MRRefTest : public ::testing::Test {
using resources = ::testing::Types<rmm::mr::pinned_host_memory_resource>;

// static property checks
static_assert(rmm::detail::polyfill::resource_with<rmm::mr::pinned_host_memory_resource,
cuda::mr::host_accessible>);
static_assert(cuda::mr::synchronous_resource_with<rmm::mr::pinned_host_memory_resource,
cuda::mr::host_accessible>);

TYPED_TEST_SUITE(MRRefTest, resources);

Expand Down
10 changes: 5 additions & 5 deletions cpp/tests/mr/system_mr_tests.cu
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION.
* SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION.
* SPDX-License-Identifier: Apache-2.0
*/

Expand Down Expand Up @@ -48,14 +48,14 @@ void touch_on_gpu(void* ptr, std::size_t size)
using system_mr = rmm::mr::system_memory_resource;

// static property checks
static_assert(rmm::detail::polyfill::resource_with<system_mr, cuda::mr::device_accessible>);
static_assert(rmm::detail::polyfill::async_resource_with<system_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<system_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<system_mr, cuda::mr::device_accessible>);

using headroom_mr = rmm::mr::sam_headroom_memory_resource;

// static property checks
static_assert(rmm::detail::polyfill::resource_with<headroom_mr, cuda::mr::device_accessible>);
static_assert(rmm::detail::polyfill::async_resource_with<headroom_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::synchronous_resource_with<headroom_mr, cuda::mr::device_accessible>);
static_assert(cuda::mr::resource_with<headroom_mr, cuda::mr::device_accessible>);

class SystemMRTest : public ::testing::Test {
protected:
Expand Down
Loading
Loading