Repository navigation
Description
Summary
Since release master-848-9cdb6b6, sd-cli (official bin-win-vulkan-x64 asset) crashes silently (process exits, no error message on stdout/stderr, bash reports exit code 127) when generating a Flux image with split text encoders on AMD Vulkan. The exact same command works on the previous release asset (master-841-6b3edaa). SDXL with a monolithic checkpoint works fine on the new build, so this looks related to the multi-model loading / weight-residency refactor (candidates: #1940, #1942, #1905).
Environment
- OS: Windows 11 (10.0.26200)
- GPU: AMD Radeon RX 6950 XT 16 GB (RDNA2 / gfx1030)
- Driver: 32.0.21045.5002 (Adrenalin)
- Build:
sd-master-9cdb6b6-bin-win-vulkan-x64.zip(official release asset), commit9cdb6b6 - Working build for comparison:
sd-master-<sha>-bin-win-vulkan-x64.zipwith commit6b3edaa(master-841)
Models (GGUF from the project's recommended sources):
flux1-schnell-Q6_K.gguf(diffusion model)clip_l.safetensors,t5xxl_fp16.safetensors(text encoders)ae.safetensors(VAE)
Reproduction
sd-cli.exe --diffusion-model flux1-schnell-Q6_K.gguf \
--clip_l clip_l.safetensors --t5xxl t5xxl_fp16.safetensors --vae ae.safetensors \
-p "a red apple on a wooden table, photo" \
--steps 4 --cfg-scale 1.0 --sampling-method euler -W 512 -H 512 --seed 42 \
--vae-tiling --backend vulkan -o out.png
Observed on 9cdb6b6 (master-848)
1) Default invocation — silent death. The process terminates without any error message (exit code 127 under Git Bash). Last log lines with -v:
[INFO ] stable-diffusion.cpp:5322 - get_learned_condition completed, taking 13.73s
[INFO ] stable-diffusion.cpp:5705 - generating image: 1/1 - seed 42
[INFO ] ggml_graph_cut.cpp:965 - flux build cached graph cut plan done (taking 6 ms)
[VERBOSE] model_loader.cpp:1243 - loading tensors completed, taking 5.32s (read: 4.06s, ...)
[VERBOSE] model_manager.cpp:428 - model manager prepared params backend buffers (9379.29 MB, 776 tensors, 192 blocks, VRAM) on Vulkan0
<process exits here, no message>
2) --auto-fit off — identical silent crash at the same point.
3) --offload-to-cpu — hard Vulkan OOM error:
ggml_vulkan: vk::Device::createComputePipeline: ErrorOutOfDeviceMemory
4) --max-vram 6 — an actual error line is finally logged, then the process still dies silently:
[ERROR ] ggml_runner.cpp:848 - t5 segment 17/26 (t5.block.15) failed during weight preparation
<process exits here, exit code 127, no additional message>
Expected / previous behavior
The identical command on the 6b3edaa build completes successfully and produces the image (this GPU is 16 GB; the previous build's streaming/offload behavior fits Flux Q6_K + t5xxl fp16 in VRAM).
Control test: SDXL is unaffected
A monolithic SDXL checkpoint (-m juggernautXL...safetensors, 512×512, euler_a) generates fine on 9cdb6b6 — so the regression is specific to the split-encoders path (diffusion model + separate clip/t5/vae), i.e. exactly what the new model manager / runner lifecycle code (#1940, #1942) and streamed-layer prefetch (#1905) touch.
Additional notes
- Two distinct problems, possibly: (a) the weight-preparation memory management regression itself, and (b) the process exits with no diagnostic at all in cases 1/2/4 — even when an
[ERROR]line was just logged (case 4), there is no exception message, no abort message, nothing. A graceful failure with the underlying Vulkan error would have made this much easier to report. - No other GPU-heavy process was running; no zombie
sd-cliprocesses; VRAM was free before each run (each configuration was tested in a fresh process). - Happy to test a fix build or additional variants (e.g. quantized t5xxl, flux1-dev, other
--max-vramvalues) on this machine.
Activity
docs(veille): sd-cli master-848-9cdb6b6 TESTEE puis ROLLBACK — crash …
laurentvv commentedon Sep 7, 2026
Data point: still present in
master-849-d04e895(officialbin-win-vulkan-x64asset).Tested the exact same Flux schnell command (split text encoders, Vulkan, RX 6950 XT): identical silent crash, exit code 127 with no message, at the same point — right after:
Unsurprising since the only commit in 849 (#1939, SDXL embeddings loading) doesn't touch this path.
6b3edaaremains unaffected. I'll keep6b3edaainstalled and can test any candidate fix build on this machine (AMD RX 6950 XT 16 GB, Windows 11, Vulkan).vmobilis commentedon Sep 8, 2026
@laurentvv, hello, if nobody else will confirm the bug, there is a little possibility that the regression affects only your particular hw+drivers setup and others will not be able to reproduce the error.
If so, since some of 7 commits between 6b3edaa and 9cdb6b6 have binaries in releases, maybe you could try to locate the crashing commit more precisely, to clarify possible reason? (Or are they all crash right after https://github.com/leejet/stable-diffusion.cpp/releases/tag/master-841-6b3edaa)?
Good luck!
laurentvv commentedon Sep 8, 2026
Follow-up per @vmobilis' suggestion — bisected further, the culprit is now isolated to a single commit.
Binary bisect (official
bin-win-vulkan-x64releases, same Flux schnell command as the original report):6b3edaa6b3edaa462d67580bac2dLocal builds to separate #1905 from #1940 (MSYS2/UCRT64, gcc 16.2,
-DGGML_VULKAN=ON, same ggml submodule pine20c3a14for all three, same machine/command):6b3edaa(control)6c57cc3(#1905 prefetch streamed layers, alone)462d675(#1940 unify runner lifecycles and weight residency)The regression is introduced by
462d675— PR #1940 "refactor: unify runner lifecycles and weight residency".Extra detail that may help: with my gcc build the failure is not fully silent — the process aborts with a visible exception:
It happens right after the DiT weights finish streaming to VRAM (last log line
model_loader.cpp:1243 - loading tensors completed, i.e. the same stage as themodel_manager.cpp:428buffer-preparation line in the original report). So the ~9.4 GB of DiT buffers get allocated successfully, then the first compute submit runs out of device memory — consistent with the--offload-to-cpu/--max-vrambehaviors reported earlier. It looks like the weight-residency refactor changed when (or whether) streamed buffers are released before compute on this 16 GB RDNA2 setup.Happy to test any candidate fix build on this machine (AMD RX 6950 XT 16 GB, Windows 11, Vulkan, AMD proprietary driver).
mlsterpr0 commentedon Sep 9, 2026
master-841-6b3edaa seems to be last working vulkan release. After it, Minimax H3 crashes when loading text encoder.
[INFO ] ggml_graph_cut.cpp:952 - qwen3vl build cached graph cut plan done (taking 4 ms)
\stable-diffusion.cpp\ggml\src\ggml-backend.cpp:930: pre-allocated tensor (text_encoders.llm.model.embed_tokens.weight) in a buffer (Vulkan0) that cannot run the operation (NONE)
leejet commentedon Sep 10, 2026
I’m unable to reproduce this issue on my device, so I can’t confirm whether #1958 fixes it. Could you give it a try?
laurentvv commentedon Sep 10, 2026
Tested leejet's candidate fix PR #1958 (
58d3f6e, local MSYS2/UCRT64 build, gcc 16.2,-DGGML_VULKAN=ON, same ggml submodule pine20c3a14as the bisect builds, RX 6950 XT16 GB, Windows 11, AMD proprietary driver).
The hard crash is fixed — error handling now works as designed — but generation still
does not complete on this card. No more
terminate()/vk::Queue::submit: ErrorOutOfDeviceMemoryabort on the plain repro: the failure is caught and propagatedcleanly to the CLI with a precise diagnostic. Same command as the original report
(Flux schnell Q6_K, 512×512, 4 steps, euler,
--vae-tiling,--backend vulkan):Deterministic, not fragmentation: identical failure (same numbers, same segment
30/59) on a freshly rebooted machine with only 0.5/16 GB VRAM in use before launch.
The manager comes up ~47 MB short at
flux.single_blocks.9(need 954.20 MB device,available 906.93 MB) — mid-sampling, i.e. it can no longer evict enough of the
resident DiT weights to prepare the next segment.
--offload-to-cpualso fails, differently: all 18,858 MB of weights go to RAM asexpected (
VRAM 0.00MB, RAM 18858.13MB), loading completes, then the process diesuncaught with exit 127 during compute:
~15.5 GB of VRAM were free at that point, so a pipeline creation failing with
OutOfDeviceMemory looks like a separate backend/allocation issue on this path
(possibly also refactor: unify runner lifecycles and weight residency #1940-related).
Machine available for any follow-up build. (Also confirmed: master-841
6b3edaastillgenerates this exact command fine.)
leejet commentedon Sep 11, 2026
Could you try running the following command and send me the detailed logs so I can investigate the issue?
sd-cli.exe --diffusion-model flux1-schnell-Q6_K.gguf \ --clip_l clip_l.safetensors --t5xxl t5xxl_fp16.safetensors --vae ae.safetensors \ -p "a red apple on a wooden table, photo" \ --steps 4 --cfg-scale 1.0 --sampling-method euler -W 512 -H 512 --seed 42 \ --vae-tiling --backend vulkan --offload-to-cpu --log-level debug -o out.pnglaurentvv commentedon Sep 11, 2026
Ran your exact command on my side — same setup as my earlier reports (AMD RX 6950 XT 16 GB, Windows 11, AMD proprietary driver,
uma: 0), local MSYS2/UCRT64 build of58d3f6e(PR #1958 head, gcc 16.2,-DGGML_VULKAN=ON, ggml pine20c3a14), with--log-level debug.Full debug log (192 lines, raw): gist
Result: same uncaught crash as my 2026-09-10 report — exit 127,
terminateonvk::Device::createComputePipeline: ErrorOutOfDeviceMemory— but the debug level pinpoints where it happens now: the very first T5 segment, right after a 9 GB "staged compute params" copy into VRAM.Key excerpt:
Observations (no interpretation, just what the log shows):
model_manager"staged compute params (9083.77 MB, 219 tensors, 146 blocks) to Vulkan0" — the full T5 weight set gets copied into VRAM anyway (6.05 s copy). CLIP-L does the same (235 MB staged) and runs fine.--offload-to-cpu(plain repro), the fix: guard GPU memory capacity and propagate encoding failures #1958 guard logsmodel manager cannot make enough memory available on Vulkan0…and fails cleanly atflux.single_blocks.9. Here the 9 GB staging to Vulkan0 happens silently and the next pipeline creation OOMs uncaught — the guard doesn't seem to cover the staging step.createComputePipelineforrms_norm_mul_f32already fails withErrorOutOfDeviceMemory. Same deterministic behavior as before (rebooted-machine test on 2026-09-10),max_vram: 0in the params dump.Happy to test any follow-up build on this machine.
📄 Full raw debug log (192 lines — 12 terminal progress-bar redraw lines elided for readability; byte-exact raw version in the gist linked above)
leejet commentedon Sep 11, 2026
Thanks for testing. The log narrows the failure to T5’s first Vulkan graph execution, after its weights have been staged successfully.
I found a cleanup path that can throw a second exception while handling the pipeline creation failure. That explains why the final error mentions Queue::submit and the new error handler does not get a chance to report it.
For the original OOM, I suspect the smaller weight allocations introduced by the refactor may interact with Vulkan’s preference for CPU-visible VRAM. Could you run the same build and command twice from MSYS2 Bash:
Please attach both logs and, if available, the memory heaps/types section from vulkaninfo. This should help distinguish memory placement pressure from a pipeline-specific driver issue.
laurentvv commentedon Sep 11, 2026
Both runs done, same setup as my debug log (RX 6950 XT 16 GB, Windows 11, AMD proprietary
driver, local
58d3f6ebuild, exact same command: Flux schnell Q6_K,--offload-to-cpu --log-level debug).The headline:
GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM=1makes the whole--offload-to-cpupath work. Clean exit 0, correct image (red apple on wooden table, seed 42). Same 9,083.77
MB T5 staging that died at pipeline creation now completes — and everything is faster, not
just working: T5 staging 1.25 s (vs 5.84 s in run 1), conditioning 4.71 s, sampling 11.65 s
(4 steps), VAE decode 1.41 s, image saved.
Run 1 (
GGML_VK_MEMORY_LOGGER=1only) pins the failure exactly where you suspected — T5'sfirst graph execution, after successful staging, and with the double exception you described
(the
terminatereportsQueue::submitwhile the failing call wascreateComputePipeline):Note the sequence: the 68.25 MiB compute buffer allocates fine right after staging, then the
next allocation (pipeline creation) OOMs while the logger reports 9.17 GiB total device —
with roughly 6 GB of the 16 GB card still free.
vulkaninfomemory layout for this card (full section in the gist) matches your CPU-visibleVRAM hypothesis:
DEVICE_LOCAL(+MULTI_INSTANCE) — real VRAMDEVICE_LOCAL|HOST_VISIBLE— the host-visible VRAM windowDEVICE_LOCAL|HOST_VISIBLE|HOST_COHERENT→ heap 2 (256 MiB)So the only host-visible device-local pool this driver exposes is 256 MiB. With host-visible
vidmem enabled, device allocations (staged weights, pipeline resources) interact with that
tiny window and pipeline creation ends up
ErrorOutOfDeviceMemorydespite heap 0 beingmostly free; disabling it forces plain device-local placement and the path both works and
gets measurably faster.
Full logs, raw (single gist, 3 files): https://gist.github.com/laurentvv/6422321845c3466179f20f7ec5c0cf80
run1_memlogger_crash.log—GGML_VK_MEMORY_LOGGER=1(exit 127)run2_nohostvisible_SUCCESS.log—+GGML_VK_DISABLE_HOST_VISIBLE_VIDMEM=1(exit 0, full memory-logger output)vulkaninfo_memory_heaps_types.txt— heaps/types section for this GPUHappy to A/B any candidate (e.g. gating host-visible usage by the heap size, or defaulting it
off when a small host-visible device-local heap is detected).
laurentvv commentedon Sep 11, 2026
Also tested your
--max-vramsuggestion (from #1947) on my #1946 repro — plain path, i.e. no--offload-to-cpuand noGGML_VK_DISABLE_HOST_VISIBLE_VIDMEM, so this maps to the original (non-offload) failure. Same setup as my earlier reports (RX 6950 XT 16 GB, Windows 11, AMD proprietary driver, local58d3f6ebuild = PR #1958 head; Flux schnell Q6_K, 512×512, 4 steps, euler, seed 42,--vae-tiling),--max-vram10/12/14 (GiB).The graph still doesn't complete on this card, but
--max-vramproduces a very clean diagnostic. The budget mechanism itself works: with a cap set, reported free device memory tracks the cap exactly (the underflowed free-VRAM accounting from my original report is bypassed). What fails instead is the budget-side bookkeeping: the manager fills residency up to the cap, then can no longer evict enough to make budget headroom for the next segment's streaming weights.--max-vramflux.single_blocks.9flux.double_blocks.2flux.double_blocks.9flux.double_blocks.17Observations:
So on this card (18,858 MB of weights vs 16 GB VRAM — stream-through is mandatory), no
--max-vramvalue I tried lets the graph complete; the failure just moves. The eviction/budget interplay on the stream-through path looks like the remaining blocker for the plain (non-offload) path — happy to test any candidate that changes it.Full logs (10/12/14 GiB): gist
leejet commentedon Sep 13, 2026
I made an attempt to fix the issue. Please try the latest code from #1958.
Run the following command and check whether the issue has been resolved. If the problem still persists, please send me the detailed debug logs so I can investigate further.
sd-cli.exe --diffusion-model flux1-schnell-Q6_K.gguf \ --clip_l clip_l.safetensors --t5xxl t5xxl_fp16.safetensors --vae ae.safetensors \ -p "a red apple on a wooden table, photo" \ --steps 4 --cfg-scale 1.0 --sampling-method euler -W 512 -H 512 --seed 42 \ --vae-tiling --backend vulkan --offload-to-cpu --log-level debug -o out.pnglaurentvv commentedon Sep 13, 2026
Tested the latest code from PR #1958 (head
1bf76e6, includingda4e841"handle backend cleanup errors and use 256 MiB residency blocks" and5c7fc62"use 1 GiB residency blocks") on the same setup as my previous reports.Setup: RX 6950 XT 16 GB, Windows 11, AMD proprietary driver, local MSYS2/UCRT64 gcc build of PR head
1bf76e6, ggml submodule ate20c3a14(unchanged from my bisect — conditions identical to my earlier tests). Flux schnell Q6_K, 512×512, 4 steps, euler, seed 42,--vae-tiling --backend vulkan.Results — both failure paths from my previous reports now work:
Plain path (no offload, the original [Bug] Vulkan/AMD RX 6950 XT: Flux (split text encoders) silently crashes since master-848-9cdb6b6 — regression vs master-841-6b3edaa (weight preparation OOM) #1946 failure): ✅ fixed. Generation completes (
generate_image completed in 13.14s, exit 0). Previously (58d3f6e) it failed deterministically at segment 30/59 (flux.single_blocks.9), ~47 MB short, and on master ≥848 it silently crashed.--offload-to-cpu(your suggested command, with--log-level debug): ✅ works too. Exit 0, image saved (completed in 17.41s). Previously (58d3f6e) this path died with a silent exit 127 onvk::Device::createComputePipeline: ErrorOutOfDeviceMemorydespite ~15.5 GB free VRAM.Outputs (repro prompt "a photo of a red fox in snow" for #1, your apple command for #2):
Sanity check vs pre-regression baseline: same repro on the installed
6b3edaa(master-841) binary produces a visually identical image — mean per-pixel difference 1.6/255 (small numeric drift expected from the merged master refactors):One extra observation: with ~2-3 GB of VRAM occupied by another process, the old
6b3edaabinary fails atflux prepare(OOM on a 331 MB params buffer) while the PR build had just completed the same run — the new residency manager also seems more robust under VRAM pressure on this 16 GB card.Thanks — the residency block sizing was indeed the missing piece. From my side the regression is resolved; happy to re-test if you change anything else before merging.
leejet commentedon Sep 13, 2026
Thanks for testing. Since all the issues have been fixed, I’ll merge the corresponding PR.