Skip to content

zorch.sumcheck.jagged.buffers

Fixed-width round buffers: cap-width pads/resizes and the layer-entry donated buffer pool that lays each layer's live prefix in place.

LayerBuffers

Donated cap-wide layer-entry buffers, owned by ONE prove chain: one array per (role, width, dtype), re-donated each layer via _lay_prefix_many so only the live prefix is written — a fresh cap pad per layer costs ~2x cap-width writes, a top GPU item of the warm prove. The tail keeps the previous layer's bytes; the capped rounds mask every read by the live operand, byte-gated by the capped-chain test. The one-chain scope is what frees the planes with the prove: cap-wide planes run ~5.3 GiB per 80M-cap class, so any longer-lived owner caps a resident multi-class prover at one big class per 32 GB card.

Source code in zorch/sumcheck/jagged/buffers.py
38
39
40
41
42
43
44
45
46
47
48
49
50
51
class LayerBuffers:
    """Donated cap-wide layer-entry buffers, owned by ONE prove chain:
    one array per (role, width, dtype), re-donated
    each layer via `_lay_prefix_many` so only the live prefix is written —
    a fresh cap pad per layer costs ~2x cap-width writes, a top GPU item of
    the warm prove. The tail keeps the previous layer's bytes; the capped
    rounds mask every read by the `live` operand, byte-gated by the
    capped-chain test. The one-chain scope is what frees the planes with
    the prove: cap-wide planes run ~5.3 GiB per 80M-cap class, so any
    longer-lived owner caps a resident multi-class prover at one big
    class per 32 GB card."""

    def __init__(self) -> None:
        self.pool: dict[tuple[str, int, Any], Array] = {}