Contents

namespace

SushiAI::IO

Declared in
include/SushiAI/io/checkpoint.hpp

Contains

Variables

constexpr std::uint32_t CHECKPOINT_MAGIC = 0x50434153u

The first four bytes of every checkpoint: the ASCII "SACP".

Spelled as the little-endian word rather than a character array so it compares against what get_u32 decodes without a second conversion at each use.

constexpr std::uint32_t CHECKPOINT_VERSION = 1u

The format version this build reads and writes.

A file carrying any other version is an error rather than something read with today's field order. That is the whole point of the field: the format's next change must be loud, not a misread.

constexpr std::uint32_t MAX_TENSOR_COUNT = 4096u

The largest tensor count a file may declare.

constexpr std::uint32_t MAX_NAME_LENGTH = 256u

The longest parameter name a file may declare, in bytes.

Functions

template <typename M>
void save_checkpoint(const std::filesystem::path &path, M &module, Graph::TensorPool &pool, SushiBLAS::Engine &engine)

Writes every declared parameter of the module to disk.

Parameters

path

Target filesystem path for the checkpoint.

module

Traced model providing declared parameters.

pool

Storage pool containing parameter tensors.

engine

Engine flushed prior to reading tensor memory.

template <typename M>
void load_checkpoint(const std::filesystem::path &path, M &module, Graph::TensorPool &pool)

Loads parameter tensors from a checkpoint file into a module.

Parameters

path

Checkpoint path to read from disk.

module

Traced model matching the checkpoint structure.

pool

Storage pool where parameters are materialized.