class
SushiBLAS::Storage
A class to manage memory for tensors.
- Declared in
include/SushiBLAS/storage.hpp- Inherits
SushiRuntime::Core::RefCounted
This class holds the pointer to memory and information about the allocation. it uses SYCL Unified Shared Memory (USM) through a SushiRuntime RuntimeContext. It is reference counted to help share data safely between tensors.
Public member functions
Storage(SushiRuntime::Execution::RuntimeContext &ctx, size_t n_bytes, SushiRuntime::API::Residency residency=SushiRuntime::API::Residency::Shared, size_t device_index=0)Allocates aligned memory of n_bytes from a runtime context, with a residency.
Parameters
ctxRuntime context that performs the allocation; must outlive this Storage.
n_bytesNumber of bytes requested.
residencyKind of USM to allocate.
device_indexDevice queue that owns the allocation.
Exceptions
std::runtime_errorif the size is zero or the allocation fails.
Storage(const Storage &)=deleteStorage & operator=(const Storage &)=deletevoid * allocation_base() const noexceptReturns the base address of the whole allocation, ignoring every view's offset.
Returns
The pointer the runtime context handed back, or nullptr before construction completed.
Warning
Never a tensor's data; use Tensor::data() to address elements.
See also
include/SushiBLAS/README.md
SushiRuntime::Execution::RuntimeContext & get_context() const noexceptReturns the runtime context that made the allocation and frees it.
SushiRuntime::API::Residency get_residency() const noexceptReturns the kind of USM the allocation lives in (Shared, Device, or Host).
size_t get_device_index() const noexceptReturns the device queue that owns the allocation.
size_t size_bytes() const noexceptReturns the allocated size in bytes: the requested size rounded up to DEFAULT_ALIGNMENT.

