Contents

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) noexcept

Binds the factory to the context that allocates.

Parameters

context

Performs every allocation; it must outlive the factory and its tensors.

layout

Memory layout of every tensor the factory creates.

TensorFactory(const TensorFactory &)=delete
TensorFactory & operator=(const TensorFactory &)=delete
TensorFactory(TensorFactory &&)=delete
TensorFactory & operator=(TensorFactory &&)=delete
~TensorFactory()=default
Core::Layout get_layout() const noexcept

Returns the memory layout of every tensor the factory creates.

SushiRuntime::Execution::RuntimeContext & get_context() const noexcept

Returns 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) const

Creates a dense tensor; a shape with a zero dimension gets no storage.

Parameters

device_index

Device queue that owns the allocation, below the context's device_count().

Exceptions

std::runtime_error

on 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_error

on a rank too high, a negative dimension or an overflowing count.