Repository navigation
Description
Overview
The reusable smoke-tests.yml restores and saves a JAX persistent compilation cache but sets no compile-time threshold, so autonerves/jax_wrapper.py's setdefault of JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS=1 wins and only executables that took over a second are ever written to disk. The JAX smoke scripts are made of many sub-second compiles, so a cache_jax: HIT leg holds 1–4 entries and every run re-pays the compile. /ci_speedup (2026-09-10) set the threshold to 0 per-script for the three slowest entries; this task hoists it to the whole leg, in the one place that owns the cache. Measured locally: 23–31s → 10–18s per script, output byte-identical, at the cost of ~500 entries / ~3 MB of cache artefact per JAX script.
Plan
- Export
JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS=0in the runner step's env ofsmoke-tests.yml, next toJAX_COMPILATION_CACHE_DIR, so every script subprocess inherits it (the runner copies the job env). - Record in the step comment why the threshold is 0, what it costs (artefact growth) and how to back it out (delete the line, or bump
PYAUTO_CACHE_EPOCHto drop the fat caches). - Pin it in
tests/test_smoke_tests_wiring.pybeside the existing runner-step assertions: the key is present, is exactly"0", and the runner command is still untouched. - No epoch bump: the accumulating cache simply gains entries under the same key prefix; restore-time cost is priced after merge from the board's
cache_state.jsonsizes. - Out of scope, recorded as follow-ups: the now-redundant per-script overrides in the autolens/autogalaxy
profile_smoke.yaml; the same missing threshold onlib-tests.yml's unit leg.
Detailed implementation plan
Affected Repositories
- PyAutoHeart (primary, only)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoHeart | main (e08b049) |
clean |
No open PRs on PyAutoHeart; no branch touches smoke-tests.yml. Web session: no task worktree; the branch is pushed from the session clone.
Suggested branch: claude/jax-cache-threshold-smoke-nfobes (the session's designated branch; feature/smoke-jax-cache-threshold on a local checkout)
Work Classification: Library (organ workflow + its wiring test)
Worktree root: n/a — web-github session clone (/home/user/PyAutoHeart)
Implementation Steps
.github/workflows/smoke-tests.yml, stepRun the workspace runner (the smoke runner by default): addJAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS: "0"to the stepenv:immediately afterJAX_COMPILATION_CACHE_DIR. Comment: autonerves defaults it to 1s when the cache dir is set; JAX's own default is 1.0s; the smoke scripts compile hundreds of sub-second executables so the 1s regime persists almost nothing (measured 2→513, 4→299, 1→~490 entries on the three slowest scripts, 23–31s → 10–18s); the price is cache-artefact size, and the way out is this one line or an epoch bump. Therun:body stays byte-identical (a workspace owns its runner; the wiring test pins that).tests/test_smoke_tests_wiring.py: extendtest_the_runner_step_names_both_cache_dirs_and_is_otherwise_untouched(or add a siblingtest_the_runner_persists_every_compile_it_makes) assertingstep["env"]["JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS"] == "0", that it sits in the same step asJAX_COMPILATION_CACHE_DIR, and thatpython "$RUNNER" $RUNNER_ARGSis still the command. Update the docstring/comment that says "one env key is the whole change".- Leave
PYAUTO_CACHE_EPOCHalone: the restore-keys prefix still matches the existing entries, and the next save is the superset. Nothing else in the file moves. - Validate:
python3 -m pytest -q -n autoin PyAutoHeart (the wiring test file alone is 46 tests at baseline), then commit, push, open the PR. - PR body carries the pricing note for the human: what to watch on the board (
[jax cache hit|miss]per-repo lines andcache_state.jsonjax_mb/jax_n), the expected order of magnitude (~3 MB × JAX scripts per workspace per Python leg), and the rollback.
Key Files
.github/workflows/smoke-tests.yml— the runner step env (line ~591 today,JAX_COMPILATION_CACHE_DIR); cache restore/save at ~380 and ~790tests/test_smoke_tests_wiring.py— runner-step assertions (test_the_runner_step_names_both_cache_dirs_and_is_otherwise_untouched,test_the_runner_command_is_still_byte_identical_and_still_fatal)PyAutoNerves/autonerves/jax_wrapper.py:133— thesetdefault("JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS", "1")this overrides; a preset value is respected (test_min_compile_time_respects_preset_value)
Follow-ups (not this PR)
- autolens_workspace_test / autogalaxy_workspace_test
profile_smoke.yaml: the three per-scriptJAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECSoverrides from/ci_speedup2026-09-10 become redundant once this is onmain(harmless while they stay). lib-tests.yml(the libraries' unit gate) restores the same cache with the same missing threshold; a separate pricing, since its suites are a different compile profile.
Original Prompt
Click to expand starting prompt
Set JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS=0 for the whole smoke leg
Type: refactor
Target: pyautoheart
Repos:
- PyAutoHeart
Themes: - performance
- ci
Difficulty: small
Autonomy: supervised
Priority: high
Status: formalised
Consequence: judge
Review-minutes: 15
Unattended: ready
Filed: 2026-09-10
/ci_speedup (2026-09-10) fixed this per-script for the three slowest JAX smoke
entries. The general fix is one line, and it is a human's call because of what
it does to the cache artefact.
The finding
PyAutoHeart's reusable smoke-tests.yml restores/saves .pyauto_jax_cache and
exports JAX_COMPILATION_CACHE_DIR, but sets no compile-time threshold.
JAX's default jax_persistent_cache_min_compile_time_secs is 1.0s
(jax/_src/config.py:1500), and autonerves/jax_wrapper.py setdefaults the
same, so only executables taking longer than a second are ever written to disk.
The JAX smoke scripts are made of many small compiles, so almost nothing is
cached and CI re-pays the compile on every run. This is why the board shows
cache_jax: HIT beside numbers that match a cold run — the cache it hits holds
1–4 entries.
Measured, cache built and read under each regime (local, smoke profile):
| script | threshold 1.0 (CI today) | threshold 0 | cache entries |
|---|---|---|---|
autolens imaging/jax_likelihood/delaunay.py |
23.4–27.1s | 10.4–10.5s | 2 → 513 |
autolens misc/jax_assertions/delaunay_nn.py |
27.2–27.8s | 13.0–13.5s | 4 → 299 |
autogalaxy interferometer/jax_likelihood/delaunay_mge.py |
30.5–31.3s | 18.1–18.4s | 1 → ~490 |
Compile censuses (JAX_LOG_COMPILES=1): 504 executables / 471 cold; 312 / 308
under 1s; 507 with exactly 1 over the threshold.
Why it is not already done
Three per-script overrides shipped instead (autolens + autogalaxy
profile_smoke.yaml, 2026-09-10). Hoisting to defaults: or into
smoke-tests.yml would pay on every jax_likelihood/jax_grad script in
the leg — but it grows the saved cache artefact by roughly 500 entries /
~3 MB per script, across two workspaces and both python legs. That is a
cache-size and restore-time trade a human should price, not an agent.
Not a correctness risk
The threshold governs which XLA executables are persisted, not the graph,
dtypes, backend or arithmetic. A cache hit returns the executable the compiler
would have built. Printed output was diffed byte-for-byte across both regimes on
all three scripts; RC=0 throughout.
Caveat worth carrying
misc/jax_assertions/delaunay_nn_caps.py is genuinely threshold-insensitive
(17.0s vs 15.1s) because four of its six compiles take 1.048–1.094s — they clear
1.0s by under 10%. A faster runner would silently drop them below the threshold
and the script would regress with no code change. That fragility is an argument
for setting the threshold globally rather than per-script.
Activity
Jammy2211 commentedon Sep 10, 2026
Shipped
30af9f9(headb1afb3e) intomain, 2026-09-10.smoke-tests.ymlrunner step now exportsJAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS: "0"besideJAX_COMPILATION_CACHE_DIR; wiring testtest_the_runner_persists_every_compile_it_makespins it. Runner command untouched; no epoch bump.@main. What to watch: the board's[jax cache hit|miss]lines andcache_state.jsonjax_mb/jax_n. Rollback: delete the one line or bumpPYAUTO_CACHE_EPOCH.profile_smoke.yamlare now redundant;lib-tests.ymlhas the same missing threshold.Mind:
active/smoke_jax_cache_threshold.md→complete/2026/09/smoke-jax-cache-threshold.md.Generated by Claude Code