From 9ecd7331c2ebe498811951da6ebaf4f238f9c8dd Mon Sep 17 00:00:00 2001 From: Wagner Bruna Date: Tue, 23 Jun 2026 11:57:56 -0300 Subject: [PATCH 01/10] ci: use dynamic cpu backends for released binaries --- .github/workflows/build.yml | 44 ++++++++++++++++--------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df4c07d45..499de152c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -83,7 +83,7 @@ jobs: run: | mkdir build cd build - cmake .. -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON + cmake .. -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='$ORIGIN' cmake --build . --config Release - name: Get commit hash @@ -146,7 +146,7 @@ jobs: run: | mkdir build cd build - cmake .. -DSD_BUILD_SHARED_LIBS=ON -DSD_VULKAN=ON + cmake .. -DSD_BUILD_SHARED_LIBS=ON -DSD_VULKAN=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON -DCMAKE_INSTALL_RPATH='$ORIGIN' cmake --build . --config Release - name: Get commit hash @@ -341,18 +341,12 @@ jobs: strategy: matrix: include: - - build: "noavx" - defines: "-DGGML_NATIVE=OFF -DGGML_AVX=OFF -DGGML_AVX2=OFF -DGGML_FMA=OFF -DSD_BUILD_SHARED_LIBS=ON" - - build: "avx2" - defines: "-DGGML_NATIVE=OFF -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON" - - build: "avx" - defines: "-DGGML_NATIVE=OFF -DGGML_AVX=ON -DGGML_AVX2=OFF -DSD_BUILD_SHARED_LIBS=ON" - - build: "avx512" - defines: "-DGGML_NATIVE=OFF -DGGML_AVX512=ON -DGGML_AVX=ON -DGGML_AVX2=ON -DSD_BUILD_SHARED_LIBS=ON" + - build: "cpuonly" + defines: "-DGGML_NATIVE=OFF -DSD_BUILD_SHARED_LIBS=ON -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON" - build: "cuda12" - defines: "-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe \"--diag_suppress=177\" -Xcudafe \"--diag_suppress=550\"'" + defines: "-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe \"--diag_suppress=177\" -Xcudafe \"--diag_suppress=550\"' -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON" - build: "vulkan" - defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON" + defines: "-DSD_VULKAN=ON -DSD_BUILD_SHARED_LIBS=ON -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON" steps: - name: Clone id: checkout @@ -400,19 +394,6 @@ jobs: cmake .. -DCMAKE_CXX_FLAGS='/bigobj' -G Ninja -DCMAKE_C_COMPILER=cl.exe -DCMAKE_CXX_COMPILER=cl.exe -DCMAKE_BUILD_TYPE=Release ${{ matrix.defines }} cmake --build . - - name: Check AVX512F support - id: check_avx512f - if: ${{ matrix.build == 'avx512' }} - continue-on-error: true - run: | - cd build - $vcdir = $(vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath) - $msvc = $(join-path $vcdir $('VC\Tools\MSVC\'+$(gc -raw $(join-path $vcdir 'VC\Auxiliary\Build\Microsoft.VCToolsVersion.default.txt')).Trim())) - $cl = $(join-path $msvc 'bin\Hostx64\x64\cl.exe') - echo 'int main(void){unsigned int a[4];__cpuid(a,7);return !(a[1]&65536);}' >> avx512f.c - & $cl /O2 /GS- /kernel avx512f.c /link /nodefaultlib /entry:main - .\avx512f.exe && echo "AVX512F: YES" && ( echo HAS_AVX512F=1 >> $env:GITHUB_ENV ) || echo "AVX512F: NO" - - name: Get commit hash id: commit if: ${{ ( github.event_name == 'push' && github.ref == 'refs/heads/master' ) || github.event.inputs.create_release == 'true' }} @@ -529,6 +510,9 @@ jobs: -DSD_HIPBLAS=ON ` -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` + -DSD_BUILD_SHARED_GGML_LIB=ON ` + -DGGML_BACKEND_DL=ON ` + -DGGML_CPU_ALL_VARIANTS=ON ` -DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" ` -DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` @@ -657,6 +641,11 @@ jobs: -DSD_HIPBLAS=ON ` -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` + -DSD_BUILD_SHARED_GGML_LIB=ON ` + -DGGML_BACKEND_DL=ON ` + -DGGML_CPU_ALL_VARIANTS=ON ` + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON ` + -DCMAKE_INSTALL_RPATH='$ORIGIN' ` -DCMAKE_C_COMPILER=clang ` -DCMAKE_CXX_COMPILER=clang++ ` -DCMAKE_BUILD_TYPE=Release ` @@ -794,6 +783,11 @@ jobs: -DGPU_TARGETS="${{ matrix.gpu_targets }}" \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ -DSD_BUILD_SHARED_LIBS=ON cmake --build . --config Release From 90dd78beac2d359c935ac164bd35e6b2441b3bbd Mon Sep 17 00:00:00 2001 From: leejet Date: Thu, 25 Jun 2026 23:16:36 +0800 Subject: [PATCH 02/10] cpuonly -> cpu --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 499de152c..09069923f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -341,7 +341,7 @@ jobs: strategy: matrix: include: - - build: "cpuonly" + - build: "cpu" defines: "-DGGML_NATIVE=OFF -DSD_BUILD_SHARED_LIBS=ON -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON" - build: "cuda12" defines: "-DSD_CUDA=ON -DSD_BUILD_SHARED_LIBS=ON -DCMAKE_CUDA_ARCHITECTURES='61;70;75;80;86;89;90;100;120' -DCMAKE_CUDA_FLAGS='-Xcudafe \"--diag_suppress=177\" -Xcudafe \"--diag_suppress=550\"' -DGGML_NATIVE=OFF -DSD_BUILD_SHARED_GGML_LIB=ON -DGGML_BACKEND_DL=ON -DGGML_CPU_ALL_VARIANTS=ON" From 028ab5575e3a67dfae365001be392fe73b90859c Mon Sep 17 00:00:00 2001 From: leejet Date: Thu, 25 Jun 2026 23:23:15 +0800 Subject: [PATCH 03/10] use dynamic CPU backends in Docker images --- Dockerfile | 15 ++++++++++++--- Dockerfile.cuda | 13 +++++++++++-- Dockerfile.musa | 16 +++++++++++++--- Dockerfile.sycl | 17 ++++++++++++++--- Dockerfile.vulkan | 16 +++++++++++++--- 5 files changed, 63 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index ba27d66bc..0ef3d56ac 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,14 @@ WORKDIR /sd.cpp COPY . . -RUN cmake . -B ./build +RUN cmake . -B ./build \ + -DSD_BUILD_SHARED_LIBS=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' RUN cmake --build ./build --config Release --parallel FROM ubuntu:$UBUNTU_VERSION AS runtime @@ -28,7 +35,9 @@ RUN apt-get update && \ apt-get install --yes --no-install-recommends libgomp1 && \ apt-get clean -COPY --from=build /sd.cpp/build/bin/sd-cli /sd-cli -COPY --from=build /sd.cpp/build/bin/sd-server /sd-server +COPY --from=build /sd.cpp/build/bin /sd.cpp/bin +RUN printf '#!/bin/sh\nexec /sd.cpp/bin/sd-cli "$@"\n' > /sd-cli && \ + printf '#!/bin/sh\nexec /sd.cpp/bin/sd-server "$@"\n' > /sd-server && \ + chmod +x /sd-cli /sd-server ENTRYPOINT [ "/sd-cli" ] diff --git a/Dockerfile.cuda b/Dockerfile.cuda index 42b8f4fa2..33e66426f 100644 --- a/Dockerfile.cuda +++ b/Dockerfile.cuda @@ -26,6 +26,13 @@ ARG GGML_CUDA_FA_ALL_QUANTS="" RUN cmake . -B ./build \ -DSD_CUDA=ON \ + -DSD_BUILD_SHARED_LIBS=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' \ ${CUDA_ARCHITECTURES:+-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHITECTURES}"} \ ${GGML_CUDA_FA_ALL_QUANTS:+-DGGML_CUDA_FA_ALL_QUANTS=${GGML_CUDA_FA_ALL_QUANTS}} RUN cmake --build ./build --config Release -j$(nproc) @@ -36,7 +43,9 @@ RUN apt-get update && \ apt-get install --yes --no-install-recommends libgomp1 && \ apt-get clean -COPY --from=build /sd.cpp/build/bin/sd-cli /sd-cli -COPY --from=build /sd.cpp/build/bin/sd-server /sd-server +COPY --from=build /sd.cpp/build/bin /sd.cpp/bin +RUN printf '#!/bin/sh\nexec /sd.cpp/bin/sd-cli "$@"\n' > /sd-cli && \ + printf '#!/bin/sh\nexec /sd.cpp/bin/sd-server "$@"\n' > /sd-server && \ + chmod +x /sd-cli /sd-server ENTRYPOINT [ "/sd-cli" ] diff --git a/Dockerfile.musa b/Dockerfile.musa index 8e23318d8..1c1d4d28c 100644 --- a/Dockerfile.musa +++ b/Dockerfile.musa @@ -24,12 +24,22 @@ RUN mkdir build && cd build && \ cmake .. -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ \ -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fopenmp -I/usr/lib/llvm-14/lib/clang/14.0.0/include -L/usr/lib/llvm-14/lib" \ -DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS} -fopenmp -I/usr/lib/llvm-14/lib/clang/14.0.0/include -L/usr/lib/llvm-14/lib" \ - -DSD_MUSA=ON -DCMAKE_BUILD_TYPE=Release && \ + -DSD_MUSA=ON \ + -DSD_BUILD_SHARED_LIBS=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' \ + -DCMAKE_BUILD_TYPE=Release && \ cmake --build . --config Release FROM mthreads/musa:${MUSA_VERSION}-runtime-ubuntu${UBUNTU_VERSION}-amd64 as runtime -COPY --from=build /sd.cpp/build/bin/sd-cli /sd-cli -COPY --from=build /sd.cpp/build/bin/sd-server /sd-server +COPY --from=build /sd.cpp/build/bin /sd.cpp/bin +RUN printf '#!/bin/sh\nexec /sd.cpp/bin/sd-cli "$@"\n' > /sd-cli && \ + printf '#!/bin/sh\nexec /sd.cpp/bin/sd-server "$@"\n' > /sd-server && \ + chmod +x /sd-cli /sd-server ENTRYPOINT [ "/sd-cli" ] diff --git a/Dockerfile.sycl b/Dockerfile.sycl index 88794be08..7359ab0a3 100644 --- a/Dockerfile.sycl +++ b/Dockerfile.sycl @@ -21,12 +21,23 @@ WORKDIR /sd.cpp COPY . . RUN mkdir build && cd build && \ - cmake .. -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx -DSD_SYCL=ON -DCMAKE_BUILD_TYPE=Release && \ + cmake .. -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \ + -DSD_SYCL=ON \ + -DSD_BUILD_SHARED_LIBS=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' \ + -DCMAKE_BUILD_TYPE=Release && \ cmake --build . --config Release -j$(nproc) FROM intel/oneapi-basekit:${SYCL_VERSION}-devel-ubuntu24.04 AS runtime -COPY --from=build /sd.cpp/build/bin/sd-cli /sd-cli -COPY --from=build /sd.cpp/build/bin/sd-server /sd-server +COPY --from=build /sd.cpp/build/bin /sd.cpp/bin +RUN printf '#!/bin/sh\nexec /sd.cpp/bin/sd-cli "$@"\n' > /sd-cli && \ + printf '#!/bin/sh\nexec /sd.cpp/bin/sd-server "$@"\n' > /sd-server && \ + chmod +x /sd-cli /sd-server ENTRYPOINT [ "/sd-cli" ] diff --git a/Dockerfile.vulkan b/Dockerfile.vulkan index a8f1b8728..2a832976e 100644 --- a/Dockerfile.vulkan +++ b/Dockerfile.vulkan @@ -19,7 +19,15 @@ WORKDIR /sd.cpp COPY . . -RUN cmake . -B ./build -DSD_VULKAN=ON +RUN cmake . -B ./build \ + -DSD_VULKAN=ON \ + -DSD_BUILD_SHARED_LIBS=ON \ + -DGGML_NATIVE=OFF \ + -DSD_BUILD_SHARED_GGML_LIB=ON \ + -DGGML_BACKEND_DL=ON \ + -DGGML_CPU_ALL_VARIANTS=ON \ + -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON \ + -DCMAKE_INSTALL_RPATH='$ORIGIN' RUN cmake --build ./build --config Release --parallel FROM ubuntu:$UBUNTU_VERSION AS runtime @@ -28,7 +36,9 @@ RUN apt-get update && \ apt-get install --yes --no-install-recommends libgomp1 libvulkan1 mesa-vulkan-drivers && \ apt-get clean -COPY --from=build /sd.cpp/build/bin/sd-cli /sd-cli -COPY --from=build /sd.cpp/build/bin/sd-server /sd-server +COPY --from=build /sd.cpp/build/bin /sd.cpp/bin +RUN printf '#!/bin/sh\nexec /sd.cpp/bin/sd-cli "$@"\n' > /sd-cli && \ + printf '#!/bin/sh\nexec /sd.cpp/bin/sd-server "$@"\n' > /sd-server && \ + chmod +x /sd-cli /sd-server ENTRYPOINT [ "/sd-cli" ] From 0136fac5053a6209c98c4b1d5f96e00e64635a18 Mon Sep 17 00:00:00 2001 From: leejet Date: Thu, 25 Jun 2026 23:43:33 +0800 Subject: [PATCH 04/10] check disk space --- .github/workflows/build.yml | 93 +++++++++++++++++++++++++++++++------ 1 file changed, 80 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09069923f..c054f74d0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,6 +72,20 @@ jobs: with: version: 10.15.1 + - name: Free disk space + run: | + echo "Before cleanup:" + df -h + + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo apt-get clean + + echo "After cleanup:" + df -h + - name: Dependencies id: depends run: | @@ -135,6 +149,20 @@ jobs: with: version: 10.15.1 + - name: Free disk space + run: | + echo "Before cleanup:" + df -h + + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo apt-get clean + + echo "After cleanup:" + df -h + - name: Dependencies id: depends run: | @@ -256,6 +284,9 @@ jobs: # if set to "true" but frees about 6 GB tool-cache: false + - name: Check disk space + run: df -h + - name: Build and push Docker image id: build-push uses: docker/build-push-action@v6 @@ -364,6 +395,11 @@ jobs: with: version: 10.15.1 + - name: Check disk space before dependencies + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Install cuda-toolkit id: cuda-toolkit if: ${{ matrix.build == 'cuda12' }} @@ -382,6 +418,11 @@ jobs: Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}" Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin" + - name: Check disk space before build + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Activate MSVC environment id: msvc_dev_cmd uses: ilammy/msvc-dev-cmd@v1 @@ -466,6 +507,11 @@ jobs: with: version: 10.15.1 + - name: Check disk space before ROCm setup + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Cache ROCm Installation id: cache-rocm uses: actions/cache@v4 @@ -490,6 +536,11 @@ jobs: tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1 write-host "Completed ROCm extraction" + - name: Check disk space after ROCm setup + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Setup ROCm Environment run: | $rocmPath = "C:\TheRock\build" @@ -586,6 +637,11 @@ jobs: with: version: 10.15.1 + - name: Check disk space before ROCm setup + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Cache ROCm Installation id: cache-rocm uses: actions/cache@v4 @@ -619,6 +675,11 @@ jobs: } write-host "Completed AMD HIP SDK installation" + - name: Check disk space after ROCm setup + run: | + [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize + Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" + - name: Verify ROCm run: | # Find and test ROCm installation @@ -711,6 +772,25 @@ jobs: run: | sudo apt install -y build-essential cmake wget zip ninja-build + - name: Free disk space + run: | + echo "Before cleanup:" + df -h + + # Remove preinstalled SDKs and caches not needed for this job. + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /opt/hostedtoolcache || true + + # Remove old package lists and caches before the large ROCm install. + sudo rm -rf /var/lib/apt/lists/* || true + sudo apt-get clean + + echo "After cleanup:" + df -h + - name: Setup Legacy ROCm if: matrix.ROCM_VERSION == '7.2.1' id: legacy_env @@ -732,19 +812,6 @@ jobs: sudo apt update sudo apt-get install -y libssl-dev rocm-hip-sdk - - name: Free disk space - run: | - # Remove preinstalled SDKs and caches not needed for this job - sudo rm -rf /usr/share/dotnet || true - sudo rm -rf /usr/local/lib/android || true - sudo rm -rf /opt/ghc || true - sudo rm -rf /usr/local/.ghcup || true - sudo rm -rf /opt/hostedtoolcache || true - - # Remove old package lists and caches - sudo rm -rf /var/lib/apt/lists/* || true - sudo apt clean - - name: Setup TheRock if: matrix.ROCM_VERSION != '7.2.1' id: therock_env From a2ab796143b7e6cf1cfc28a3fce07e5de4a0fb6f Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 00:05:21 +0800 Subject: [PATCH 05/10] rEVERt "check disk space" This reverts commit 0136fac5053a6209c98c4b1d5f96e00e64635a18. --- .github/workflows/build.yml | 93 ++++++------------------------------- 1 file changed, 13 insertions(+), 80 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c054f74d0..09069923f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,20 +72,6 @@ jobs: with: version: 10.15.1 - - name: Free disk space - run: | - echo "Before cleanup:" - df -h - - sudo rm -rf /usr/share/dotnet || true - sudo rm -rf /usr/local/lib/android || true - sudo rm -rf /opt/ghc || true - sudo rm -rf /usr/local/.ghcup || true - sudo apt-get clean - - echo "After cleanup:" - df -h - - name: Dependencies id: depends run: | @@ -149,20 +135,6 @@ jobs: with: version: 10.15.1 - - name: Free disk space - run: | - echo "Before cleanup:" - df -h - - sudo rm -rf /usr/share/dotnet || true - sudo rm -rf /usr/local/lib/android || true - sudo rm -rf /opt/ghc || true - sudo rm -rf /usr/local/.ghcup || true - sudo apt-get clean - - echo "After cleanup:" - df -h - - name: Dependencies id: depends run: | @@ -284,9 +256,6 @@ jobs: # if set to "true" but frees about 6 GB tool-cache: false - - name: Check disk space - run: df -h - - name: Build and push Docker image id: build-push uses: docker/build-push-action@v6 @@ -395,11 +364,6 @@ jobs: with: version: 10.15.1 - - name: Check disk space before dependencies - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Install cuda-toolkit id: cuda-toolkit if: ${{ matrix.build == 'cuda12' }} @@ -418,11 +382,6 @@ jobs: Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}" Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin" - - name: Check disk space before build - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Activate MSVC environment id: msvc_dev_cmd uses: ilammy/msvc-dev-cmd@v1 @@ -507,11 +466,6 @@ jobs: with: version: 10.15.1 - - name: Check disk space before ROCm setup - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Cache ROCm Installation id: cache-rocm uses: actions/cache@v4 @@ -536,11 +490,6 @@ jobs: tar -xzf "${env:RUNNER_TEMP}\rocm.tar.gz" -C C:\TheRock\build --strip-components=1 write-host "Completed ROCm extraction" - - name: Check disk space after ROCm setup - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Setup ROCm Environment run: | $rocmPath = "C:\TheRock\build" @@ -637,11 +586,6 @@ jobs: with: version: 10.15.1 - - name: Check disk space before ROCm setup - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Cache ROCm Installation id: cache-rocm uses: actions/cache@v4 @@ -675,11 +619,6 @@ jobs: } write-host "Completed AMD HIP SDK installation" - - name: Check disk space after ROCm setup - run: | - [System.IO.DriveInfo]::GetDrives() | Where-Object { $_.DriveType -eq 'Fixed' -and $_.IsReady } | Select-Object Name, @{Name="TotalGB"; Expression={[math]::Round($_.TotalSize / 1GB, 2)}}, @{Name="FreeGB"; Expression={[math]::Round($_.AvailableFreeSpace / 1GB, 2)}} | Format-Table -AutoSize - Write-Host "RUNNER_TEMP=$env:RUNNER_TEMP" - - name: Verify ROCm run: | # Find and test ROCm installation @@ -772,25 +711,6 @@ jobs: run: | sudo apt install -y build-essential cmake wget zip ninja-build - - name: Free disk space - run: | - echo "Before cleanup:" - df -h - - # Remove preinstalled SDKs and caches not needed for this job. - sudo rm -rf /usr/share/dotnet || true - sudo rm -rf /usr/local/lib/android || true - sudo rm -rf /opt/ghc || true - sudo rm -rf /usr/local/.ghcup || true - sudo rm -rf /opt/hostedtoolcache || true - - # Remove old package lists and caches before the large ROCm install. - sudo rm -rf /var/lib/apt/lists/* || true - sudo apt-get clean - - echo "After cleanup:" - df -h - - name: Setup Legacy ROCm if: matrix.ROCM_VERSION == '7.2.1' id: legacy_env @@ -812,6 +732,19 @@ jobs: sudo apt update sudo apt-get install -y libssl-dev rocm-hip-sdk + - name: Free disk space + run: | + # Remove preinstalled SDKs and caches not needed for this job + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /opt/hostedtoolcache || true + + # Remove old package lists and caches + sudo rm -rf /var/lib/apt/lists/* || true + sudo apt clean + - name: Setup TheRock if: matrix.ROCM_VERSION != '7.2.1' id: therock_env From 4592725fff984bd6c046c3339fb5ff41288db3df Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 00:09:06 +0800 Subject: [PATCH 06/10] debug --- .github/workflows/build.yml | 38 +++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09069923f..0de00033c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -519,7 +519,24 @@ jobs: -DHIP_PATH="${env:HIP_PATH}" ` -DCMAKE_BUILD_TYPE=Release ` -DGPU_TARGETS="${{ env.GPU_TARGETS }}" - cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS} + cmake --build . --config Release --parallel 1 --verbose 2>&1 | Tee-Object -FilePath build.log + $buildExitCode = $LASTEXITCODE + if ($buildExitCode -ne 0) { + Write-Host "Build failed. First matching error context from build.log:" + Select-String -Path build.log -Pattern 'error:|fatal error|FAILED:|No space left|Access is denied|undefined reference|unresolved external|LNK[0-9]+|C[0-9]{4}' -Context 5,8 | Select-Object -First 80 + exit $buildExitCode + } + + - name: Upload build logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: windows-therock-rocm-build-logs + path: | + build/build.log + build/CMakeFiles/CMakeOutput.log + build/CMakeFiles/CMakeError.log + if-no-files-found: ignore - name: Get commit hash id: commit @@ -650,7 +667,24 @@ jobs: -DCMAKE_CXX_COMPILER=clang++ ` -DCMAKE_BUILD_TYPE=Release ` -DGPU_TARGETS="${{ env.GPU_TARGETS }}" - cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS} + cmake --build . --config Release --parallel 1 --verbose 2>&1 | Tee-Object -FilePath build.log + $buildExitCode = $LASTEXITCODE + if ($buildExitCode -ne 0) { + Write-Host "Build failed. First matching error context from build.log:" + Select-String -Path build.log -Pattern 'error:|fatal error|FAILED:|No space left|Access is denied|undefined reference|unresolved external|LNK[0-9]+|C[0-9]{4}' -Context 5,8 | Select-Object -First 80 + exit $buildExitCode + } + + - name: Upload build logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: windows-hip-sdk-build-logs + path: | + build/build.log + build/CMakeFiles/CMakeOutput.log + build/CMakeFiles/CMakeError.log + if-no-files-found: ignore - name: Get commit hash id: commit From c7d6ce75b5424e9a4bffc93ad38a545bb1ae136c Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 00:35:42 +0800 Subject: [PATCH 07/10] revert 'debug' This reverts commit 4592725fff984bd6c046c3339fb5ff41288db3df. --- .github/workflows/build.yml | 38 ++----------------------------------- 1 file changed, 2 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0de00033c..09069923f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -519,24 +519,7 @@ jobs: -DHIP_PATH="${env:HIP_PATH}" ` -DCMAKE_BUILD_TYPE=Release ` -DGPU_TARGETS="${{ env.GPU_TARGETS }}" - cmake --build . --config Release --parallel 1 --verbose 2>&1 | Tee-Object -FilePath build.log - $buildExitCode = $LASTEXITCODE - if ($buildExitCode -ne 0) { - Write-Host "Build failed. First matching error context from build.log:" - Select-String -Path build.log -Pattern 'error:|fatal error|FAILED:|No space left|Access is denied|undefined reference|unresolved external|LNK[0-9]+|C[0-9]{4}' -Context 5,8 | Select-Object -First 80 - exit $buildExitCode - } - - - name: Upload build logs - if: failure() - uses: actions/upload-artifact@v4 - with: - name: windows-therock-rocm-build-logs - path: | - build/build.log - build/CMakeFiles/CMakeOutput.log - build/CMakeFiles/CMakeError.log - if-no-files-found: ignore + cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS} - name: Get commit hash id: commit @@ -667,24 +650,7 @@ jobs: -DCMAKE_CXX_COMPILER=clang++ ` -DCMAKE_BUILD_TYPE=Release ` -DGPU_TARGETS="${{ env.GPU_TARGETS }}" - cmake --build . --config Release --parallel 1 --verbose 2>&1 | Tee-Object -FilePath build.log - $buildExitCode = $LASTEXITCODE - if ($buildExitCode -ne 0) { - Write-Host "Build failed. First matching error context from build.log:" - Select-String -Path build.log -Pattern 'error:|fatal error|FAILED:|No space left|Access is denied|undefined reference|unresolved external|LNK[0-9]+|C[0-9]{4}' -Context 5,8 | Select-Object -First 80 - exit $buildExitCode - } - - - name: Upload build logs - if: failure() - uses: actions/upload-artifact@v4 - with: - name: windows-hip-sdk-build-logs - path: | - build/build.log - build/CMakeFiles/CMakeOutput.log - build/CMakeFiles/CMakeError.log - if-no-files-found: ignore + cmake --build . --config Release --parallel ${env:NUMBER_OF_PROCESSORS} - name: Get commit hash id: commit From 6590a70d4f356ade83c046ab7775b02cef50799c Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 00:38:58 +0800 Subject: [PATCH 08/10] fix ci --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 09069923f..6e2fdb8a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -511,8 +511,6 @@ jobs: -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` -DSD_BUILD_SHARED_GGML_LIB=ON ` - -DGGML_BACKEND_DL=ON ` - -DGGML_CPU_ALL_VARIANTS=ON ` -DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" ` -DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` @@ -642,8 +640,6 @@ jobs: -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` -DSD_BUILD_SHARED_GGML_LIB=ON ` - -DGGML_BACKEND_DL=ON ` - -DGGML_CPU_ALL_VARIANTS=ON ` -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON ` -DCMAKE_INSTALL_RPATH='$ORIGIN' ` -DCMAKE_C_COMPILER=clang ` From 14d6c0484932a44f87a40165d364dd52de3dc382 Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 00:56:12 +0800 Subject: [PATCH 09/10] fix ci --- .github/workflows/build.yml | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e2fdb8a7..795295cd3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -707,6 +707,25 @@ jobs: run: | sudo apt install -y build-essential cmake wget zip ninja-build + - name: Free disk space + run: | + df -h + + # Remove preinstalled SDKs and caches not needed for this job before + # installing ROCm. The legacy ROCm apt packages are large enough to + # exhaust ubuntu-latest if cleanup runs after installation. + sudo rm -rf /usr/share/dotnet || true + sudo rm -rf /usr/local/lib/android || true + sudo rm -rf /opt/ghc || true + sudo rm -rf /usr/local/.ghcup || true + sudo rm -rf /opt/hostedtoolcache || true + sudo rm -rf /usr/share/swift || true + sudo rm -rf /usr/local/share/boost || true + docker system prune -af || true + + sudo apt clean + df -h + - name: Setup Legacy ROCm if: matrix.ROCM_VERSION == '7.2.1' id: legacy_env @@ -728,19 +747,6 @@ jobs: sudo apt update sudo apt-get install -y libssl-dev rocm-hip-sdk - - name: Free disk space - run: | - # Remove preinstalled SDKs and caches not needed for this job - sudo rm -rf /usr/share/dotnet || true - sudo rm -rf /usr/local/lib/android || true - sudo rm -rf /opt/ghc || true - sudo rm -rf /usr/local/.ghcup || true - sudo rm -rf /opt/hostedtoolcache || true - - # Remove old package lists and caches - sudo rm -rf /var/lib/apt/lists/* || true - sudo apt clean - - name: Setup TheRock if: matrix.ROCM_VERSION != '7.2.1' id: therock_env From 38f3b80c548b8df4c7a5ee01f5988c43fc01f1d9 Mon Sep 17 00:00:00 2001 From: leejet Date: Fri, 26 Jun 2026 01:04:06 +0800 Subject: [PATCH 10/10] fix ci --- .github/workflows/build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 795295cd3..1b42846fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -510,7 +510,6 @@ jobs: -DSD_HIPBLAS=ON ` -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` - -DSD_BUILD_SHARED_GGML_LIB=ON ` -DCMAKE_C_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` -DCMAKE_CXX_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang++.exe" ` -DCMAKE_HIP_COMPILER="${env:HIP_PATH}\lib\llvm\bin\clang.exe" ` @@ -639,9 +638,6 @@ jobs: -DSD_HIPBLAS=ON ` -DSD_BUILD_SHARED_LIBS=ON ` -DGGML_NATIVE=OFF ` - -DSD_BUILD_SHARED_GGML_LIB=ON ` - -DCMAKE_BUILD_WITH_INSTALL_RPATH=ON ` - -DCMAKE_INSTALL_RPATH='$ORIGIN' ` -DCMAKE_C_COMPILER=clang ` -DCMAKE_CXX_COMPILER=clang++ ` -DCMAKE_BUILD_TYPE=Release `