mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-12 11:56:36 +00:00
refactor: consolidate graph helpers in sd.cpp
This commit is contained in:
1 parent
6cfc3572f7
commit
ee12f0ea97
8 files changed
+62
-78
No files matched your search
+5
-4
@@ -33,8 +33,9 @@ cmake --build build-upstream --config Release
|
||||
```
|
||||
|
||||
Both patched and upstream builds use the selected library and matching private
|
||||
headers for backend integration. Backend options such as `-DSD_CUDA=ON` apply
|
||||
to the selected tree as usual.
|
||||
headers for application graph helpers and backend integration. The generic
|
||||
operator registration API remains in `ggml-ext.h`. Backend options such as
|
||||
`-DSD_CUDA=ON` apply to the selected tree as usual.
|
||||
|
||||
`SD_USE_UPSTREAM_GGML` defaults to `OFF`, which enables the patched GGML
|
||||
extensions. Set it to `ON` when using upstream GGML; it selects the compatibility
|
||||
@@ -52,8 +53,8 @@ quantization types remain available, subject to backend operator support.
|
||||
|
||||
`SD_USE_SYSTEM_GGML=ON` instead links an installed GGML CMake package, located
|
||||
with `ggml_DIR` or `CMAKE_PREFIX_PATH`. An installed patched package must include
|
||||
the extension and graph APIs. Set `SD_GGML_SOURCE_DIR` to its matching source
|
||||
tree for private backend headers, including CUDA/HIP/MUSA vendor headers.
|
||||
the extension API. Set `SD_GGML_SOURCE_DIR` to its matching source tree for
|
||||
private graph and backend headers, including CUDA/HIP/MUSA vendor headers.
|
||||
The installed library must use the same ABI settings as sd.cpp,
|
||||
including `GGML_MAX_NAME`. For an upstream package, also set
|
||||
`SD_USE_UPSTREAM_GGML=ON` and point `SD_GGML_SOURCE_DIR` to its matching source
|
||||
|
||||
+10
-14
@@ -448,22 +448,18 @@ kernel compiled for SM80 or newer. CPU, HIP, MUSA, and Vulkan do not advertise
|
||||
support. ggml no longer contains a Sol-Attn opcode, constructor, allocation rule,
|
||||
or backend kernel.
|
||||
|
||||
## Public graph access
|
||||
## Internal graph access
|
||||
|
||||
`ggml-graph.h` exposes leaf enumeration, append-only leaf construction, recorded
|
||||
use counts, mapped inference-graph copying, use-count copying for segments, and
|
||||
backend execution of a node range. Mapped copies retain node order and consumer
|
||||
counts from the original graph, including consumers outside a graph view. The
|
||||
caller owns tensor copies and remaps their storage and edges; invalid mappings
|
||||
leave the destination graph unchanged. Range execution uses already allocated
|
||||
tensors and retains the original graph's consumer counts.
|
||||
`src/core/ggml_compat.cpp` uses `ggml-impl.h` for leaf enumeration, graph copying,
|
||||
use-count preservation and range execution. Patched and upstream builds share
|
||||
this implementation; ggml does not expose a separate public graph API for these
|
||||
application helpers. Mapped copies retain node order and consumer counts,
|
||||
including consumers outside a graph view. Invalid mappings leave the destination
|
||||
unchanged. Workspace measurement, graph cuts and evaluation callbacks use these
|
||||
helpers.
|
||||
|
||||
Workspace measurement, graph cuts, and evaluation callbacks use these APIs.
|
||||
Backend extensions require matching private headers. Compatibility with an
|
||||
upstream ggml lacking this header is isolated in `src/core/ggml_compat.cpp`; that
|
||||
optional build still requires matching upstream private headers. The compatibility
|
||||
layer also retains the workaround for old Metal backends wrapping failed host
|
||||
mappings. The patched Metal backend returns null directly when mapping fails.
|
||||
The compatibility layer also retains the workaround for old Metal backends
|
||||
wrapping failed host mappings. The patched Metal backend returns null directly.
|
||||
|
||||
Vulkan command recording services are declared in the private
|
||||
`ggml/src/ggml-ext-vulkan.h`. Pipeline ownership, submission and synchronization
|
||||
|
||||
Reference in new issue
Block a user