Workspace and memory

Overview

The per-Queue workspace arena, leases and BumpAllocator sizing.

Functions

◆ workspace_bytes()

template<typename Fn>
size_t batchlas::workspace_bytes ( Fn && layout)
inline

Bytes a workspace layout needs, obtained by replaying it against a sizing pool.

An algorithm describes its workspace once, in a *_layout function, and both its *_buffer_size entry point and its implementation go through it, so they cannot drift:

size_t foo_buffer_size(Queue& ctx, ...) {
return workspace_bytes([&](BumpAllocator& p) { return foo_layout<B, T>(ctx, p, ...); });
}
size_t workspace_bytes(Fn &&layout)
Bytes a workspace layout needs, obtained by replaying it against a sizing pool.
Definition mempool.hh:192
Linear (bump) sub-allocator over a caller-supplied workspace buffer.
Definition mempool.hh:30
Where BatchLAS work runs: a device, a backend, an ordered SYCL queue and a workspace arena.
Parameters
layoutcallable taking a BumpAllocator&; its result is discarded
Returns
BumpAllocator::required_bytes() of the sizing pool after layout ran
Precondition
layout is pure with respect to the workspace: it may read the caller's views and build views over what it allocates, but never reads or writes workspace memory, never launches a kernel, and asks nested size queries about the caller's views only.
See also
Workspace

Definition at line 192 of file mempool.hh.

Files

file  include/batchlas/util/mempool.hh
 BumpAllocator, the linear sub-allocator over a workspace span, and workspace_bytes().
file  include/batchlas/util/workspace.hh
 WorkspaceLease: a scoped borrow of scratch memory from a Queue's workspace arena.

Classes

struct  batchlas::BumpAllocator
 Linear (bump) sub-allocator over a caller-supplied workspace buffer. More...
class  batchlas::WorkspaceLease
 A borrow of scratch memory from a Queue's workspace arena, returned to the arena when the handle goes out of scope. More...