Contents

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=default

Builds 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_index

Device queue that owns the block: the operand's Storage::get_device_index().

Exceptions

std::runtime_error

if the allocation of a new block fails.

ScratchBuffer(const ScratchBuffer &other) noexcept

Puts one more handle on other's block.

ScratchBuffer(ScratchBuffer &&other) noexcept

Takes other's handle and leaves other empty.

ScratchBuffer & operator=(const ScratchBuffer &other) noexcept

Releases this handle and puts one more on other's block.

ScratchBuffer & operator=(ScratchBuffer &&other) noexcept

Releases this handle and takes other's.

~ScratchBuffer()

Releases this handle; the last one returns the block to its shelf.

void * data() const noexcept

Returns the base address, or null when the handle leases nothing.

std::size_t bytes() const noexcept

Returns the usable size in bytes: what the caller asked for, 0 when empty.

bool is_empty() const noexcept

Returns true when the handle leases no block.

SushiRuntime::Core::ResourceRegion region() const noexcept

Returns the region a task that writes the scratch declares.

Precondition

is_empty() is false.

SushiRuntime::sushi_ptr< Storage > storage() const noexcept

Returns the allocation behind the leased block, or null when the handle leases nothing.