Skip to content

feat(ci): JAX + numba caches in lib-tests.yml, numba cache in smoke-tests.yml - #217

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/lib-tests-compile-caches
Sep 7, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/lib-tests-compile-caches

Conversation

@Jammy2211

Copy link
Copy Markdown
Contributor

Closes #215. Census option O1 of the ci-timing-fast-tests epic, widened by one finding made while reading the workflows: smoke-tests.yml cached JAX and datasets only — numba sat at /tmp/numba_cache with no restore and no save, so every smoke run compiled numba cold.

What changes

lib-tests.yml (unittest job only; unittest-nojax is untouched and its wiring test asserts that)

  • Job-level PYAUTO_CACHE_EPOCH salt; Resolve cache keys (jaxlib, full python version); Restore the JAX compile cache per (OS, py leg, jaxlib); Restore the numba cache per (OS, full python); Stamp source mtimes from content; Measure the caches before the run; Record cache state writing test-results/cache_state.json (jax + numba sections) so it rides the existing unit-timings-<py> artifact; Save … steps gated on a measured change, saving on red too.
  • Run tests gains an env: block naming both cache dirs; the run: text is byte-identical. Every new step is continue-on-error: true.

smoke-tests.yml

  • The numba cache beside the JAX one; the runner's NUMBA_CACHE_DIR moves from /tmp to the restored-and-saved workspace path (env only, command unchanged); the sidecar gains a numba section and numba_changed output; the same content-stamp step.

The one non-obvious mechanism. numba stamps every cache entry with its source file's (st_mtime, st_size) (numba/core/caching.py) and stores it under a directory named for the source's directory. A fresh clone or a fresh pip install gives every .py a new mtime, so a restored numba cache would miss every entry it holds. Both workflows therefore rewrite each .py's mtime as a function of its content hash before anything compiles: identical content hits, changed content misses. That is what makes the prefix restore-keys fallback safe and lets the numba key carry no library commit.

Ingest, record, board

  • smoke_timings.parse_cache_state reads numba (absent section → unknown, since older sidecars predate it — unlike jax/datasets, absence is not evidence of a miss); cache_view carries it; classify_drift gains prev_cache_key (default cache_jax, unchanged for scripts).
  • unit_timings reads the sidecar into every leg, the rollup repos[] carries cache, and the unit drift rule refuses two known but different combined states (heart.timings.unit_cache_state: hit only when jax and numba both hit, miss only when both missed, else unknown), carried in the record as cache_state.
  • timings/unit/<repo>.jsonl lines gain cache: {jax, numba}; scripts lines gain numba; the board brackets the state on the unit suite line and extends the scripts bracket to [jax cache hit, numba hit] only when numba is known.
  • timings/README.md schemas updated; a dated correction appended to the census §5.3 (nothing rewritten).

Validation

  • python3 -m pytest -q -n auto: 893 → 924 passing. Both workflows parse; every heredoc is valid Python; the stamp script was exercised against a scratch tree.
  • Hot-vs-cold is not claimed here: it lands in timings/unit/<repo>.jsonl and timings/scripts/<repo>.jsonl with the daily runs after merge. GitHub cache scoping means a PR-branch save is invisible to main, so the first main run after merge misses and seeds and the second hits. The workflows are consumed @main, so the callers see this only after merge.

Guard

Settings and caches only — the closed jax-compile-time arc's verdict is honoured exactly; no test, likelihood or sampler changed; --xla_cpu_multi_thread_eigen=false is untouched wherever it is set.

Worth a reviewer's eye

  • A unit leg's cache_view reads datasets: "miss" (the libraries' workflow has no dataset cache); it is contained — the unit record and the unit board line carry jax + numba only.
  • Both epoch salts start at "1" and are independent knobs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WYcmRnZf3cbC5Wth9bCkEg


Generated by Claude Code

…ests.yml

Census option O1 of the ci-timing-fast-tests epic, widened by one finding:
library CI is compile-bound and `lib-tests.yml` restored no JAX and no numba
cache, and `smoke-tests.yml` — which the census said "has both" — cached JAX
and datasets only, with numba at /tmp/numba_cache and no restore or save.

- lib-tests.yml (`unittest` job only): epoch salt, JAX compile cache per
  (OS, py leg, jaxlib), numba cache per (OS, full python), the
  `cache_state.json` sidecar riding the unit-timings artifact, saves gated on
  a measured change; every new step continue-on-error, pytest command
  byte-identical apart from env. `unittest-nojax` untouched.
- smoke-tests.yml: the numba cache beside the JAX one, the runner's
  NUMBA_CACHE_DIR moved under the workspace, a `numba` section in the sidecar.
- Both workflows stamp every source .py's mtime from its content hash: numba
  keys each entry on (mtime, size), so a fresh clone or pip install would
  otherwise miss every restored entry. Identical content hits, changed
  content misses, so the prefix fallback is safe and the numba key names no
  library commit.
- Ingest/record/board: `numba` in the sidecar parse (absent → unknown), unit
  legs and rows carry `cache`, the unit drift rule refuses two known but
  different combined jax+numba states (`cache_state`), the board brackets the
  state on both the scripts and the unit lines. README schemas updated; a
  dated correction appended to the census §5.3.

Tests 893 → 924. Hot-vs-cold lands in timings/unit and timings/scripts with
the daily runs after merge; a PR-branch save is invisible to main, so the
first main run seeds and the second hits.

Closes #215

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WYcmRnZf3cbC5Wth9bCkEg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(ci): JAX+numba caches in lib-tests, numba cache in smoke-tests

1 participant