stable-diffusion.cpp/examples/common
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
..
common.cpp feat: run CPU graphs in segments when weights stream from disk 2026-10-11 06:39:34 +02:00
common.h Merge upstream leejet/stable-diffusion.cpp master into fix_to_claude 2026-10-11 04:26:15 +02:00
log.cpp refactor: escape newlines in prompt logs and clarify source separators (#2106) 2026-10-06 19:51:12 +08:00
log.h feat: add verbose logging and log-level selection (#1941) 2026-09-06 23:14:03 +08:00
media_io.cpp fix: add alpha channel input for Qwen Image 2.1 and relative docs (#2021) 2026-09-22 21:45:06 +08:00
media_io.h fix: add alpha channel input for Qwen Image 2.1 and relative docs (#2021) 2026-09-22 21:45:06 +08:00
resource_owners.hpp feat: add minimax-h3 support (#1854) 2026-08-04 23:14:18 +08:00