okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-mmq-default-off: build the engine without llama.cpp's MMQ kernels by default (-DSTRATA_MMQ=ON keeps the old path; linux-aarch64 unchanged)5649b9e52

main
8.2 KiB194 linesraw
1name: Backend compile checks
2
3# Compile and link every engine backend with a pinned toolchain, without a GPU: nothing is run, so a call into a kernel that only
4# exists for another backend (or an API a toolkit version dropped) fails here instead of on a user's machine.  Hardware runs are separate.
5#   CUDA 12.9 and 13.0   nvidia/cuda devel container   target strata (no MMQ, the default) (CMake preset cuda-compile)
6#   HIP (ROCm 7.2)       rocm/dev container            target strata                      (CMake preset hip-compile)
7#   SYCL (oneAPI 2026.1) ubuntu + Intel's apt repo     target strata of sycl/             (the commands of packaging/build_sycl_linux.sh)
8#   Metal                macOS runner                  target strata                      (metal/; metal-build.yml keeps its own strata build)
9# ggml comes from the vendored third_party/strata-ggml (frozen at llama.cpp's pin), the same tree the release builds use: nothing is downloaded.
10# Architectures are fewer than the release package's (compile time); the flags that decide which sources and defines are built are the release's.
11
12on:
13  push:
14    branches: [main]
15    paths:
16      - .github/workflows/backends.yml
17      - CMakeLists.txt
18      - CMakePresets.json
19      - cmake/**
20      - src/**
21      - include/**
22      - third_party/**
23      - sycl/**
24      - metal/**
25      - setup.py
26      - packaging/build_cuda_linux.sh
27      - packaging/build_hip_linux.sh
28      - packaging/build_sycl_linux.sh
29  pull_request:
30    paths:
31      - .github/workflows/backends.yml
32      - CMakeLists.txt
33      - CMakePresets.json
34      - cmake/**
35      - src/**
36      - include/**
37      - third_party/**
38      - sycl/**
39      - metal/**
40      - setup.py
41      - packaging/build_cuda_linux.sh
42      - packaging/build_hip_linux.sh
43      - packaging/build_sycl_linux.sh
44  workflow_dispatch:
45
46permissions:
47  contents: read
48
49concurrency:
50  group: backends-${{ github.ref }}
51  cancel-in-progress: true
52
53env:
54  CCACHE_DIR: ${{ github.workspace }}/.ccache
55  CCACHE_MAXSIZE: 2G
56
57jobs:
58  cuda:
59    name: CUDA ${{ matrix.cuda }}
60    runs-on: ubuntu-24.04
61    timeout-minutes: 120
62    container: nvidia/cuda:${{ matrix.image }}
63    strategy:
64      fail-fast: false
65      matrix:
66        include:
67          # the cuda12 package is the one for Pascal and Volta: sm_60 needs STRATA_EXPERIMENTAL_SM60 (packaging/build_cuda_linux.sh)
68          - { cuda: '12.9', image: '12.9.1-devel-ubuntu24.04', archs: '60-real;61-real;70-real;86-real', sm60: 'ON' }
69          - { cuda: '13.0', image: '13.0.2-devel-ubuntu24.04', archs: '75-real;86-real;120-real', sm60: 'OFF' }
70    steps:
71      - name: Tools
72        run: |
73          apt-get update
74          DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates cmake ninja-build ccache
75          cmake --version | head -1
76      - uses: actions/checkout@v4
77        with:
78          persist-credentials: false
79      - uses: actions/cache@v4
80        with:
81          path: .ccache
82          key: ccache-cuda${{ matrix.cuda }}-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**', 'cmake/**') }}
83          restore-keys: ccache-cuda${{ matrix.cuda }}-
84      - name: Configure (preset cuda-compile)
85        run: |
86          nvcc --version | tail -2
87          cmake --preset cuda-compile -B build \
88            "-DCMAKE_CUDA_ARCHITECTURES=${{ matrix.archs }}" -DSTRATA_EXPERIMENTAL_SM60=${{ matrix.sm60 }} \
89            -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache
90      - name: Build strata
91        run: cmake --build build --target strata -j "$(nproc)"
92      - name: Cache statistics
93        run: ccache -s | head -8
94
95  hip:
96    name: HIP ROCm 7.2
97    runs-on: ubuntu-24.04
98    timeout-minutes: 120
99    container: rocm/dev-ubuntu-24.04:7.2.4-complete
100    steps:
101      - name: Tools
102        run: |
103          apt-get update
104          DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates cmake ninja-build ccache
105          cmake --version | head -1
106      - uses: actions/checkout@v4
107        with:
108          persist-credentials: false
109      - uses: actions/cache@v4
110        with:
111          path: .ccache
112          key: ccache-hip72-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**', 'cmake/**') }}
113          restore-keys: ccache-hip72-
114      - name: Configure (preset hip-compile)
115        run: |
116          /opt/rocm/llvm/bin/clang++ --version | head -1
117          cmake --preset hip-compile -B build \
118            -DCMAKE_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ -DCMAKE_HIP_COMPILER_ROCM_ROOT=/opt/rocm -DCMAKE_PREFIX_PATH=/opt/rocm \
119            -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_HIP_COMPILER_LAUNCHER=ccache
120      - name: Build strata
121        run: cmake --build build --target strata -j "$(nproc)"
122      - name: Cache statistics
123        run: ccache -s | head -8
124
125  sycl:
126    # The engine needs oneAPI 2026.1 or newer (sycl/include/dpct/util.hpp uses the entangle and chunked_partition extensions, which the
127    # 2025.3.2 compiler does not have: it stops at "no member named 'entangle'"; the intel/oneapi-basekit images end at 2025.3), so the
128    # compiler comes from Intel's apt repository at a pinned version.
129    name: SYCL oneAPI 2026.1
130    runs-on: ubuntu-24.04
131    timeout-minutes: 120
132    container: ubuntu:24.04
133    steps:
134      - name: Tools and oneAPI 2026.1
135        run: |
136          apt-get update
137          DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates cmake ninja-build ccache wget gpg
138          wget -qO- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor -o /usr/share/keyrings/oneapi-archive-keyring.gpg
139          echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" > /etc/apt/sources.list.d/oneAPI.list
140          apt-get update
141          DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
142            intel-oneapi-compiler-dpcpp-cpp-2026.1=2026.1.1-325 intel-oneapi-mkl-devel-2026.1=2026.1.0-236
143      - uses: actions/checkout@v4
144        with:
145          persist-credentials: false
146      - uses: actions/cache@v4
147        with:
148          path: .ccache
149          key: ccache-sycl-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**', 'sycl/**') }}
150          restore-keys: ccache-sycl-
151      - name: Configure and build (the commands of packaging/build_sycl_linux.sh)
152        shell: bash
153        run: |
154          . /opt/intel/oneapi/setvars.sh --force >/dev/null
155          icpx --version | head -1
156          cmake -S sycl -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icpx \
157            -DSTRATA_SYCL_PARITY=OFF -DSTRATA_SYCL_IQ_DECODE_FAST=ON \
158            -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
159          cmake --build build --target strata -j "$(nproc)"
160      - name: Cache statistics
161        run: ccache -s | head -8
162
163  metal:
164    name: Metal strata
165    # the macOS 26 SDK: metal/src/mtl_rt.mm names MTLGPUFamilyMetal4 behind @available (a run-time check); the names must be in the SDK
166    runs-on: macos-26
167    timeout-minutes: 60
168    env:
169      # metal/setup_mac.py's metal-cpp pin (the same as metal-build.yml)
170      METAL_CPP_URL: https://developer.apple.com/metal/cpp/files/metal-cpp_26.zip
171      METAL_CPP_SHA256: 4df3c078b9aadcb516212e9cb03004cbc5ce9a3e9c068fa3144d021db585a3a4
172    steps:
173      - uses: actions/checkout@v4
174        with:
175          persist-credentials: false
176      - name: Tools
177        run: brew install ninja ccache
178      - name: metal-cpp
179        run: |
180          curl -fsSL "$METAL_CPP_URL" -o metal-cpp.zip
181          echo "$METAL_CPP_SHA256  metal-cpp.zip" | shasum -a 256 -c -
182          unzip -q metal-cpp.zip -d _mcpp
183      - uses: actions/cache@v4
184        with:
185          path: .ccache
186          key: ccache-metal-${{ hashFiles('CMakeLists.txt', 'src/**', 'include/**', 'metal/**') }}
187          restore-keys: ccache-metal-
188      - name: Configure
189        run: |
190          cmake -S metal -B build-metal -G Ninja -DCMAKE_BUILD_TYPE=Release \
191            -DMETAL_CPP_DIR="$PWD/_mcpp/metal-cpp" \
192            -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
193      - name: Build and link strata
194        run: cmake --build build-metal --target strata