Skip to content

SD3.5 Large and Large Turbo: conditioning graph broken with --clip-on-cpu (t5 compute buffer size stays at 11.94 MB, output is pure noise) #1578

Open

Description

@cupa9491-dev

System:

  • CPU: AMD Ryzen 5 5600G (AVX2)
  • GPU: AMD Radeon Vega 7 iGPU (8 GB UMA VRAM)
  • RAM: 32 GB
  • OS: Windows
  • sd.cpp version: commit 0e4ee04, Vulkan binary

Models tested:

  • sd3.5_large.safetensors (official, SHA256: ffef7a279d9134626e6ce0d494fba84fc1c7e720b3c7df2d19a09dc3796d8f93)
  • sd3.5_large_turbo.safetensors (official)

Command:

sd-cli.exe -m sd3.5_large.safetensors --clip_l clip_l.safetensors --clip_g clip_g.safetensors --t5xxl t5xxl_fp8_e4m3fn.safetensors --clip-on-cpu --vae-on-cpu --offload-to-cpu --diffusion-fa --cfg-scale 4.5 --sampling-method euler --steps 8 -W 768 -H 768 -o output.png -v

Problem:
With --clip-on-cpu, the conditioning compute buffers are abnormally small:

clip compute buffer size: 1.42 MB(RAM)
identity projection
t5 compute buffer size: 11.94 MB(RAM)

Normal values should be hundreds of MB. The result is pure noise regardless of prompt, steps, or CFG scale.

Without --clip-on-cpu (no offload flags), the params buffers load correctly:

clip params backend buffer size = 235.06 MB(VRAM)
clip params backend buffer size = 1329.29 MB(VRAM)
t5 params backend buffer size = 9083.77 MB(VRAM)

But then VRAM OOM occurs during diffusion model loading (15 GB required, 8 GB available).

SD3.5 Medium works correctly using GGUF from calcuis/sd3.5-medium-gguf with the same encoder files and same flags.

Expected behavior: --clip-on-cpu should allow running SD3.5 Large on systems with limited VRAM by keeping encoders in RAM while using GPU for diffusion steps.

Activity

  1. wbruna commented on May 29, 2026

    @wbruna
    Contributor

    sd3.5_large.safetensors (official, SHA256: ffef7a279d9134626e6ce0d494fba84fc1c7e720b3c7df2d19a09dc3796d8f93)

    This one? https://huggingface.co/second-state/stable-diffusion-3.5-large-GGUF/blob/main/sd3.5_large.safetensors

    It's a 16.5G model file. It would fail to load on most 8G GPUs, except Vulkan can spill it to system-shared VRAM. The problem is, on many systems Vulkan can cause issues when free VRAM is too low.

    I'd suggest trying a smaller quant: https://huggingface.co/second-state/stable-diffusion-3.5-large-GGUF/tree/main , or create one from the original with e.g. sd-cli.exe -M convert -m sd3.5_large.safetensors --type q5_1 -o sd3.5_large-Q5_1.gguf. Converting the T5 model may be useful too (fp8 tensors double in size when loaded).

    Another option could be limiting VRAM usage with --offload-to-cpu --max-vram -0.5.

    I'd also suggest running with either --clip-on-cpu --vae-on-cpu or --offload-to-cpu. If only the diffusion model is on the GPU, --offload-to-cpu will increase RAM usage for no benefit.

  2. cupa9491-dev commented on May 30, 2026

    @cupa9491-dev
    Author

    All of this was done, including creating models from the original and using flags.

  3. wbruna commented on May 30, 2026

    @wbruna
    Contributor

    All of this was done, including creating models from the original and using flags.

    Look, we can try to guess what's happening on your system, but it'd be far more efficient if you gave us more information. I'd suggest running the smallest quant you can get with --verbose, and posting the output, so we can see how much memory it is trying to allocate. A verbose log from the successful calcuis/sd3.5-medium-gguf command would be useful, too.

  4. cupa9491-dev commented on May 31, 2026

    @cupa9491-dev
    Author

    log_large.txt
    log_medium.txt
    SD3.5 Medium GGUF produces correct images with the same t5 compute buffer size: 11.94 MB and identity projection. SD3.5 Large GGUF produces pure noise. The difference is only in the diffusion model file.

  5. wbruna commented on May 31, 2026

    @wbruna
    Contributor

    Thanks. These are parts of the diff between the log files you've provided ('-' is medium, '+' is large):

    Details
     [DEBUG] stable-diffusion.cpp:375  - Version: SD3.x 
    -[INFO ] stable-diffusion.cpp:403  - Weight type stat:                      f16: 1578 |    q5_0: 263  
    +[INFO ] stable-diffusion.cpp:403  - Weight type stat:                      f32: 192  |     f16: 1570 |    q4_0: 581  
     [INFO ] stable-diffusion.cpp:404  - Conditioner weight type stat:          f16: 932  
    -[INFO ] stable-diffusion.cpp:405  - Diffusion model weight type stat:      f16: 402  |    q5_0: 263  
    -[INFO ] stable-diffusion.cpp:406  - VAE weight type stat:                  f16: 244  
    +[INFO ] stable-diffusion.cpp:405  - Diffusion model weight type stat:      f32: 192  |     f16: 394  |    q4_0: 581  
    +[INFO ] stable-diffusion.cpp:406  - VAE weight type stat:                  f32: 192  |     f16: 244  |    q4_0: 52   
     [INFO ] stable-diffusion.cpp:408  - ggml tensor size = 400 bytes
    -[DEBUG] ggml_extend_backend.cpp:291  - Initializing backend: CPU
     [DEBUG] clip_tokenizer.cpp:65   - vocab size: 49408
     [DEBUG] clip_tokenizer.cpp:65   - vocab size: 49408
    -[DEBUG] mmdit.hpp:680  - MMDiT layers: 24 (including 13 MMDiT-x layers)
    +[DEBUG] mmdit.hpp:680  - MMDiT layers: 38 (including 0 MMDiT-x layers)
     [INFO ] stable-diffusion.cpp:797  - using VAE for encoding / decoding
     [INFO ] auto_encoder_kl.hpp:525  - vae decoder: ch = 128
     [INFO ] stable-diffusion.cpp:899  - Using flash attention in the diffusion model
     [INFO ] stable-diffusion.cpp:928  - loading weights
     [DEBUG] ggml_extend.hpp:2711 - clip params backend buffer size =  235.06 MB(RAM) (196 tensors)
     [DEBUG] ggml_extend.hpp:2711 - clip params backend buffer size =  1329.29 MB(RAM) (517 tensors)
     [DEBUG] ggml_extend.hpp:2711 - t5 params backend buffer size =  9083.77 MB(RAM) (219 tensors)
    -[DEBUG] ggml_extend.hpp:2711 - mmdit params backend buffer size =  2390.99 MB(VRAM) (665 tensors)
    +[DEBUG] ggml_extend.hpp:2711 - mmdit params backend buffer size =  4779.76 MB(RAM) (923 tensors)
     [DEBUG] ggml_extend.hpp:2711 - vae params backend buffer size =  94.57 MB(RAM) (138 tensors)
    -[DEBUG] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\sd3.5_medium-q5_0.gguf' (mmap disabled by caller)
    +[DEBUG] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\sd3.5_large-Q4_0.gguf' (mmap disabled by caller)
     [INFO ] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\clip_l.safetensors' (mmap disabled by caller)
     [INFO ] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\clip_g.safetensors' (mmap disabled by caller)
     [INFO ] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\t5xxl_fp8_e4m3fn.safetensors' (mmap disabled by caller)
     [INFO ] model.cpp:811  - NOT using mmap for 'C:\sd-cpp\models\sd3\diffusion_pytorch_model.safetensors' (mmap disabled by caller)
     [INFO ] model.cpp:822  - model files processing completed in 0.00s
     [INFO ] model.cpp:926  - using 6 threads for model loading
    Details
     [INFO ] stable-diffusion.cpp:1030 - finished loaded file
    -[DEBUG] stable-diffusion.cpp:1112 - total params memory size = 13133.69MB (VRAM 2390.99MB, RAM 10742.70MB): text_encoders 10648.12MB(RAM), diffusion_model 2390.99MB(VRAM), vae 94.57MB(RAM),
     controlnet 0.00MB(N/A), pmid 0.00MB(N/A)
    +[DEBUG] stable-diffusion.cpp:1112 - total params memory size = 15522.46MB (VRAM 0.00MB, RAM 15522.46MB): text_encoders 10648.12MB(RAM), diffusion_model 4779.76MB(RAM), vae 94.57MB(RAM), con
    trolnet 0.00MB(N/A), pmid 0.00MB(N/A)
     [INFO ] stable-diffusion.cpp:1196 - running in FLOW mode
     [INFO ] stable-diffusion.cpp:4270 - generate_image 1024x1024
     [INFO ] denoiser.hpp:581  - get_sigmas with discrete scheduler
     [INFO ] stable-diffusion.cpp:3358 - sampling using Euler method
     [INFO ] conditioner.hpp:883  - parse 'a lovely cat' to [['a lovely cat', 1], ]
     [DEBUG] bpe_tokenizer.cpp:206  - split prompt "a lovely cat" to tokens ["a</w>", "lovely</w>", "cat</w>", ]
     [DEBUG] bpe_tokenizer.cpp:206  - split prompt "a lovely cat" to tokens ["a</w>", "lovely</w>", "cat</w>", ]
     [DEBUG] t5_unigram_tokenizer.cpp:336  - split prompt "a lovely cat" to tokens ["▁", "a", "▁lovely", "▁cat", ]
     [DEBUG] ggml_extend.hpp:1930 - clip compute buffer size: 1.42 MB(RAM)
     [DEBUG] clip.hpp:323  - identity projection
     [DEBUG] ggml_extend.hpp:1930 - clip compute buffer size: 1.42 MB(RAM)
     [DEBUG] ggml_extend.hpp:1930 - clip compute buffer size: 2.36 MB(RAM)
     [DEBUG] ggml_extend.hpp:1930 - clip compute buffer size: 2.36 MB(RAM)
     [DEBUG] ggml_extend.hpp:1930 - t5 compute buffer size: 11.94 MB(RAM)
    -[DEBUG] conditioner.hpp:1086 - computing condition graph completed, taking 3654 ms
    -[DEBUG] stable-diffusion.cpp:4024 - get_learned_condition completed, taking 3.65s
    +[DEBUG] conditioner.hpp:1086 - computing condition graph completed, taking 3722 ms
    +[DEBUG] stable-diffusion.cpp:4024 - get_learned_condition completed, taking 3.72s
     [INFO ] stable-diffusion.cpp:4304 - generating image: 1/1 - seed 42

    You have mentioned

    SD3.5 Medium GGUF produces correct images with the same t5 compute buffer size: 11.94 MB and identity projection.

    but apart from memory sizes and timings (which are naturally different), the clip and t5 compute buffer sizes and the 'identity projection' being mentioned are identical, so I don't think T5 itself has anything to do with this issue.

    On the other hand, I see lots of these:

    +[DEBUG] model.cpp:1193 - unknown tensor 'model.diffusion_model.(...)

    model.diffusion_model. usually is a tensor prefix on "complete" model files, that should be loaded with -m/--model instead of --diffusion-model. Your initial command did that:

    sd-cli.exe -m sd3.5_large.safetensors

    but it looks like this test was made with --diffusion-model instead:

     [DEBUG] main.cpp:600  - SDContextParams {
       n_threads: 6,
       model_path: "",
       clip_l_path: "C:\sd-cpp\models\sd3\clip_l.safetensors",
       clip_g_path: "C:\sd-cpp\models\sd3\clip_g.safetensors",
       clip_vision_path: "",
       t5xxl_path: "C:\sd-cpp\models\sd3\t5xxl_fp8_e4m3fn.safetensors",
       llm_path: "",
       llm_vision_path: "",
    -  diffusion_model_path: "C:\sd-cpp\models\sd3\sd3.5_medium-q5_0.gguf",
    +  diffusion_model_path: "C:\sd-cpp\models\sd3\sd3.5_large-Q4_0.gguf",
       high_noise_diffusion_model_path: "",
       embeddings_connectors_path: "",
       vae_path: "C:\sd-cpp\models\sd3\diffusion_pytorch_model.safetensors",

    Could you try again with -m, and post the log? It would also be helpful if you used --offload-to-cpu and --clip-on-cpu --vae-on-cpu consistently, to minimize the difference between the logs.

  6. cupa9491-dev commented on Jun 1, 2026

    @cupa9491-dev
    Author
    Image

    log_large_m.txt

    Thank you for the clarification. I ran the test with -m flag as requested, with --offload-to-cpu, --clip-on-cpu and --vae-on-cpu. The log is attached. The output is still pure noise (image attached).
    Key observations from the log:

    model_path is correctly set, diffusion_model_path is empty
    VAE is included in the GGUF: VAE weight type stat: f32: 192 | q4_0: 52
    All weights are in RAM: mmdit params backend buffer size = 4779.76 MB(RAM)
    t5 compute buffer size: 11.94 MB remains the same as with SD3.5 Medium
    Generation completes successfully but produces noise

    SD3.5 Medium GGUF with identical flags produces correct images.

  7. added a commit that references this issue on Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions