Skip to main content

Module session

Module session 

Source
Expand description

The render session: the one worker pool that calibration, refine, the bench and the dataset render through. None of them owns a pool.

Each worker holds one renderer, and so one plug-in instance in its own host process. A worker starts its renderer at its first job, and starts a new one after RESTART_AFTER renders, so state a plug-in builds up over many loads cannot reach later renders. A failed render is retried once on a new renderer. A second failure gives a RenderFailure, which a consumer scores FAILED_SCORE; the session goes on with the next job.

Every render starts with the flush of the recipe. That is the renderer’s duty, not the session’s: every Renderer::render loads the job’s state and plays the pre-roll before the clip.

A panic in a renderer counts as a failed try, so it costs one job a retry and never the jobs of the other workers. A RenderError::WrongSynth is the caller’s mistake, not a fault of the plug-in: it fails the job at once and keeps the renderer.

§Repeat renders

A fresh Vital instance renders bit-identically to any other fresh instance, and each later render on one instance differs from the ones before. So the n-th renders of two workers are equal. A consumer that needs repeat-render noise draws its renders in sequence on one instance. One that needs a repeatable render renders on a fresh instance.

§Costs

  • Each worker holds one plug-in in its own host process. A Vital host takes about 270 to 325 MB of resident memory, and the session sets no cap on the worker count, so pick it for the machine.
  • Run RenderSession::start_all before RenderSession::render_all. A plug-in that cannot start otherwise fails every job after two start time-outs each, every job returns the sentinel, and a search spends its budget on nothing.
  • A job that always hangs costs about two render time-outs: one per try.

Structs§

RenderFailure
A render that failed on every try.
RenderSession
A pool of workers that renders jobs in parallel.

Enums§

RenderOutcome
What the session gives for one job.

Constants§

FAILED_SCORE
The score a consumer gives a failed render: far above any distance a render can score, so a search ranks it last, and finite, so sums and means of scores stay finite.
RESTART_AFTER
How many renders a renderer plays before the worker starts a new one.
RETRIES
How many times a failed render is tried again.

Type Aliases§

BoxedRenderer
A renderer a worker can own on its own thread.
Spawn
Starts a renderer for the worker with the given index.