cuda::experimental::stf::buddy_allocator#
-
class buddy_allocator : public cuda::experimental::stf::block_allocator_interface#
Buddy allocator policy which relies on a root allocator to create large buffers which are then suballocated with a buddy allocation algorithm.
Public Functions
-
buddy_allocator() = default#
-
inline buddy_allocator(block_allocator_untyped root_allocator_)#
- inline virtual void *allocate(
- backend_ctx_untyped &ctx,
- const data_place &memory_node,
- ::std::ptrdiff_t &s,
- event_list &prereqs,
Asynchronous allocation of memory.
This method asynchronously allocates
*s
bytes on the specified memory node. Upon success,*ptr
will contain the address of the allocated buffer. If the allocation fails,*s
will contain a negative value.- Parameters:
ctx – Untyped backend context
memory_node – Memory node where the allocation should occur
s – Pointer to the size of the allocation
prereqs – List of events that should finish before the allocation starts
- Returns:
void* Pointer to the allocated memory
- inline virtual void deallocate(
- backend_ctx_untyped&,
- const data_place &memory_node,
- event_list &prereqs,
- void *ptr,
- size_t sz,
Deallocation of memory.
This method deallocates memory previously allocated by the allocate method.
- Parameters:
ctx – Untyped backend context
memory_node – Memory node where the deallocation should occur
prereqs – List of events that should finish before the deallocation starts
ptr – Pointer to the memory to be deallocated
sz – Size of the memory to be deallocated
-
inline virtual event_list deinit(backend_ctx_untyped &ctx) override#
Deinitialization of the allocator.
- Returns:
List of events indicating that this was deinitialized
-
inline virtual ::std::string to_string() const override#
String representation of the allocator.
This method returns a string representation of the allocator.
- Returns:
std::string String representation of the allocator
-
inline virtual void print_info() const#
Print information about the allocator.
This method prints information about the allocator to stderr.
-
buddy_allocator() = default#