ChunkMemoryModel

Qualified name: algan.rendering.memory\_model.ChunkMemoryModel

class ChunkMemoryModel(safety=1.15)[source]

Bases: object

Affine fit of arena peak against chunk frame count.

Lives for a render job and is carried across batches, so only the first batch pays for probing. Observations are kept per (route, resolution) signature – a batch whose frame buffers changed shape has a different line.

Methods

describe

is_calibrated

Whether anything has been measured for this signature yet.

observe

Record that num_frames frames peaked at peak_bytes.

plan

Largest chunk expected to fit, or 1 while still probing.

predict

Bytes a chunk of num_frames is expected to need, with margin.

predict_preflight

Predict intrinsic workspace, or leave preparation in probe mode.

Attributes

safety

is_calibrated(signature)[source]

Whether anything has been measured for this signature yet.

One sample is enough to plan from: _line reads it as a pure per-frame cost, which over-charges by the intercept and is therefore safe. Requiring two would deadlock – planning would pin every chunk to one frame, and a second frame count would never be observed.

observe(signature, num_frames, peak_bytes, *, capacity_limited=False)[source]

Record that num_frames frames peaked at peak_bytes.

plan(signature, requested_frames, available_bytes)[source]

Largest chunk expected to fit, or 1 while still probing.

Probing deliberately renders single frames until the line is known. Those frames are part of the batch, so the cost is the loss of batching on them, not extra work.

predict(signature, num_frames)[source]

Bytes a chunk of num_frames is expected to need, with margin.

predict_preflight(signature, num_frames)[source]

Predict intrinsic workspace, or leave preparation in probe mode.

Auto-sized tiles adapt to the arena left by the prepared scene. Their high-water marks describe supplied capacity, not required capacity. Keep using those actual peaks for conservative render chunk planning; scene preflight instead retains its unmeasured-batch guard and OOM retry until the recent window contains only fixed-size observations.