Implement looped_kv_cache_bytes(n_blocks, n_loops, n_kv_heads, head_dim, seq_len, batch, dtype_bytes, share_across_loops=False) that returns a dict describing the KV cache of a looped transformer.
n_blocks blocks, so one pass costs n_blocks times that.share_across_loops=False (the default, and what works in practice) the hidden states differ between passes, so every pass needs its own cache entries: the total is n_loops passes' worth.share_across_loops=True (the experiment Nanbeige tried, which cost accuracy) later passes reuse the first pass's keys and values, so only one pass is stored.Return a dict with integer values:
"block_applications": n_blocks * n_loops"per_pass_bytes": bytes for one pass over the stack"total_bytes": bytes actually stored"unrolled_bytes": what an unrolled model with block_applications distinct blocks would store (always n_loops passes' worth)total_bytes; unrolled_bytes ignores it.