Skip to content

Commit 35112de

Browse files
committed
ci(linux): build fat package — GGML_BACKEND_DL + GGML_CPU_ALL_VARIANTS
Replace the AVX2/FMA/F16C portable baseline (#3) with a fat-package build that produces one libstable-diffusion.so plus a libggml-cpu-*.so per CPU variant — sandybridge, haswell, skylakex (AVX-512F), icelake (AVX-512 + VNNI), alderlake (AVX-512 + VNNI + DOTPROD), and a pure-x64 fallback. At runtime ggml dlopens the variants and picks the highest-tier one the host CPU supports. AVX-512 hosts get AVX-512 perf; older boxes fall back gracefully — no -march=native runner lottery, no SIGILL. Tradeoff: zip grows from ~12 MB → ~50–80 MB. Acceptable for a one-time download, especially since downstream consumers (Lemonade) cache the extracted directory across model loads. Applied to ubuntu-latest-cmake (CPU) and ubuntu-latest-rocm (HIP), since the HIPBLAS build still uses ggml CPU ops for parts of the pipeline. Windows AVX2 already pins GGML_NATIVE=OFF + AVX2 only, and macOS arm64 shares a uniform NEON+DOTPROD+i8mm+bf16 baseline across all Apple Silicon generations, so neither needs the same treatment. Upstream PR leejet#1448 (commit b8079e2) wired the runtime backend discovery code into libstable-diffusion.so already; this just enables the build flag that produces the variant .so files.
1 parent b6f38cd commit 35112de

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

.github/workflows/build.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ jobs:
5353
run: |
5454
mkdir build
5555
cd build
56-
# Disable -march=native and pin CPU instruction set to AVX2+FMA+F16C so
57-
# the released x86_64 binary runs on hosts without AVX-512.
58-
# Without GGML_NATIVE=OFF, ggml's CMake auto-enables every extension
59-
# the build runner's CPU has (including AVX-512 on Azure Xeon
60-
# Platinum 8370C runners), which then SIGILLs on AVX-512-less hosts.
56+
# Build a fat package: one libstable-diffusion.so plus a libggml-cpu-*.so
57+
# per CPU variant (sandybridge, haswell, skylakex, icelake, alderlake,
58+
# x64). At runtime ggml dlopens whichever variant is highest-priority on
59+
# the host CPU, so an AVX-512 host gets AVX-512 perf and an AVX-512-less
60+
# host falls back to haswell — same zip, no -march=native runner
61+
# lottery, no SIGILL.
6162
cmake .. \
6263
-DGGML_NATIVE=OFF \
63-
-DGGML_AVX2=ON \
64-
-DGGML_FMA=ON \
65-
-DGGML_F16C=ON \
64+
-DGGML_BACKEND_DL=ON \
65+
-DGGML_CPU_ALL_VARIANTS=ON \
6666
-DSD_BUILD_SHARED_LIBS=ON
6767
cmake --build . --config Release
6868
@@ -513,16 +513,16 @@ jobs:
513513
run: |
514514
mkdir build
515515
cd build
516-
# Same portability concern as ubuntu-latest-cmake: pin the host CPU
517-
# instruction set so the binary runs on AVX-512-less ROCm hosts too.
516+
# Fat package: same approach as ubuntu-latest-cmake. The HIPBLAS build
517+
# still uses ggml's CPU ops for parts of the pipeline (CLIP encoding,
518+
# etc.), so it benefits from per-CPU variants the same way.
518519
cmake .. -G Ninja \
519520
-DCMAKE_HIP_COMPILER="$(hipconfig -l)/clang" \
520521
-DCMAKE_HIP_FLAGS="-mllvm --amdgpu-unroll-threshold-local=600" \
521522
-DCMAKE_BUILD_TYPE=Release \
522523
-DGGML_NATIVE=OFF \
523-
-DGGML_AVX2=ON \
524-
-DGGML_FMA=ON \
525-
-DGGML_F16C=ON \
524+
-DGGML_BACKEND_DL=ON \
525+
-DGGML_CPU_ALL_VARIANTS=ON \
526526
-DSD_HIPBLAS=ON \
527527
-DHIP_PLATFORM=amd \
528528
-DGPU_TARGETS="${{ matrix.gpu_targets }}" \

0 commit comments

Comments
 (0)