stable-diffusion.cpp/examples
Claude 0d84e104ee
feat: run CPU graphs in segments when weights stream from disk
Without a GPU, auto-fit now compares the available RAM with the size of
each component and leaves the ones that do not fit on disk. When it does,
it turns the memory guard on at 90% unless --memory-guard is set.

On CPU backends the memory guard now counts the weights a graph still has
to read from disk before they are loaded. When that total would pass the
threshold and some weights can be released, the graph runs in segments, as
it already does on a GPU, so the peak stays well below the size of the
model. Splitting is skipped when the guard is off or when every weight is
resident, because it could not lower the peak.

Checked with a synthetic SD 1.5 model (128x128, 3 steps, 2 threads, Linux):
with 3.3 GiB of RAM held by another process and a 60% guard, the UNet runs
in 22 segments with a 732 MiB peak instead of 1722 MiB and the image is
identical pixel for pixel. Resident weights and runs without pressure or
without the guard behave as before. Not tested on Windows or with real
models.

Claude-Session: https://claude.ai/code/session_01EhZzDBkuuMp1jBf4WtEySC
2026-10-11 06:39:34 +02:00
..
cli feat: support for merging LoRA weights on model conversion (#2079) 2026-10-06 17:50:16 +08:00
common feat: run CPU graphs in segments when weights stream from disk 2026-10-11 06:39:34 +02:00
server Merge branch 'leejet:master' into fork-pull 2026-10-09 00:43:29 +02:00
CMakeLists.txt feat: add Mage-Flow support (#1808) 2026-07-23 01:23:25 +08:00