From 6a68a98599d75cd1a48ab0ef987ee2d24f555cd6 Mon Sep 17 00:00:00 2001 From: Drew VanDine Date: Fri, 5 Jun 2026 09:08:23 -0400 Subject: [PATCH] ci: fix CUDA compilation and bundle all ggml shared libs Add -DGGML_CUDA=ON and -DCMAKE_CUDA_COMPILER explicitly to the Linux CUDA cmake invocation so CUDA is actually compiled instead of silently falling back to CPU when auto-detection fails. Widen the ggml artifact collection from libggml-cuda.so only to libggml*.so* (Linux) and ggml*.dll (Windows) to capture all ggml shared libraries (core, base backend, cuda backend) regardless of where cmake places them in the build tree. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/build.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 522cf1cf2..89a29563b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -152,7 +152,9 @@ jobs: cmake_arch="${cmake_arch#sm_}" cmake -B build -S . \ -DSD_CUBLAS=ON \ + -DGGML_CUDA=ON \ -DCMAKE_CUDA_ARCHITECTURES="${cmake_arch}" \ + -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \ -DGGML_NATIVE=OFF \ -DSD_BUILD_SHARED_LIBS=ON \ -DCMAKE_BUILD_TYPE=Release @@ -166,9 +168,9 @@ jobs: cp -av ${cuda_lib}/libcublasLt.so* build/bin/ cp -av ${cuda_lib}/libcurand.so* build/bin/ cp -av ${cuda_lib}/libnvJitLink.so* build/bin/ - # ggml-cuda is a build artifact (backend plugin); copy it into bin/ if - # cmake placed it outside build/bin/ (e.g. build/ggml/src/) - find build -name 'libggml-cuda.so*' ! -path 'build/bin/*' -exec cp -av {} build/bin/ \; + # Copy all ggml shared libs (libggml.so, libggml-base.so, libggml-cuda.so, etc.) + # from wherever cmake placed them outside build/bin/ into the distribution dir. + find build -name 'libggml*.so*' ! -path 'build/bin/*' -exec cp -av {} build/bin/ \; - name: Set RPATH for portable distribution run: | @@ -278,12 +280,11 @@ jobs: if (-not $dll) { throw "Required CUDA runtime DLL matching '$pattern' was not found in $cudaBin" } Copy-Item $dll.FullName .\build\bin\Release } - # ggml-cuda.dll is a build artifact (backend plugin); copy into Release/ - # if cmake placed it outside build\bin\Release\ (e.g. build\ggml\src\Release\) - $ggmlCuda = Get-ChildItem -Path build -Filter 'ggml-cuda.dll' -Recurse | + # Copy all ggml DLLs (ggml.dll, ggml-base.dll, ggml-cuda.dll, etc.) + # from wherever cmake placed them outside build\bin\Release\ into the distribution dir. + Get-ChildItem -Path build -Filter 'ggml*.dll' -Recurse | Where-Object { $_.FullName -notlike '*\bin\Release\*' } | - Select-Object -First 1 - if ($ggmlCuda) { Copy-Item $ggmlCuda.FullName .\build\bin\Release\ } + ForEach-Object { Copy-Item $_.FullName .\build\bin\Release\ -Force } 7z a sd-${{ env.BRANCH_NAME }}-${{ steps.commit.outputs.short }}-windows-cuda-${{ matrix.sm }}-x64.zip .\build\bin\Release\* - name: Upload artifacts