namespace
SushiAI::IO
- Declared in
include/SushiAI/io/checkpoint.hpp
Contains
Variables
constexpr std::uint32_t CHECKPOINT_MAGIC = 0x50434153uThe 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 = 1uThe 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 = 4096uThe largest tensor count a file may declare.
constexpr std::uint32_t MAX_NAME_LENGTH = 256uThe 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
pathTarget filesystem path for the checkpoint.
moduleTraced model providing declared parameters.
poolStorage pool containing parameter tensors.
engineEngine 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
pathCheckpoint path to read from disk.
moduleTraced model matching the checkpoint structure.
poolStorage pool where parameters are materialized.

