mirror of
https://github.com/mudler/LocalAI.git
synced 2026-09-18 18:59:29 -04:00
fix(stablediffusion): embed Metal library (#11531)
The Darwin workflow passes BUILD_TYPE=metal but does not define OS=Darwin. The backend therefore omitted its Metal CMake flags and shipped the runtime source path instead of the embedded library. Map the requested build type directly to the Metal flags and guard the build contract with a dry-run regression test. Assisted-by: Codex:gpt-5 Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
This commit is contained in:
1 parent
9f17f5e76c
commit
ce8a04fe46
2 files changed
+25
-9
No files matched your search
@@ -42,13 +42,9 @@ else ifeq ($(BUILD_TYPE),hipblas)
|
||||
CMAKE_ARGS+=-DSD_HIPBLAS=ON -DGGML_HIPBLAS=ON -DAMDGPU_TARGETS=$(AMDGPU_TARGETS)
|
||||
else ifeq ($(BUILD_TYPE),vulkan)
|
||||
CMAKE_ARGS+=-DSD_VULKAN=ON -DGGML_VULKAN=ON
|
||||
else ifeq ($(OS),Darwin)
|
||||
ifneq ($(BUILD_TYPE),metal)
|
||||
CMAKE_ARGS+=-DSD_METAL=OFF -DGGML_METAL=OFF
|
||||
else
|
||||
CMAKE_ARGS+=-DSD_METAL=ON -DGGML_METAL=ON
|
||||
CMAKE_ARGS+=-DGGML_METAL_EMBED_LIBRARY=ON
|
||||
endif
|
||||
else ifeq ($(BUILD_TYPE),metal)
|
||||
CMAKE_ARGS+=-DSD_METAL=ON -DGGML_METAL=ON
|
||||
CMAKE_ARGS+=-DGGML_METAL_EMBED_LIBRARY=ON
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_TYPE),sycl_f16)
|
||||
@@ -72,7 +68,6 @@ sources/stablediffusion-ggml.cpp:
|
||||
git checkout $(STABLEDIFFUSION_GGML_VERSION) && \
|
||||
git submodule update --init --recursive --depth 1 --single-branch
|
||||
|
||||
# Detect OS
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
# Only build CPU variants on Linux
|
||||
@@ -134,4 +129,4 @@ libgosd-custom: CMakeLists.txt cpp/gosd.cpp cpp/gosd.h
|
||||
(mv build-$(SO_TARGET)/libgosd.so ./$(SO_TARGET) 2>/dev/null || \
|
||||
mv build-$(SO_TARGET)/libgosd.dylib ./$(SO_TARGET) 2>/dev/null)
|
||||
|
||||
all: stablediffusion-ggml package
|
||||
all: stablediffusion-ggml package
|
||||
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CURDIR=$(dirname "$(realpath "$0")")
|
||||
BACKEND_DIR="$CURDIR/../../backend/go/stablediffusion-ggml"
|
||||
|
||||
build_commands=$(make -Bn -C "$BACKEND_DIR" \
|
||||
BUILD_TYPE=metal \
|
||||
libgosd-fallback.so)
|
||||
|
||||
for expected_flag in \
|
||||
-DSD_METAL=ON \
|
||||
-DGGML_METAL=ON \
|
||||
-DGGML_METAL_EMBED_LIBRARY=ON; do
|
||||
if ! grep -Fq -- "$expected_flag" <<<"$build_commands"; then
|
||||
echo "FAIL: Darwin Metal build omitted $expected_flag"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "PASS: stablediffusion-ggml embeds its Darwin Metal library"
|
||||
Reference in new issue
Block a user