You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature] Prebuilt binaries support of AMD CPUs without FMA3 #1589
Prebuilt binaries should support AMD CPUs without FMA3
Detailed Description
I want to use stable diffusion prebuilt binaries on an AMD FX(tm)-6100, but it fails with Illegal instruction.
After some debugging I found that vfmadd213ss (FMA3 instruction) is used in libstable-diffusion.so, which is not supported by my CPU.
It would be great if you could provide a variant for type of CPU.
I downloaded build master-665 of commit 02f0637 from #1591. Illegal instructions still occurs in ggml_cpu_init due to unsupported FMA3 instruction, so it does not solve this issue
I downloaded build master-665 of commit 02f0637 from #1591 . Illegal instructions still occurs in ggml_cpu_init due to unsupported FMA3 instruction, so it does not solve this issue
As I've explained in that PR, it opened up the possibility of a released binary to support several CPU arches at the same time; a proper fix still needs changes to the Github release configuration.
I've pushed a tentative change to my fork; could you give it a try?
This version runs and does not terminate with illegal instruction any more.
The generated image is not OK however.
I was able to reproduce something like that on my iGPU (3400G):
versus the dGPU (7600 XT):
With SD1.5, both the dGPU and the iGPU work:
except with the iGPU + --vae-conv-direct:
So I suspect this is a separate issue: likely a bug on the Vulkan backend (ggml, or the driver), because it seems to be triggered only by certain device+model+flag combinations.
@klkr1 , could you verify if the garbled image issue still happens on the latest release (master-737-3b6c9ca)? I cannot reproduce it anymore on my iGPU.
@wbruna: with this version for me it is still garbled for SDXL without options:
SD15 on rocm: OK
SD15 on vulkan: OK
SDXL on rocm: now outOfMemory, unless I use --offload-to-cpu, then it is OK
SDXL on vulkan: garbled
SDXL on vulkan --offload-to-cpu: OK
SDXL on vulkan --vae-conv-direct: OK
Edit: I mixed up SD15 on vulkan and SDXL on rocm SD15 is OK in both cases, SDXL on rocm was outOfMemory
Is there anything I can do for debugging?
At least with SDXL, this is a bit more consistent: the issue seems directly related to the total VRAM available. Could you check if --params-backend disk also avoids the issue? (by the way, SDXL Turbo is a distilled model, so the default parameters are a bit too much; try --cfg-scale 1 --steps 4 or so)
It shouldn't really happen with sd-cli, though, because sd-cli drops the diffusion weights from VRAM before running the VAE. But, on my card, I am seeing a VRAM spike on the VAE phase, instead of the expected drop. @leejet , is this expected default behavior for current sd-cli?
The SD1.5 result is very weird: it shouldn't take more memory than SDXL in any case. Could you post a full --debug log?
And @leejet , since the original issue is fixed, please let us know if this should be moved to a separate one.
Thanks! Your Radeon RX 6600 XT has 8GiB VRAM, right? And from the logs the generation hits:
VRAM 6624.11MB
So this really looks like that bug: when VRAM is too tight, Vulkan can produce bad images.
Edit: I mixed up SD15 on vulkan and SDXL on rocm SD15 is OK in both cases, SDXL on rocm was outOfMemory
You are getting close to the VRAM limit, so depending on the options and how much other programs are using, it is expected that i fails in some attempts.
Activity
klkr1 commentedon Jun 3, 2026
I downloaded build master-665 of commit 02f0637 from #1591. Illegal instructions still occurs in ggml_cpu_init due to unsupported FMA3 instruction, so it does not solve this issue
wbruna commentedon Jun 4, 2026
As I've explained in that PR, it opened up the possibility of a released binary to support several CPU arches at the same time; a proper fix still needs changes to the Github release configuration.
I've pushed a tentative change to my fork; could you give it a try?
https://github.com/wbruna/stable-diffusion.cpp/releases/tag/master-674-fd19aaa
It shall pick the appropriate backend for your CPU at the beginning:
klkr1 commentedon Jun 5, 2026
This version runs and does not terminate with illegal instruction any more.
The generated image is not OK however.
Log Output:
wbruna commentedon Jun 7, 2026
I was able to reproduce something like that on my iGPU (3400G):
versus the dGPU (7600 XT):
With SD1.5, both the dGPU and the iGPU work:
except with the iGPU +
--vae-conv-direct:So I suspect this is a separate issue: likely a bug on the Vulkan backend (ggml, or the driver), because it seems to be triggered only by certain device+model+flag combinations.
Could you check if other models work for you?
klkr1 commentedon Jun 8, 2026
I did some checks with both SD15 and SDXL both with rocm 7.13 backend and vulkan backend.
SD15 on rocm: OK
SD15 on vulkan: OK
SDXL on rocm: OK
SDXL on vulkan: garbled
SDXL on vulkan --offload-to-cpu: OK
SDXL on vulkan --vae-conv-direct: OK
Seems indeed to be a problem of model+options
leejet commentedon Jun 28, 2026
This should be resolved now.
wbruna commentedon Jun 29, 2026
@klkr1 , could you verify if the garbled image issue still happens on the latest release (
master-737-3b6c9ca)? I cannot reproduce it anymore on my iGPU.klkr1 commentedon Jul 1, 2026
@wbruna: with this version for me it is still garbled for SDXL without options:
SD15 on rocm: OK
SD15 on vulkan: OK
SDXL on rocm: now outOfMemory, unless I use --offload-to-cpu, then it is OK
SDXL on vulkan: garbled
SDXL on vulkan --offload-to-cpu: OK
SDXL on vulkan --vae-conv-direct: OK
Edit: I mixed up SD15 on vulkan and SDXL on rocm SD15 is OK in both cases, SDXL on rocm was outOfMemory
Is there anything I can do for debugging?
wbruna commentedon Jul 2, 2026
At least with SDXL, this is a bit more consistent: the issue seems directly related to the total VRAM available. Could you check if
--params-backend diskalso avoids the issue? (by the way, SDXL Turbo is a distilled model, so the default parameters are a bit too much; try--cfg-scale 1 --steps 4or so)It shouldn't really happen with sd-cli, though, because sd-cli drops the diffusion weights from VRAM before running the VAE. But, on my card, I am seeing a VRAM spike on the VAE phase, instead of the expected drop. @leejet , is this expected default behavior for current sd-cli?
The SD1.5 result is very weird: it shouldn't take more memory than SDXL in any case. Could you post a full --debug log?
And @leejet , since the original issue is fixed, please let us know if this should be moved to a separate one.
leejet commentedon Jul 8, 2026
Currently, unless
--params-backendis set todisk, the weights of unused components will not be automatically released.klkr1 commentedon Jul 8, 2026
@wbruna: --params-backend disk also solves the issue with vulkan and SDXL.
Here is the output of SDXL on vulkan without additional options:
vulkan.log
wbruna commentedon Jul 9, 2026
Thanks! Your Radeon RX 6600 XT has 8GiB VRAM, right? And from the logs the generation hits:
So this really looks like that bug: when VRAM is too tight, Vulkan can produce bad images.
You are getting close to the VRAM limit, so depending on the options and how much other programs are using, it is expected that i fails in some attempts.
I was able to reproduce it, and posted a test on the llama.cpp issue: ggml-org/llama.cpp#24943