Skip to content

feat: JAX persistent compilation cache by default + XLA_FLAGS append fix (#127) - #128

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/jax-cache-default
Jul 17, 2026
Merged

feat: JAX persistent compilation cache by default + XLA_FLAGS append fix (#127)#128
Jammy2211 merged 1 commit into
mainfrom
feature/jax-cache-default

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Overview

Rollout of the autolens_profiling#71 verdict (closes #127): enable the JAX persistent compilation cache by default, turning prohibitive XLA compile times into a once-per-machine cost — measured 117 s → 2.3 s locally (51×) and 5518 s → 937 s end-to-end on the A100 pathological case (5.9×).

Also fixes the XLA_FLAGS clobber: the wrapper previously overwrote the variable when the constant_folding disable was absent, silently discarding user/job flags (--xla_dump_to, --xla_gpu_autotune_level=0). It now appends. This bug made dump flags look inert during the #71 research and invalidated the historical 2026-07-15 "autotune ruled out" A/B (downgraded to unproven on the #71 record).

API Changes

None (public Python API untouched). Environment behavior at import autoconf.jax_wrapper (i.e. import autofit and downstream):

  • JAX_COMPILATION_CACHE_DIR — newly defaulted to $XDG_CACHE_HOME/pyauto_jax or ~/.cache/pyauto_jax when unset. Pre-set values respected; explicit empty string disables the cache.
  • JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS — defaulted to 1 when unset and the cache is enabled; pre-set values respected.
  • XLA_FLAGS — existing user flags are now preserved (constant_folding disable appended instead of replacing the whole value).
  • New INFO log line explains the cache location and the one-time first-compile cost.

Tests

  • New test_autoconf/test_jax_wrapper.py: 9 env-handling tests (reload-based, no JAX import per the unit-test rule).
  • Full PyAutoConf suite: 147 passed.
  • Downstream PyAutoFit suite against this branch: 1493 passed, 1 skipped (PyAutoFit imports jax_wrapper at __init__ line 1 — the highest-risk downstream of this base-layer change).
  • Empirical verification of the env-only path in fresh processes: jax.config.jax_compilation_cache_dir / jax_persistent_cache_min_compile_time_secs pick up the values, and cache entries are written on first compile.

Heart

RED at ship time — pre-existing reasons unrelated to this branch; human-acknowledged for PR-open (merge stays human).

🤖 Generated with Claude Code

…AGS clobber

JAX_COMPILATION_CACHE_DIR defaults to ~/.cache/pyauto_jax (XDG-aware) when unset; empty string disables; JAX_PERSISTENT_CACHE_MIN_COMPILE_TIME_SECS defaults to 1. XLA_FLAGS now appends constant_folding disable instead of overwriting user/job flags. Evidence: autolens_profiling#71 (cache 51x local / 5.9x A100 end-to-end).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label Jul 17, 2026
@Jammy2211
Jammy2211 merged commit 86986be into main Jul 17, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/jax-cache-default branch July 17, 2026 07:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: enable JAX persistent compilation cache by default (+ fix XLA_FLAGS clobber)

1 participant