diff --git a/docs/ecosystem.md b/docs/ecosystem.md index dc150c2e..f5a4fd78 100644 --- a/docs/ecosystem.md +++ b/docs/ecosystem.md @@ -30,3 +30,4 @@ applications that integrate it as an image generation backend. - [NodeTool](https://github.com/nodetool-ai/nodetool) - [Quo](https://github.com/quo-ai/quo) - [Prisme](https://github.com/d3Ita/prisme) +- [Off Grid AI](https://github.com/off-grid-ai/OGAD) diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index f4bbb2ed..c9bd8e08 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -77,3 +77,32 @@ If the problem persists after trying the relevant steps above, [submit a bug report](https://github.com/leejet/stable-diffusion.cpp/issues/new?template=bug_report.yml). Include your full command, backend and hardware, model and weight format, logs, and the scale values you tried with their results. + +## Windows: process exits immediately with 0xC0000135 (STATUS_DLL_NOT_FOUND) + +`sd-cli.exe` / `sd-server.exe` from the Windows ROCm prebuilt may exit with +`0xC0000135` (`STATUS_DLL_NOT_FOUND`) and no output when the HIP runtime is +not on `PATH`. `stable-diffusion.dll` statically imports `hipblas.dll` and +`libhipblaslt.dll`, but the release archive only bundles `amd_comgr.dll`, +`amdhip64_7.dll` and `rocm_kpack.dll`. This is a loader failure, unrelated to +`--audio-vae` or other generation options; `0xC000001D` +(`STATUS_ILLEGAL_INSTRUCTION`) would instead indicate a CPU instruction issue. + +Fix: prepend the ROCm SDK `bin` directories to `PATH` — with the Python ROCm +wheels these are `\Lib\site-packages\_rocm_sdk_libraries\bin` and +`_rocm_sdk_core\bin`. Do not copy individual DLLs: `rocblas.dll` and +`libhipblaslt.dll` also need their sibling `rocblas\` and `hipblaslt\` data +directories. + +Verify: + +```powershell +.\sd-cli.exe --version +'0x{0:X8}' -f $LASTEXITCODE +``` + +Expect the version string and `0x00000000`. If it still fails, inspect the +whole DLL chain (`sd-cli.exe` -> `stable-diffusion.dll` -> ...): `dumpbin +/dependents` lists only one image's direct imports, so use +[Dependencies](https://github.com/lucasg/Dependencies) or also check +`stable-diffusion.dll` to find the missing module. diff --git a/examples/server/README.md b/examples/server/README.md index 7ca218b7..ebfe4a5b 100644 --- a/examples/server/README.md +++ b/examples/server/README.md @@ -114,6 +114,14 @@ total work is unknown. The canvas keeps the submitted output aspect ratio, and stage changes keep the same layout. Editing the next request's resolution does not resize the current preview or result. +Settings will offer **Notify me when generation finishes** (upcoming; requires +a frontend update). When enabled, the UI requests browser notification +permission and shows a notification when a generation job completes, fails, or +is cancelled, so you do not need to watch the tab while waiting. The +preference is saved locally. Notifications require granting browser +notification permission; if permission was previously denied, reset it in the +browser's site settings for this site before turning the setting on. + ### LoRAs To apply a LoRA, open **LoRA**, select a compatible file, and set its diff --git a/src/core/ggml_compat.cpp b/src/core/ggml_compat.cpp index 061b3370..f6e8e7fc 100644 --- a/src/core/ggml_compat.cpp +++ b/src/core/ggml_compat.cpp @@ -151,17 +151,6 @@ bool ggml_graph_cpy_use_counts(const ggml_cgraph* src, ggml_cgraph* dst) { } return true; } - -ggml_status ggml_backend_graph_compute_async_range(ggml_backend_t backend, ggml_cgraph* graph, int first, int last) { - if (!backend || !graph || first < 0 || last < first || last > graph->n_nodes) { - return GGML_STATUS_FAILED; - } - if (first == last) { - return GGML_STATUS_SUCCESS; - } - auto view = ggml_graph_view(graph, first, last); - return ggml_backend_graph_compute_async(backend, &view); -} #endif #ifdef SD_USE_UPSTREAM_GGML diff --git a/src/core/ggml_compat.h b/src/core/ggml_compat.h index 9f64262f..9a367a8b 100644 --- a/src/core/ggml_compat.h +++ b/src/core/ggml_compat.h @@ -29,13 +29,6 @@ bool ggml_graph_cpy_mapped(const struct ggml_cgraph* src, struct ggml_cgraph* ds // This preserves external consumers when constructing an inference graph segment. bool ggml_graph_cpy_use_counts(const struct ggml_cgraph* src, struct ggml_cgraph* dst); -// Executes nodes [first, last) with the original graph's use counts. No graph ownership -// is transferred. Tensor storage must already be allocated; invalid bounds fail. -enum ggml_status ggml_backend_graph_compute_async_range(ggml_backend_t backend, - struct ggml_cgraph* graph, - int first, - int last); - #else #error "Patched ggml requires ggml-graph.h; select SD_USE_UPSTREAM_GGML for upstream compatibility" #endif diff --git a/src/core/ggml_extend_backend.cpp b/src/core/ggml_extend_backend.cpp index c314843e..ece1c630 100644 --- a/src/core/ggml_extend_backend.cpp +++ b/src/core/ggml_extend_backend.cpp @@ -637,50 +637,6 @@ void sd_backend_clear_buffer_cache(ggml_backend_t backend) { } } -ggml_status sd_backend_graph_compute_with_eval_callback(ggml_backend_t backend, - ggml_cgraph* gf, - sd_graph_eval_callback_t callback_eval, - void* callback_eval_user_data) { - if (callback_eval == nullptr) { - return ggml_backend_graph_compute(backend, gf); - } - - ggml_status status = GGML_STATUS_SUCCESS; - const int n_nodes = ggml_graph_n_nodes(gf); - bool stopped = false; - - for (int j0 = 0; j0 < n_nodes; ++j0) { - ggml_tensor* t = ggml_graph_node(gf, j0); - bool need = callback_eval(t, true, callback_eval_user_data); - int j1 = j0; - - while (!need && j1 < n_nodes - 1) { - t = ggml_graph_node(gf, ++j1); - need = callback_eval(t, true, callback_eval_user_data); - } - - status = ggml_backend_graph_compute_async_range(backend, gf, j0, j1 + 1); - if (status != GGML_STATUS_SUCCESS) { - break; - } - - ggml_backend_synchronize(backend); - - if (need && !callback_eval(t, false, callback_eval_user_data)) { - stopped = true; - break; - } - - j0 = j1; - } - - ggml_backend_synchronize(backend); - if (stopped && status == GGML_STATUS_SUCCESS) { - status = GGML_STATUS_ABORTED; - } - return status; -} - const char* sd_get_system_info() { static std::string cache_info = []() -> std::string { ggml_backend_load_all_once(); diff --git a/src/core/ggml_extend_backend.h b/src/core/ggml_extend_backend.h index 0e0c4342..634c888f 100644 --- a/src/core/ggml_extend_backend.h +++ b/src/core/ggml_extend_backend.h @@ -102,10 +102,6 @@ bool sd_backend_cpu_set_n_threads(ggml_backend_t backend_cpu, int n_threads); void sd_backend_set_buffer_cache_enabled(ggml_backend_t backend, bool enabled); void sd_backend_clear_buffer_cache(ggml_backend_t backend); -ggml_status sd_backend_graph_compute_with_eval_callback(ggml_backend_t backend, - ggml_cgraph* gf, - sd_graph_eval_callback_t callback_eval, - void* callback_eval_user_data); std::string sd_backend_resolve_name(const std::string& name); bool sd_parse_backend_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error); bool sd_parse_flash_attention_assignment(const std::string& spec, SDBackendAssignment* assignment, std::string* error); diff --git a/src/model/vae/hunyuan_vae.hpp b/src/model/vae/hunyuan_vae.hpp index ff2b2bb6..567a7043 100644 --- a/src/model/vae/hunyuan_vae.hpp +++ b/src/model/vae/hunyuan_vae.hpp @@ -140,8 +140,15 @@ namespace Hunyuan { } return input; }; - padded = replicate_pad(padded, 0, pad_w, pad_w); - padded = replicate_pad(padded, 1, pad_h, pad_h); + if (pad_w > 0 || pad_h > 0) { + const int64_t frames = padded->ne[2]; + const int64_t channels = padded->ne[3]; + // Keep spatial padding in one outer slice to avoid per-channel CUDA launches. + padded = ggml_reshape_3d(ctx->ggml_ctx, ggml_ext_cont(ctx, padded), padded->ne[0], padded->ne[1], frames * channels); + padded = replicate_pad(padded, 0, pad_w, pad_w); + padded = replicate_pad(padded, 1, pad_h, pad_h); + padded = ggml_reshape_4d(ctx->ggml_ctx, padded, padded->ne[0], padded->ne[1], frames, channels); + } return conv->forward(ctx, padded); } }; diff --git a/src/model/vae/minimax_h3_vae.hpp b/src/model/vae/minimax_h3_vae.hpp index 3010cb82..2e3a6e52 100644 --- a/src/model/vae/minimax_h3_vae.hpp +++ b/src/model/vae/minimax_h3_vae.hpp @@ -100,8 +100,15 @@ namespace MiniMaxH3VAE { return value; }; - x = reflect_pad(x, 0, std::get<2>(temporal_padding)); - x = reflect_pad(x, 1, std::get<1>(temporal_padding)); + if (std::get<1>(temporal_padding) != 0 || std::get<2>(temporal_padding) != 0) { + const int64_t frames = x->ne[2]; + const int64_t channels = x->ne[3]; + // Keep spatial padding in one outer slice to avoid per-channel CUDA launches. + x = ggml_reshape_3d(ctx->ggml_ctx, ggml_ext_cont(ctx, x), x->ne[0], x->ne[1], frames * channels); + x = reflect_pad(x, 0, std::get<2>(temporal_padding)); + x = reflect_pad(x, 1, std::get<1>(temporal_padding)); + x = ggml_reshape_4d(ctx->ggml_ctx, x, x->ne[0], x->ne[1], frames, channels); + } int temporal_pad = std::get<0>(temporal_padding) * 2; if (temporal_pad > 0) { x = ggml_ext_pad_ext(ctx, @@ -167,10 +174,14 @@ namespace MiniMaxH3VAE { ggml_tensor* forward(GGMLRunnerContext* ctx, ggml_tensor* x) { if (spatial_stride == 2) { GGML_ASSERT(x->ne[0] > 1 && x->ne[1] > 1); - auto right = ggml_ext_slice(ctx, x, 0, x->ne[0] - 2, x->ne[0] - 1); - x = ggml_concat(ctx->ggml_ctx, x, right, 0); - auto bottom = ggml_ext_slice(ctx, x, 1, x->ne[1] - 2, x->ne[1] - 1); - x = ggml_concat(ctx->ggml_ctx, x, bottom, 1); + const int64_t frames = x->ne[2]; + const int64_t channels = x->ne[3]; + x = ggml_reshape_3d(ctx->ggml_ctx, ggml_ext_cont(ctx, x), x->ne[0], x->ne[1], frames * channels); + auto right = ggml_ext_slice(ctx, x, 0, x->ne[0] - 2, x->ne[0] - 1); + x = ggml_concat(ctx->ggml_ctx, x, right, 0); + auto bottom = ggml_ext_slice(ctx, x, 1, x->ne[1] - 2, x->ne[1] - 1); + x = ggml_concat(ctx->ggml_ctx, x, bottom, 1); + x = ggml_reshape_4d(ctx->ggml_ctx, x, x->ne[0], x->ne[1], frames, channels); } return std::dynamic_pointer_cast(blocks["conv"])->forward(ctx, x); } diff --git a/src/model_io/safetensors_io.cpp b/src/model_io/safetensors_io.cpp index 05860626..29b94eb8 100644 --- a/src/model_io/safetensors_io.cpp +++ b/src/model_io/safetensors_io.cpp @@ -147,6 +147,10 @@ static bool read_comfy_quant_config(std::ifstream& file, config.convrot = true; config.group_size = json.value("convrot_groupsize", 256); } + if (config.format == "asym_w4a8_int8") { + // ComfyUI defaults the W4A8 weight group size to 16 when the key is missing. + config.weight_group_size = json.value("group_size", 16); + } } catch (const std::exception&) { set_error(error, "parsing ComfyUI quantization metadata tensor failed: '" + tensor_name + "'"); return false;