Module scratch_pool

Module scratch_pool 

Source
Expand description

2026-09-25: Device scratch pool of the high-speed-swap tier: slots that hold one block’s K and V for every KV head, filled from the storage backend.

Owner: storage, high-speed swap. Invariants:

  • lookup[k] == s exactly when residents[s] == Some(k).
  • A slot is in free_list only while residents holds None for it.

Slot S is slot_bytes = 2 * num_kv_heads * group_stride bytes. The K stripe of head h starts at S * slot_bytes + h * group_stride and its V stripe at S * slot_bytes + (num_kv_heads + h) * group_stride. That is the layout TiledAttention::scratch_pool_strides describes when group_stride is exactly block_size * head_dim * 2 bytes, with no filesystem padding.

Structs§

ResidentKey
ScratchDims
ScratchPool