diff --git a/.github/workflows/smoke-tests.yml b/.github/workflows/smoke-tests.yml index 9aa94ed7..54ef1892 100644 --- a/.github/workflows/smoke-tests.yml +++ b/.github/workflows/smoke-tests.yml @@ -589,6 +589,17 @@ jobs: # subprocess, so each script's JAX writes to and reads from the same # compilation cache instead of one per-process temporary. JAX_COMPILATION_CACHE_DIR: ${{ github.workspace }}/.pyauto_jax_cache + # Persist EVERY compile, not only those over JAX's 1.0s default + # (autonerves setdefaults the same 1s whenever the cache dir is set; + # a preset value wins). The smoke scripts are hundreds of sub-second + # compiles each, so under the 1s regime a "hit" cache held 1-4 + # entries and every run re-paid the compile: measured 2->513, + # 4->299 and 1->~490 entries on the three slowest JAX scripts, and + # 23-31s -> 10-18s per script, output byte-identical. The price is + # cache-artefact size (~500 entries / ~3 MB per JAX script, per + # python leg); the way out is this one line, or an epoch bump to + # drop the fat caches. + JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS: "0" # Via env, never interpolated into the script body: these inputs reach # here from a caller's workflow_dispatch, and `${{ }}` inside `run:` # would splice their text straight into the shell. diff --git a/tests/test_smoke_tests_wiring.py b/tests/test_smoke_tests_wiring.py index 053fd89b..c317dece 100644 --- a/tests/test_smoke_tests_wiring.py +++ b/tests/test_smoke_tests_wiring.py @@ -103,11 +103,26 @@ def test_the_runner_step_names_both_cache_dirs_and_is_otherwise_untouched(): # cache the cache steps could not name, and the runner copies this job env # into every script subprocess, so all of them share the one directory. assert cache_dir.startswith("${{ github.workspace }}/") - # The command itself is untouched — one env key is the whole change. + # The command itself is untouched — the env keys are the whole change. assert 'python "$RUNNER" $RUNNER_ARGS' in step["run"] assert "continue-on-error" not in step +def test_the_runner_persists_every_compile_it_makes(): + """JAX (and autonerves, whenever the cache dir is set) only persist an + executable that took over a second to compile. The smoke scripts are + hundreds of sub-second compiles each, so under that default a "hit" cache + held 1-4 entries and every run re-paid the compile. The threshold is set + where the cache dir is set — the same step env the runner copies into + every script subprocess — and it is exactly "0", not a smaller-but-nonzero + value a faster runner could silently drop a compile under (PyAutoHeart#221).""" + step = _step(_steps(), RUNNER_STEP) + assert step["env"]["JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS"] == "0" + assert "JAX_COMPILATION_CACHE_DIR" in step["env"] + # Still an env-only change: the runner command is a workspace's own. + assert 'python "$RUNNER" $RUNNER_ARGS' in step["run"] + + # --- placement, and non-fatality -------------------------------------------- def test_the_cache_steps_sit_between_the_install_and_the_upload_in_order():