Expand description
2026-10-02: The caches a circuit declares (StateKind::is_cache), sized: how many units
each kind holds is a plan input (CacheInputs) the engine decides; the bytes of one unit
are the declaration’s elements times its element size. A cache whose input is absent holds
nothing; nothing here guesses a count.
Owner: metrale-circuit (memory). Invariants:
- One unit rule per kind (
units_of); every byte count but the prompt-lookup index isunits x elements x element size. - The prompt-lookup index is a host hash table per sequence: its bytes follow the table’s
growth law (
hash_table_bytes), evaluated at the sequence’s history length. - A keyed format must be given (
crate::state::StateInputs::formats); a missing key is an error, as incrate::state::StatePlan.
Structs§
- Cache
Inputs - 2026-10-02: How many units each cache kind holds;
Noneor 0 for a cache the serve does not keep. - Cache
Term - 2026-10-02: One sized cache declaration.
- Lookup
Inputs - 2026-10-02: The prompt-lookup index of the sequences in flight.
Functions§
- cache_
terms - 2026-10-02: Size every cache declaration of
statesunderinputs;formatsresolves keyed formats. - hash_
table_ bytes - 2026-10-02: Bytes of a Rust
HashMap(hashbrown) holdingentriesentries ofentry_byteseach (a multiple of 16), as it grows by inserting them: buckets are the next power of two ofentries * 8 / 7(4 or 8 below 8 entries; hashbrowncapacity_to_buckets), each bucket one entry plus one control byte, plus one 16-byte control group. 0 entries hold no allocation. - units_
of - 2026-10-02: The units
inputsgive a cache ofkind;Nonefor a non-cache kind, for the prompt-lookup index (not linear in its units) and on overflow.