namespace
SushiAI
- Declared in
include/SushiAI/autograd/backward.hpp
Contains
Typedefs
using SushiAI::DType = SushiBLAS::Core::DataTypeThe element type of a tensor.
An alias, not a parallel enum: SushiAI performs no arithmetic of its own, so the set of types it can express is exactly the set SushiBLAS can compute on.
using SushiAI::Layout = SushiBLAS::Core::LayoutThe memory layout of a tensor, aliased from SushiBLAS for the same reason.
using SushiAI::OpID = SushiRuntime::Graph::OpIDThe runtime's operation-identity type, aliased for brevity.
Variables
constexpr int32_t MAX_RANK = static_cast<int32_t>(SushiBLAS::Core::MAX_TENSOR_RANK)Maximum tensor rank, fixed by SushiBLAS's own storage of shape and strides.
Functions
SushiBLAS::Tensor allocate_tensor(SushiBLAS::Engine &engine, SushiRuntime::span< const int64_t > dims, DType dtype=DType::FLOAT32)Allocates a tensor of dims with its own Storage.
Parameters
engineThe engine whose context owns the allocator.
dimsThe extents, outermost first.
dtypeThe element type.
Returns
The new tensor with standalone storage.
Exceptions
ErrorIf an extent is invalid or allocation fails.
SushiBLAS::Tensor allocate_tensor(SushiBLAS::Engine &engine, const Shape &shape, DType dtype=DType::FLOAT32)Allocates a tensor of shape with its own Storage.
Parameters
engineThe engine whose context owns the allocator.
shapeThe extents.
dtypeThe element type.
Returns
The new tensor; nothing else references its Storage.
Exceptions
ErrorAs the span overload does.
SushiBLAS::Tensor allocate_like(SushiBLAS::Engine &engine, const SushiBLAS::Tensor &like)Allocates a tensor with like's extents, dtype, and layout.
Parameters
engineThe engine whose context owns the allocator.
likeThe tensor to copy the description from.
Returns
The new tensor; it shares nothing with like.
Exceptions
ErrorIf
likeholds no elements, or the allocation fails.
SushiRuntime::sushi_ptr< SushiBLAS::Storage > allocate_arena(SushiBLAS::Engine &engine, std::size_t bytes)Allocates one arena buffer for memory planning.
Parameters
engineThe engine whose context owns the allocator.
bytesNumber of bytes the arena holds; must be positive.
Returns
The newly allocated storage.
Exceptions
ErrorIf
bytesis zero or allocation fails.
SushiBLAS::Tensor view_tensor(SushiBLAS::Engine &engine, const SushiRuntime::sushi_ptr< SushiBLAS::Storage > &arena, std::size_t byte_offset, const Shape &shape, DType dtype)Returns a tensor view into arena at byte_offset.
Parameters
engineThe engine whose default layout the view takes.
arenaStorage to carve from; must outlive the view.
byte_offsetOffset in bytes; must be aligned to element width.
Exceptions
ErrorIf offset is misaligned or out of bounds.
constexpr std::size_t dtype_size(DType dtype) noexceptReturns the size in bytes occupied by one element of dtype.
Parameters
dtypeThe element type to size.
Returns
The element's size in bytes; never zero.
constexpr const char * dtype_name(DType dtype) noexceptA human-readable name for dtype, for diagnostics and error text.
Parameters
dtypeThe element type to name.
Returns
A null-terminated literal owned by the library; never null.
constexpr bool is_real_float(DType dtype) noexceptReports whether dtype is a real floating-point type.
Parameters
dtypeThe element type to test.
Returns
True for HALF, FLOAT32, and FLOAT64; false otherwise.
const char * version_string() noexceptReturns the library version string.
Returns
A null-terminated literal owned by the library; never null.

