cuda::experimental::stf::block_allocator_interface
Defined in include/cuda/experimental/__stf/allocators/block_allocator.cuh
-
class block_allocator_interface
Interface for block allocator.
This class provides an interface for a block allocator. It defines methods for allocation, deallocation, initialization, and printing of information.
Subclassed by cuda::experimental::stf::buddy_allocator, cuda::experimental::stf::cached_block_allocator, cuda::experimental::stf::fixed_size_allocator, cuda::experimental::stf::pooled_allocator, cuda::experimental::stf::uncached_block_allocator, cuda::experimental::stf::uncached_graph_allocator, cuda::experimental::stf::uncached_stream_allocator
Public Functions
-
block_allocator_interface() = default
Default constructor.
-
virtual ~block_allocator_interface() = default
Virtual destructor.
-
virtual void *allocate(backend_ctx_untyped&, const data_place &memory_node, ::std::ptrdiff_t &s, event_list &prereqs) = 0
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
-
virtual void deallocate(backend_ctx_untyped&, const data_place &memory_node, event_list &prereqs, void *ptr, size_t sz) = 0
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
-
virtual event_list deinit(backend_ctx_untyped&) = 0
Deinitialization of the allocator.
- Returns
List of events indicating that this was deinitialized
-
virtual ::std::string to_string() const = 0
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.
-
block_allocator_interface() = default