Repository navigation
Description
Overview
JAX 0.12.1 (on PyPI since 2026-11-18) breaks the default structured step-0 triangle containment route. On jax 0.12.1, 5 of the test__step0_route_is_bit_identical_to_gather[...-structured] cases fail (83–836 points per case get different kept triangles from the reference gather route). On the same source with jax 0.12.0.1, all 15 pass. Reproduced locally. The PyAutoNerves pin jax>=0.12.0,<0.13 admits 0.12.1, so fresh installs of the released 2026.11.13.1 are affected, and this blocks the pending library release (PyAutoHands release.yml run 44501247836 failed on this).
Plan
- Find out what the differences are: points on or very near a shared triangle edge whose rounding changed (e.g. XLA fusion / fused multiply-add in 0.12.1), or genuinely wrong containment.
- If fixable, make the
structuredbranch of_step0_containsmatch the gather route exactly on both jax 0.12.0.1 and 0.12.1, keeping its no-gather property. - If not cleanly fixable within about an hour of investigation, switch the default
_STEP0_CONTAINMENTback to"gather"(the reference path), measure the CPU cost, and file a follow-up to fix the structured route. - Leave the PyAutoNerves jax pin alone (excluding 0.12.1 only hides the problem; 0.12.2 would very likely bring it back).
- Validate on both jax versions, then ship as a
pending-releasePR so it goes out with the pending release.
Effective level: supervised; merge mode: human /prm.
Detailed implementation plan
Affected Repositories
- PyAutoArray (primary)
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoArray | main (5815019d) |
clean |
Other PyAutoArray worktrees (magnification-maps-wiring, places-to-be-readme, repository-guidance-cleanup) do not touch triangles.
Suggested branch: feature/jax-0121-step0-structured
Implementation Steps
- Reproduce. Make a scratch venv with
jax==0.12.1 jaxlib==0.12.1, chained to the PyAuto313 site-packages through a.pthfile. Runpytest test_autoarray/structures/triangles/test_coordinate_jax.py -k step0_route_is_bit_identical: 5 fail on 0.12.1, 15 pass on 0.12.0.1. - Investigate. In
autoarray/structures/triangles/array.py, look at_step0_contains, specifically thestructuredbranch (about lines 260–296), and at_barycentric_contains.- Compare the structured mask with the gather mask for the failing cases.
- For each differing triangle, recompute the barycentric terms in float64 and measure the distance to the edge.
- Try disabling XLA fused-multiply-add contraction to test the fusion hypothesis.
- Fix (preferred). Make the structured branch feed
_barycentric_containsoperands of the same form, operation order and dtype as the gather route. Keep the zero-gather property and the existing HLO guard tests. Add a regression comment naming jax 0.12.1. - Fallback. Set
_STEP0_CONTAINMENT = "gather"and update the comment block. Re-measure the step-0 CPU cost from point-source phase 4c and record it. File a Mind follow-up to restorestructured. - Tests.
- Full
test_autoarrayon jax 0.12.0.1 (local~/venv/PyAuto313) and on 0.12.1 (the scratch venv). - PyAutoLens
test_autolens/pointon 0.12.1. - The PR's CI installs 0.12.1 itself.
- Full
Key Files
autoarray/structures/triangles/array.py:_STEP0_CONTAINMENTswitch,_step0_containsstructured branch,_barycentric_contains.autoarray/structures/triangles/coordinate_array.py:Step0Layoutand thegridlayout used by the structured route.test_autoarray/structures/triangles/test_coordinate_jax.py: the bit-identity fuzz (the witness) and HLO guards.
Original Prompt
Click to expand starting prompt
JAX 0.12.1 breaks step-0 structured triangle containment (bit-identity vs gather fails)
Type: bug
Target: PyAutoArray
Repos:
- PyAutoArray
Themes: - jax
- triangles
- point-source
- release-blocker
Difficulty: small
Autonomy: supervised
Priority: high
Status: draft
Consequence: judge
Witness: on jax 0.12.1,pytest test_autoarray/structures/triangles/test_coordinate_jax.py -k step0_route_is_bit_identicalpasses (or jax 0.12.1 is excluded from the pin with a recorded reason), and the PyAutoHands release.yml TestPyPI test step passes for PyAutoArray.
Lane: any
Found 2026-11-19 by the release session (/release, stopped at vitals). The PyAutoHands release.yml TestPyPI test step
(run 44501247836, 2026-11-19T09:58Z) failed on PyAutoArray: 5 of 2473 tests failed, all
test_autoarray/structures/triangles/test_coordinate_jax.py::test__step0_route_is_bit_identical_to_gather[...-structured]
(cases solver, solver_deflected, alternating, alternating_padded, even_rows). The structured route's containment differs
from the gather route at 83–836 points per case, e.g. "structured on solver: 83 of 15443 points differ from gather,
first at [-6.75 9.8726896]".
Cause (strongly indicated): the JAX version, not a code change. Yesterday's run 44279589911 passed on the same PyAutoArray
main (5815019) with jax/jaxlib 0.12.0.1; today's installed jax/jaxlib 0.12.1 (PyPI 2026-11-18T13:57Z). The test and the
triangles code are unchanged since 2026-09-27 (#579 step-0 routes; 462ad09 MAX_CONTAINING_SIZE 15->20). Library CI on
main last ran before 0.12.1 existed, so it still shows green.
Impact: the pin jax>=0.12,<0.13 admits 0.12.1, so fresh installs of the released 2026.11.13.1 are also affected
(point-source containment on the structured step-0 route may be wrong). It blocks the pending library release (18
pending-release PRs across Fit/Galaxy/Array/Lens): a rehearsal would fail the same way.
Fix options: (1) exclude jax 0.12.1 in the pin (!=0.12.1 or <0.12.1) — fast and protects current users; needs the
DNA/Nerves version-policy view (memory: jax-version-policy, pin jax>=0.12,<0.13 shipped 2026.11.12.1); (2) reproduce
locally on 0.12.1, find which op changed (likely a sort/searchsorted/float rounding or scatter semantics change in the
structured route) and fix it so the route is bit-identical on both versions. Prefer (2) if small; else (1) now and (2)
as a follow-up.
Activity
Jammy2211 commentedon Nov 19, 2026
Library PR created
pending-release), head3b2ba0f8_barycentric_containsonce on flat(N,)operands. No gather; default route staysstructured.Jammy2211 commentedon Nov 19, 2026
Smoke results (
pyauto-heart smoke --root <task worktree> --jobs 3)8/8 passed, including the autolens_test point-source scripts (
point.py,solver_extent.py). Note: the cached smoke environments run jax 0.12.0.1, so this is the no-regression check; jax 0.12.1 coverage is the unit/point test runs above plus PR CI. Ready for human /prm on #704.Jammy2211 commentedon Nov 19, 2026
Shipped
Merged #704 (merge commit
e398b808) on 2026-11-19. CI green on jax 0.12.1 (unittest 3.12/3.13 + nojax). Awaiting the next library release (pending-release).