Skip to content

Commit 33d330f

Browse files
committed
docs: credit Depot build cache (README badge) + document the cache in CLAUDE.md
- README: a small "Build cache:" badge group crediting Depot (sccache → Depot Cache), matching the existing tool-badge style. - CLAUDE.md: a "CI build cache & parallelism (sccache + Depot)" section for maintainers — the BUILD_JOBS knob (macOS -j2 / OOM rationale), the sccache WebDAV → Depot wiring (SCCACHE_WEBDAV_ENDPOINT/TOKEN, the DEPOT_TOKEN secret), content-addressed / pinned-tag hit behavior, release-safety, the use_cache flag + fork-PR/no-token inertness, and the phase-1 (macOS) vs phase-2 (dockcross/Windows/Linux-host) rollout. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JdLpWD8nedY7LwNnHefZLF
1 parent a94cf0a commit 33d330f

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

CLAUDE.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,47 @@ cmake -B build && cmake --build build --target jllama # now embeds the real UI
165165
```
166166
`webui-generated/` is git-ignored.
167167

168+
## CI build cache & parallelism (sccache + Depot)
169+
170+
The native build dominates CI time (134 llama.cpp model TUs + ggml + the 16.6k-line
171+
`httplib.cpp`, all at `-O3`). Two knobs in **`.github/build.sh`**, both behind the
172+
`use_cache` `workflow_dispatch` input (default **true**), keep it fast and stop the macOS
173+
runners OOM-ing.
174+
175+
**`BUILD_JOBS` — compile parallelism.** `build.sh` builds with `cmake --build -j${BUILD_JOBS}`
176+
(default: all cores, via portable `nproc``sysctl -n hw.ncpu``4` detection). GitHub's
177+
~7 GB **macOS arm64** runners OOM under full `-j` when `httplib.cpp` co-schedules with the
178+
model TUs; the runner is then killed as **SIGTERM / exit 143** ("received a shutdown
179+
signal"), which *looks* like a timeout but is an out-of-memory kill. The three macOS build
180+
jobs therefore set `BUILD_JOBS: 2` to bound peak memory.
181+
182+
**`sccache` → Depot Cache — shared compiler cache.** When `USE_CACHE=true` **and** `sccache`
183+
plus a cache token are present, `build.sh` adds
184+
`-DCMAKE_C_COMPILER_LAUNCHER=sccache -DCMAKE_CXX_COMPILER_LAUNCHER=sccache` and prints
185+
`sccache --show-stats`. The cache lives in **Depot Cache** over sccache's **WebDAV** backend:
186+
187+
- `SCCACHE_WEBDAV_ENDPOINT: https://cache.depot.dev`
188+
- `SCCACHE_WEBDAV_TOKEN: ${{ secrets.DEPOT_TOKEN }}` — a Depot **organization** token, stored
189+
as the repo secret **`DEPOT_TOKEN`**.
190+
191+
Because `sccache` is **content-addressed** and llama.cpp is pinned (`GIT_TAG b9682`), the
192+
~280 upstream object files are byte-identical every run, so a warm cache recompiles only the
193+
*changed* files. Depot's cache is **shared across all branches** (unlike GitHub's
194+
per-branch `actions/cache`), so every branch builds incrementally; a `b<nnnn>` version bump
195+
naturally invalidates the upstream entries (their content changed) with no manual step. It
196+
stays `-O3` and is **bit-identical** to a clean build (release-safe).
197+
198+
**Safety / transparency.** It is **inert** until `DEPOT_TOKEN` is configured and on **fork
199+
PRs** (secrets are hidden there) — those simply compile normally; the `Install sccache` step
200+
is `continue-on-error`; and `use_cache=false` forces a pristine, from-scratch build.
201+
202+
**Rollout.** **Phase 1 (current): the 3 macOS build jobs** (slowest + OOM-prone) —
203+
`brew install sccache` + the env above + `BUILD_JOBS: 2`. **Phase 2 (TODO):** the dockcross
204+
Linux/Android/CUDA jobs (the `sccache` binary **and** `DEPOT_TOKEN` must be passed *into* the
205+
container), the Windows jobs (sccache supports MSVC), and the Linux-host `test-cpp` job. To
206+
extend a job: install `sccache`, set the two `SCCACHE_WEBDAV_*` env vars, and (for
207+
RAM-limited runners) `BUILD_JOBS`.
208+
168209
## Upgrading/Downgrading llama.cpp Version
169210

170211
To change the llama.cpp version, update the following **three** files:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
[![Publish](https://github.com/bernardladenthin/java-llama.cpp/actions/workflows/publish.yml/badge.svg)](https://github.com/bernardladenthin/java-llama.cpp/actions/workflows/publish.yml)
2121
[![CodeQL](https://github.com/bernardladenthin/java-llama.cpp/actions/workflows/codeql.yml/badge.svg)](https://github.com/bernardladenthin/java-llama.cpp/actions/workflows/codeql.yml)
2222

23+
**Build cache:**
24+
[![Build cache by Depot](https://img.shields.io/badge/build%20cache-Depot-FF5C35)](https://depot.dev)
25+
_Shared, incremental CI compiler caching (sccache) powered by [Depot](https://depot.dev)._
26+
2327
**Coverage:**
2428
[![Coverage Status](https://coveralls.io/repos/github/bernardladenthin/java-llama.cpp/badge.svg?branch=main)](https://coveralls.io/github/bernardladenthin/java-llama.cpp?branch=main)
2529
[![codecov](https://codecov.io/gh/bernardladenthin/java-llama.cpp/graph/badge.svg)](https://codecov.io/gh/bernardladenthin/java-llama.cpp)

0 commit comments

Comments
 (0)