memory_model¶
Runtime model of render-arena peak storage per frame chunk.
The model observes ManualMemory.max_pointer and fits a conservative affine
estimate, peak(n) = a + b*n, separately for each render signature. Recent
observations, safety margins and growth limits guide the next chunk size. When
an affine fit is unsuitable it falls back to a per-frame bound.
This measures allocations made through the arena, including new rendering and post-processing code that uses it. It does not measure every PyTorch allocation, compiler workspace or driver reservation. The surrounding render loop handles those constraints and retries chunks that exhaust the arena. Later, denser frames can exceed a fit derived from earlier frames; the estimate is not a proof that an entire animation will fit.
Classes
What one prepared batch costs, split into its actor and frame parts. |
|
Affine fit of arena peak against chunk frame count. |
|
Measured bound on an out-of-arena transient build's peak. |
Functions
- chunk_signature(*, width, height, channels, dtype, samples_per_pixel, num_triangles, num_circuits)[source]¶
Key identifying batches whose peak lies on the same line.
Resolution and buffer dtype change the per-frame cost; the primitive counts change it too, and a batch with different geometry is a different line. Geometry counts are bucketed logarithmically so ordinary scene variation does not discard a usable fit, while an order-of-magnitude change starts a fresh one.