Repository navigation
Conversation
|
Important Review skippedToo 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.
|
Contributor
|
This pr is insane. |
1 task
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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.generation_infoand expose metadata inspection and encoding through the C API.Related Issue / Discussion
N/A
Additional Information
N/A
Checklist