Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
9860a92
docs: add Off Grid AI to applications and UIs (#2372)
alichherawalla Nov 22, 2026
f0816c9
fix: delete 2 unused functions, fixing linking against shared libggml…
adamjrichter Nov 22, 2026
a852f49
docs: troubleshooting for Windows ROCm 0xC0000135 (STATUS_DLL_NOT_FOU…
farawayso Nov 22, 2026
56d95bf
fix: default asym_w4a8_int8 group_size to 16 like ComfyUI (#2388)
linzch3 Nov 22, 2026
6874e49
perf(vae): batch spatial padding in Hunyuan causal convolutions (#2374)
losewayy Nov 22, 2026
422b10d
perf: reduce CUDA launch overhead in H3 VAE encoding (#2369)
losewayy Nov 22, 2026
9e7eed7
docs(server): document browser notification on generation finish (#2318)
LWWZH Nov 22, 2026
6cd0ef1
feat: add Diffusion Graph Language support (#2396)
leejet Nov 22, 2026
2c678bc
feat: support for MOSS-Image edit LoRAs (#2203)
wbruna Nov 22, 2026
bf31b9c
fix: avoid structured binding capture for MUSA builds
leejet Nov 22, 2026
0d71f96
fix: restore runtime LoRA tensor counts and unify automatic LoRA mode…
leejet Nov 22, 2026
6667be6
feat: support immediate LoRA merges for INT8 weights (#2403)
leejet Nov 23, 2026
5b80e1f
refactor(server): use one context with on-demand model loading (#2404)
leejet Nov 23, 2026
91ed009
fix: restore Qwen Image 2.1 prefix caching in DGL (#2405)
leejet Nov 23, 2026
8187e47
ci: decouple GitHub releases from Docker builds
leejet Nov 23, 2026
3b12781
feat(server): add idle TTLs for model weights (#2406)
leejet Nov 23, 2026
20e2b79
fix(lora): add in F32 when the backend rejects mixed-type addition (#…
nitrobin Nov 24, 2026
571fc44
fix: hidream-o1-image speckle noise removal (#2407)
SolicTous Nov 24, 2026
d697a0a
fix: keep at least one trimmed sigma in the hires refine schedule (#2…
farawayso Nov 24, 2026
ce7ef90
feat(server): add A1111 metadata endpoints and interrupt for sdapi cl…
wiz0floyd Nov 24, 2026
79dc7ca
feat: add converter metadata to GGUF exports (#2409)
leejet Nov 24, 2026
5303199
fix: clear backend buffer caches after idle weight release (#2418)
leejet Nov 25, 2026
f296cb0
fix: correct RelayVSR KV graph cuts and report DGL OOMs (#2419)
leejet Nov 25, 2026
82c19c8
feat(server): support cancelling DGL jobs (#2420)
leejet Nov 25, 2026
c33eebc
feat(server): add --api-key, --api-key-file and --cors-origins (#2367)
jasmaine Nov 25, 2026
5fa203c
feat: support ClipProj-MiniMax-H3 (no mlp) (#2410)
stduhpf Nov 25, 2026
52491bd
feat: add inline media previews to the DGL editor (#2423)
leejet Nov 25, 2026
456f52d
fix: resize Qwen Image Edit vision references (#2433)
leejet Nov 26, 2026
514e786
fix: load the LTX-2.5 keyframe embedding as F32 (#2432)
jasperblues Nov 26, 2026
439e77a
feat: support -mlp variants of ClipProj-MiniMax-H3 (#2424)
stduhpf Nov 26, 2026
fce8619
fix: support fused QKV in FLUX.3 checkpoints (#2434)
leejet Nov 26, 2026
00a944f
perf: enable rms_affine modulation fusion for lingbot video (#2422)
losewayy Nov 26, 2026
6b51a95
refactor: reuse INT8 GEMM for W4A8 (#2435)
leejet Nov 26, 2026
ea3f6ec
fix: load LTX INT8 ConvRot checkpoints (#2436)
leejet Nov 26, 2026
e637c7b
feat(server): update Web UI comparison and input sizing (#2437)
leejet Nov 26, 2026
908965d
fix: detect Ming-Image vs Z-Image by pad-token presence (#2441)
kuhnchris Nov 27, 2026
c80ed92
feat(server): configurable write directory via --output-dir (#2442)
kuhnchris Nov 27, 2026
9d1fe30
perf: optimize LTXAV CUDA execution (#2443)
leejet Nov 27, 2026
dee497f
fix(server): honor configured DGL output directories (#2444)
leejet Nov 27, 2026
05adb5b
feat: add runtime INT8 execution for Q8_0 linear layers (#2445)
leejet Nov 27, 2026
3b0426f
fix: count idle GPU buffers toward the max VRAM budget (#2446)
leejet Nov 27, 2026
58d1126
fix(vulkan): keep CPU-offloaded weights in pageable RAM (#2450)
leejet Nov 28, 2026
cab31f1
docs: document textual inversion usage (#2339)
LWWZH Nov 28, 2026
3771ef2
fix(lora): apply LoRAs at runtime for fp8 weights in auto mode (#2431)
jasperblues Nov 28, 2026
d68f288
feat: support Q4 and Q5 weights in INT8 linear layers (#2452)
leejet Nov 28, 2026
51866c1
feat: support K-quant weights in INT8 linear layers (#2454)
leejet Nov 28, 2026
fb226da
fix(server): align high-noise video options with native support (#2457)
leejet Nov 28, 2026
3d0df00
perf: extend CUDA fusions for Wan (#2458)
leejet Nov 28, 2026
52e1a65
fix(server): snapshot the DGL file-access policy after the directory …
iamskeole Nov 29, 2026
7cf6887
fix: preserve underscores in FLUX.3 LoRA tensor names (#2462)
PanosPetrou Nov 29, 2026
a1e13e2
docs: add MiniMax-H3 AV continuation DGL example (docs/dgl/minimax_h3…
unico123 Nov 29, 2026
b3319c0
feat: support pi-H3 adapters in DGL (#2468)
leejet Nov 29, 2026
7c293e1
feat: manage weight residency across GPU, RAM, and disk (#2470)
leejet Nov 30, 2026
a5b83a9
perf: reduce build time (#2471)
leejet Nov 30, 2026
75b3b99
fix(server): honor WebUI scheduler changes for preset sigmas (#2472)
leejet Nov 30, 2026
330efca
fix: honor per-token audio timesteps in LTX denoising (#2473)
leejet Nov 30, 2026
0915ceb
fix: disable precompiled headers for SYCL builds
leejet Nov 30, 2026
eaee7d7
Merge upstream master-1163-0915ceb
Vect0rM Dec 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
19 changes: 17 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
[
".github/workflows/**",
".dockerignore",
"docs/dgl-builtins.md",
"docker/Dockerfile*",
"scripts/ci-cuda-cache.sh",
"**/CMakeLists.txt",
Expand All @@ -38,6 +39,7 @@ on:
[
".github/workflows/**",
".dockerignore",
"docs/dgl-builtins.md",
"docker/Dockerfile*",
"scripts/ci-cuda-cache.sh",
"**/CMakeLists.txt",
Expand Down Expand Up @@ -100,6 +102,7 @@ jobs:
cd build
cmake .. -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='$ORIGIN'
cmake --build . --config Release
cmake --build . --config Release --target dgl-check-builtins

- name: Get commit hash
id: commit
Expand All @@ -121,6 +124,8 @@ jobs:
run: |
cp ggml/LICENSE ./build/bin/ggml.txt
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
cp thirdparty/libwebm/LICENSE.TXT ./build/bin/libwebm.txt
cp thirdparty/libwebp/COPYING ./build/bin/libwebp.txt
chmod +x start-server.sh
zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/bin/* ./start-server.sh ./start-server.bat

Expand Down Expand Up @@ -186,6 +191,8 @@ jobs:
run: |
cp ggml/LICENSE ./build/bin/ggml.txt
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
cp thirdparty/libwebm/LICENSE.TXT ./build/bin/libwebm.txt
cp thirdparty/libwebp/COPYING ./build/bin/libwebp.txt
chmod +x start-server.sh
zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-vulkan.zip ./build/bin/* ./start-server.sh ./start-server.bat

Expand Down Expand Up @@ -366,6 +373,8 @@ jobs:
run: |
cp ggml/LICENSE ./build/bin/ggml.txt
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
cp thirdparty/libwebm/LICENSE.TXT ./build/bin/libwebm.txt
cp thirdparty/libwebp/COPYING ./build/bin/libwebp.txt
chmod +x start-server.sh
zip -j sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-${{ steps.system-info.outputs.OS_NAME }}-${{ steps.system-info.outputs.OS_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}.zip ./build/bin/* ./start-server.sh ./start-server.bat

Expand Down Expand Up @@ -474,8 +483,11 @@ jobs:
ls .\build\bin
throw "Can't find stable-diffusion.dll"
}
$binPath = Split-Path -Parent $filePath
Copy-Item thirdparty/libwebm/LICENSE.TXT (Join-Path $binPath 'libwebm.txt')
Copy-Item thirdparty/libwebp/COPYING (Join-Path $binPath 'libwebp.txt')
if ("${{ matrix.build }}" -eq "cuda12") {
Copy-Item thirdparty/cutlass/LICENSE.txt (Join-Path (Split-Path -Parent $filePath) 'cutlass.txt')
Copy-Item thirdparty/cutlass/LICENSE.txt (Join-Path $binPath 'cutlass.txt')
}
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-${{ matrix.build }}-x64.zip $filePath .\start-server.sh .\start-server.bat

Expand Down Expand Up @@ -633,6 +645,8 @@ jobs:
- name: Pack artifacts
if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }}
run: |
Copy-Item thirdparty/libwebm/LICENSE.TXT .\build\bin\libwebm.txt
Copy-Item thirdparty/libwebp/COPYING .\build\bin\libwebp.txt
7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-win-rocm-${{ env.ROCM_VERSION }}-x64.zip .\build\bin\* .\start-server.sh .\start-server.bat

- name: Upload artifacts
Expand Down Expand Up @@ -796,6 +810,8 @@ jobs:
run: |
cp ggml/LICENSE ./build/bin/ggml.txt
cp LICENSE ./build/bin/stable-diffusion.cpp.txt
cp thirdparty/libwebm/LICENSE.TXT ./build/bin/libwebm.txt
cp thirdparty/libwebp/COPYING ./build/bin/libwebp.txt
chmod +x start-server.sh
zip -y -r sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-bin-${{ steps.system-info.outputs.OS_TYPE }}-Ubuntu-${{ env.UBUNTU_VERSION }}-${{ steps.system-info.outputs.CPU_ARCH }}-rocm-${{ matrix.ROCM_VERSION }}.zip ./build/bin ./start-server.sh ./start-server.bat

Expand All @@ -819,7 +835,6 @@ jobs:
- ubuntu-latest-cmake
- ubuntu-latest-cmake-vulkan
- ubuntu-latest-rocm
- build-and-push-docker-images
- macOS-latest-cmake
- windows-latest-cmake
- windows-latest-rocm
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ build*/
cmake-build-*/
test/
tests/
/dgl/*
!/dgl/.gitkeep
logs/
input/
output/
.vscode/
.idea/
.cache/
Expand Down
12 changes: 12 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,18 @@ Core implementation lives under `src/`.

Current source layout includes:

* `src/api/` - C API options, generation requests, and translation to DGL.
* `src/core/` - shared tensor, ggml integration, backend, graph, RNG, and utility
code.
* `src/dgl/` - DGL compilation, execution, and built-in operations. See the
[DGL architecture guide](docs/development/dgl.md) for layer boundaries.
* `src/model/` - model families and model components.
* `src/model_io/` - model file loading, GGUF, safetensors, pickle, and related
serialization helpers.
* `src/runtime/` - sampling, denoising, guidance, caching, preprocessing, and
runtime execution helpers.
* `src/weights/` - weight residency state and reclaim decisions. See the
[weight residency internals](docs/development/weights.md).
* `src/tokenizers/` - tokenizer implementations.
* `src/conditioning/` - conditioning and prompt-related implementation.
* `src/extensions/` - optional feature extensions.
Expand Down Expand Up @@ -92,6 +97,7 @@ documentation.

* `docs/` - documentation for supported models, build options, behavior, and
workflows; start from `docs/README.md`.
* `docs/dgl/` - runnable DGL examples grouped by model.
* `docs/models/` - model and component usage guides, including LoRAs, adapters,
auxiliary models, and model-specific examples.
* `docs/guides/` - shared usage workflows, configuration, and performance guides.
Expand Down Expand Up @@ -127,6 +133,12 @@ documentation.
6. Keep edits scoped to the requested behavior.
7. Run the narrowest useful build, test, or inspection command available.

Regenerate [the DGL built-in catalog](docs/dgl-builtins.md) whenever a
registered function is added, removed, renamed, or changes its parameters,
defaults, or outputs. Run the `dgl-update-builtins` CMake target to
regenerate the catalog and `dgl-check-builtins` to verify it. Update the
DGL guide or examples when a built-in changes behavior.

Follow `CONTRIBUTING.md` for formatting, naming, PR expectations, dependency
update policy, and security rules. For tokenizer additions, follow its embedded-data
allowlist and default to an external `tokenizer.json`.
Expand Down
93 changes: 70 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.12)
cmake_minimum_required(VERSION 3.16)
project("stable-diffusion")

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
Expand All @@ -9,21 +9,16 @@ if (NOT XCODE AND NOT MSVC AND NOT CMAKE_BUILD_TYPE)
endif()

if (MSVC)
cmake_host_system_information(RESULT SD_LOGICAL_CORES QUERY NUMBER_OF_LOGICAL_CORES)
if (SD_LOGICAL_CORES GREATER 8)
math(EXPR SD_DEFAULT_MSVC_MP_COUNT "${SD_LOGICAL_CORES} - 2")
elseif (SD_LOGICAL_CORES GREATER 2)
math(EXPR SD_DEFAULT_MSVC_MP_COUNT "${SD_LOGICAL_CORES} - 1")
else()
set(SD_DEFAULT_MSVC_MP_COUNT "${SD_LOGICAL_CORES}")
endif()
cmake_host_system_information(RESULT SD_PHYSICAL_CORES QUERY NUMBER_OF_PHYSICAL_CORES)
set(SD_DEFAULT_MSVC_MP_COUNT "${SD_PHYSICAL_CORES}")
if (NOT SD_DEFAULT_MSVC_MP_COUNT GREATER 0)
set(SD_DEFAULT_MSVC_MP_COUNT 1)
endif()
set(SD_MSVC_MP_COUNT "${SD_DEFAULT_MSVC_MP_COUNT}" CACHE STRING "Maximum parallel MSVC compilations per project")
if (NOT SD_MSVC_MP_COUNT MATCHES "^[1-9][0-9]*$" OR SD_MSVC_MP_COUNT GREATER 65536)
message(FATAL_ERROR "SD_MSVC_MP_COUNT must be an integer between 1 and 65536")
endif()
message("-- SD_MSVC_MP_COUNT: ${SD_MSVC_MP_COUNT}")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
add_compile_definitions(_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING)
# /MP is MSVC-only: icx rejects it outright once offloading is enabled.
Expand Down Expand Up @@ -96,9 +91,10 @@ endif()
# general
#option(SD_BUILD_TESTS "sd: build tests" ${SD_STANDALONE})
option(SD_BUILD_EXAMPLES "sd: build examples" ${SD_STANDALONE})
option(SD_BUILD_PCH "sd: use a C++ precompiled header for the library" 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_WEBM "sd: enable WebM video I/O 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)
Expand Down Expand Up @@ -127,9 +123,6 @@ endif()

if(SD_METAL)
if(NOT SD_USE_UPSTREAM_GGML)
if(CMAKE_VERSION VERSION_LESS 3.16)
message(FATAL_ERROR "SD_METAL with SD_USE_UPSTREAM_GGML=OFF requires CMake 3.16 or later for OBJC and OBJCXX support")
endif()
enable_language(OBJC OBJCXX)
endif()
message("-- Use Metal as backend stable-diffusion")
Expand Down Expand Up @@ -184,13 +177,21 @@ if(SD_WEBP)
"Expected WebP::libwebpmux or WebP::webpmux."
)
endif()
if(TARGET WebP::webpdemux)
add_library(webpdemux ALIAS WebP::webpdemux)
elseif(TARGET WebP::libwebpdemux)
add_library(webpdemux ALIAS WebP::libwebpdemux)
else()
message(FATAL_ERROR "System WebP package must provide WebP::webpdemux or WebP::libwebpdemux.")
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)
pkg_check_modules(WebPDemux REQUIRED IMPORTED_TARGET GLOBAL libwebpdemux)
add_library(webp ALIAS PkgConfig::WebP)
add_library(libwebpmux ALIAS PkgConfig::WebPMux)
add_library(webpdemux ALIAS PkgConfig::WebPDemux)
endif()
endif()
endif()
Expand All @@ -210,7 +211,7 @@ if(SD_WEBM)
pkg_check_modules(WebM REQUIRED IMPORTED_TARGET GLOBAL libwebm)
endif()
if(PkgConfig_FOUND AND WebM_FOUND)
link_libraries(PkgConfig::WebM)
add_library(webm ALIAS PkgConfig::WebM)
else()
find_path(WEBM_INCLUDE_DIR
NAMES mkvmuxer/mkvmuxer.h mkvparser/mkvparser.h common/webmids.h
Expand All @@ -236,6 +237,17 @@ endif ()

set(SD_LIB stable-diffusion)

file(GLOB SD_API_TEMPLATES CONFIGURE_DEPENDS "src/api/templates/*.dgl")
set(SD_API_TEMPLATE_CONTENT "#ifndef __SD_API_TEMPLATES_H__\n#define __SD_API_TEMPLATES_H__\n#include <map>\n#include <string>\n#include <string_view>\nnamespace sd::api::templates {\ninline const std::map<std::string, std::string_view> sources = {\n")
foreach(SD_API_TEMPLATE IN LISTS SD_API_TEMPLATES)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${SD_API_TEMPLATE}")
get_filename_component(SD_API_TEMPLATE_NAME "${SD_API_TEMPLATE}" NAME_WE)
file(READ "${SD_API_TEMPLATE}" SD_API_TEMPLATE_TEXT)
string(APPEND SD_API_TEMPLATE_CONTENT "{\"${SD_API_TEMPLATE_NAME}\", R\"SD_DGL(${SD_API_TEMPLATE_TEXT})SD_DGL\"},\n")
endforeach()
string(APPEND SD_API_TEMPLATE_CONTENT "};\n}\n#endif\n")
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated/api_templates.h" CONTENT "${SD_API_TEMPLATE_CONTENT}")

file(GLOB SD_LIB_SOURCES CONFIGURE_DEPENDS
"src/*.h"
"src/*.cpp"
Expand All @@ -255,11 +267,19 @@ file(GLOB SD_LIB_SOURCES CONFIGURE_DEPENDS
"src/extensions/*.h"
"src/extensions/*.cpp"
"src/extensions/*.hpp"
"src/dgl/*.h"
"src/dgl/*.cpp"
"src/dgl/syntax/*.h"
"src/dgl/syntax/*.cpp"
"src/dgl/bindings/*.h"
"src/dgl/bindings/*.cpp"
"src/dgl/models/*.h"
"src/dgl/models/*.cpp"
"src/dgl/ops/*.h"
"src/dgl/ops/*.cpp"
"src/model/*/*.h"
"src/model/*/*.cpp"
"src/model/*/*.hpp"
"src/pipeline/*.h"
"src/pipeline/*.cpp"
"src/runtime/*.h"
"src/runtime/*.cpp"
"src/runtime/*.hpp"
Expand All @@ -269,8 +289,18 @@ file(GLOB SD_LIB_SOURCES CONFIGURE_DEPENDS
"src/tokenizers/*.cpp"
"src/tokenizers/vocab/*.h"
"src/tokenizers/vocab/*.cpp"
"src/weights/*.h"
"src/weights/*.cpp"
)

if(CMAKE_GENERATOR MATCHES "^Ninja")
# Compile the vocabulary data alongside PCH generation to shorten the build tail.
set(SD_VOCAB_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/src/tokenizers/vocab/vocab.cpp")
list(REMOVE_ITEM SD_LIB_SOURCES "${SD_VOCAB_SOURCE}")
list(PREPEND SD_LIB_SOURCES "${SD_VOCAB_SOURCE}")
set_source_files_properties("${SD_VOCAB_SOURCE}" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()

find_program(GIT_EXE NAMES git git.exe NO_CMAKE_FIND_ROOT_PATH)
if(GIT_EXE)
execute_process(COMMAND ${GIT_EXE} describe --tags --abbrev=7 --dirty=+
Expand Down Expand Up @@ -363,6 +393,14 @@ target_link_libraries(${SD_LIB} PUBLIC ggml)
find_package(Threads REQUIRED)
target_link_libraries(${SD_LIB} PRIVATE Threads::Threads)
target_link_libraries(${SD_LIB} PRIVATE onig sd-utf8proc)
if(SD_WEBP)
target_compile_definitions(${SD_LIB} PRIVATE SD_USE_WEBP)
target_link_libraries(${SD_LIB} PRIVATE webp webpdemux)
endif()
if(SD_WEBM)
target_compile_definitions(${SD_LIB} PRIVATE SD_USE_WEBM)
target_link_libraries(${SD_LIB} PRIVATE webm)
endif()
if (SD_CUDA)
find_package(CUDAToolkit REQUIRED)
# Keep the driver stub on downstream link lines when no driver is installed.
Expand Down Expand Up @@ -430,9 +468,20 @@ if (SD_HIPBLAS)
endif()
endif()
target_include_directories(${SD_LIB} PUBLIC include)
target_include_directories(${SD_LIB} PRIVATE src src/core)
target_include_directories(${SD_LIB} PRIVATE src src/core "${CMAKE_CURRENT_BINARY_DIR}/generated")
target_include_directories(${SD_LIB} PUBLIC thirdparty)
target_compile_features(${SD_LIB} PUBLIC c_std_11 cxx_std_17)
# oneAPI 2025.x cannot bundle precompiled headers when -fsycl is enabled.
if(SD_BUILD_PCH AND NOT SD_SYCL)
set(SD_PCH_HEADERS ${SD_LIB_SOURCES})
list(FILTER SD_PCH_HEADERS INCLUDE REGEX "[.]hpp$")
list(FILTER SD_PCH_HEADERS EXCLUDE REGEX "/tokenizers/vocab/")
list(TRANSFORM SD_PCH_HEADERS PREPEND "$<$<COMPILE_LANGUAGE:CXX>:")
list(TRANSFORM SD_PCH_HEADERS APPEND ">")
target_precompile_headers(${SD_LIB} PRIVATE
"$<$<COMPILE_LANGUAGE:CXX>:<json.hpp$<ANGLE-R>>"
${SD_PCH_HEADERS})
endif()
set_target_properties(${SD_LIB} PROPERTIES
CXX_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN ON)
Expand All @@ -444,6 +493,7 @@ endif()




#
# install
#
Expand All @@ -459,12 +509,9 @@ set(SD_INCLUDE_INSTALL_DIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE PATH "Location of h
set(SD_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE PATH "Location of library files")
set(SD_BIN_INSTALL_DIR ${CMAKE_INSTALL_BINDIR} CACHE PATH "Location of binary files")

set(SD_PUBLIC_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/stable-diffusion.h)

set_target_properties(${SD_LIB}
PROPERTIES
PUBLIC_HEADER "${SD_PUBLIC_HEADERS}")
PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/include/stable-diffusion.h")


install(TARGETS ${SD_LIB}
Expand Down
10 changes: 9 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ Link new documentation from [the documentation index](docs/README.md) or
[the model index](docs/models/README.md), as appropriate. Keep supported model
entries and their guide links in the project README.

Use **DGL** for the language name in headings, prose, link text, UI labels,
comments, logs, and diagnostics. Preserve literal spellings in commands, files,
paths, and protocol or metadata fields, such as `-M dgl`, `.dgl`, `docs/dgl/`,
and the metadata key `dgl`. Code identifiers follow their existing naming style,
such as `sd_dgl_run`, `sd::dgl`, `SD_DGL_VALUE_TENSOR`, and `DglWorkspace`.

### Model Documentation

Every new model or component integration must include a user guide in
Expand All @@ -60,7 +66,9 @@ omitting other sections when they have no content:
- `Model files`, with component, weights/downloads, CLI option, and requirement
columns. Include tokenizers, projectors, connectors, downloads, conversion, and
required preprocessing.
- `Usage`, with `Web UI` and `CLI` subsections where applicable. Link to the
- `Usage`, with `Web UI`, `DGL`, and `Legacy CLI` subsections in that order
where applicable. Group DGL scripts in a task table with descriptive links;
put shared run instructions below the table. Link to the
server's shared Web UI guide and list compatible recipes/components. Group
complete CLI examples by task or variant within this section; do not add a
separate `Quick start` or `Examples` section. Keep API usage in its own
Expand Down
Loading
Loading