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
engineEngine managing device memory context.
countNumber of scalar float elements to allocate.
Exceptions
ErrorIf count is zero or allocation fails.
StepScalars(const StepScalars &)=deleteStepScalars & operator=(const StepScalars &)=deleteconst float * device_pointer() const noexceptThe 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
valuesSpan containing exactly count() float scalar values.
Exceptions
ErrorIf values span size does not match count().
std::size_t count() const noexceptHow many scalars the buffer holds.

