Felipe97/llama-cpp-compiled
01.2k
1name: CI (webgpu)2 3on:4 workflow_dispatch: # allows manual triggering5 push:6 branches:7 - master8 paths: [9 '.github/workflows/build-webgpu.yml',10 '**/CMakeLists.txt',11 '**/.cmake',12 '**/*.h',13 '**/*.hpp',14 '**/*.c',15 '**/*.cpp',16 '**/*.wgsl',17 '**/*.tmpl',18 'ggml/src/ggml-webgpu/wgsl-shaders/embed_wgsl.py'19 ]20 21 pull_request:22 types: [opened, synchronize, reopened]23 paths: [24 '.github/workflows/build-webgpu.yml',25 'ggml/src/ggml-webgpu/**'26 ]27 28concurrency:29 group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }}30 cancel-in-progress: true31 32env:33 GGML_NLOOP: 334 GGML_N_THREADS: 135 LLAMA_ARG_LOG_COLORS: 136 LLAMA_ARG_LOG_PREFIX: 137 LLAMA_ARG_LOG_TIMESTAMPS: 138 39jobs:40 format:41 runs-on: ubuntu-24.0442 43 steps:44 - name: Clone45 uses: actions/checkout@v646 47 - name: Install clang-format 2248 run: |49 wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key |50 sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc > /dev/null51 sudo add-apt-repository -y \52 "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main"53 sudo apt-get update54 sudo apt-get install -y clang-format-2255 56 - name: Check formatting57 run: |58 find ggml/src/ggml-webgpu \59 -type f \( -name '*.cpp' -o -name '*.hpp' -o -name '*.h' \) \60 -print0 |61 xargs -0 clang-format-22 --dry-run --Werror62 63 macos:64 runs-on: macos-latest65 66 steps:67 - name: Clone68 id: checkout69 uses: actions/checkout@v670 71 - name: ccache72 uses: ggml-org/ccache-action@v1.2.2473 with:74 key: webgpu-macos-latest75 save: false76 77 - name: Dawn Dependency78 id: dawn-depends79 run: |80 DAWN_VERSION="v20260908.214631"81 DAWN_OWNER="google"82 DAWN_REPO="dawn"83 DAWN_ASSET_NAME="Dawn-94c3c9cc0d5fb2e85aebb370fa8d37b71aa34655-macos-latest-Release"84 echo "Fetching release asset from https://github.com/google/dawn/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.tar.gz"85 curl -L -o artifact.tar.gz \86 "https://github.com/google/dawn/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.tar.gz"87 mkdir dawn88 tar -xvf artifact.tar.gz -C dawn --strip-components=189 90 - name: ccache-buckets-restore91 uses: ./.github/actions/ccache-buckets92 env:93 HF_TOKEN: ${{ secrets.HF_TOKEN_CI }}94 with:95 key: webgpu-macos-latest96 folder: llama.cpp97 hf_bucket: ggml-org/cache98 99 - name: Build100 id: cmake_build101 run: |102 export CMAKE_PREFIX_PATH=dawn103 cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF104 time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)105 106 - name: ccache-buckets-save107 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}108 uses: ./.github/actions/ccache-buckets109 env:110 HF_TOKEN: ${{ secrets.HF_TOKEN_CACHE_OUTPUT }}111 with:112 key: webgpu-macos-latest113 folder: llama.cpp114 evict-old-files: 1d115 hf_bucket: ggml-org/cache116 save: true117 118 - name: Test119 id: cmake_test120 run: |121 cd build122 ctest -L main --verbose --timeout 900123 124 ubuntu:125 runs-on: ubuntu-24.04126 127 steps:128 - name: Clone129 id: checkout130 uses: actions/checkout@v6131 132 - name: ccache133 uses: ggml-org/ccache-action@v1.2.24134 with:135 key: webgpu-ubuntu-24.04136 save: false137 138 - name: Dependencies139 id: depends140 run: |141 sudo add-apt-repository -y ppa:kisak/kisak-mesa142 sudo apt-get update -y143 sudo apt-get install -y build-essential mesa-vulkan-drivers \144 libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libssl-dev145 146 - name: Dawn Dependency147 id: dawn-depends148 run: |149 sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev150 DAWN_VERSION="v20260908.214631"151 DAWN_OWNER="google"152 DAWN_REPO="dawn"153 DAWN_ASSET_NAME="Dawn-94c3c9cc0d5fb2e85aebb370fa8d37b71aa34655-ubuntu-latest-Release"154 echo "Fetching release asset from https://github.com/google/dawn/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.tar.gz"155 curl -L -o artifact.tar.gz \156 "https://github.com/google/dawn/releases/download/${DAWN_VERSION}/${DAWN_ASSET_NAME}.tar.gz"157 mkdir dawn158 tar -xvf artifact.tar.gz -C dawn --strip-components=1159 160 - name: ccache-buckets-restore161 uses: ./.github/actions/ccache-buckets162 env:163 HF_TOKEN: ${{ secrets.HF_TOKEN_CI }}164 with:165 key: webgpu-ubuntu-24.04166 folder: llama.cpp167 hf_bucket: ggml-org/cache168 169 - name: Build170 id: cmake_build171 run: |172 export Dawn_DIR=dawn/lib64/cmake/Dawn173 cmake -B build \174 -DGGML_WEBGPU=ON175 time cmake --build build --config Release -j $(nproc)176 177 - name: ccache-buckets-save178 if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}179 uses: ./.github/actions/ccache-buckets180 env:181 HF_TOKEN: ${{ secrets.HF_TOKEN_CACHE_OUTPUT }}182 with:183 key: webgpu-ubuntu-24.04184 folder: llama.cpp185 evict-old-files: 1d186 hf_bucket: ggml-org/cache187 save: true188 189 - name: Test190 id: cmake_test191 run: |192 cd build193 ctest -L main --verbose --timeout 900194 