mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-28 19:16:33 +00:00
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 |
||
|---|---|---|
| .. | ||
| common.cpp | ||
| common.h | ||
| log.cpp | ||
| log.h | ||
| media_io.cpp | ||
| media_io.h | ||
| resource_owners.hpp | ||