#1615: Auto caps CPU frames in flight from free memory after a job switches to the CPU (#3458)

A GPU project whose Render Queue job measured the CPU faster (#3335) rendered
every frame of a batch at once on the CPU, one per thread, with no memory cap:
on a 16-thread machine at about 1.4 GB a frame the app ran out of RAM and
exited without an error (0.23.1, Windows).

While a job renders on the CPU after a GPU frame measured its working memory,
CPU frames in flight now fit half the memory the system has free at that size
per frame, 1 to one per thread, settled once per job and logged. The probe's
timed CPU frames use the same cap. EFFECTCRAFT_CPU_INFLIGHT still overrides
it; Software Rendering projects, with no measurement, are unchanged. The host
reads the free memory through the new JobOptions::free_memory.
This commit is contained in:
FredApps authored and GitHub committed 2026-11-11 14:31:36 +01:00
1 parent 33a15e1d86
commit 006dcc962d
4 files changed
+147 -6

No files matched your search

+7 -4
View File
@@ -100,10 +100,13 @@ Commands (CLI, MCP, control channel):
one; `EFFECTCRAFT_GPU_MEMCAP_MB` sets it), keeping room for the upload cache to fill. It
renders one frame at a time where the memory can't be measured (Metal, WebGPU, GL, or the
cap turned off) and once frames have had to wait for memory. The render log names the count.
`EFFECTCRAFT_GPU_INFLIGHT` overrides it. CPU renders have no such setting: they keep one
frame per thread in flight, so their memory grows with the core count. Set
`EFFECTCRAFT_CPU_INFLIGHT` to a whole number of frames (at least 1) to cap the frames in
flight of every Render Queue render and export, `effectcraft-cli render` included
`EFFECTCRAFT_GPU_INFLIGHT` overrides it. CPU renders have no such setting. A job on GPU
Acceleration that renders on the CPU (it measured the CPU faster, or the GPU stopped) fits
its CPU frames in flight into half the memory the system has free, at the size a GPU frame
measured, from 1 to one per thread; the app log names the count. Other CPU renders (Software
Rendering projects) keep one frame per thread in flight, so their memory grows with the core
count. Set `EFFECTCRAFT_CPU_INFLIGHT` to a whole number of frames (at least 1) to cap the
frames in flight of every Render Queue render and export, `effectcraft-cli render` included
([#1615](https://github.com/storytold/effectcraft/issues/1615)); previews don't read it. One
exception: while a job on GPU Acceleration times both compositors on its first frames, it
renders them under the cap but keeps them all (up to 12) until it has chosen. That timing