9 #include <kvikio/defaults.hpp>
117 template <
typename Allocator = CudaPinnedAllocator>
122 std::stack<void*> _free_buffers{};
125 Allocator _allocator{};
140 std::size_t
const _size;
149 void* get() noexcept;
150 void* get(std::ptrdiff_t offset) noexcept;
151 std::size_t size() noexcept;
170 std::
size_t _clear();
180 void _ensure_buffer_size();
203 void put(
void* buffer, std::
size_t size);
RAII wrapper for a host bounce buffer allocation.
Thread-safe singleton pool for reusable bounce buffers.
void put(void *buffer, std::size_t size)
Return a buffer to the pool for reuse.
std::size_t clear()
Free all retained allocations in the pool.
static KVIKIO_EXPORT BounceBufferPool & instance()
Get the singleton instance of the pool.
Buffer get()
Acquire a bounce buffer from the pool.
Allocator for page-aligned AND CUDA-registered pinned host memory.
void deallocate(void *buffer, std::size_t size)
Deallocate memory previously allocated by this allocator.
void * allocate(std::size_t size)
Allocate page-aligned CUDA-registered pinned host memory.
Allocator for CUDA pinned host memory.
void deallocate(void *buffer, std::size_t size)
Deallocate memory previously allocated by this allocator.
void * allocate(std::size_t size)
Allocate CUDA pinned host memory.
Allocator for page-aligned host memory.
void deallocate(void *buffer, std::size_t size)
Deallocate memory previously allocated by this allocator.
void * allocate(std::size_t size)
Allocate page-aligned host memory.
static std::size_t bounce_buffer_size()
Get the size of the bounce buffer used to stage data in host memory.