7 #include <rmm/detail/cuda_memory_resource.hpp>
8 #include <rmm/detail/export.hpp>
9 #include <rmm/detail/nvtx/ranges.hpp>
14 namespace RMM_NAMESPACE {
59 #ifdef RMM_ENABLE_LEGACY_MR_INTERFACE
74 #ifdef RMM_DEPRECATE_LEGACY_MR_INTERFACE
76 "This function is deprecated. Use allocate_sync(std::size_t bytes, std::size_t alignment) "
79 void* allocate(std::size_t bytes, std::size_t alignment =
alignof(std::max_align_t))
82 return do_allocate(bytes, alignment);
100 #ifdef RMM_DEPRECATE_LEGACY_MR_INTERFACE
102 "This function is deprecated. Use deallocate_sync(void* ptr, std::size_t bytes, std::size_t "
103 "alignment) instead.")]]
105 void deallocate(
void* ptr,
107 std::size_t alignment =
alignof(std::max_align_t)) noexcept
110 do_deallocate(ptr, bytes, alignment);
126 void*
allocate_sync(std::size_t bytes, std::size_t alignment =
alignof(std::max_align_t))
129 return do_allocate(bytes, alignment);
147 std::size_t alignment =
alignof(std::max_align_t)) noexcept
150 do_deallocate(ptr, bytes, alignment);
167 return do_is_equal(other);
179 return do_is_equal(other);
191 return !do_is_equal(other);
214 virtual void* do_allocate(std::size_t bytes,
215 std::size_t alignment =
alignof(std::max_align_t)) = 0;
230 virtual void do_deallocate(
void* ptr,
232 std::size_t alignment =
alignof(std::max_align_t)) noexcept = 0;
248 return this == &other;
254 rmm::detail::polyfill::resource_with<host_memory_resource, cuda::mr::host_accessible>);
Base class for host memory allocation.
Definition: host_memory_resource.hpp:48
bool is_equal(host_memory_resource const &other) const noexcept
Compare this resource to another.
Definition: host_memory_resource.hpp:165
void * allocate_sync(std::size_t bytes, std::size_t alignment=alignof(std::max_align_t))
Allocates memory on the host of size at least bytes bytes.
Definition: host_memory_resource.hpp:126
host_memory_resource(host_memory_resource &&) noexcept=default
Default move constructor.
host_memory_resource(host_memory_resource const &)=default
Default copy constructor.
bool operator==(host_memory_resource const &other) const noexcept
Comparison operator with another host_memory_resource.
Definition: host_memory_resource.hpp:177
friend void get_property(host_memory_resource const &, cuda::mr::host_accessible) noexcept
Enables the cuda::mr::host_accessible property.
Definition: host_memory_resource.hpp:199
void deallocate_sync(void *ptr, std::size_t bytes, std::size_t alignment=alignof(std::max_align_t)) noexcept
Deallocate memory pointed to by ptr.
Definition: host_memory_resource.hpp:145
bool operator!=(host_memory_resource const &other) const noexcept
Comparison operator with another host_memory_resource.
Definition: host_memory_resource.hpp:189