AffineFrameCost

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

class AffineFrameCost[source]

Bases: object

What one prepared batch costs, split into its actor and frame parts.

A batch’s cost is a + b * frames. b * frames is what the frame count buys – per-frame geometry, frame buffers – and a is what the batch’s actor set costs however few frames are rendered: textures, per-primitive metadata, kernel workspace.

Reading the total as if it all scaled (divide the budget by the measured cost, multiply by the frame count) does two things wrong. It under-reads, because the fixed part is charged as though shrinking the window shrank it. And it cannot tell a batch with too many frames from one with too many actors – which matters, because only the first is fixable by shortening the window. Batch preparation selects the actors that have spawned by the window’s end, so the lever on a is the window’s reach over the spawn schedule, not its length: a render that could not tell them apart shrank its window to a single frame and stayed there.

One instance covers one prepared batch. The actor set is what fixes a, so a fresh fetch is a fresh line; the arena preflight feeds it one observation per probe of that batch.

Methods

actor_share

Fraction of this batch's own cost that its actor set fixes.

describe

fixed_bytes

a -- what this batch's actor set costs at any frame count.

max_frames_for

Largest frame count expected to fit, or None if unmeasured.

observe

Attributes

budget

Bytes this cost is allowed, as of the most recent observation.

actor_share()[source]

Fraction of this batch’s own cost that its actor set fixes.

Measured against the batch’s cost at the largest window observed, not against the budget: a budget is a prediction and can collapse (the peak models that supply some of them carry intercepts of their own), which would make every batch look actor-bound. What the caller needs to know is simply how much of this cost shortening the window can reach – near 1.0, almost none of it, and only a batch carrying fewer actors will be smaller.

None until two frame counts have been measured; one sample cannot distinguish the two parts at all.

budget

Bytes this cost is allowed, as of the most recent observation.

fixed_bytes()[source]

a – what this batch’s actor set costs at any frame count.

max_frames_for(budget_bytes=None)[source]

Largest frame count expected to fit, or None if unmeasured.

Zero means the fixed part alone overruns the budget: no window is short enough, and only a batch carrying fewer actors will fit.