Skip to content

R1e: nothing is JIT-compiled after readiness - #1231

Merged
trissim merged 7 commits into
mainfrom
refactor/R1e-no-jit-after-readiness
Oct 12, 2026
Merged

trissim merged 7 commits into
mainfrom
refactor/R1e-no-jit-after-readiness

Conversation

@trissim

@trissim trissim commented Oct 12, 2026 •

Copy link
Copy Markdown
Collaborator

R1e · guards 2/2 · production −1410 +241 · tests −4 +285

Owner requirement: every one-time cost is paid in function-catalog preparation, before the server reports ready; nothing is JIT-compiled afterwards in the server, its workers or the client. Receipt with method, tables and certificates: docs/refactor/consolidation-20261009/R1e-no-jit-after-readiness.md.

Measured on main (cold Numba and catalog caches, CPU-only, Numba's numba:compile event and cache lookups counted per process)

  • ExampleFly and ExampleColocalization compiled 7 kernels inside timed execution (0.91 s, 0.77 s): the Costes warm-up passed only anti-correlated data, and linear_costes branches on the data.
  • 52 of 298 first-party kernels had no compiled signature anywhere after a full preparation.
  • The client loaded 60 to 178 kernels (0.5 to 1.0 s) converting a .cppipe, because building a callable's contract ran its preparation hooks. It never runs a kernel.
  • The server first-imported 106 modules across the first request, and each worker repeated them (0.09 to 0.13 s; 0.44 s when PolyStore's registry cache missed).
  • Not reproduced: R1c's "workers compile thresholding kernels". Workers are forked before readiness with every prepared kernel loaded.

Changed

  • Every such kernel is now reached by its owner's existing preparation (branch, dimensionality or dtype the warm-up missed), or deleted because nothing calls it (30 kernels). No list of kernel names; no kernel body changed.
  • CallableProjection.declared_contract() reads a contract without preparing; .cppipe conversion and pattern lowering use it. CompilationSession prepares through normalize_prepared_function_pattern, so a process without catalog preparation still prepares at compile time. Signatures are identical before and after preparation for all 1035 catalogued targets.
  • The catalog server builds the storage backend registry and completes the domain-extended registries before the worker fork.

After

main branch
Compilations after readiness (Fly / Colocalization) 7 / 7 0 / 0
Kernel loads in the client 60 to 178 0
Kernels with no compiled signature after preparation 52 0
Server imports after readiness, setup / compile / execute 44 / 2 / 60 0 / 2 / 57
Pipeline compile first / second, ExampleHuman 0.302 / 0.282 s 0.181 / 0.176 s
Cold preparation, traced, mean of six 52.3 s 51.0 s

Wall times were taken with other jobs running on the machine; counts are exact.

Guards

tests/integration/test_no_jit_after_readiness.py: one cold run of two pipelines over a real server in a child process. (1) No process compiles or loads a kernel after its server's readiness; a client never does. (2) Every openhcs Numba dispatcher that is not inline="always" has a compiled signature at readiness; seen failing with one warm-up removed. Integration tier (a cold preparation takes about 90 s). They cannot see a kernel prepared with one signature and reached with another.

Gates

  • verify_branch.sh r1e: 11656 passed, 34 failed, 2 errors; new against the known list: 0.
  • Official30 parity under heavy_slot.sh and official30.lock, cold: 1 passed in 716 s (all 30 cases); its trace shows 0 compilations after the first preparation in any process.
  • smoke_local.sh rc=0; guardrails_local.sh rc=0; guards 2 passed.

For the reviewer

  • Three Numba overrides were removed for inputs production does not pass (block_labels, non-boolean fill_labeled_holes_below_size, 3D relabel_sequential); those inputs now take the inherited NumPy/SciPy implementation. Certificate: tests-only. The alternative is to keep them and add warm-ups.
  • intensity_zernike_moments_batch (an exported name with no caller) is deleted.
  • Remaining late work, 0.03 s per process: PIL plugin and imagecodecs loading at first image I/O. Its owner is PolyStore; Storage backends prepare their process-wide lazy state on request PolyStore#40 adds the preparation, to be adopted after a release.

🤖 Generated with Claude Code

trissim and others added 6 commits October 12, 2026 12:19
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng, late imports, guard)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…red by the catalog server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 17:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@trissim
trissim merged commit 1b5fe99 into main Oct 12, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants