char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Mendy Bergerggml-webgpu: Update to a recent version of Dawn (#28683)d3146f2b5

char/aliceai-t5-moe
5.7 KiB193 linesraw
1name: CI (webgpu)
2
3on:
4  workflow_dispatch: # allows manual triggering
5  push:
6    branches:
7      - master
8    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: true
31
32env:
33  GGML_NLOOP: 3
34  GGML_N_THREADS: 1
35  LLAMA_ARG_LOG_COLORS: 1
36  LLAMA_ARG_LOG_PREFIX: 1
37  LLAMA_ARG_LOG_TIMESTAMPS: 1
38
39jobs:
40  format:
41    runs-on: ubuntu-24.04
42
43    steps:
44      - name: Clone
45        uses: actions/checkout@v6
46
47      - name: Install clang-format 22
48        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/null
51          sudo add-apt-repository -y \
52            "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main"
53          sudo apt-get update
54          sudo apt-get install -y clang-format-22
55
56      - name: Check formatting
57        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 --Werror
62
63  macos:
64    runs-on: macos-latest
65
66    steps:
67      - name: Clone
68        id: checkout
69        uses: actions/checkout@v6
70
71      - name: ccache
72        uses: ggml-org/ccache-action@v1.2.24
73        with:
74          key: webgpu-macos-latest
75          save: false
76
77      - name: Dawn Dependency
78        id: dawn-depends
79        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 dawn
88          tar -xvf artifact.tar.gz -C dawn --strip-components=1
89
90      - name: ccache-buckets-restore
91        uses: ./.github/actions/ccache-buckets
92        env:
93          HF_TOKEN: ${{ secrets.HF_TOKEN_CI }}
94        with:
95          key: webgpu-macos-latest
96          folder: llama.cpp
97          hf_bucket: ggml-org/cache
98
99      - name: Build
100        id: cmake_build
101        run: |
102          export CMAKE_PREFIX_PATH=dawn
103          cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DGGML_WEBGPU=ON -DGGML_METAL=OFF -DGGML_BLAS=OFF
104          time cmake --build build --config Release -j $(sysctl -n hw.logicalcpu)
105
106      - name: ccache-buckets-save
107        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
108        uses: ./.github/actions/ccache-buckets
109        env:
110          HF_TOKEN: ${{ secrets.HF_TOKEN_CACHE_OUTPUT }}
111        with:
112          key: webgpu-macos-latest
113          folder: llama.cpp
114          evict-old-files: 1d
115          hf_bucket: ggml-org/cache
116          save: true
117
118      - name: Test
119        id: cmake_test
120        run: |
121          cd build
122          ctest -L main --verbose --timeout 900
123
124  ubuntu:
125    runs-on: ubuntu-24.04
126
127    steps:
128      - name: Clone
129        id: checkout
130        uses: actions/checkout@v6
131
132      - name: ccache
133        uses: ggml-org/ccache-action@v1.2.24
134        with:
135          key: webgpu-ubuntu-24.04
136          save: false
137
138      - name: Dependencies
139        id: depends
140        run: |
141          sudo add-apt-repository -y ppa:kisak/kisak-mesa
142          sudo apt-get update -y
143          sudo apt-get install -y build-essential mesa-vulkan-drivers \
144            libxcb-xinput0 libxcb-xinerama0 libxcb-cursor-dev libssl-dev
145
146      - name: Dawn Dependency
147        id: dawn-depends
148        run: |
149          sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev mesa-common-dev libx11-xcb-dev libxi-dev
150          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 dawn
158          tar -xvf artifact.tar.gz -C dawn --strip-components=1
159
160      - name: ccache-buckets-restore
161        uses: ./.github/actions/ccache-buckets
162        env:
163          HF_TOKEN: ${{ secrets.HF_TOKEN_CI }}
164        with:
165          key: webgpu-ubuntu-24.04
166          folder: llama.cpp
167          hf_bucket: ggml-org/cache
168
169      - name: Build
170        id: cmake_build
171        run: |
172          export Dawn_DIR=dawn/lib64/cmake/Dawn
173          cmake -B build \
174            -DGGML_WEBGPU=ON
175          time cmake --build build --config Release -j $(nproc)
176
177      - name: ccache-buckets-save
178        if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
179        uses: ./.github/actions/ccache-buckets
180        env:
181          HF_TOKEN: ${{ secrets.HF_TOKEN_CACHE_OUTPUT }}
182        with:
183          key: webgpu-ubuntu-24.04
184          folder: llama.cpp
185          evict-old-files: 1d
186          hf_bucket: ggml-org/cache
187          save: true
188
189      - name: Test
190        id: cmake_test
191        run: |
192          cd build
193          ctest -L main --verbose --timeout 900