class
SushiBLAS::TensorFactory
Allocates dense tensors of one default layout from one runtime context.
- Declared in
include/SushiBLAS/tensor_factory.hpp
See also
include/SushiBLAS/README.md
Public member functions
explicit TensorFactory(SushiRuntime::Execution::RuntimeContext &context, Core::Layout layout=Core::Layout::ROW_MAJOR) noexceptBinds the factory to the context that allocates.
Parameters
contextPerforms every allocation; it must outlive the factory and its tensors.
layoutMemory layout of every tensor the factory creates.
TensorFactory(const TensorFactory &)=deleteTensorFactory & operator=(const TensorFactory &)=deleteTensorFactory(TensorFactory &&)=deleteTensorFactory & operator=(TensorFactory &&)=delete~TensorFactory()=defaultCore::Layout get_layout() const noexceptReturns the memory layout of every tensor the factory creates.
SushiRuntime::Execution::RuntimeContext & get_context() const noexceptReturns the runtime context that allocates.
Tensor create(SushiRuntime::span< const int64_t > dims, Core::DataType dtype=Core::DataType::FLOAT32, SushiRuntime::API::Residency residency=SushiRuntime::API::Residency::Shared, std::size_t device_index=0) constCreates a dense tensor; a shape with a zero dimension gets no storage.
Parameters
device_indexDevice queue that owns the allocation, below the context's device_count().
Exceptions
std::runtime_erroron a rank too high, a negative dimension, an overflowing byte count, a device index out of range or a failed allocation.
Static public member functions
static std::size_t allocation_bytes(SushiRuntime::span< const int64_t > dims, Core::DataType dtype)Returns the byte count a dense tensor of dims and dtype needs; 0 if a dimension is 0.
Exceptions
std::runtime_erroron a rank too high, a negative dimension or an overflowing count.

