Skip to content

feat: add Diffusion Graph Language support - #2396

Merged
leejet merged 4 commits into
masterfrom
dgl
Nov 22, 2026
Merged

leejet merged 4 commits into
masterfrom
dgl

Conversation

@leejet

@leejet leejet commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Introduce DGL (Diffusion Graph Language) for composing image and video workflows from model, conditioning, sampling, tensor, and media operations.
  • Add script execution and validation to sd-cli, plus a C API for host tensor inputs, structured results, progress, previews, and cancellation. DGL contexts reuse loaded components and plan weight placement within RAM and VRAM budgets.
  • Run native image generation, video generation, and image upscaling through DGL templates. Record the exact executed source in generation_info and expose metadata inspection and encoding through the C API.
  • Add local, same-origin server endpoints for managing scripts, queueing runs, and retrieving results. Prepare configured model components before reporting them as ready.

Related Issue / Discussion

N/A

Additional Information

N/A

Checklist

@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Too many files!

This PR contains 674 files, which is 374 over the limit of 300.

To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch.

Usage-priced reviews support at most 500 files.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 33269775-b3f3-4a9c-abe9-35610dca4499
Commits

Reviewing files that changed from the base of the PR and between 9e7eed7 and 1414627.

Files selected for processing: 674

  • .github/workflows/build.yml
  • .gitignore
  • AGENTS.md
  • CMakeLists.txt
  • CONTRIBUTING.md
  • README.md
  • dgl/.gitkeep
  • docs/README.md
  • docs/build.md
  • docs/development/backend_probe.md
  • docs/development/c_api.md
  • docs/development/dgl.md
  • docs/development/model_config.md
  • docs/development/pulid.md
  • docs/dgl-builtins.md
  • docs/dgl.md
  • docs/dgl/README.md
  • docs/dgl/adetailer/adetailer-existing-image.dgl
  • docs/dgl/adetailer/adetailer-generated-image.dgl
  • docs/dgl/anima/anima-preview-txt2img.dgl
  • docs/dgl/animatediff/animatediff-realisticvision-v6-domain-lora.dgl
  • docs/dgl/animatediff/animatediff-realisticvision-v6-img2video.dgl
  • docs/dgl/animatediff/animatediff-realisticvision-v6-txt2video-16-frames.dgl
  • docs/dgl/animatediff/animatediff-realisticvision-v6-txt2video-cpu-offload.dgl
  • docs/dgl/animatediff/animatediff-realisticvision-v6-txt2video-vram-budget.dgl
  • docs/dgl/animatediff/realisticvision-v6-txt2img.dgl
  • docs/dgl/boogu_image/boogu-image-base-txt2img.dgl
  • docs/dgl/boogu_image/boogu-image-edit.dgl
  • docs/dgl/chroma/chroma-unlocked-v40-txt2img.dgl
  • docs/dgl/chroma_radiance/chroma1-radiance-v0-4-txt2img.dgl
  • docs/dgl/distilled_sd/sdxs-512-dreamshaper-txt2img.dgl
  • docs/dgl/distilled_sd/ssd1b-txt2img.dgl
  • docs/dgl/ernie_image/ernie-image-turbo-txt2img.dgl
  • docs/dgl/ernie_image/ernie-image-txt2img.dgl
  • docs/dgl/esrgan/realesrgan-x4plus-anime-6b-upscale.dgl
  • docs/dgl/esrgan/sd1-5-txt2img-esrgan.dgl
  • docs/dgl/fibo2/fibo2-dev-edit.dgl
  • docs/dgl/fibo2/fibo2-dev-txt2img.dgl
  • docs/dgl/fibo2/fibo2-edit-turbo.dgl
  • docs/dgl/flux/flux1-dev-lora.dgl
  • docs/dgl/flux/flux1-dev-txt2img.dgl
  • docs/dgl/flux/flux1-schnell-txt2img.dgl
  • docs/dgl/flux2/flux2-dev-edit.dgl
  • docs/dgl/flux2/flux2-klein-4b-edit.dgl
  • docs/dgl/flux2/flux2-klein-4b-txt2img.dgl
  • docs/dgl/flux2/flux2-klein-9b-edit.dgl
  • docs/dgl/flux2/flux2-klein-9b-txt2img.dgl
  • docs/dgl/flux2/flux2-klein-base-4b-txt2img.dgl
  • docs/dgl/flux2/flux2-klein-base-9b-txt2img.dgl
  • docs/dgl/flux3/flux3-image-klein-base-txt2img.dgl
  • docs/dgl/flux3/flux3-image-klein-edit.dgl
  • docs/dgl/flux3/flux3-image-klein-txt2img.dgl
  • docs/dgl/hidream_o1_image/hidream-o1-image-dev-txt2img.dgl
  • docs/dgl/hunyuan_video/hunyuanvideo1-5-720p-txt2video.dgl
  • docs/dgl/ideogram4/ideogram4-txt2img.dgl
  • docs/dgl/ip_adapter/ip-adapter-plus-sd1-5.dgl
  • docs/dgl/ip_adapter/ip-adapter-sd1-5.dgl
  • docs/dgl/ip_adapter/ip-adapter-sdxl-controlnet.dgl
  • docs/dgl/ip_adapter/ip-adapter-sdxl.dgl
  • docs/dgl/iris/iris-3b-txt2img.dgl
  • docs/dgl/kontext/flux1-kontext-dev-edit.dgl
  • docs/dgl/krea2/krea2-raw-txt2img.dgl
  • docs/dgl/lcm/lcm-lora-sd1-5.dgl
  • docs/dgl/lens/lens-turbo-txt2img.dgl
  • docs/dgl/lens/lens-txt2img.dgl
  • docs/dgl/lingbot_video/lingbot-video-dens-1-3b-txt2video.dgl
  • docs/dgl/llada_image/llada-image-turbo-edit.dgl
  • docs/dgl/llada_image/llada-image-turbo-txt2img.dgl
  • docs/dgl/longcat_image/longcat-image-txt2img.dgl
  • docs/dgl/lora/sd1-5-lora.dgl
  • docs/dgl/ltx2/ltx-2-3-dev-first-last-frame.dgl
  • docs/dgl/ltx2/ltx-2-3-dev-img2video.dgl
  • docs/dgl/ltx2/ltx-2-3-dev-txt2video.dgl
  • docs/dgl/ltx2/ltx-2-3-spatial-upscale.dgl
  • docs/dgl/ltx2/ltx-2-5-dev-img2video.dgl
  • docs/dgl/ltx2/ltx-2-5-dev-txt2video.dgl
  • docs/dgl/ltx2/ltx-2-5-spatial-upscale.dgl
  • docs/dgl/mage_flow/mage-flow-edit.dgl
  • docs/dgl/mage_flow/mage-flow-turbo-txt2img.dgl
  • docs/dgl/ming_image/ming-image-0-1-design-txt2img.dgl
  • docs/dgl/minimax_h3/minimax-h3-first-last-frame.dgl
  • docs/dgl/minimax_h3/minimax-h3-latent-hires.dgl
  • docs/dgl/minimax_h3/minimax-h3-learned-hires.dgl
  • docs/dgl/minimax_h3/minimax-h3-reference-to-av.dgl
  • docs/dgl/minimax_h3/minimax-h3-text-to-av.dgl
  • docs/dgl/minimax_h3_image/minimax-h3-image-edit.dgl
  • docs/dgl/minimax_h3_image/minimax-h3-image-txt2img.dgl
  • docs/dgl/minit2i/minit2i-cuda-txt2img.dgl
  • docs/dgl/minit2i/minit2i-metal-txt2img.dgl
  • docs/dgl/moss_image/moss-image-base-txt2img.dgl
  • docs/dgl/moss_image/moss-image-sft-inline-images.dgl
  • docs/dgl/moss_image/moss-image-sft-txt2img.dgl
  • docs/dgl/ovis_image/ovis-image-txt2img.dgl
  • docs/dgl/p_h3_image/p-h3-image-edit.dgl
  • docs/dgl/p_h3_image/p-h3-image-txt2img.dgl
  • docs/dgl/photo_maker/photomaker-v1-sdxl.dgl
  • docs/dgl/photo_maker/photomaker-v2-sdxl.dgl
  • docs/dgl/pid/pid-flux1-512-to-2048-txt2img.dgl
  • docs/dgl/pixart/pixart-sigma-xl2-1024-ms-txt2img.dgl
  • docs/dgl/pulid/pulid-flux1-schnell.dgl
  • docs/dgl/qwen_image/qwen-image-txt2img.dgl
  • docs/dgl/qwen_image_2.1/qwen-image-2-1-edit.dgl
  • docs/dgl/qwen_image_2.1/qwen-image-2-1-txt2img.dgl
  • docs/dgl/qwen_image_edit/qwen-image-edit-2509.dgl
  • docs/dgl/qwen_image_edit/qwen-image-edit-2511.dgl
  • docs/dgl/qwen_image_edit/qwen-image-edit.dgl
  • docs/dgl/relay_vsr/relayvsr-x2-image-upscale.dgl
  • docs/dgl/relay_vsr/relayvsr-x2-video-upscale.dgl
  • docs/dgl/sd/nitrosd-realism-nitrofusion.dgl
  • docs/dgl/sd/sd1-4-img2img.dgl
  • docs/dgl/sd/sd1-4-txt2img.dgl
  • docs/dgl/sd/sd1-5-controlnet.dgl
  • docs/dgl/sd/sd1-5-inpainting.dgl
  • docs/dgl/sd/sd1-5-txt2img.dgl
  • docs/dgl/sd/sdxl-txt2img.dgl
  • docs/dgl/sd3/sd3-5-large-txt2img.dgl
  • docs/dgl/seedvr2/seedvr2-3b-image-upscale.dgl
  • docs/dgl/seedvr2/seedvr2-3b-video-upscale.dgl
  • docs/dgl/sefi_image/sefi-1b-base-txt2img.dgl
  • docs/dgl/sefi_image/sefi-1b-turbo-txt2img.dgl
  • docs/dgl/sefi_image/sefi-5b-turbo-txt2img.dgl
  • docs/dgl/sefi_image/sefi-image-5b-rl.dgl
  • docs/dgl/sensenova_u1/sensenova-u1-cuda-txt2img.dgl
  • docs/dgl/taesd/sd1-5-taesd-preview.dgl
  • docs/dgl/wan/wan2-1-first-last-frame-14b.dgl
  • docs/dgl/wan/wan2-1-i2v-14b.dgl
  • docs/dgl/wan/wan2-1-t2v-1-3b.dgl
  • docs/dgl/wan/wan2-1-t2v-14b.dgl
  • docs/dgl/wan/wan2-1-vace-1-3b-ref2video.dgl
  • docs/dgl/wan/wan2-1-vace-1-3b-txt2video.dgl
  • docs/dgl/wan/wan2-1-vace-1-3b-video2video.dgl
  • docs/dgl/wan/wan2-1-vace-14b-ref2video.dgl
  • docs/dgl/wan/wan2-1-vace-14b-txt2video.dgl
  • docs/dgl/wan/wan2-1-vace-14b-video2video.dgl
  • docs/dgl/wan/wan2-2-first-last-frame-a14b.dgl
  • docs/dgl/wan/wan2-2-i2v-a14b.dgl
  • docs/dgl/wan/wan2-2-s2v-14b.dgl
  • docs/dgl/wan/wan2-2-t2v-a14b-image.dgl
  • docs/dgl/wan/wan2-2-t2v-a14b-lora.dgl
  • docs/dgl/wan/wan2-2-t2v-a14b.dgl
  • docs/dgl/wan/wan2-2-ti2v-5b-img2video.dgl
  • docs/dgl/wan/wan2-2-ti2v-5b-txt2video.dgl
  • docs/dgl/wan/wan2-2-vace-fun-a14b-ref2video.dgl
  • docs/dgl/z_image/z-image-base-txt2img.dgl
  • docs/dgl/z_image/z-image-turbo-controlnet.dgl
  • docs/dgl/z_image/z-image-turbo-txt2img.dgl
  • docs/dgl/z_image_l2p/z-image-l2p-txt2img.dgl
  • docs/guides/backend.md
  • docs/guides/c_api.md
  • docs/guides/caching.md
  • docs/guides/edit.md
  • docs/guides/generation_metadata.md
  • docs/guides/image_preprocessing.md
  • docs/guides/int8_convrot.md
  • docs/guides/performance.md
  • docs/guides/prompt_images.md
  • docs/guides/rpc.md
  • docs/guides/sage_attention.md
  • docs/guides/sampling.md
  • docs/guides/tokenizers.md
  • docs/models/README.md
  • docs/models/adetailer.md
  • docs/models/anima.md
  • docs/models/animatediff.md
  • docs/models/boogu_image.md
  • docs/models/chroma.md
  • docs/models/chroma_radiance.md
  • docs/models/distilled_sd.md
  • docs/models/ernie_image.md
  • docs/models/esrgan.md
  • docs/models/fibo2.md
  • docs/models/flux.md
  • docs/models/flux2.md
  • docs/models/flux3.md
  • docs/models/hidream_o1_image.md
  • docs/models/hunyuan_video.md
  • docs/models/ideogram4.md
  • docs/models/ip_adapter.md
  • docs/models/iris.md
  • docs/models/kontext.md
  • docs/models/krea2.md
  • docs/models/lcm.md
  • docs/models/lens.md
  • docs/models/lingbot_video.md
  • docs/models/llada_image.md
  • docs/models/longcat_image.md
  • docs/models/lora.md
  • docs/models/ltx2.md
  • docs/models/mage_flow.md
  • docs/models/ming_image.md
  • docs/models/minimax_h3.md
  • docs/models/minimax_h3_image.md
  • docs/models/minit2i.md
  • docs/models/moss_image.md
  • docs/models/ovis_image.md
  • docs/models/p_h3_image.md
  • docs/models/photo_maker.md
  • docs/models/pid.md
  • docs/models/pixart.md
  • docs/models/pulid.md
  • docs/models/qwen_image.md
  • docs/models/qwen_image_2.1.md
  • docs/models/qwen_image_edit.md
  • docs/models/relay_vsr.md
  • docs/models/sd.md
  • docs/models/sd3.md
  • docs/models/seedvr2.md
  • docs/models/sefi_image.md
  • docs/models/sensenova_u1.md
  • docs/models/taesd.md
  • docs/models/wan.md
  • docs/models/z_image.md
  • docs/models/z_image_l2p.md
  • examples/cli/CMakeLists.txt
  • examples/cli/README.md
  • examples/cli/dgl.cpp
  • examples/cli/dgl.h
  • examples/cli/image_metadata.h
  • examples/cli/main.cpp
  • examples/cli/media_input.cpp
  • examples/cli/media_input.h
  • examples/common/common.cpp
  • examples/common/common.h
  • examples/common/generation_metadata.cpp
  • examples/common/generation_metadata.h
  • examples/common/log.cpp
  • examples/common/log.h
  • examples/common/media_io.cpp
  • examples/common/media_io.h
  • examples/common/media_metadata.cpp
  • examples/common/media_metadata.h
  • examples/common/resource_owners.hpp
  • examples/server/CMakeLists.txt
  • examples/server/README.md
  • examples/server/api.md
  • examples/server/async_jobs.cpp
  • examples/server/async_jobs.h
  • examples/server/frontend
  • examples/server/main.cpp
  • examples/server/model_catalog.cpp
  • examples/server/model_catalog.h
  • examples/server/recipes/README.md
  • examples/server/recipes/anima-edit.json
  • examples/server/recipes/animatediff-sd15.json
  • examples/server/recipes/defaults.md
  • examples/server/recipes/flux1-pulid.json
  • examples/server/recipes/hunyuan-video-15-i2v.json
  • examples/server/recipes/hunyuan-video-15-t2v.json
  • examples/server/recipes/krea2-raw-edit.json
  • examples/server/recipes/krea2-turbo-edit.json
  • examples/server/recipes/lingbot-video-dense.json
  • examples/server/recipes/lingbot-video-moe.json
  • examples/server/recipes/ltx23-dev.json
  • examples/server/recipes/ltx23-distilled.json
  • examples/server/recipes/ltx25-dev.json
  • examples/server/recipes/nitrosd-realism.json
  • examples/server/recipes/sd1-ip-adapter.json
  • examples/server/recipes/sdxl-ip-adapter.json
  • examples/server/recipes/sdxl-photomaker.json
  • examples/server/recipes/wan21-flf2v.json
  • examples/server/recipes/wan21-i2v.json
  • examples/server/recipes/wan21-t2v.json
  • examples/server/recipes/wan21-vace.json
  • examples/server/recipes/wan22-i2v.json
  • examples/server/recipes/wan22-s2v.json
  • examples/server/recipes/wan22-t2v.json
  • examples/server/recipes/wan22-ti2v-5b.json
  • examples/server/routes.h
  • examples/server/routes_dgl.cpp
  • examples/server/routes_models.cpp
  • examples/server/routes_openai.cpp
  • examples/server/routes_sdapi.cpp
  • examples/server/routes_sdcpp.cpp
  • examples/server/runtime.cpp
  • examples/server/runtime.h
  • include/stable-diffusion.h
  • scripts/face_detect.py
  • scripts/format-code.ps1
  • scripts/format-code.sh
  • scripts/pulid_extract_id.py
  • src/api/api.cpp
  • src/api/api.h
  • src/api/generation.cpp
  • src/api/generation.h
  • src/api/generation_h3.cpp
  • src/api/generation_hires.cpp
  • src/api/generation_image.cpp
  • src/api/generation_metadata.cpp
  • src/api/generation_program.cpp
  • src/api/generation_program.h
  • src/api/generation_prompt.cpp
  • src/api/generation_template.cpp
  • src/api/generation_template.h
  • src/api/generation_video.cpp
  • src/api/image_metadata.cpp
  • src/api/media_metadata.cpp
  • src/api/metadata.h
  • src/api/options.cpp
  • src/api/options.h
  • src/api/program_result.cpp
  • src/api/result.cpp
  • src/api/result.h
  • src/api/templates/README.md
  • src/api/templates/image.dgl
  • src/api/templates/image_edit.dgl
  • src/api/templates/image_h3.dgl
  • src/api/templates/image_helpers.dgl
  • src/api/templates/image_hires.dgl
  • src/api/templates/image_inpaint.dgl
  • src/api/templates/image_layered.dgl
  • src/api/templates/image_pixel.dgl
  • src/api/templates/image_predictors.dgl
  • src/api/templates/image_reference.dgl
  • src/api/templates/image_sefi.dgl
  • src/api/templates/load_components.dgl
  • src/api/templates/lora.dgl
  • src/api/templates/upscale.dgl
  • src/api/templates/video_h3.dgl
  • src/api/templates/video_helpers.dgl
  • src/api/templates/video_hires.dgl
  • src/api/templates/video_ltx.dgl
  • src/api/templates/video_reference.dgl
  • src/api/templates/video_wan.dgl
  • src/api/tensor.cpp
  • src/api/tensor.h
  • src/api/upscaler.cpp
  • src/conditioning/conditioner.hpp
  • src/conditioning/conditioning_cache.h
  • src/conditioning/fibo2.hpp
  • src/conditioning/photomaker_prompt.h
  • src/conditioning/prompt_input.cpp
  • src/conditioning/prompt_input.h
  • src/conditioning/prompt_templates.h
  • src/conditioning/textual_inversion.cpp
  • src/conditioning/textual_inversion.h
  • src/config.cpp
  • src/config.h
  • src/core/backend_fit.cpp
  • src/core/backend_fit.h
  • src/core/compute_workspace.cpp
  • src/core/compute_workspace.h
  • src/core/execution_engine.cpp
  • src/core/execution_engine.h
  • src/core/file_access.h
  • src/core/ggml_extend_backend.cpp
  • src/core/ggml_extend_backend.h
  • src/core/ggml_graph_cut.cpp
  • src/core/ggml_runner.cpp
  • src/core/ggml_runner.h
  • src/core/image_geometry.cpp
  • src/core/image_geometry.h
  • src/core/image_tensor.cpp
  • src/core/image_tensor.h
  • src/core/option_types.cpp
  • src/core/probe/backend_probe.cpp
  • src/core/probe/backend_probe.h
  • src/core/progress.h
  • src/core/rng_philox.hpp
  • src/core/util.cpp
  • src/core/util.h
  • src/detailer.cpp
  • src/detailer.h
  • src/device_residency_manager.h
  • src/dgl/bindings/arguments.cpp
  • src/dgl/bindings/arguments.h
  • src/dgl/bindings/audio.cpp
  • src/dgl/bindings/audio.h
  • src/dgl/bindings/component_loader.cpp
  • src/dgl/bindings/component_loader.h
  • src/dgl/bindings/components.cpp
  • src/dgl/bindings/components.h
  • src/dgl/bindings/condition.cpp
  • src/dgl/bindings/condition.h
  • src/dgl/bindings/conversion.cpp
  • src/dgl/bindings/conversion.h
  • src/dgl/bindings/detailer.cpp
  • src/dgl/bindings/detailer.h
  • src/dgl/bindings/detections.cpp
  • src/dgl/bindings/detections.h
  • src/dgl/bindings/image.cpp
  • src/dgl/bindings/image.h
  • src/dgl/bindings/latents.cpp
  • src/dgl/bindings/latents.h
  • src/dgl/bindings/lora.cpp
  • src/dgl/bindings/lora.h
  • src/dgl/bindings/media.cpp
  • src/dgl/bindings/media.h
  • src/dgl/bindings/model.cpp
  • src/dgl/bindings/model.h
  • src/dgl/bindings/postprocess.cpp
  • src/dgl/bindings/postprocess.h
  • src/dgl/bindings/predictor.cpp
  • src/dgl/bindings/predictor.h
  • src/dgl/bindings/preview.cpp
  • src/dgl/bindings/preview.h
  • src/dgl/bindings/regions.cpp
  • src/dgl/bindings/regions.h
  • src/dgl/bindings/registration.cpp
  • src/dgl/bindings/registration.h
  • src/dgl/bindings/relay_vsr.cpp
  • src/dgl/bindings/relay_vsr.h
  • src/dgl/bindings/rng.cpp
  • src/dgl/bindings/rng.h
  • src/dgl/bindings/seedvr2.cpp
  • src/dgl/bindings/seedvr2.h
  • src/dgl/bindings/sefi.cpp
  • src/dgl/bindings/sefi.h
  • src/dgl/bindings/tensor_ops.cpp
  • src/dgl/bindings/tensor_ops.h
  • src/dgl/bindings/values.cpp
  • src/dgl/bindings/values.h
  • src/dgl/bindings/video.cpp
  • src/dgl/bindings/video.h
  • src/dgl/bindings/video_windows.cpp
  • src/dgl/bindings/video_windows.h
  • src/dgl/bytes.h
  • src/dgl/context.cpp
  • src/dgl/context.h
  • src/dgl/dgl.cpp
  • src/dgl/diagnostic.h
  • src/dgl/executor.cpp
  • src/dgl/executor.h
  • src/dgl/graph.cpp
  • src/dgl/graph.h
  • src/dgl/graph_resources.cpp
  • src/dgl/indexing.cpp
  • src/dgl/indexing.h
  • src/dgl/model_value.cpp
  • src/dgl/model_value.h
  • src/dgl/models/animatediff.cpp
  • src/dgl/models/animatediff.h
  • src/dgl/models/audio_encoder.cpp
  • src/dgl/models/audio_encoder.h
  • src/dgl/models/audio_vae.cpp
  • src/dgl/models/audio_vae.h
  • src/dgl/models/circular_axes.h
  • src/dgl/models/component_builders.cpp
  • src/dgl/models/component_builders.h
  • src/dgl/models/component_sources.cpp
  • src/dgl/models/component_sources.h
  • src/dgl/models/control.cpp
  • src/dgl/models/control.h
  • src/dgl/models/denoising_parameterization.cpp
  • src/dgl/models/denoising_parameterization.h
  • src/dgl/models/detail_detector.cpp
  • src/dgl/models/detail_detector.h
  • src/dgl/models/diffusion_model.h
  • src/dgl/models/diffusion_prediction.h
  • src/dgl/models/dit.cpp
  • src/dgl/models/dit.h
  • src/dgl/models/fwd.h
  • src/dgl/models/image_upscale.cpp
  • src/dgl/models/image_upscale.h
  • src/dgl/models/ip_adapter.cpp
  • src/dgl/models/ip_adapter.h
  • src/dgl/models/latent_upscaler.cpp
  • src/dgl/models/latent_upscaler.h
  • src/dgl/models/lora.cpp
  • src/dgl/models/lora.h
  • src/dgl/models/model_base.cpp
  • src/dgl/models/model_base.h
  • src/dgl/models/model_load_params.h
  • src/dgl/models/model_runtime.cpp
  • src/dgl/models/model_runtime.h
  • src/dgl/models/photomaker.cpp
  • src/dgl/models/photomaker.h
  • src/dgl/models/photomaker_prompt.h
  • src/dgl/models/pulid.cpp
  • src/dgl/models/pulid.h
  • src/dgl/models/relay_vsr.cpp
  • src/dgl/models/relay_vsr.h
  • src/dgl/models/text_encoder.cpp
  • src/dgl/models/text_encoder.h
  • src/dgl/models/upscaler.cpp
  • src/dgl/models/upscaler.h
  • src/dgl/models/vae.cpp
  • src/dgl/models/vae.h
  • src/dgl/models/vision_encoder.cpp
  • src/dgl/models/vision_encoder.h
  • src/dgl/ops/audio.cpp
  • src/dgl/ops/audio.h
  • src/dgl/ops/control.cpp
  • src/dgl/ops/control.h
  • src/dgl/ops/detailer.cpp
  • src/dgl/ops/detailer.h
  • src/dgl/ops/fwd.h
  • src/dgl/ops/image.cpp
  • src/dgl/ops/image.h
  • src/dgl/ops/ip_adapter.h
  • src/dgl/ops/media.cpp
  • src/dgl/ops/media.h
  • src/dgl/ops/media_encoding.cpp
  • src/dgl/ops/media_encoding.h
  • src/dgl/ops/predictor.cpp
  • src/dgl/ops/predictor.h
  • src/dgl/ops/preview.cpp
  • src/dgl/ops/preview.h
  • src/dgl/ops/prompt.cpp
  • src/dgl/ops/prompt.h
  • src/dgl/ops/pulid.cpp
  • src/dgl/ops/pulid.h
  • src/dgl/ops/relay_vsr.cpp
  • src/dgl/ops/relay_vsr.h
  • src/dgl/ops/sampling.cpp
  • src/dgl/ops/sampling.h
  • src/dgl/ops/sampling_observer.cpp
  • src/dgl/ops/sampling_observer.h
  • src/dgl/ops/seedvr2.cpp
  • src/dgl/ops/seedvr2.h
  • src/dgl/ops/sefi_sampling.cpp
  • src/dgl/ops/sefi_sampling.h
  • src/dgl/ops/spectrum_cache.cpp
  • src/dgl/ops/spectrum_cache.h
  • src/dgl/ops/tensor.cpp
  • src/dgl/ops/tensor.h
  • src/dgl/ops/vae.cpp
  • src/dgl/ops/vae.h
  • src/dgl/ops/video.cpp
  • src/dgl/ops/video.h
  • src/dgl/ops/video_encoding.cpp
  • src/dgl/ops/video_timing.cpp
  • src/dgl/ops/video_timing.h
  • src/dgl/ops/video_webm.cpp
  • src/dgl/ops/video_webm.h
  • src/dgl/ops/video_webp.cpp
  • src/dgl/ops/video_webp.h
  • src/dgl/ops/video_windows.cpp
  • src/dgl/ops/video_windows.h
  • src/dgl/registry.cpp
  • src/dgl/registry.h
  • src/dgl/result.cpp
  • src/dgl/result.h
  • src/dgl/run_events.cpp
  • src/dgl/run_events.h
  • src/dgl/run_plan.cpp
  • src/dgl/run_plan.h
  • src/dgl/syntax/lexer.cpp
  • src/dgl/syntax/lexer.h
  • src/dgl/syntax/parser.cpp
  • src/dgl/syntax/syntax.h
  • src/dgl/tensor.h
  • src/dgl/tensor_io.cpp
  • src/dgl/tensor_io.h
  • src/dgl/value.cpp
  • src/dgl/value.h
  • src/dgl/version.cpp
  • src/dgl/version.h
  • src/extensions/generation_extension.h
  • src/extensions/photomaker_embedding.cpp
  • src/extensions/photomaker_embedding.h
  • src/extensions/photomaker_extension.cpp
  • src/extensions/pulid_embedding.cpp
  • src/extensions/pulid_embedding.h
  • src/generation_info.cpp
  • src/generation_info.h
  • src/model.h
  • src/model/adapter/ip_adapter.hpp
  • src/model/adapter/lora.hpp
  • src/model/adapter/pmid.hpp
  • src/model/adapter/pulid.hpp
  • src/model/common/block.hpp
  • src/model/common/ggml_block.hpp
  • src/model/common/ltx.hpp
  • src/model/diffusion/anima.hpp
  • src/model/diffusion/animatediff.hpp
  • src/model/diffusion/boogu.hpp
  • src/model/diffusion/control.hpp
  • src/model/diffusion/fibo2.hpp
  • src/model/diffusion/flux.hpp
  • src/model/diffusion/flux3.hpp
  • src/model/diffusion/hidream_o1.hpp
  • src/model/diffusion/krea2.hpp
  • src/model/diffusion/ltxv.hpp
  • src/model/diffusion/mage_flow.hpp
  • src/model/diffusion/model.hpp
  • src/model/diffusion/qwen_image.hpp
  • src/model/diffusion/qwen_image_2_1.hpp
  • src/model/diffusion/relay_vsr.cpp
  • src/model/diffusion/relay_vsr.hpp
  • src/model/diffusion/seedvr2.hpp
  • src/model/diffusion/unet.hpp
  • src/model/diffusion/z_image.hpp
  • src/model/integrations/anima.cpp
  • src/model/integrations/boogu_image.cpp
  • src/model/integrations/ernie_image.cpp
  • src/model/integrations/fibo2.cpp
  • src/model/integrations/flux.cpp
  • src/model/integrations/flux2.cpp
  • src/model/integrations/flux3.cpp
  • src/model/integrations/hidream_o1.cpp
  • src/model/integrations/hunyuan_video.cpp
  • src/model/integrations/ideogram4.cpp
  • src/model/integrations/iris.cpp
  • src/model/integrations/krea2.cpp
  • src/model/integrations/lens.cpp
  • src/model/integrations/lingbot_video.cpp
  • src/model/integrations/llada_image.cpp
  • src/model/integrations/longcat.cpp
  • src/model/integrations/ltxav.cpp
  • src/model/integrations/mage_flow.cpp
  • src/model/integrations/ming_image.cpp
  • src/model/integrations/minimax_h3.cpp
  • src/model/integrations/minit2i.cpp
  • src/model/integrations/moss_image.cpp
  • src/model/integrations/pid.cpp
  • src/model/integrations/pixart.cpp
  • src/model/integrations/qwen_image.cpp
  • src/model/integrations/sd.cpp
  • src/model/integrations/sd3.cpp
  • src/model/integrations/seedvr2.cpp
  • src/model/integrations/sensenova_u1.cpp
  • src/model/integrations/wan.cpp
  • src/model/integrations/z_image.cpp
  • src/model/integrations/z_image_l2p.cpp
  • src/model/te/clip.hpp
  • src/model/te/ltx_connector.hpp
  • src/model/te/ming_image_te.hpp
  • src/model/te/ph3_image_connector.hpp
  • src/model/upscaler/flash_vsr.hpp
  • src/model/upscaler/scale.cpp
  • src/model/upscaler/scale.hpp
  • src/model/vae/audio_geometry.hpp
  • src/model/vae/auto_encoder_kl.hpp
  • src/model/vae/geometry.hpp
  • src/model/vae/hunyuan_vae.hpp
  • src/model/vae/ltx_vae.hpp
  • src/model/vae/mage_vae.hpp
  • src/model/vae/minimax_h3_vae.hpp
  • src/model/vae/seedvr2_vae.hpp
  • src/model/vae/tae.hpp
  • src/model/vae/vae.hpp
  • src/model/vae/wan_vae.hpp
  • src/model_build_context.cpp
  • src/model_build_context.h
  • src/model_component.h
  • src/model_definition.h
  • src/model_io/npy_io.cpp
  • src/model_io/npy_io.h
  • src/model_loader.cpp
  • src/model_loader.h
  • src/model_loader_files.cpp
  • src/model_manager.cpp
  • src/model_manager.h
  • src/model_manager_files.cpp
  • src/model_manager_prefetch.cpp
  • src/model_registry.cpp
  • src/name_conversion.cpp
  • src/pipeline/diffusion_engine.cpp
  • src/pipeline/diffusion_engine.h
  • src/pipeline/generation.h
  • src/pipeline/image.cpp
  • src/pipeline/relay_vsr.cpp
  • src/pipeline/request.cpp
  • src/pipeline/request.h
  • src/pipeline/seedvr2.cpp
  • src/pipeline/video.cpp
  • src/pipeline/video_upscale.cpp
  • src/pipeline/video_upscale.h
  • src/runtime/cache_dit.hpp
  • src/runtime/denoiser.hpp
  • src/runtime/easycache.hpp
  • src/runtime/guidance.h
  • src/runtime/image_preprocess.cpp
  • src/runtime/image_preprocess.h
  • src/runtime/latent-preview.h
  • src/runtime/sample-cache.cpp
  • src/runtime/sample-cache.h
  • src/runtime/spectrum.hpp
  • src/runtime/ucache.hpp
  • src/stable-diffusion.cpp
  • src/tokenizers/tokenizer_config.cpp
  • src/tokenizers/tokenizer_config.h
  • src/upscaler.cpp
  • src/upscaler.h

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@Green-Sky

Copy link
Copy Markdown
Contributor

This pr is insane.

@leejet
leejet merged commit 6cd0ef1 into master Nov 22, 2026
11 checks passed
@leejet
leejet deleted the dgl branch November 22, 2026 17:28
filve pushed a commit to filve/diffusione-in-tempo-reale that referenced this pull request Nov 24, 2026
…art 2)

Brings in the Diffusion Graph Language runtime (leejet#2396) and the commits
after it: MOSS-Image edit LoRAs (leejet#2203), runtime LoRA counts (leejet#2400),
immediate LoRA merges for INT8 weights (leejet#2403), one server context with
on-demand model loading (leejet#2404), Qwen Image 2.1 prefix caching (leejet#2405)
and idle TTLs for model weights (leejet#2406). The server changes of leejet#2404
and leejet#2406 come in the same merge so that sd-server is ported once.

src/pipeline and src/stable-diffusion.cpp are gone; the fork's
additions move into the graph runtime:
- CPU fallback: ModelRuntime::configure_backends() falls back to the cpu
  backend, with a warning, when a module's backend cannot be
  initialized; disable_backend_fallback (also a DGL context option)
  makes it fail with SD_ERROR_BACKEND instead.
- memory_guard is a DGL context option for the context's ModelManager.
  ModelManager::ResourceHandle, the residency manager the models use,
  forwards the guard hooks and honours the prefetch suspension.
- layer_split_fill is applied when the context is created; multi_gpu is
  checked there. The multi-GPU planner, which upstream no longer calls,
  picks the device of each module when auto-fit is on, more than one
  GPU is present and no backend was given (planned_backend_spec() in
  src/api/generation_program.cpp); the run plan places the weights.
- The SD2 v-parameterization probe reports a failed compute instead of
  aborting.
- sd_ctx_create, sd_ctx_set_model_options*, sd_generate_image and
  sd_generate_video record the error code again; a load failure with no
  deeper cause is model_file.

sd-server keeps the ContextKeeper as the owner of the context:
- requests pick their model as upstream does (recipe and models in the
  body); the switch goes through ContextKeeper::load(), so the profile
  ladder and the recovery cover it too;
- sd_ctx_mutex serializes model switches, generations and DGL scripts;
  a DGL script runs on the keeper's context, or on a temporary one while
  no model is loaded (ContextKeeper::with_context()); the idle TTL
  release does not wait for a running generation (try_with_context());
- every context the keeper creates gets the server's file-access policy
  (create_context_from_params() + apply_server_file_access());
- /sdcpp/v1/models/load and /unload stay, rebuilt on
  resolve_model_selection(), as do /sdcpp/v1/health and /resources;
- /sdcpp/v1/upscale and the server-side ADetailer go, as upstream did:
  both are DGL scripts now.

Tests: memory_guard_engine_test follows the new capacity hook;
server_recovery_test checks with_context() and try_with_context()
(red with both behaviours broken); api_robustness expects a missing
model file at the first generation, where the weights load now;
server_cancel_e2e.py uses 100 steps, the server's maximum.

docs: the C API section of docs/integrazione_progetti.md uses the
opaque options; backend.md says what the multi-GPU planner decides
with DGL; api.md documents the kept load/unload routes.

Verified with a CPU build: the library, sd-cli and sd-server build; all
nine unit-test programs pass, server_recovery_test eight times in a row
and twice under TSan with no warnings; with a synthetic SD 1.5 model
(random weights) sd-cli generates, falls back to the cpu backend for
--backend vulkan0 and fails as backend with --disable-backend-fallback,
and test/server_cancel_e2e.py passes its 35 checks against a real
sd-server. A scratch smoke test of the server (20 checks: no model, DGL
jobs with and without a model, models/load and unload, a job that picks
its model, the idle release) passes too.

Claude-Session: https://claude.ai/code/session_01EhZzDBkuuMp1jBf4WtEySC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants