Repository navigation
Description
Overview
XLA:CPU keeps deadlocking inside compiled JAX likelihoods (a later call never returns, 0 % CPU, futex wait in CpuPjRtRawLoadedExecutable::Execute), and each occurrence has been patched locally (container flags, a Heart release-only flag, a profiling-script flag, a private RAL job script). Users' installs get none of these fixes, and the recommended baseline jax 0.11.2 still hangs. This research task finds one general policy covering the allowed JAX version range plus any default XLA CPU flags, backs it with a repeated-call hang matrix, and records it as a PyAutoDNA campaign so the policy and the environments' actual JAX versions and XLA flags are visible on the DNA board.
Heart RED development override invoked by the human on 2026-11-10 (Heart RED: PyAutoGalaxy/PyAutoLens Tests failing, workspace validation 14f). This is a research task; no library change ships from it.
Plan
- Build one set of hang reproducers: the PyAutoPulse reproducer that needs no PyAuto code (exported group MGE prefix-3 module), group Delaunay prefix 4, the
delaunay_mgemulti-dataset vmap (hung even with the eigen flag in release-integrate), the PyAutoHeart#274 batched-Cholesky path, and one real HowToLens ch2 tutorial-4 MGE fit. - Run a hang matrix: jax 0.9.2 / 0.11.2 / 0.12.0 / 0.12.0.1 × {no flag,
--xla_cpu_multi_thread_eigen=false,--xla_cpu_enable_concurrency_optimized_scheduler=false} × N=300 repeated calls, in throwaway per-version venvs (never PyAuto313 or the shared RAL install). Short laptop pilot, then a RAL CPU array (not thegpupartition). - Record every cell in PyAutoDNA: one stack per jax version × flag pair, one receipt per environment (
dna collect --probe-backend), one validation record per stack × environment under a new DNA-writtenresearchauthority (which can never trigger a promotion by itself). - Measure the per-call cost of each surviving flag across likelihood families (MGE, rectangular, Delaunay, interferometer, point source) at 4 cores, 8 cores and on a RAL node, in fp64, and store it as DNA evidence.
- Check JAX/XLA upstream for an existing issue or a fix in 0.12. If there isn't one, draft an upstream issue from the reproducer for the human to approve before filing.
- Write a DNA decision page that replaces the overdue
decisions/jax-2026-10-04.md. It covers the allowed range, any CPU-only default flag, the baseline and the guard design. Add a small DNA board change so environments' JAX versions and XLA flags, plus a JAX CPU policy panel, show publicly. - File follow-up prompts: the Nerves pin/flag change, a Heart guard that writes reproducer results into DNA on every allowed version, HowToLens/docs updates, and pointing PyAutoPulse's XLA notes at DNA.
Tier: glance — merge mode: auto-merge on green if the Witness passes, post-merge summary
Detailed implementation plan
Affected Repositories
- PyAutoNerves (issue home; read-only in this task)
- autolens_profiling (reproducer and matrix scripts, campaign wiki)
- PyAutoDNA (campaign records,
researchauthority, decision page, board panel) - Read-only: HowToLens, PyAutoHeart, PyAutoPulse
Branch Survey
| Repository | Current Branch | Dirty? | Notes |
|---|---|---|---|
| ./lens/autolens_profiling | main | clean | co-claimed with paused gradient-correctness-sweep (#517) by human override 2026-11-10; separate branch and worktree, paths disjoint |
| ./organs/PyAutoDNA | main | clean | leftover worktree feature/pyautodna-stack-management (0 ahead, clean): not a conflict |
Suggested branch: feature/jax-version-policy (worktree ~/Code/PyAutoLabs-wt/jax-version-policy/)
Implementation Steps
Phase 1: hang matrix as a DNA campaign (prompt questions 1, 2, 4, 6)
autolens_profiling/scripts/misc/jax_version_policy/export_reproducers.py: serializejax.exportmodules plus their inputs for group MGE prefix 3, group Delaunay prefix 4 and thedelaunay_mgevmap. Reuse_jax_cell,_flat_paramsand_stage_valuefromscripts/misc/likelihood_breakdown/galaxy_group_standard.py.hang_matrix.py: in a freshpython -Iprocess that imports only jax, load the module and call it N times under a per-call watchdog. Each run writes a JSON row: jax/jaxlib, XLA_FLAGS, cores, environment id, the call index that hung (or null), and seconds per call.lapack_repro.py: a batchedcho_factorreproducer for the #274 path.make_venvs.sh: one venv per jax version under a scratch path.- Caveat: an exported module fixes the StableHLO, so re-running it under each version tests XLA compile and runtime, but not tracing. Each version also runs one real HowToLens tutorial-4 fit through the library with a repeated-call driver.
- RAL: an sbatch array of version × flag × reproducer × 5 repeats,
--no-requeue, private checkout,ralpartition. The laptop pilot stays under 30 min. - PyAutoDNA: register the stacks (jax pin plus runtime XLA constraint) and the campaign "jax-cpu-policy". Collect receipts per environment. Add the
researchvalidation authority todna/schema.pyand the gate code (it can never satisfy promotion), with tests. Import the matrix rows as validation records.
Phase 2: flag cost (question 3)
8. Reuse the likelihood_breakdown drivers (XLA_CPU_WORKAROUND_FLAG already exists) to measure steady-state per-call time with and without each flag, per family, at 4/8 cores locally and at full width on RAL. Store the results as DNA evidence.
9. Confirm from XLA option handling that the flags are inert on GPU. Run on GPU only if the check is ambiguous.
Phase 3: decision, board, follow-ups (question 5)
10. PyAutoDNA/decisions/jax-cpu-policy-2026-11.md replaces jax-2026-10-04.md with a new review date. It holds the matrix, the cost table, the recommended single policy and the Heart guard design.
11. DNA board: a public allowlist of runtime flag names and specific XLA option tokens (no paths or hosts) in dna/inventory.py / dna/board.py, plus a JAX CPU policy panel showing matrix status per allowed version. Tests cover both.
12. Follow-up prompts in PyAutoMind/draft/: Nerves pin and/or jax_wrapper CPU-only default flag; Heart scheduled reproducer guard writing DNA records; HowToLens/README docs; PyAutoPulse knowledge and decision pointers to DNA; the upstream JAX issue (human approval).
13. Witness check against the prompt's Witness: line.
Key Files
PyAutoPulse/knowledge/xla_cpu_deadlock_jaxlib_0_11_2.md: reproducer recipePyAutoPulse/decisions/xla-cpu-deadlock-eigen-workaround.md: D12 decisionPyAutoNerves/autonerves/jax_wrapper.py: existingXLA_FLAGSeditsPyAutoDNA/dna/inventory.py:16: runtimeFLAGScollected (incl.XLA_FLAGS)PyAutoDNA/dna/campaigns.py,dna/schema.py,dna/board.py,environments.yaml,decisions/jax-2026-10-04.mdautolens_profiling/scripts/misc/likelihood_breakdown/galaxy_group_standard.py
Original Prompt
Click to expand starting prompt
JAX version policy and the recurring XLA:CPU deadlocks: what is the general…
Type: research
Target: PyAutoNerves
Repos:
- autolens_profiling
- PyAutoNerves
- HowToLens
- PyAutoHeart
- PyAutoPulse
Difficulty: too-large
Autonomy: supervised
Priority: high
Status: formalised
Consequence: glance
Witness: a written recommendation (one policy covering JAX version range + any default XLA flags) backed by a repro matrix: each candidate jax/jaxlib version x flag setting, run on the laptop and a RAL CPU node, records hang / no-hang over N repeated calls of the known reproducers, plus per-call cost of the flag on at least one MGE and one pixelized likelihood.
Review-minutes: 3
Unattended: needs-slicing
Lane: ral
Human request (2026-11-10): "make this more general research on what to do with JAX version and what might be the most general sensible solution". Raised while regenerating HowToLens#130 stored results on RAL, where tutorials 4 and 6 deadlocked at 0 % CPU.
The problem: the same bug class keeps being patched locally
XLA:CPU on JAX CPU hangs: a compiled (often vmapped) executable runs, then a later call never returns, process at 0 % CPU (futex wait in CpuPjRtRawLoadedExecutable::Execute → tsl::BlockUntilReady → absl::Mutex). Every fix so far has been scoped to one place; no fix reaches users' installs.
| When | Where seen | Fix | Scope |
|---|---|---|---|
| 2026-09 | 4-core containers, vmap ("intra-op thread-pool starvation") — Mind complete/2026/09/mge-jit-regression-rebaseline.md, jax-import-order-x64.md, jit-visualization-outputs.md | XLA_FLAGS=--xla_cpu_multi_thread_eigen=false |
container/CI only |
| 2026-10-04 | CPU batched LAPACK (Cholesky) on jax 0.10.x / 0.11.0 — PyAutoHeart#274 | PyAutoNerves 249ba9e: jax>=0.7.0,<0.12.0,!=0.10.*,!=0.11.0 (+ README "JAX compatibility") |
everyone |
| 2026-10-05 | CPU FFT pool deadlock in release validation | PyAutoHeart ad9bbc4: eigen flag in workspace-validation release mode, release-diagnostic, jax-compatibility; test asserts smoke mode does NOT set it |
Heart release legs only |
| 2026-10-29 | likelihood-lifecycle 2d: every JAX CPU cell on jaxlib 0.11.2 (MGE, rectangular, Delaunay) — decision D12 | eigen flag in scripts/misc/likelihood_breakdown/galaxy_group_standard.py (XLA_CPU_WORKAROUND_FLAG) |
autolens_profiling only |
| 2026-11-10 | HowToLens ch2 tutorials 4 (MGE) and 6 (MultiStartProdigy) on RAL, jaxlib 0.11.2 | eigen flag in the private RAL job script | one task |
Key facts:
- PyAutoNerves names 0.11.2 the "recommended validation baseline" and it is what users resolve today (laptop and RAL venvs are jax/jaxlib 0.11.2), yet 0.11.2 has the 2d/HowToLens deadlock. The 0.10/0.11.0 exclusion fixed a different (LAPACK) path.
- jax/jaxlib 0.12.0 and 0.12.0.1 are on PyPI and excluded by the
<0.12.0cap. Untested whether they fix either path. - PyAutoNerves
autonerves/jax_wrapper.pyalready editsXLA_FLAGSbefore JAX starts (appends--xla_disable_hlo_passes=constant_folding,--xla_gpu_autotune_level=0, Triton GEMM off), env-respecting — a natural home for a CPU flag if that is the answer. - Known reproducer with no PyAuto code: PyAutoPulse
knowledge/xla_cpu_deadlock_jaxlib_0_11_2.md(exported group MGE prefix-3 function, hangs ~call 14 by default, 300 calls fine with either flag). Decision record: PyAutoPulsedecisions/xla-cpu-deadlock-eigen-workaround.md. - Two flags avoid it:
--xla_cpu_multi_thread_eigen=false(D12 chose it; ~+25 % per call vs default on group/mge, ~2x faster than the alternative on MGE) and--xla_cpu_enable_concurrency_optimized_scheduler=false. - Hang is intermittent (call 1 to ~35): short smokes and test mode pass by luck. Smoke tests run in test mode and never hit it; readers running tutorials live (HowToLens ch2 tutorial 1 runs a real JAX search) are exposed.
- Prior human constraint (CI timing epic): keep the eigen flag and the Eigen-pool bug-class reproduction (jax-compile-stall epic in epics.md).
Questions to answer
- Do jax/jaxlib 0.12.0 / 0.12.0.1 fix the 0.11.2 XLA:CPU deadlock (Pulse reproducer + one real tutorial fit) and the PyAutoHeart#274 LAPACK path? Any upstream JAX issue / fix commit?
- Which versions in the allowed range are actually safe on CPU, with and without each flag? Is "recommended baseline 0.11.2" still right?
- Is a library default (e.g. PyAutoNerves
jax_wrapperappending a CPU-only XLA flag, skipped when the platform is GPU, never overriding a user's explicit setting) the most general fix? Cost across likelihood families (MGE, rectangular, Delaunay, interferometer, point source), CPU core counts (4 vs 8 vs RAL nodes), and fp64. - Alternatives: pin/cap changes (exclude 0.11.2, move to 0.12.x, raise the floor), the scheduler flag instead, per-feature workarounds, or documentation only. Interaction with the GPU path (flag inert? D12 2d fix skipped it for cuda).
- How should this be guarded so it stops recurring: a Heart check that runs a known reproducer for N calls on each allowed jax version, rather than test-mode smokes.
- Should an upstream JAX issue be filed (the Pulse reproducer's exported module is the evidence)?
Deliverable
A short decision page (PyAutoPulse knowledge/decision or Nerves README section) with the repro matrix, a recommended single policy, and follow-up implementation prompts (library change, pin change, Heart guard, docs). Research only: no library change in this task.
Constraints
- Laptop for short pilots only; repeated-call matrices longer than ~30 min go to a RAL array per the no-long-laptop-runs rule (private checkout, never the shared install).
- Measure through
pyauto-brain profilingconventions where timing rows are recorded.
Activity
Jammy2211 commentedon Nov 10, 2026
Progress: phase 1 laptop pilot
The hang test grid ran on the laptop (8 cores, one repeat per cell; 100 calls for the exported likelihoods, 30 for Delaunay, 20 for FFT):
while_loopcan deadlock since 0.11.1 jax-ml/jax#41265, fixed by [XLA:CPU] Use xla::cpu::Worker::Parallelize for DUCC FFT parallel loops. openxla/xla#50091 and released in jax 0.12.0. I found no upstream issue for the MGE/Delaunay hang.DNA: PyAutoDNA
feature/jax-version-policyadds:PyAutoDNAresearch validation authority that can block a promotion but never satisfy one;dna import-matrix;The laptop's own PyAuto313 environment (jax 0.11.2) now shows as yellow. The draft decision is in
decisions/jax-cpu-policy-2026-11.md.Next: the RAL grid (4 jax versions × 2 core counts × 5 repeats, 300 calls) is approved but not yet submitted, because the RAL jump host stopped responding during venv setup. After that: a Heart validation of 0.12, then the proposed floor
jax>=0.12.0,jaxlib>=0.12.0(both packages need it, because jax 0.12.0 still accepts jaxlib 0.11.2).Jammy2211 commentedon Nov 11, 2026
RAL results (job 415009) and recommendation
The run had 600 cells: jax 0.9.2 / 0.11.2 / 0.12.0 / 0.12.0.1 × {no flag, eigen, scheduler} × {4, 16} cores × 5 repeats, at 300 calls per cell (180,000 calls in total).
unloadable, not as failures.Recommendation (PyAutoDNA
decisions/jax-cpu-policy-2026-11.md):jax>=0.12.0,<0.13andjaxlib>=0.12.0,<0.13, after a Heart validation on 0.12.The FFT part is already fixed upstream (jax-ml/jax#41265 / openxla/xla#50091). 0.12 no longer reproduces the MGE hang either, so no upstream issue is needed.
All 600 rows are recorded in DNA as research evidence. Four follow-up drafts are filed in Mind: the Nerves floor (with the Heart validation), the Heart guard, removing the workarounds, and pointing the Pulse notes at DNA.
Jammy2211 commentedon Nov 11, 2026
Shipped for review: PyAutoLabs/autolens_profiling#527 (hang-grid scripts) and PyAutoLabs/PyAutoDNA#5 (research authority,
import-matrix, JAX CPU policy panel, decision, public records). The human acknowledged Heart YELLOW at ship on 2026-11-11. Merge via/prm. The jax floor change itself is follow-updraft/feature/autonerves/raise_jax_floor_to_0_12.mdand is coupled to the next release.Jammy2211 commentedon Nov 11, 2026
Shipped
Merged:
ad0242fc): thePyAutoDNAresearch validation authority (can block a promotion, never satisfy one),dna import-matrix, the public XLA-option allowlist, the JAX CPU policy board panel with a yellow item when an observed environment runs a hanging setup, the decisiondecisions/jax-cpu-policy-2026-11.md, and the published laptop + RAL 415009 records.a66136c4): the hang-grid scripts (scripts/misc/jax_version_policy/) and the RAL array script. A follow-up commit re-rendered the dashboard index and recorded the stall watchdog as not a timing gate.Witness: met. One policy (
jax>=0.12.0,<0.13+jaxlib>=0.12.0,<0.13, no default XLA flag), backed by a hang grid on the laptop and on RAL CPU nodes (600 cells, 180,000 calls). It also gives per-call flag cost on MGE and pixelized likelihoods (eigen flag +18–50 % on rectangular at 0.12).Approved by the human on 2026-11-11. The floor change itself rides the next release:
draft/feature/autonerves/raise_jax_floor_to_0_12.md(needs a Heart validation on 0.12 first). Other follow-ups: the Heart hang guard writing DNA records, removing the eigen-flag workarounds after release, and pointing Pulse's XLA notes at the DNA decision.