From e374a27316eff35774bfb47383fbdd978eb3fcc1 Mon Sep 17 00:00:00 2001 From: Mark Harris <783069+harrism@users.noreply.github.com> Date: Sat, 27 Jan 2024 02:43:57 +1100 Subject: [PATCH] Deprecate rmm::mr::device_memory_resource::get_mem_info() and supports_get_mem_info(). (#1436) Closes #1427 . Part of #1388. #1430 made these functions non-virtual and removed them from all MRs and tests. This PR completes the next step of deprecating them. Merge after - https://github.com/rapidsai/raft/pull/2108 - https://github.com/rapidsai/cudf/pull/14832 Authors: - Mark Harris (https://github.com/harrism) Approvers: - Lawrence Mitchell (https://github.com/wence-) - Michael Schellenberger Costa (https://github.com/miscco) - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/rmm/pull/1436 --- .../rmm/mr/device/device_memory_resource.hpp | 31 +++++++++---------- .../rmm/mr/pinned_host_memory_resource.hpp | 20 ------------ 2 files changed, 14 insertions(+), 37 deletions(-) diff --git a/include/rmm/mr/device/device_memory_resource.hpp b/include/rmm/mr/device/device_memory_resource.hpp index 5d7894995..97ae85449 100644 --- a/include/rmm/mr/device/device_memory_resource.hpp +++ b/include/rmm/mr/device/device_memory_resource.hpp @@ -304,21 +304,32 @@ class device_memory_resource { /** * @brief Query whether the resource supports the get_mem_info API. * + * @deprecated Use rmm::available_device_memory instead. + * * @return bool true if the resource supports get_mem_info, false otherwise. */ - [[nodiscard]] virtual bool supports_get_mem_info() const noexcept { return false; }; + [[deprecated("Use rmm::available_device_memory instead.")]] // + [[nodiscard]] virtual bool + supports_get_mem_info() const noexcept + { + return false; + }; /** * @brief Queries the amount of free and total memory for the resource. * + * @deprecated Use rmm::available_device_memory instead. + * * @param stream the stream whose memory manager we want to retrieve * * @returns a pair containing the free memory in bytes in .first and total amount of memory in * .second */ - [[nodiscard]] std::pair get_mem_info(cuda_stream_view stream) const + [[deprecated("Use rmm::available_device_memory instead.")]] // + [[nodiscard]] std::pair + get_mem_info(cuda_stream_view stream) const { - return do_get_mem_info(stream); + return {0, 0}; } /** @@ -374,20 +385,6 @@ class device_memory_resource { { return this == &other; } - - /** - * @brief Get free and available memory for memory resource - * - * @throws std::runtime_error if we could not get free / total memory - * - * @param stream the stream being executed on - * @return std::pair with available and free memory for resource - */ - [[nodiscard]] virtual std::pair do_get_mem_info( - cuda_stream_view stream) const - { - return {0, 0}; - } }; static_assert(cuda::mr::async_resource_with); /** @} */ // end of group diff --git a/include/rmm/mr/pinned_host_memory_resource.hpp b/include/rmm/mr/pinned_host_memory_resource.hpp index c51af4182..0748302c2 100644 --- a/include/rmm/mr/pinned_host_memory_resource.hpp +++ b/include/rmm/mr/pinned_host_memory_resource.hpp @@ -177,26 +177,6 @@ class pinned_host_memory_resource { */ bool operator!=(const pinned_host_memory_resource&) const { return false; } - /** - * @brief Query whether the resource supports reporting free and available memory. - * - * @return false - */ - static bool supports_get_mem_info() { return false; } - - /** - * @brief Query the total amount of memory and free memory available for allocation by this - * resource. - * - * @throws nothing - * - * @return std::pair containing 0 for both total and free memory. - */ - [[nodiscard]] static std::pair get_mem_info(cuda::stream_ref) noexcept - { - return {0, 0}; - } - /** * @brief Enables the `cuda::mr::device_accessible` property *