Block Hash#
-
struct Hash128#
Two-word representation used for stable context-cache identities.
-
struct AdapterKey#
-
struct MediaSpanKey#
-
struct BlockKeyExtras#
Public Members
-
std::vector<MediaSpanKey> media#
Non-token inputs whose content or placement changes the state produced for this block.
-
std::optional<AdapterKey> adapter#
-
std::vector<MediaSpanKey> media#
-
template<>
struct hash<trt_edgellm::rt::Hash128># Public Functions
- inline size_t operator()(
- trt_edgellm::rt::Hash128 const &value
-
Hash128 trt_edgellm::rt::hashOpaqueIdentity(std::string_view bytes)#
Deterministically hash exact opaque bytes for adapter, media, or isolation identity. This uses the same non-cryptographic 128-bit FNV-1a primitive as block chaining.
- BlockHash trt_edgellm::rt::hashBlock(
- BlockHash parent,
- int32_t const *tokens,
- size_t count,
- BlockKeyExtras const &extras,
- Hash128 const *perPositionMediaHash
Hash one caller-supplied token block and its non-token identity into its parent chain.
The implementation uses deterministic 128-bit Fowler-Noll-Vo (FNV-1a) over a tagged byte stream. It is a non-cryptographic hash; this layer does not perform a secondary token comparison when two hashes are equal.
When
perPositionMediaHashis non-null, at each token position where the entry is non-zero the 128-bit content hash is fed into the byte stream instead of the 4-byte token ID. A zero Hash128 means “use the token ID”. Passing nullptr (default) uses token IDs for all positions.
- std::vector<BlockHash> trt_edgellm::rt::hashFullBlocks(
- int32_t const *tokens,
- size_t tokenCount,
- int32_t pageSize,
- std::vector<BlockKeyExtras> const &extrasPerBlock,
- Hash128 const *perPositionMediaHash
Hash each complete token block in order, chaining from kCHAIN_ROOT and excluding any partial tail.
When
perPositionMediaHashis non-null it must cover the full token range (tokenCount entries). The appropriate slice is passed to each block.
- BlockHash trt_edgellm::rt::hashExactPrefix(
- int32_t const *tokens,
- size_t tokenCount,
- int32_t pageSize,
- std::vector<BlockKeyExtras> const &extrasPerBlock
Hash an exact token prefix, including a partial final block when present.
When extras are supplied, one entry is required for every touched block (
ceil(tokenCount / pageSize)). An aligned prefix returns the same digest as its final complete BlockHash; an empty prefix returns kCHAIN_ROOT.