stable-diffusion.cpp/docs
Claude 51845ffb58
feat: report why a call failed and expose system memory
new_sd_ctx(), generate_image() and generate_video() now record the
reason of a failure, and sd_get_last_error() returns it with a code:
out of memory, model file, backend, invalid argument, busy or
cancelled. An application can tell "try again with less memory" from
"the file is damaged" instead of reading the log. The state belongs to
the calling thread; errors logged by the model loader threads reach the
thread that reports the failure. C++ exceptions, std::bad_alloc
included, no longer cross the C API.

A test with a limited address space showed the process ending with
std::terminate when a loader thread could not be created while others
were already running. The loader now uses fewer threads, or the
calling thread when none could be started, and the loader threads
report exceptions as a failed load.

sd_get_system_memory() returns total, available and process RAM. The
free memory of the CPU device in sd_get_device_info() is the available
RAM, because ggml reports the total on Linux and macOS.

Checked with a synthetic 2.1 GB SD 1.5 model under a limited address
space: the standard configuration fails with out_of_memory, the same
context generates once the limit is lifted, and weights on disk let
the same request succeed. The Windows branch of system_memory.cpp was
only syntax-checked; macOS was not built.

Claude-Session: https://claude.ai/code/session_01EhZzDBkuuMp1jBf4WtEySC
2026-10-11 07:09:28 +02:00
..
adetailer.md feat: add ADetailer support (#1785) 2026-07-14 23:59:11 +08:00
anima.md docs: unify model path 2026-07-05 18:31:59 +08:00
animatediff.md refactor: unify runner lifecycles and weight residency (#1940) 2026-09-06 22:30:45 +08:00
backend.md feat: run CPU graphs in segments when weights stream from disk 2026-10-11 06:39:34 +02:00
boogu_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
build.md ci: build portable packages with GPU backends (Windows CUDA 12 and Vulkan, Linux Vulkan) 2026-10-11 05:40:43 +02:00
caching.md feat: add configurable conditioning cache for all models (#2034) 2026-09-23 22:25:42 +08:00
chroma.md refactor: move model-specific args into model parsers (#1757) 2026-07-06 23:13:18 +08:00
chroma_radiance.md docs: unify model path 2026-07-05 18:31:59 +08:00
distilled_sd.md feat: SDXS-09 support and update doc (#1356) 2026-04-17 01:11:44 +08:00
docker.md chore: move Dockerfiles into docker directory (#1745) 2026-07-05 18:39:09 +08:00
edit.md feat: add configurable image input preprocessing (#2028) 2026-09-23 02:12:49 +08:00
ernie_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
esrgan.md fix: preserve alpha when upscaling RGBA images with ESRGAN (#2029) 2026-09-23 02:23:10 +08:00
flux.md docs: unify model path 2026-07-05 18:31:59 +08:00
flux2.md docs: unify model path 2026-07-05 18:31:59 +08:00
hidream_o1_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
hipBLAS_on_Windows.md ci: update ROCm Windows builds (#1282) 2026-05-16 20:25:38 +08:00
hunyuan_video.md feat: add hunyuan video 1.5 support (#1795) 2026-07-18 22:30:10 +08:00
ideogram4.md feat: restore legacy fp8 handling when building with upstream ggml (#2001) 2026-09-21 00:48:30 +08:00
image_preprocessing.md feat: add configurable image input preprocessing (#2028) 2026-09-23 02:12:49 +08:00
imatrix.md feat: add imatrix support (#633) 2026-07-01 23:26:37 +08:00
int8_convrot.md feat: enable hip INT8 tensorwise matmul and convrot (#2071) 2026-09-27 23:24:07 +08:00
integrazione_progetti.md feat: report why a call failed and expose system memory 2026-10-11 07:09:28 +02:00
ip_adapter.md feat: add IP-Adapter Plus (Resampler image projection) support (#1839) 2026-08-02 16:15:28 +08:00
iris.md feat: add Iris-3B text-to-image support (#2117) 2026-10-10 01:39:49 +08:00
kontext.md docs: unify model path 2026-07-05 18:31:59 +08:00
krea2.md docs: unify model path 2026-07-05 18:31:59 +08:00
lcm.md feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
lens.md refactor: require external Gemma 2 and GPT-OSS tokenizers (#1974) 2026-09-15 01:25:13 +08:00
lingbot_video.md feat: add lingbot video support (#1770) 2026-07-11 17:50:59 +08:00
llada_image.md feat: add LLaDA-Image support (#1968) 2026-09-21 01:14:20 +08:00
longcat_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
lora.md feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
ltx2.md feat: add LTX-2.5 support (#1893) 2026-08-30 19:13:06 +08:00
mage_flow.md docs: update hugging face links for MageFlow diffusion and VAE models (#2065) 2026-09-27 17:22:03 +08:00
ming_image.md feat: add Ming-Image Design support (#2063) 2026-09-27 17:24:13 +08:00
minimax_h3.md feat: add minimax-h3 support (#1854) 2026-08-04 23:14:18 +08:00
minit2i.md feat: add MiniT2I support (#1683) 2026-07-02 00:46:51 +08:00
model_config.md feat: add verbose logging and log-level selection (#1941) 2026-09-06 23:14:03 +08:00
ovis_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
performance.md feat: run CPU graphs in segments when weights stream from disk 2026-10-11 06:39:34 +02:00
photo_maker.md feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
pid.md refactor: require external Gemma 2 and GPT-OSS tokenizers (#1974) 2026-09-15 01:25:13 +08:00
pixart.md feat: add PixArt model family support (#2047) 2026-09-25 18:18:55 +08:00
pulid.md chore: move utility scripts under scripts (#1746) 2026-07-05 18:48:18 +08:00
quantization_and_gguf.md feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
qwen_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
qwen_image_2.1.md feat: add TAEQI2.1 support for Qwen Image 2.1 (#2123) 2026-10-11 00:01:18 +08:00
qwen_image_edit.md refactor: move model-specific args into model parsers (#1757) 2026-07-06 23:13:18 +08:00
rpc.md docs: reflect GGML_MAX_NAME value change in rpc docs (and in ggml_extend assert) (#1950) 2026-09-10 23:55:02 +08:00
sage_attention.md feat: add native CUDA SageAttention support (#2005) 2026-09-21 01:16:59 +08:00
sd.md refactor: unify runner lifecycles and weight residency (#1940) 2026-09-06 22:30:45 +08:00
sd3.md feat: simple openai image generation api compatiple server (#1037) 2025-12-13 13:53:21 +08:00
sefi_image.md refactor: unify runner lifecycles and weight residency (#1940) 2026-09-06 22:30:45 +08:00
sensenova_u1.md feat: add SenseNova U1.5 support (#1935) 2026-09-12 00:39:59 +08:00
taesd.md feat: add TAEQI2.1 support for Qwen Image 2.1 (#2123) 2026-10-11 00:01:18 +08:00
tokenizers.md refactor: require external Gemma 2 and GPT-OSS tokenizers (#1974) 2026-09-15 01:25:13 +08:00
troubleshooting.md fix: reject video models in image generation (#2017) 2026-09-21 21:48:42 +08:00
wan.md fix: improve GGUF metadata parsing and reader selection (#2062) 2026-09-27 16:24:07 +08:00
z_image.md docs: unify model path 2026-07-05 18:31:59 +08:00
z_image_l2p.md feat: add Z-Image L2P support (#2075) 2026-10-06 17:23:21 +08:00