Memory
A run needs two kinds of memory. GPU memory (VRAM, 24 GB on a 7900 XTX) holds the work of drawing — the picture-in-progress, attention — and whatever weights are on the card. System memory (RAM) holds the weights that aren’t. A big model with its text encoder can be 20 GB or more, so where those weights live is what decides whether a run fits.
The Memory setting
In the Models fold, per model (Save as defaults for this model keeps it), and on the Video tab.
| Setting | What it does |
|---|---|
| Auto | stable-diffusion.cpp measures free memory and places each part: on the card first, then in RAM, then read from the SSD. The default, and right for anything that fits. |
| System RAM | Every weight waits in RAM and moves to the card a piece at a time, so the whole card is free for the drawing. The fix when a big model runs out of GPU memory. The text encoder is read from its file, used for the prompt and then let go, so it doesn’t hold RAM while the picture is drawn. Needs RAM about the size of the model; a little slower. |
| Stream from SSD | The model and its text encoder are re-read from their files as they’re needed. The least memory of the three — for when RAM is what runs out. Slower. It only reads, so it doesn’t wear the drive. |
System RAM has a second limit. The graphics card reaches system RAM
through a window the Linux driver sizes at half your RAM by default (the
GTT — about 15 GB on a 30 GB machine). Weights kept in RAM have to
fit in that window, however much RAM is free. A full-precision 9B model
(17 GB) doesn’t, and the run stops with “device lost”; the error box then
offers Stream from SSD, which goes from the file straight to the card. The
window can be made larger with a kernel setting (ttm.pages_limit),
or a Q8 file of the model fits it as it is.
Auto guesses how much room the drawing will need and fills the rest of the card with weights. A 9B model at two megapixels can need more than the guess, which is when System RAM helps.
Can the text encoder’s result be kept?
Not between runs. stable-diffusion.cpp can only remember a prompt’s encoding inside one running process, and yasdig starts a fresh one for every pass. What it does instead, in System RAM and Stream from SSD, is let go of the encoder as soon as it has read the prompt — the encoder is the second-largest file in most sets, and it is only needed for the first second or two.
When a run runs out
The error says which memory ran out and when — loading the model, drawing (with the step), or turning the result into pixels — and offers what fits: System RAM, Stream from SSD, a smaller size, or a smaller file. Pick one, then Try again re-runs exactly what failed. Nothing is saved until you press Save as defaults.
System RAM comes with its figure — needs about 17.6 GB of RAM; 26.0 GB is free — counted from the model’s own files. When it won’t fit with room to spare, it is shown greyed out and Stream from SSD is offered instead: a full-precision 9B can need more RAM than a 32 GB machine has free.
“Device lost” is a different failure: stable-diffusion.cpp’s own check said the work fits, and the graphics driver still had no room for it, because the desktop and the browser use the card too. The box then offers to keep 3 GB of the card free. That is a setting for this machine, not a model, so it is saved at once (Settings → Keep free on the GPU) and applies to every run after.
Running out while turning the result into pixels is the VAE. stable-diffusion.cpp already retries that in tiles by itself, so what is left is a smaller size.
Running out of system memory looks different: the system stops the run with no message, and yasdig says so. Close what you don’t need, or use Stream from SSD.
The lasting fix: a smaller file
A Q8 GGUF needs about half the memory of the original, Q6 a bit less again, and Q4 about a quarter — with Q8 indistinguishable and Q4 starting to lose fine detail. fp8 files run at twice their size on AMD cards. The Models tab has GGUF sets for every family, and its Convert panel turns a file you have into one.
After a run
When any weights weren’t on the card, a line under the timings says where they were — text encoder in system RAM, model streamed from the SSD. That explains a slow run before it becomes a failed one.