This repository was archived by the owner on Jul 17, 2026. It is now read-only.
fix(infra): persistent XLA compile cache in harvest/clustering workers; one policy definition#969
Open
claude-spd1 wants to merge 2 commits into
Open
fix(infra): persistent XLA compile cache in harvest/clustering workers; one policy definition#969claude-spd1 wants to merge 2 commits into
claude-spd1 wants to merge 2 commits into
Conversation
…ring workers; one policy definition open_jax_run jit-compiles a full 8B forward, but neither worker entrypoint enabled the persistent compile cache — a fanned-out harvest recompiled identical HLO per worker, per invocation, while the trainer's cache dir already sat on shared FS. - Hoist the cache policy into core as param_decomp.compile_cache.enable_persistent_compilation_cache (the one definition); the LM composition root, pretrain.train (whose copy had already drifted: missing min_entry_size_bytes, int threshold, dead out_dir-None guard), and both workers call it at startup. - Lower jax_persistent_cache_min_compile_time_secs 60 -> 5 (jax default 1): under 60s, eval-tier and init compiles (1-60s) recompiled on every requeue, and the worker forward would miss the cache whenever it compiles in under a minute. 5s still keeps trivial slice/utility jits out. - Document at the hoisted site: rank-0's xla_dump_* XLA_FLAGS don't fork its cache key (jax strips debug options), and jax_persistent_cache_enable_xla_caches='all' must stay unset (crashes on jax 0.10.1/B200; default already persists the autotune cache). Verified on CPU: cache dir auto-created by jax, entries written and reused. Audit ref: 2026-07-10 jax compile audit, M1 + cache-policy LOW. Crew-Address: task/jax-worker-persistent-cache Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…ithmetic grid step The run's pinned runtime.compiler_options reached every step factory except open_jax_run's consumer forward and make_arithmetic_grid_step, which compiled with bare defaults. compiler_options enter the compile-cache key, so threading them now also keeps worker cache entries stable instead of invalidating them in a later pass. _take_columns (trivial gather) stays without options, noted at the site. Audit ref: 2026-07-10 jax compile audit, compiler_options-consistency LOW (sanctioned rider on the M1 cache fix). Crew-Address: task/jax-worker-persistent-cache Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Harvest and clustering workers never enabled JAX's persistent compilation cache, so a fanned-out harvest recompiled the identical full 8B
open_jax_runforward once per worker, per invocation — while the trainer's cache dir already sat on shared FS.Commit 1 — the cache fix:
param_decomp.compile_cache.enable_persistent_compilation_cache— now the ONE definition. Called at startup by the LM composition root,pretrain.train, and both workers (harvest/scripts/run_worker.py,clustering/scripts/run_worker.py). The pretrain copy had already drifted (missingmin_entry_size_bytes,intthreshold, deadout_dir is Noneguard) — deduped.jax_persistent_cache_min_compile_time_secs60 → 5 (jax default: 1). Under 60s, eval-tier and init compiles (1–60s) recompiled on every requeue, and the M1 fix's value would silently hinge on whether the worker forward happens to compile in over a minute. 5s still keeps trivial slice/utility jits from churning the dir. Happy to bump back if someone knows why 60 was chosen.xla_dump_*XLA_FLAGSdon't fork its cache key (jax strips debug options when keying);jax_persistent_cache_enable_xla_caches='all'must stay unset (runtimeCUDA_ERROR_NOT_FOUNDon jax 0.10.1/B200; the default already persists the per-fusion autotune cache on jax ≥ 0.10).Commit 2 — sanctioned rider (audit-classed consistency LOW, folded in per triage since
compiler_optionsenter the compile-cache key — threading them later would invalidate the worker cache entries this PR creates): the run's pinnedruntime.compiler_optionsnow reachopen_jax_run's consumer forward andmake_arithmetic_grid_step, the two step factories that compiled with bare defaults._take_columns(trivial gather) deliberately stays without options, noted at the site.Related Issue
Bridge task
jax-worker-persistent-cache(2026-07-10 JAX compile audit: M1 + cache-policy LOW + compiler_options LOW; ledger in lore2026-07-10--jax-compile-audit-remaining-findings).Motivation and Context
A fanned-out harvest pays the multi-minute forward compile N times for identical HLO; requeued trainer runs additionally re-paid every 1–60s compile. Known open item NOT addressed here (belongs to task
jax-compile-observability): the 2026-06-19 observation of the trainer cache not writing new entries.How Has This Been Tested?
make checkclean (ruff + basedpyright, whole workspace).pytestover the touched surfaces: clustering ensemble pipeline + membership bridge, harvest batch, pretrain smoke, arithmetic eval — 20 passed.enable_persistent_compilation_cacheon a temp dir → jax auto-creates the dir and writes entries on compile (verified with threshold dropped to 0 so a toy jit qualifies).Does this PR introduce a breaking change?
No. Behavioral deltas: workers now populate/read the shared
xla_compilation_cachesibling ofruns/; compiles in the 5–60s band now cache; the consumer forward and arithmetic grid step compile under the run's pinnedcompiler_options.🤖 Generated with Claude Code
Crew-Address: task/jax-worker-persistent-cache