class
SushiBLAS::ScratchBuffer
Leases one device scratch block; the block returns to its pool when the last copy dies.
- Declared in
include/SushiBLAS/engine/scratch.hpp
See also
include/SushiBLAS/engine/README.md
Public member functions
ScratchBuffer() noexcept=defaultBuilds an empty handle that leases nothing.
ScratchBuffer(ScratchPool &pool, std::size_t bytes, std::size_t device_index)Leases at least bytes of device memory from pool, or nothing when bytes is zero.
Parameters
device_indexDevice queue that owns the block: the operand's Storage::get_device_index().
Exceptions
std::runtime_errorif the allocation of a new block fails.
ScratchBuffer(const ScratchBuffer &other) noexceptPuts one more handle on other's block.
ScratchBuffer(ScratchBuffer &&other) noexceptTakes other's handle and leaves other empty.
ScratchBuffer & operator=(const ScratchBuffer &other) noexceptReleases this handle and puts one more on other's block.
ScratchBuffer & operator=(ScratchBuffer &&other) noexceptReleases this handle and takes other's.
~ScratchBuffer()Releases this handle; the last one returns the block to its shelf.
void * data() const noexceptReturns the base address, or null when the handle leases nothing.
std::size_t bytes() const noexceptReturns the usable size in bytes: what the caller asked for, 0 when empty.
bool is_empty() const noexceptReturns true when the handle leases no block.
SushiRuntime::Core::ResourceRegion region() const noexceptReturns the region a task that writes the scratch declares.
Precondition
is_empty() is false.
SushiRuntime::sushi_ptr< Storage > storage() const noexceptReturns the allocation behind the leased block, or null when the handle leases nothing.

