From 944edbb0c2ec771021318b4e0fe829b6eb71125d Mon Sep 17 00:00:00 2001 From: Mark Harris <783069+harrism@users.noreply.github.com> Date: Mon, 29 Jan 2024 23:32:01 +0000 Subject: [PATCH 1/7] Add device_async_resource_ref alias --- include/rmm/mr/resource_ref.hpp | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 include/rmm/mr/resource_ref.hpp diff --git a/include/rmm/mr/resource_ref.hpp b/include/rmm/mr/resource_ref.hpp new file mode 100644 index 000000000..7209892d7 --- /dev/null +++ b/include/rmm/mr/resource_ref.hpp @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2024, NVIDIA CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#pragma once + +#include + +namespace rmm::mr { + +/** + * @addtogroup memory_resources + * @{ + * @file + */ + +/** + * @brief Alias for a `cuda::mr::async_resource_ref` with the property + * `cuda::mr::device_accessible`. + */ +using device_async_resource_ref = cuda::mr::async_resource_ref; + +/** @} */ // end of group +} // namespace rmm::mr From 3e6310072a4604727533ab64e08f4e1f49ad66e0 Mon Sep 17 00:00:00 2001 From: Mark Harris <783069+harrism@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:37:00 +0000 Subject: [PATCH 2/7] Use alias in tests. --- tests/device_buffer_tests.cu | 5 +++-- tests/device_uvector_tests.cpp | 11 ++++++----- tests/mr/device/mr_ref_test.hpp | 3 ++- tests/mr/device/thrust_allocator_tests.cu | 5 +++-- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/device_buffer_tests.cu b/tests/device_buffer_tests.cu index f73be0201..217259ac9 100644 --- a/tests/device_buffer_tests.cu +++ b/tests/device_buffer_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2022, NVIDIA CORPORATION. + * Copyright (c) 2019-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -58,7 +59,7 @@ struct DeviceBufferTest : public ::testing::Test { }; using resources = ::testing::Types; -using async_resource_ref = cuda::mr::async_resource_ref; +using async_resource_ref = rmm::mr::device_async_resource_ref; TYPED_TEST_CASE(DeviceBufferTest, resources); diff --git a/tests/device_uvector_tests.cpp b/tests/device_uvector_tests.cpp index 3c042a437..ef28fc593 100644 --- a/tests/device_uvector_tests.cpp +++ b/tests/device_uvector_tests.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2020-2022, NVIDIA CORPORATION. + * Copyright (c) 2020-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,12 +15,13 @@ * limitations under the License. */ -#include -#include - #include #include #include +#include + +#include +#include // explicit instantiation for test coverage purposes. template class rmm::device_uvector; @@ -31,7 +32,7 @@ struct TypedUVectorTest : ::testing::Test { }; using TestTypes = ::testing::Types; -using async_resource_ref = cuda::mr::async_resource_ref; +using async_resource_ref = rmm::mr::device_async_resource_ref; TYPED_TEST_CASE(TypedUVectorTest, TestTypes); diff --git a/tests/mr/device/mr_ref_test.hpp b/tests/mr/device/mr_ref_test.hpp index 9826c10be..e3f57b091 100644 --- a/tests/mr/device/mr_ref_test.hpp +++ b/tests/mr/device/mr_ref_test.hpp @@ -33,6 +33,7 @@ #include #include #include +#include #include @@ -45,7 +46,7 @@ #include using resource_ref = cuda::mr::resource_ref; -using async_resource_ref = cuda::mr::async_resource_ref; +using async_resource_ref = rmm::mr::device_async_resource_ref; namespace rmm::test { diff --git a/tests/mr/device/thrust_allocator_tests.cu b/tests/mr/device/thrust_allocator_tests.cu index ed8875cbe..38c85eb6a 100644 --- a/tests/mr/device/thrust_allocator_tests.cu +++ b/tests/mr/device/thrust_allocator_tests.cu @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2021, NVIDIA CORPORATION. + * Copyright (c) 2019-2024, NVIDIA CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ #include #include #include +#include #include @@ -32,7 +33,7 @@ namespace rmm::test { namespace { struct allocator_test : public mr_test {}; -using async_resource_ref = cuda::mr::async_resource_ref; +using async_resource_ref = rmm::mr::device_async_resource_ref; TEST_P(allocator_test, first) { From 2f6e66e19689857f05912d26e13c14f79c8a373d Mon Sep 17 00:00:00 2001 From: Mark Harris <783069+harrism@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:37:22 +0000 Subject: [PATCH 3/7] Add pinned_host_memory_resource to doc group --- include/rmm/mr/pinned_host_memory_resource.hpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/rmm/mr/pinned_host_memory_resource.hpp b/include/rmm/mr/pinned_host_memory_resource.hpp index 0748302c2..059be609c 100644 --- a/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/include/rmm/mr/pinned_host_memory_resource.hpp @@ -29,6 +29,12 @@ namespace rmm::mr { +/** + * @addtogroup memory_resources + * @{ + * @file + */ + /** * @brief Memory resource class for allocating pinned host memory. * @@ -199,4 +205,6 @@ class pinned_host_memory_resource { static_assert(cuda::mr::async_resource_with); + +/** @} */ // end of group } // namespace rmm::mr From 4eab718fe3d23eb184171ae635221343c0a61a1b Mon Sep 17 00:00:00 2001 From: Mark Harris <783069+harrism@users.noreply.github.com> Date: Tue, 30 Jan 2024 22:56:46 +0000 Subject: [PATCH 4/7] Move header up and move up to rmm:: namespace --- include/rmm/{mr => }/resource_ref.hpp | 4 ++-- tests/device_buffer_tests.cu | 4 ++-- tests/device_uvector_tests.cpp | 4 ++-- tests/mr/device/mr_ref_test.hpp | 4 ++-- tests/mr/device/thrust_allocator_tests.cu | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) rename include/rmm/{mr => }/resource_ref.hpp (95%) diff --git a/include/rmm/mr/resource_ref.hpp b/include/rmm/resource_ref.hpp similarity index 95% rename from include/rmm/mr/resource_ref.hpp rename to include/rmm/resource_ref.hpp index 7209892d7..a363f9b50 100644 --- a/include/rmm/mr/resource_ref.hpp +++ b/include/rmm/resource_ref.hpp @@ -17,7 +17,7 @@ #include -namespace rmm::mr { +namespace rmm { /** * @addtogroup memory_resources @@ -32,4 +32,4 @@ namespace rmm::mr { using device_async_resource_ref = cuda::mr::async_resource_ref; /** @} */ // end of group -} // namespace rmm::mr +} // namespace rmm diff --git a/tests/device_buffer_tests.cu b/tests/device_buffer_tests.cu index 217259ac9..ef858bc62 100644 --- a/tests/device_buffer_tests.cu +++ b/tests/device_buffer_tests.cu @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include @@ -59,7 +59,7 @@ struct DeviceBufferTest : public ::testing::Test { }; using resources = ::testing::Types; -using async_resource_ref = rmm::mr::device_async_resource_ref; +using async_resource_ref = rmm::device_async_resource_ref; TYPED_TEST_CASE(DeviceBufferTest, resources); diff --git a/tests/device_uvector_tests.cpp b/tests/device_uvector_tests.cpp index ef28fc593..590b857aa 100644 --- a/tests/device_uvector_tests.cpp +++ b/tests/device_uvector_tests.cpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include #include @@ -32,7 +32,7 @@ struct TypedUVectorTest : ::testing::Test { }; using TestTypes = ::testing::Types; -using async_resource_ref = rmm::mr::device_async_resource_ref; +using async_resource_ref = rmm::device_async_resource_ref; TYPED_TEST_CASE(TypedUVectorTest, TestTypes); diff --git a/tests/mr/device/mr_ref_test.hpp b/tests/mr/device/mr_ref_test.hpp index e3f57b091..2684042d7 100644 --- a/tests/mr/device/mr_ref_test.hpp +++ b/tests/mr/device/mr_ref_test.hpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include #include @@ -46,7 +46,7 @@ #include using resource_ref = cuda::mr::resource_ref; -using async_resource_ref = rmm::mr::device_async_resource_ref; +using async_resource_ref = rmm::device_async_resource_ref; namespace rmm::test { diff --git a/tests/mr/device/thrust_allocator_tests.cu b/tests/mr/device/thrust_allocator_tests.cu index 38c85eb6a..4f5c76b09 100644 --- a/tests/mr/device/thrust_allocator_tests.cu +++ b/tests/mr/device/thrust_allocator_tests.cu @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include @@ -33,7 +33,7 @@ namespace rmm::test { namespace { struct allocator_test : public mr_test {}; -using async_resource_ref = rmm::mr::device_async_resource_ref; +using async_resource_ref = rmm::device_async_resource_ref; TEST_P(allocator_test, first) { From ef03bd767a97d0bd3837ec5fc4434f06a6ca148f Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Wed, 31 Jan 2024 09:22:11 +0000 Subject: [PATCH 5/7] Do not use backticks in doc strings --- include/rmm/mr/pinned_host_memory_resource.hpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/include/rmm/mr/pinned_host_memory_resource.hpp b/include/rmm/mr/pinned_host_memory_resource.hpp index 059be609c..39552be7f 100644 --- a/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/include/rmm/mr/pinned_host_memory_resource.hpp @@ -51,9 +51,9 @@ class pinned_host_memory_resource { /** * @brief Allocates pinned host memory of size at least \p bytes bytes. * - * @throws `rmm::out_of_memory` if the requested allocation could not be fulfilled due to to a + * @throws rmm::out_of_memory if the requested allocation could not be fulfilled due to to a * CUDA out of memory error. - * @throws `rmm::bad_alloc` if the requested allocation could not be fulfilled due to any other + * @throws rmm::bad_alloc if the requested allocation could not be fulfilled due to any other * reason. * * @param bytes The size, in bytes, of the allocation. @@ -96,9 +96,9 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to allocate. * - * @throws `rmm::out_of_memory` if the requested allocation could not be fulfilled due to to a + * @throws rmm::out_of_memory if the requested allocation could not be fulfilled due to to a * CUDA out of memory error. - * @throws `rmm::bad_alloc` if the requested allocation could not be fulfilled due to any other + * @throws rmm::bad_alloc if the requested allocation could not be fulfilled due to any other * error. * * @param bytes The size, in bytes, of the allocation. @@ -115,9 +115,9 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to allocate. * - * @throws `rmm::out_of_memory` if the requested allocation could not be fulfilled due to to a + * @throws rmm::out_of_memory if the requested allocation could not be fulfilled due to to a * CUDA out of memory error. - * @throws `rmm::bad_alloc` if the requested allocation could not be fulfilled due to any other + * @throws rmm::bad_alloc if the requested allocation could not be fulfilled due to any other * error. * * @param bytes The size, in bytes, of the allocation. From cd412a5c1e9c3086a2f019a1839a36a9775b2270 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Wed, 31 Jan 2024 10:14:21 +0000 Subject: [PATCH 6/7] Try nothing --- include/rmm/mr/pinned_host_memory_resource.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/rmm/mr/pinned_host_memory_resource.hpp b/include/rmm/mr/pinned_host_memory_resource.hpp index 39552be7f..4b54ba133 100644 --- a/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/include/rmm/mr/pinned_host_memory_resource.hpp @@ -77,7 +77,7 @@ class pinned_host_memory_resource { /** * @brief Deallocate memory pointed to by \p ptr of size \p bytes bytes. * - * @throws Nothing. + * @throws nothing * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. @@ -137,7 +137,7 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to deallocate. * - * @throws Nothing. + * @throws nothing * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. @@ -156,7 +156,7 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to deallocate. * - * @throws Nothing. + * @throws nothing * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. From 4f0101aee405aca558245e73d00bde36b7cffa70 Mon Sep 17 00:00:00 2001 From: Michael Schellenberger Costa Date: Wed, 31 Jan 2024 11:09:08 +0000 Subject: [PATCH 7/7] nothing is not accepted by docs --- include/rmm/mr/device/binning_memory_resource.hpp | 2 -- .../rmm/mr/device/detail/stream_ordered_memory_resource.hpp | 2 -- include/rmm/mr/pinned_host_memory_resource.hpp | 6 ------ 3 files changed, 10 deletions(-) diff --git a/include/rmm/mr/device/binning_memory_resource.hpp b/include/rmm/mr/device/binning_memory_resource.hpp index a0cf6bf40..56e2958e8 100644 --- a/include/rmm/mr/device/binning_memory_resource.hpp +++ b/include/rmm/mr/device/binning_memory_resource.hpp @@ -169,8 +169,6 @@ class binning_memory_resource final : public device_memory_resource { /** * @brief Deallocate memory pointed to by \p p. * - * @throws nothing - * * @param ptr Pointer to be deallocated * @param bytes The size in bytes of the allocation. This must be equal to the * value of `bytes` that was passed to the `allocate` call that returned `p`. diff --git a/include/rmm/mr/device/detail/stream_ordered_memory_resource.hpp b/include/rmm/mr/device/detail/stream_ordered_memory_resource.hpp index 1d6829cb5..c7c8d9178 100644 --- a/include/rmm/mr/device/detail/stream_ordered_memory_resource.hpp +++ b/include/rmm/mr/device/detail/stream_ordered_memory_resource.hpp @@ -226,8 +226,6 @@ class stream_ordered_memory_resource : public crtp, public device_ /** * @brief Deallocate memory pointed to by `p`. * - * @throws nothing - * * @param p Pointer to be deallocated * @param size The size in bytes of the allocation to deallocate * @param stream The stream in which to order this deallocation diff --git a/include/rmm/mr/pinned_host_memory_resource.hpp b/include/rmm/mr/pinned_host_memory_resource.hpp index 4b54ba133..e92b2985e 100644 --- a/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/include/rmm/mr/pinned_host_memory_resource.hpp @@ -77,8 +77,6 @@ class pinned_host_memory_resource { /** * @brief Deallocate memory pointed to by \p ptr of size \p bytes bytes. * - * @throws nothing - * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. * @param alignment Alignment in bytes. Default alignment is used if unspecified. @@ -137,8 +135,6 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to deallocate. * - * @throws nothing - * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. * @param stream CUDA stream on which to perform the deallocation (ignored). @@ -156,8 +152,6 @@ class pinned_host_memory_resource { * * @note Stream argument is ignored and behavior is identical to deallocate. * - * @throws nothing - * * @param ptr Pointer to be deallocated. * @param bytes Size of the allocation. * @param alignment Alignment in bytes.