Contents

class

SushiAI::Optim::StepScalars

A tiny device-resident float vector, rewritten from the host per step.

Declared in
include/SushiAI/optim/step_scalars.hpp

Non-copyable: the whole point of the object is the stability of the one address its kernels captured, and a copy would suggest there can be two.

Public member functions

StepScalars(SushiBLAS::Engine &engine, std::size_t count)

Allocates and zeroes shared device buffer for step scalars.

Parameters

engine

Engine managing device memory context.

count

Number of scalar float elements to allocate.

Exceptions

Error

If count is zero or allocation fails.

StepScalars(const StepScalars &)=delete
StepScalars & operator=(const StepScalars &)=delete
const float * device_pointer() const noexcept

The address a device kernel captures by value.

Stable for the life of this object, which is what makes the capture legal across replays.

Returns

A pointer to element 0 of the buffer.

void write(SushiRuntime::span< const float > values)

Overwrites buffer contents from the host before replay.

Parameters

values

Span containing exactly count() float scalar values.

Exceptions

Error

If values span size does not match count().

std::size_t count() const noexcept

How many scalars the buffer holds.