Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
687a81f
chore: make libwebp optional and support system libwebp (#1387)
wbruna Apr 5, 2026
9369ab7
feat: inpaint improvements (#1357)
stduhpf Apr 5, 2026
7397dda
feat: add webm support (#1391)
leejet Apr 5, 2026
359eb8b
refactor: apply RAII ownership to examples (#1392)
leejet Apr 6, 2026
5bf438d
refactor: split examples common into header and source (#1393)
leejet Apr 6, 2026
8afbeb6
chore: normalize text files to utf-8 without bom (#1394)
leejet Apr 6, 2026
dd75372
fix: correct double increment on flow denoisers sigma calculations (#…
wbruna Apr 8, 2026
e8323ca
feat: add flux2 small decoder support (#1402)
leejet Apr 8, 2026
be9f51b
refactor: simplify DiscreteFlowDenoiser (#1405)
wbruna Apr 11, 2026
118489e
chore: harden safetensors and gguf loading code (#1404)
wbruna Apr 11, 2026
7ade90e
feat: add sdcpp api support (#1407)
leejet Apr 11, 2026
fd35047
feat: use sdcpp-webui as embedded webui (#1408)
leejet Apr 11, 2026
12a369c
docs: update readme
leejet Apr 11, 2026
6b675a5
docs: update readme
leejet Apr 11, 2026
ee5bf95
chore: allow building the embedded UI header separately (#1415)
wbruna Apr 15, 2026
9ac7b67
refactor: introduce shared tokenizer abstraction and split implementa…
leejet Apr 15, 2026
c41c5de
feat: add left padding support to tokenizers (#1424)
leejet Apr 15, 2026
5c243db
feat: add ernie image support (#1427)
leejet Apr 16, 2026
d73b419
feat: SDXS-09 support and update doc (#1356)
akleine Apr 16, 2026
1b4e9be
feat: add er_sde sampler (#1403)
rmatif Apr 16, 2026
84fc544
fix: skip empty prompt segments around attention range (#1429)
leejet Apr 16, 2026
a564fdf
refactor: remove is_xl guard wrapper in get_sd_version (#1430)
leejet Apr 16, 2026
2bcff67
fix: correct dpm++2s_a second model call (#1435)
wbruna Apr 18, 2026
6a9cb31
fix: tune ernie-image default flow shift (#1433)
Green-Sky Apr 18, 2026
f3f69e2
feat: add DPM++ (2S) Ancestral implementation for flow models (#1428)
wbruna Apr 18, 2026
4d626d2
feat(server): implement vid_gen async API and mode-aware capabilities…
leejet Apr 18, 2026
3c99f70
ci: skip docker image build job on pull requests (#1439)
leejet Apr 18, 2026
7d33d4b
chore: enable MSVC parallel compilation with /MP (#1438)
leejet Apr 18, 2026
e77e4c4
feat: adapt LCM for flow models (#1413)
wbruna Apr 19, 2026
7023fc4
fix: correct image to image DDIM and TCD (#1410)
wbruna Apr 19, 2026
6614334
refactor: move model file IO into dedicated module (#1442)
leejet Apr 19, 2026
0a7ae07
feat: add restricted torch legacy checkpoint loading (#1443)
leejet Apr 19, 2026
44cca3d
feat: support safetensors export in convert mode (#1444)
leejet Apr 19, 2026
c97702e
feat: add sd-webui style Hires. fix support (#1451)
leejet Apr 22, 2026
b8bdffc
feat: add more built-in highres upscalers (#1456)
leejet Apr 23, 2026
970c4a3
chore: replace some NULL with nullptr + use "%zu" for printing some s…
akleine Apr 27, 2026
f40a707
feat: add sdcpp-specific generation metadata to image outputs (#1462)
leejet Apr 27, 2026
a81677f
docs: performance tips markup (#1460)
dwgrth Apr 27, 2026
331cfa5
fix: release VAE compute buffer after tiled encoding (#1465)
wbruna Apr 29, 2026
b8079e2
feat: transition from compile-time to runtime backend discovery (#1448)
wbruna Apr 29, 2026
3d6064b
perf: speed up tensor_to_sd_image conversion (#1466)
leejet Apr 29, 2026
9097ce5
fix: skip empty MultiLoraAdapter when no LoRAs target a model (#1469)
fszontagh May 6, 2026
586b6f1
feat: adapt res samplers for flow models for eta > 0 (#1436)
wbruna May 6, 2026
90e87bc
feat: add max-vram based segmented param offload (#1476)
leejet May 6, 2026
6ee0684
feat: display server url with "http://" prefix. (#1486)
cphlipot May 14, 2026
60477fd
docs: add new go bindings for stable-diffusion.cpp (#1480)
l8bloom May 14, 2026
9d68341
feat: add Euler CFG++ and Euler-A CFG++ samplers (#1354)
daniandtheweb May 14, 2026
57ff2eb
feat: support for memory-mapping model weights (#1414)
wbruna May 14, 2026
eeac950
fix: Use PkgConfig for WebP and WebM (#1400)
candrews May 14, 2026
0665a7f
feat: add hidream o1 image support (#1485)
leejet May 14, 2026
381e0df
docs: add CONTRIBUTING.md
leejet May 14, 2026
0b82969
docs: add .github/pull_request_template.md
leejet May 14, 2026
686856e
chore: do not report the fake VAE "allocation" as an error (#1494)
wbruna May 16, 2026
db08b84
fix: Fix broken GCC 16 build (enforce C11/C++17 compile ) (#1478)
cphlipot May 16, 2026
fd1a279
refactor: unify Euler, Euler Ancestral and DDIM implementations (#1474)
wbruna May 16, 2026
38b14ad
feat: auto-detect max VRAM budget with --max-vram -1 (#1498)
leejet May 16, 2026
839f6a9
ci: switch over ROCm builds to artifacts both for stable and preview …
superm1 May 16, 2026
0c1ca17
ci: update ROCm Windows builds (#1282)
superm1 May 16, 2026
3633072
feat: add module backend assignment support (#1500)
leejet May 16, 2026
d7ecbe1
fix: avoid repeated T5 EOS tokens in Anima prompt weights (#1501)
leejet May 16, 2026
bd17f53
docs: update zit example to 8 steps (#1294)
kwsp May 16, 2026
3b4d26f
ci: update ROCm builds for Windows and Linux to use ROCm 7.13 (#1504)
superm1 May 17, 2026
67dda3f
feat: add ltx2.3 support (#1463)
leejet May 17, 2026
cde20d5
fix: handle stereo format in sd_audio (#1489)
stduhpf May 17, 2026
06accf2
feat: add ltxav latent2rgb projection matrix (#1502)
stduhpf May 17, 2026
e43b24c
feat: add ltx2.3 flf2v support (#1505)
leejet May 17, 2026
50134e5
refactor: split guidance composition (#1506)
leejet May 17, 2026
e7eb92f
feat: add Gradient Estimation sampler (#1484)
wbruna May 17, 2026
baf7eda
refactor: minify vocab files (#1509)
leejet May 17, 2026
82e03ef
ci: add inactive pr clean up workflow
leejet May 17, 2026
8308042
docs: update news
leejet May 17, 2026
21fd4e6
ci: add CUDA Docker image support for NVIDIA Spark GB10 (#1512)
ich777 May 18, 2026
f683c88
feat: make negative max_vram control the amount of spare vram (#1503)
wbruna May 18, 2026
b758b7d
fix: only enable TAE after successful load (#1517)
leejet May 18, 2026
b706d68
fix: restore singleton dims for LLM outputs (#1518)
leejet May 18, 2026
22c8c40
sync: update ggml (#1520)
leejet May 18, 2026
caa823a
ci: add RDNA1 + RDNA2 targets for ROCm 7.13 (#1511)
sofiageo May 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
## Summary

<!-- Describe what changed and why. Keep the PR focused on one clear change. -->

## Related Issue / Discussion

<!-- Link related issues, discussions, or previous PRs if applicable. -->

## Additional Information

<!-- Add verification notes, screenshots, sample output, or other context when applicable. -->

## Checklist

- [ ] I have read and confirmed this PR follows the [contribution guidelines](https://github.com/leejet/stable-diffusion.cpp/blob/master/CONTRIBUTING.md).
253 changes: 175 additions & 78 deletions .github/workflows/build.yml

Large diffs are not rendered by default.

55 changes: 55 additions & 0 deletions .github/workflows/stale-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Close inactive PRs

on:
schedule:
# Run daily. GitHub cron schedules use UTC.
- cron: "30 1 * * *"
workflow_dispatch:
inputs:
debug_only:
description: "Dry run: log intended actions without changing PRs"
required: false
default: false
type: boolean

permissions:
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
stale-prs:
runs-on: ubuntu-latest
steps:
- name: Mark and close inactive PRs
uses: actions/stale@v10
with:
days-before-issue-stale: -1
days-before-issue-close: -1

days-before-pr-stale: 365
days-before-pr-close: 7

stale-pr-label: pr:inactive
close-pr-label: pr:auto-closed
exempt-pr-labels: pr:keep-open

stale-pr-message: >
This PR has been inactive for 365 days. If there is no new activity
within 7 days, it will be closed automatically. Comment, push new
commits, or remove the pr:inactive label to keep it open. Add
pr:keep-open to exempt it from future inactive PR cleanup.

close-pr-message: >
Closing this PR because it has had no activity for 7 days after
being marked inactive. If this is still useful or ready to move
forward, feel free to reopen it with fresh context or updated
details. Sorry for any inconvenience.

remove-pr-stale-when-updated: true
delete-branch: false
operations-per-run: 100
debug-only: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_only || false }}
7 changes: 5 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
[submodule "ggml"]
path = ggml
url = https://github.com/ggml-org/ggml.git
url = https://github.com/leejet/ggml.git
[submodule "examples/server/frontend"]
path = examples/server/frontend
url = https://github.com/leejet/stable-ui.git
url = https://github.com/leejet/sdcpp-webui.git
[submodule "thirdparty/libwebp"]
path = thirdparty/libwebp
url = https://github.com/webmproject/libwebp.git
[submodule "thirdparty/libwebm"]
path = thirdparty/libwebm
url = https://github.com/webmproject/libwebm.git
120 changes: 107 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ endif()
if (MSVC)
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
add_compile_options(
$<$<COMPILE_LANGUAGE:C>:/MP>
$<$<COMPILE_LANGUAGE:C>:/utf-8>
$<$<COMPILE_LANGUAGE:CXX>:/MP>
$<$<COMPILE_LANGUAGE:CXX>:/utf-8>
)
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
Expand All @@ -22,14 +28,37 @@ else()
set(SD_STANDALONE OFF)
endif()

set(SD_SUBMODULE_WEBP FALSE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebp/CMakeLists.txt")
set(SD_SUBMODULE_WEBP TRUE)
endif()
if(SD_SUBMODULE_WEBP)
set(SD_WEBP_DEFAULT ON)
else()
set(SD_WEBP_DEFAULT ${SD_USE_SYSTEM_WEBP})
endif()

set(SD_SUBMODULE_WEBM FALSE)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/libwebm/CMakeLists.txt")
set(SD_SUBMODULE_WEBM TRUE)
endif()
if(SD_SUBMODULE_WEBM)
set(SD_WEBM_DEFAULT ON)
else()
set(SD_WEBM_DEFAULT ${SD_USE_SYSTEM_WEBM})
endif()

#
# Option list
#

# general
#option(SD_BUILD_TESTS "sd: build tests" ${SD_STANDALONE})
option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
option(SD_WEBP "sd: enable WebP image I/O support" ON)
option(SD_WEBP "sd: enable WebP image I/O support" ${SD_WEBP_DEFAULT})
option(SD_USE_SYSTEM_WEBP "sd: link against system libwebp" OFF)
option(SD_WEBM "sd: enable WebM video output support" ${SD_WEBM_DEFAULT})
option(SD_USE_SYSTEM_WEBM "sd: link against system libwebm" OFF)
option(SD_CUDA "sd: cuda backend" OFF)
option(SD_HIPBLAS "sd: rocm backend" OFF)
option(SD_METAL "sd: metal backend" OFF)
Expand All @@ -42,54 +71,120 @@ option(SD_BUILD_SHARED_GGML_LIB "sd: build ggml as a separate shared lib" O
option(SD_USE_SYSTEM_GGML "sd: use system-installed GGML library" OFF)
#option(SD_BUILD_SERVER "sd: build server example" ON)

set(CMAKE_C_STANDARD 11)
set(CMAKE_C_STANDARD_REQUIRED true)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)

if(SD_CUDA)
message("-- Use CUDA as backend stable-diffusion")
set(GGML_CUDA ON)
add_definitions(-DSD_USE_CUDA)
endif()

if(SD_METAL)
message("-- Use Metal as backend stable-diffusion")
set(GGML_METAL ON)
add_definitions(-DSD_USE_METAL)
endif()

if (SD_VULKAN)
message("-- Use Vulkan as backend stable-diffusion")
set(GGML_VULKAN ON)
add_definitions(-DSD_USE_VULKAN)
endif ()

if (SD_OPENCL)
message("-- Use OpenCL as backend stable-diffusion")
set(GGML_OPENCL ON)
add_definitions(-DSD_USE_OPENCL)
endif ()

if (SD_HIPBLAS)
message("-- Use HIPBLAS as backend stable-diffusion")
set(GGML_HIP ON)
add_definitions(-DSD_USE_CUDA)
endif ()

if(SD_MUSA)
message("-- Use MUSA as backend stable-diffusion")
set(GGML_MUSA ON)
add_definitions(-DSD_USE_CUDA)
endif()

if(SD_WEBP)
add_compile_definitions(SD_USE_WEBP)
if(NOT SD_SUBMODULE_WEBP AND NOT SD_USE_SYSTEM_WEBP)
message(FATAL_ERROR "WebP support enabled but no source found.
Either initialize the submodule:\n git submodule update --init thirdparty/libwebp\n\n"
"Or link against system library:\n cmake (...) -DSD_USE_SYSTEM_WEBP=ON")
endif()
if(SD_USE_SYSTEM_WEBP)
find_package(WebP)
if(WebP_FOUND)
add_library(webp ALIAS WebP::webp)
# libwebp CMake target naming is not consistent across versions/distros.
# Some export WebP::libwebpmux, others export WebP::webpmux.
if(TARGET WebP::libwebpmux)
add_library(libwebpmux ALIAS WebP::libwebpmux)
elseif(TARGET WebP::webpmux)
add_library(libwebpmux ALIAS WebP::webpmux)
else()
message(FATAL_ERROR
"Could not find a compatible webpmux target in system WebP package. "
"Expected WebP::libwebpmux or WebP::webpmux."
)
endif()
else()
find_package(PkgConfig REQUIRED)
pkg_check_modules(WebP REQUIRED IMPORTED_TARGET GLOBAL libwebp)
pkg_check_modules(WebPMux REQUIRED IMPORTED_TARGET GLOBAL libwebpmux)
link_libraries(PkgConfig::WebP)
link_libraries(PkgConfig::WebPMux)
add_library(libwebpmux ALIAS PkgConfig::WebPMux)
endif()
endif()
endif()

if(SD_WEBM)
if(NOT SD_WEBP)
message(FATAL_ERROR "SD_WEBM requires SD_WEBP because WebM output reuses libwebp VP8 encoding.")
endif()
if(NOT SD_SUBMODULE_WEBM AND NOT SD_USE_SYSTEM_WEBM)
message(FATAL_ERROR "WebM support enabled but no source found.
Either initialize the submodule:\n git submodule update --init thirdparty/libwebm\n\n"
"Or link against system library:\n cmake (...) -DSD_USE_SYSTEM_WEBM=ON")
endif()
if(SD_USE_SYSTEM_WEBM)
find_package(PkgConfig)
if(PkgConfig_FOUND)
pkg_check_modules(WebM REQUIRED IMPORTED_TARGET GLOBAL libwebm)
endif()
if(PkgConfig_FOUND AND WebM_FOUND)
link_libraries(PkgConfig::WebM)
else()
find_path(WEBM_INCLUDE_DIR
NAMES mkvmuxer/mkvmuxer.h mkvparser/mkvparser.h common/webmids.h
PATH_SUFFIXES webm
REQUIRED)
find_library(WEBM_LIBRARY
NAMES webm libwebm
REQUIRED)

add_library(webm UNKNOWN IMPORTED)
set_target_properties(webm PROPERTIES
IMPORTED_LOCATION "${WEBM_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${WEBM_INCLUDE_DIR}")
endif()
endif()
endif()

set(SD_LIB stable-diffusion)

file(GLOB SD_LIB_SOURCES
file(GLOB SD_LIB_SOURCES CONFIGURE_DEPENDS
"src/*.h"
"src/*.cpp"
"src/*.hpp"
"src/vocab/*.h"
"src/vocab/*.cpp"
"src/model_io/*.h"
"src/model_io/*.cpp"
"src/tokenizers/*.h"
"src/tokenizers/*.cpp"
"src/tokenizers/vocab/*.h"
"src/tokenizers/vocab/*.cpp"
)

find_program(GIT_EXE NAMES git git.exe NO_CMAKE_FIND_ROOT_PATH)
Expand Down Expand Up @@ -146,7 +241,6 @@ if(SD_SYCL)
message("-- Use SYCL as backend stable-diffusion")
set(GGML_SYCL ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing -fsycl")
add_definitions(-DSD_USE_SYCL)
# disable fast-math on host, see:
# https://www.intel.com/content/www/us/en/docs/cpp-compiler/developer-guide-reference/2021-10/fp-model-fp.html
if (WIN32)
Expand Down Expand Up @@ -182,7 +276,7 @@ endif()
add_subdirectory(thirdparty)

target_link_libraries(${SD_LIB} PUBLIC ggml zip)
target_include_directories(${SD_LIB} PUBLIC . include)
target_include_directories(${SD_LIB} PUBLIC . src include)
target_include_directories(${SD_LIB} PUBLIC . thirdparty)
target_compile_features(${SD_LIB} PUBLIC c_std_11 cxx_std_17)

Expand Down
65 changes: 65 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Contributing

This document collects general contribution conventions for this repository.

## Before You Start

Before opening a PR, please search existing PRs to avoid duplicating ongoing work.

For large-scale refactors or changes with broad impact, please open an issue first to discuss the approach before submitting a PR.

If you want to update a third-party dependency, please open an issue first instead of submitting a direct PR. See [Dependency Updates](#dependency-updates) for details.

## Pull Requests

Keep each PR focused on one clear change. Large or overly complex PRs are harder to review and may not be merged.

Follow Conventional Commit-style subjects seen in history: `feat:`, `fix:`, `refactor:`, `ci:`, `docs:`, `chore:`. Keep subjects imperative and scoped.

PRs should include:

- What changed and why (short problem/solution summary).
- Verification evidence when applicable (commands and key outputs).
- Linked issue/PR context when applicable.
- Screenshots or sample outputs for UI/visual behavior changes.

## Code Style

Format code according to the repository style before submitting changes.

Formatting follows `.clang-format` (Chromium base, 4-space indent, no tabs). Run `format-code.sh` before opening a PR. Keep C++ standard at C++17-compatible patterns used in this repo.

Naming conventions:

- Use `PascalCase` for class/struct/type names.
- In `PascalCase` names, preserve common abbreviations in uppercase, for example `SD`, `API`, `HTTP`, `JSON`, `RGB`, `VAE`, `TAE`, `LoRA`, and `WebP`.
- Use `snake_case` for functions, methods, variables, and file names unless an existing API requires a different style.
- Use a trailing underscore for private data member names, for example `hidden_size_` or `tokenizer_`.
- Use `.h` for C and C++ header files. Do not introduce new `.hpp` headers.
- Use macro-based header include guards instead of `#pragma once`.
- Format header include guards as `__SD_{PATH}__`, where `{PATH}` is the header path in uppercase snake case without the file extension. For example, `src/sample.h` should use `__SD_SAMPLE_H__`.
- Do not introduce anonymous namespaces in new or modified code; prefer `static` file-local functions/variables or an explicit named namespace when scoping is needed.
- In `class`/`struct` definitions, place data members before member functions unless an existing type already clearly follows a different pattern.
- Keep `test_*.cpp` / `test_*.py` naming for tests.

Some older code in the project may not fully follow the current conventions. Please do not submit PRs that only rewrite existing code to match style rules.

## AI-Assisted Contributions

AI tools may be used to assist development, but contributors are responsible for the quality and correctness of the submitted code.

If any part of a contribution was generated with AI assistance, the contributor must perform a thorough human review before submitting the PR and understand every changed line.

Do not list AI tools as co-authors. The human contributor is the sole responsible author of the submitted code.

Please do not submit AI-generated code that you do not understand, and do not include meaningless experiments, temporary test code, or unrelated generated output in a PR.

## Dependency Updates

Do not submit PRs that update `ggml`. `ggml` updates are performed only after local validation by the maintainer.

Other third-party dependencies are not updated unless necessary. If you want to update a dependency, please open an issue first instead of submitting a direct PR.

## Security & Configuration

Do not commit model weights, secrets, or local absolute paths. Keep large binaries out of git unless intentionally tracked release assets.
8 changes: 7 additions & 1 deletion Dockerfile.cuda
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ WORKDIR /sd.cpp
COPY . .

ARG CUDACXX=/usr/local/cuda/bin/nvcc
RUN cmake . -B ./build -DSD_CUDA=ON
ARG CUDA_ARCHITECTURES=""
ARG GGML_CUDA_FA_ALL_QUANTS=""

RUN cmake . -B ./build \
-DSD_CUDA=ON \
${CUDA_ARCHITECTURES:+-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHITECTURES}"} \
${GGML_CUDA_FA_ALL_QUANTS:+-DGGML_CUDA_FA_ALL_QUANTS=${GGML_CUDA_FA_ALL_QUANTS}}
RUN cmake --build ./build --config Release -j$(nproc)

FROM nvidia/cuda:${CUDA_VERSION}-cudnn-runtime-ubuntu${UBUNTU_VERSION} AS runtime
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.vulkan
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG UBUNTU_VERSION=24.04

FROM ubuntu:$UBUNTU_VERSION AS build

RUN apt-get update && apt-get install -y --no-install-recommends build-essential git cmake libvulkan-dev glslc
RUN apt-get update && apt-get install -y --no-install-recommends build-essential git cmake libvulkan-dev glslc spirv-headers

WORKDIR /sd.cpp

Expand Down
Loading