18 #include <rmm/detail/export.hpp>
25 #include <shared_mutex>
28 namespace RMM_NAMESPACE {
41 template <
typename Upstream>
110 void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream)
override
112 get_upstream_resource().deallocate_async(ptr, bytes, stream);
122 bool do_is_equal(device_memory_resource
const& other)
const noexcept
override
124 if (
this == &other) {
return true; }
125 auto cast =
dynamic_cast<prefetch_resource_adaptor<Upstream> const*
>(&other);
126 if (cast ==
nullptr) {
return false; }
127 return get_upstream_resource() == cast->get_upstream_resource();
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:41
Base class for all libcudf device memory allocation.
Definition: device_memory_resource.hpp:94
void * allocate_async(std::size_t bytes, std::size_t alignment, cuda_stream_view stream)
Allocates memory of size at least bytes.
Definition: device_memory_resource.hpp:217
Resource that prefetches all memory allocations.
Definition: prefetch_resource_adaptor.hpp:42
prefetch_resource_adaptor(prefetch_resource_adaptor &&) noexcept=default
Default move constructor.
prefetch_resource_adaptor(Upstream *upstream)
Construct a new prefetch resource adaptor using upstream to satisfy allocation requests.
Definition: prefetch_resource_adaptor.hpp:60
prefetch_resource_adaptor(device_async_resource_ref upstream)
Construct a new prefetch resource adaptor using upstream to satisfy allocation requests.
Definition: prefetch_resource_adaptor.hpp:50
cuda_device_id get_current_cuda_device()
Returns a cuda_device_id for the current device.
Definition: cuda_device.hpp:96
cuda::mr::async_resource_ref< cuda::mr::device_accessible > device_async_resource_ref
Alias for a cuda::mr::async_resource_ref with the property cuda::mr::device_accessible.
Definition: resource_ref.hpp:41
device_async_resource_ref to_device_async_resource_ref_checked(Resource *res)
Convert pointer to memory resource into device_async_resource_ref, checking for nullptr
Definition: resource_ref.hpp:79
void prefetch(void const *ptr, std::size_t size, rmm::cuda_device_id device, rmm::cuda_stream_view stream)
Prefetch memory to the specified device on the specified stream.
Definition: prefetch.hpp:46