Skip to content

Independent review before release: findings still open #930

Backlog

Description

@seabbs-bot

Act on the findings of the independent review of the release branch, so each is fixed or decided before the freeze.

Open now

Decided

  • No wrong output or wrong gradient was found in the built-in parts.
  • Finding 4 (NEWS.md) is resolved: the file is gone.
  • Julia floor: 1.12.
  • The FFT is chosen on request only, and Auto is removed.
  • Public: State, Secondary, test_adjoint. Internal: uses_adjoint, Run, Local, TRACED_MIN_STRATA. Device is removed; Recent stays.
  • One modifier is accepted without a tuple.
  • A part that needs the package's rule need not work under NoAdjoint (owner, 2 December).
Earlier text

Earlier title: Independent review before release

Review of claude/amazing-shannon-6nrow8 at 1f19e43, on Julia 1.13.4, Linux, 4 cores.

Summary

The numerical core is sound and fast, but the branch is not yet a release candidate.
I found no wrong output and no wrong gradient in the built-in parts: 34 modifier and coupling set-ups and 15 model cases agreed with ForwardDiff on every backend I ran.
The primal matches or beats a plain hand loop, and the reverse rule matches a hand-written adjoint.
The weak point is the extension surface, not the arithmetic.
There are five ways to write a modifier step, two cotangent contracts, and routing that depends on method-table reflection.
One natural mistake in a user step gives a silently zero reverse gradient while forward mode stays correct.
The public surface is 5 exported and 55 public names, and the docs teach at least ten more that are not public.
Six open pull requests change 12,400 lines against this branch, three add public API and one removes an extension mechanism.
Enzyme works only with runtime activity, and the docs themselves list a forward-mode crash on Julia 1.12 and later.
GPU support is real on JLArrays for the forward pass, narrow for reverse, and untested on a real GPU per pull request.
NEWS.md describes names that do not exist in the source.
The Julia 1.11 floor is claimed but barely tested, with a known silent gradient loss under Enzyme there.
The owner's worry about a local minimum is fair for the extension interface and the number of specialised run paths, not for the operator design.
My advice: merge or close the in-flight API changes, cut the public list to a core, fix the items under "Must fix", then freeze.

Must fix

1. The branch is still moving under the release

2. A step that reads a parameter from the modifier gives a silently zero reverse gradient

  • Verified with this reproducer:
struct Bad{A}; a::A; end
CR.isstateless(::Bad) = true
CR.step(m::Bad, θ, v, s) = (m.a * v, nothing)   # m.a, not θ.a
f = x -> sum(Recurrence(g; modifiers = (Bad(x[1]),))(R; history = h))
# ForwardDiff: [124.788]   Mooncake reverse: [0.0]
  • m.a is the idiomatic way to read a field in Julia, so users will write it.
  • The docs warn about it (docs/src/developer/extending.md:39), and only PieceInterface{(:step,)} catches it, by printing [false], not by throwing.
  • A gradient that differs between backends with no error is the worst failure a package like this can have.
  • Suggestion: make the mistake impossible rather than documented.
  • Pass the step a modifier whose parameter fields are stripped (or pass only its type), or drop m and dispatch on a tag, so m.a fails loudly.

3. The public list is not the surface the docs teach

  • Verified with Base.ispublic: State, contributions, Secondary, param_eltype, uses_adjoint, Run, test_adjoint, depth, forward, ispointwise, Auto and Executor are not public.
  • Each of them is used on a user-facing page or in a public docstring; a call with record = Resume() returns a State, for example.
  • Device is public, and its own docstring calls it the older name for Parallel (src/adjoints/executor.jl:460).
  • Suggestion: for each name, make it public or remove it from user pages; drop Device before it is frozen.

4. NEWS.md contradicts the code

  • Read, not run: it names Pool, Routes(...), SoftTruncate, movement, prepend = true, flows_first, Add and Clamp, none of which exist in src.
  • It says forward, depth, uses_adjoint, test_adjoint, Executor and each! are public; none is in src/ComposableRecurrences.jl:102-110.
  • It says the ForwardDiff extension is gone and also lists one.
  • Suggestion: replace it with a short changelog against v0.1.0, checked against the public list.

5. Enzyme support is narrower than the README says

  • Verified: with AutoEnzyme(; mode = Enzyme.Reverse) three of my 15 cases throw EnzymeRuntimeActivityError, including every plain-AD route (NoAdjoint, a coupling without a pullback!).
  • Verified: with Enzyme.Forward six of 15 throw the same error, including a plain dense-coupled recurrence differentiated in its coupling.
  • With set_runtime_activity all 15 pass in both modes.
  • Every Enzyme test in test/ad sets runtime activity, so the default mode is untested.
  • docs/src/extensions/enzyme.md lists a forward-mode garbage-collector crash on Julia 1.12 and later after repeated gradients (Enzyme forward gradient of "Recurrence array-field and scalar-field modifiers" segfaults in the GC #321); I did not reproduce it in a short run.
  • The README says the same code runs "under forward- and reverse-mode automatic differentiation" without qualification.
  • Suggestion: state in the README that Enzyme needs runtime activity, call Enzyme forward experimental until Enzyme forward gradient of "Recurrence array-field and scalar-field modifiers" segfaults in the GC #321 is closed, and add one default-mode test per rule so a regression is seen.

6. The Julia 1.11 floor is claimed, not tested

  • Read, not run: test.yaml:39 runs Julia 1 only, and 1.11 gets the unit suite in threads.yaml and a small compat_floor set per pull request.
  • ForwardDiff, Mooncake forward and Enzyme forward never run on 1.11 or 1.12 by name.
  • Two 1.11 Enzyme defects are marked broken (test/ad/adjoints.jl:979-981, 1430-1435), and the Enzyme page lists a silent zero gradient on 1.11.
  • _stored_coupling (src/operators/recurrence.jl:217-221) and _ADLeaves (src/adjoints/adjoints.jl:210-216) exist only to work around 1.11.
  • Suggestion: raise the floor to 1.12 and delete the workarounds, or test every backend on 1.11 per pull request.

Should fix

7. Too many ways to extend, with two contracts

  • A modifier step can be written as: a pure scalar step; a pure step on tuples with blocks; an in-place pointwise forward! with blocks = (1, 1) (extending-parameters.md); an in-place whole-vector forward!; an in-place forward! on tuples of one-entry views with a group index (extending-steps.md).
  • A depletion form reuses forward!(form, Step(), v, s, N), where the last argument is a population, not a time (src/interface/roles.jl:64-66).
  • pullback! has two contracts: it mutates grads and returns nothing for Step, Init, Pressure and Run, and it returns partials for Local (roles.jl:320-338).
  • A coupling author must learn roles, grads.piece, mirrors, cotangent, add_cotangent!, add_param! and islinear; a modifier author needs none of these.
  • Suggestion: land Make the pure step the single way to extend the package #920 so step is the only modifier path, give depletion forms the same pure signature, and rename the Local method (for example local_partials) so pullback! has one meaning.
  • Consider a pure form for couplings too, q = couple(C, θ, p) differentiated as the step is, with forward! and pullback! kept as the measured fast path.

8. Routing rests on reflection and inference

  • _canonical, _has_init, _has_step_pullback and _has_pullback call Core._hasmethod (about ten uses), which is internal to Julia.
  • _has_local calls Core.Compiler.return_type (roles.jl:377-386), so whether a rule or a forward-mode pass runs depends on what inference returns.
  • A method is found only when its trailing arguments are untyped.
  • Verified: CR.step(::Ty, θ, v::Float64, s::Float64) gives ArgumentError: Ty has neither step(m, θ, v, s) nor forward!(...), which is false.
  • Verified: late definitions are picked up correctly, so there is no world-age bug today.
  • Suggestion: replace the lookups with one declared trait or a supertype, or at least detect any step method for the type and say "its arguments must be untyped".

9. Errors from a wrong step are opaque

  • Verified: returning (v, nothing) without isstateless gives MethodError: Cannot convert an object of type Nothing to Float64.
  • Verified: returning only v gives BoundsError: attempt to access Float64 at index [2].
  • Verified: modifiers = Depletion(N) without a tuple gives MethodError: no method matching length(::Depletion{...}).
  • Verified: a device kernel with host inputs gives a scalar-indexing error, while the opposite mix gives a clear message.
  • Suggestion: check the step's return once per call (it is already inferred), accept a single modifier, and make the device check symmetric.

10. The cost of leaving the rule is a cliff

  • Verified on Mooncake reverse, 5 strata, 200 steps: my coupling with a pullback! costs 4.5 times the primal, and without one 18.4 times.
  • Enzyme reverse: 3.0 and 17.2 times.
  • The constructor logs an @info once, which is good, but the log is the only signal.
  • Each construction of such an operator builds the message string and takes a lock: 0.9 µs and 1,200 bytes against 0.08 µs for a rule-routed one (recurrence.jl:1122-1142).
  • Unexplained: after one Mooncake gradient through a plain-routed operator, the primal of the same closure went from 14.9 µs to 21.1 µs in the same session, in three separate runs.
  • Suggestion: build the message only when it is new, and look into the slowdown before release.

11. Naming collisions that will be frozen

  • step is a public function, Step is a role, and step = is a constructor keyword for lag width.
  • Verified: ComposableRecurrences.step is not Base.step, so step(1:2:5) inside the module is a MethodError.
  • Pressure() and Trace() are both roles and record markers; pressure is also a function.
  • Options come as structs (Hazard()), as symbols (overflow = :queue) and as Val (trace_imports = Val(true)), while the module docstring says options are structs.
  • Recurrence takes gain positionally and Convolution takes it as a keyword.
  • Suggestion: rename the keyword (width, say), pick one option style, and decide the names before the freeze.

12. The convolution method depends on whether FFTW is loaded

  • Auto takes the FFT from 300 lags and 1000 steps, only when FFTW is loaded in the session.
  • Verified at 300 lags and 1000 steps: direct 28.1 µs, FFT 34.2 µs, so Auto picked the slower method on this machine.
  • At 300 by 2000 they tie; at 1000 by 5000 the FFT is 4.4 times faster.
  • Results differ at about 1e-14 relative, so loading FFTW anywhere changes a model's numbers.
  • Suggestion: make the FFT opt-in for the stable release, or raise the threshold to where it wins by a clear margin.

13. Specialised run paths, some without a clear margin

  • A recurrence can run as a scan, a strata-major run, a carried run, a chained run, a series run or a coupled run (recurrence.jl:1583-1930, 1962-2092).
  • Verified: the strata-major run is 2.4 times faster at one lag and about 1.35 times at two, but about 1.05 times at three, its upper bound (_STRATA_MAJOR_LAGS = 3).
  • Verified: the same stratum gives different last bits with 1 and with 3 strata (relative 5e-16), as the paths round differently.
  • Verified: a Threaded executor below min_work is 10 to 20% slower than Serial at 20 strata.
  • Suggestion: drop three lags from the strata-major run unless a benchmark in the repository shows 10%, and state in the docs that outputs agree across paths only to rounding.

14. The package is large for its stated job

  • 24,421 lines in src and ext, 629 distinct internal function names, 63 generated functions, 12 extensions, 27 workflows.
  • Allocate (848 lines), Recent (631), computed kernels and the cohort walk (about 2,300), change points (383), growth_rate, window_sums and the Reactant extension (659) are beyond "recurrences and convolutions over lag kernels".
  • The Reactant path never runs the package's rules, by the docs' own account.
  • Suggestion: freeze a core (Recurrence, Convolution, the three wrappers, Depletion with its forms and flows, Transform, step, init, step_pullback, executors, NoAdjoint) and mark the rest experimental and outside semver.

15. No downstream test, and benchmarks that cannot be tied to this code

  • Read, not run: downstream.yaml:43 has an empty list, so BVDOutbreakSize, ComposableTuringIDModels and Wren models are not tested against this branch.
  • benchmark.yaml runs only for pull requests into main, so nothing compares this branch.
  • All 279 rows of benchmark/results/docs.csv carry one older revision, and the performance pages are built from it.
  • 129 of 607 default test items have no recorded time, so the time-budget test can pass while the run is over budget.
  • Suggestion: add the two consumers to the downstream job, regenerate the results at the release commit, and fail the budget test on unrecorded items.

16. Docs: accurate in the main, too long and repetitive

  • Read, not run: 36 pages and 12 tutorials, about 31,500 words.
  • The step equation appears in six places.
  • Rule policy and timings are split over five pages, and role argument tables over four.
  • Shift is defined twice with different meanings in the extending pages.
  • The README carries ReverseDiff badges while the backends page says ReverseDiff is not a target.
  • Private vocabulary is heavy: piece, mirror, twin, arm, cohort, draw and part are used before they are defined.
  • The GPU section of adjoints-and-backends.md is implementation notes; a table of what runs where would serve better.
  • extending.md is the best page and was enough to write a modifier.
  • For a coupling I had to assemble the layout of grads from three pages, and found no PieceInterface example for one.
  • Restructure the docs to the EpiAware standards #922 fixes the structure and most repetition; it leaves NEWS.md, the extending pages and the badges.

Can wait

  • A call without history returns zeros, and a short history is zero-padded, both silently and both documented; a warning for a recurrence with no seed and no add would save new users.
  • A State from another operator is accepted when the sizes fit; I resumed a four-lag recurrence from a three-lag state without an error.
  • Depletion(-5.0) and a negative gain run without complaint.
  • show of a Depletion in a container prints the full type; the text/plain summaries are good.
  • The first Mooncake gradient took 16 to 25 s to prepare, and each new model type 1 to 16 s; a precompile workload in the extension would help.
  • A reverse gradient allocates 11 to 16 kB at 200 steps against 1.9 kB for the primal.
  • Reverse rules are tested three times (test/unit/adjoints.jl, test/ad/adjoints.jl, the registry); keep the registry as the one oracle.
  • test/ADFixtures holds shims for pre-release designs (ADFixtures.jl:38-69); drop them at the release.
  • About 25 allocation assertions are skipped under coverage, and the main test job uploads coverage; confirm one cell runs them.
  • test/cuda/ has no workflow; say in the docs that a real GPU is tested by hand.

What is good

  • Output and gradients: correct everywhere I looked.
  • Resume: a split run equals the whole run bit for bit in all 34 set-ups, and a state can be reused.
  • Threads: Threaded equals Serial bit for bit in all 34, and 64 concurrent calls on one operator agreed.
  • Inference: @inferred passes for a call with every record marker.
  • Load time 0.44 s, first call a few microseconds, so precompilation works.
  • A user's pure step ran unchanged on JLArrays, under threads and on every backend, with the rule.
  • Broken markers are few, central and honest, and tolerances are tight (read, not run).

What I ran

  • Edge cases: about 60 calls on empty inputs, one stratum, one lag, no lags, NaN, Inf, integers, Float32, BigFloat, views, ranges and bad shapes.
  • Primal timing against hand loops at three sizes, with and without depletion, coupled and not: the package was 1.2 to 3.7 times faster than my plain loops.
  • At 3 lags and 5 steps the package took 0.20 µs against 0.10 µs for the hand loop, so a call carries about 100 ns of overhead.
  • 15 gradient cases against ForwardDiff on Mooncake reverse and forward and Enzyme reverse and forward, one backend per process.
  • Rule against a hand-written adjoint for a 14-lag, 200-step renewal: hand 6.0 µs, Enzyme rule 4.8 µs, Mooncake rule 5.4 µs.
  • A sweep of 17 built-in modifier set-ups with I and a dense coupling: resume, Threaded, trace and Mooncake gradients in parameters and gain.
  • 19 calls on JLArrays with scalar indexing disallowed, including ForwardDiff through device arrays.
  • My own modifier and coupling written from the docs alone.
  • test/unit/pure_step.jl and test/unit/primary_recurrence.jl: 195 passed in 3 min 12 s.
  • The specialised paths and the FFT threshold, as timed above.

What I did not run

  • The full test suite, the AD registry, the Reactant suite, the docs build and the benchmark suite.
  • Anything on Julia 1.11 or 1.12, on macOS or Windows, or on a real GPU.
  • A reverse gradient on device arrays.
  • ReverseDiff.
  • The downstream packages.
  • The shared workflows in EpiAware/.github, so claims about CI are from the workflow files in this repository only.
  • Timings are minimum-of-repeats on a shared 4-core machine without BenchmarkTools, so read ratios under 1.2 as ties.

Generated by Claude Code

Activity

  1. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Triage of every finding against main at cc74265

    Run today on Julia 1.13.4, Linux, 4 cores, with Enzyme 0.13, Mooncake 0.5 and ForwardDiff 1.
    Each reproducer of the review was run again unless a line says it was read.
    Timings are BenchmarkTools minima of repeated blocks in one process, not the interleaved harness, so ratios under 1.2 are ties.
    Nothing was changed before this comment.

    Status is one of: resolved, still true, partly, not reproduced.

    Must fix

    # Finding Status Evidence today
    1 The branch is moving partly #920, #923 and #926 are merged. #928 (+1660 −33, adds public API), #922 (docs, +660 −908), #955, #954 and #956 are open. Project.toml still says 0.2.0.
    2 A step that reads m.a gives a zero reverse gradient still true The reproducer gives ForwardDiff [215.45], Mooncake forward [215.45], Mooncake reverse [0.0], with no error or warning.
    3 The public list is not the surface taught still true Base.ispublic is false for State, Secondary, param_eltype, uses_adjoint, Run, test_adjoint, Auto, TRACED_MIN_STRATA (each on a docs page) and for depth, forward, ispointwise, each! (docstrings only). contributions is now public. Device is still public and still documented as the older name of Parallel. ismodifier is public and on no docs page.
    4 NEWS.md contradicts the code resolved Removed in 66aead3; grep -rn NEWS docs README.md .github test finds nothing.
    5 Enzyme needs runtime activity still true, narrower 16 cases per mode, table below. The docs page now says "Use reverse mode with runtime activity" and test/ad/static_activity.jl tests seven default-mode calls. The README still does not say it.
    6 The 1.11 floor is claimed, not tested still true Per pull request, 1.11 runs the unit suite and 21 compat_floor AD items, nearly all Enzyme reverse. Every AD item runs on 1.11 and 1.12 for Enzyme reverse and Mooncake reverse only, weekly. ForwardDiff, Mooncake forward and Enzyme forward have no 1.11 or 1.12 cell. Two 1.11 Enzyme defects are marked broken (test/ad/adjoints.jl:939, :1419), and _stored_coupling and _ADLeaves are still there.

    Enzyme, finding 5 (reverse and forward, each against ForwardDiff):

    Case Reverse, default Forward, default With runtime activity
    Rule: gain active, kernel and history constant globals correct correct correct
    Rule: kernel active correct correct correct
    Rule: dense coupling a constant global EnzymeRuntimeActivityError error correct
    Rule: dense coupling active correct error correct
    Rule: Depletion(PerStratum(N)), N a constant global error error correct
    Rule: Depletion(PerStratum(N)), N active correct error correct
    Rule: Depletion(N), scalar active correct correct correct
    Rule: a user's pure step, active or constant correct correct correct
    Rule: convolution, kernel active, input a constant global correct error correct
    Rule: convolution, input active correct correct correct
    Plain AD: NoAdjoint, kernel a constant global error error correct
    Plain AD: NoAdjoint, everything built in the loss correct correct correct
    Plain AD: coupling without a pullback!, global inputs error error correct

    Cause, from the error text: in every failing reverse case a constant array that lives outside the loss is returned or stored where Enzyme expects a differentiable value.
    For the rule-routed cases the failure is inside the constructor, not the rule: _as_coupling(::Matrix) (recurrence.jl:223) and float(::Vector) under _population each return their constant argument through a call that is not inlined.
    With the same matrix copied inside the loss, the default mode is correct.
    On the plain-AD route the constant kernel is stored beside the active arguments at adjoint_call (adjoints.jl:160).
    So the rule itself runs in the default mode; the constructors and the plain route are what need runtime activity.

    Should fix

    # Finding Status Evidence today
    7 Too many ways to extend partly #920 made the pure step the one modifier path, and a depletion form is now a pure step with θ.N. pullback! still has two contracts: it returns partials for Local (roles.jl:397-463) and mutates for the other roles. A coupling still needs forward!, pullback!, cotangent and add_cotangent!.
    8 Routing rests on reflection partly 16 uses of Core._hasmethod and 4 of Core.Compiler.return_type remain in src. The typed-step reproducer now gives ArgumentError: step(::Ty, θ, v, s) types its arguments after the modifier; write θ, v and s untyped. A late definition is still picked up.
    9 Opaque errors from a wrong step partly (v, nothing) without isstateless now gives a clear ArgumentError naming init and isstateless. Still opaque: a step returning only v (BoundsError: attempt to access Float64 at index [2]), modifiers = Depletion(N) (MethodError: no method matching length(::Depletion{…})), and a device kernel with host inputs (scalar-indexing error for Recurrence and Convolution; the opposite mix is a clear ArgumentError).
    10 Leaving the rule is a cliff still true Mooncake reverse, 5 strata, 200 steps, 14 lags: 21 µs with a pullback! (3 times the primal) and 246 µs without (27 times). Construction costs 0.25 µs and 896 bytes without a pullback! against 2 ns and 0 bytes with one. The primal after a gradient was 0.87 and 1.08 times its time before, inside the spread of repeats, so the slowdown is not reproduced. #955 is open on the silent route.
    11 Naming collisions partly The lag-width keyword is now width on both operators, so step = is gone. Still true: ComposableRecurrences.step is not Base.step; Pressure() and Trace() are roles and record markers; overflow = :queue and trace_imports = Val(true) sit beside struct options; Recurrence takes its gain as a call argument.
    12 The method depends on whether FFTW is loaded still true Loading FFTW changed Convolution(k)(x) at 300 lags and 1000 steps by 2.8e-13 relative. At that size direct took 19.9 µs and the FFT 17.5 µs here (the review saw the opposite order); at 300 × 2000, 41.6 and 28.7; at 500 × 2000, 64.6 and 32.3; at 1000 × 5000, 416 and 82. So the threshold is a tie that falls either way by machine.
    13 Specialised paths without a margin not reproduced for three lags; rest still true Strata-major against the time-major run at three lags: 1.68 times faster at 2 strata, 1.50 at 5, 1.23 at 20 and at 100 (200 steps), 1.41 at 5 × 1000. At four lags the two tie (0.996), so the bound of three is where the gain ends. One and three strata still differ in the last bits (1.05e-15 relative), and no docs page says outputs agree across paths only to rounding. Threaded() below min_work took 1.05 times Serial at 20 strata, a tie.
    14 The package is large still true 25,304 lines in src and ext (24,421 in the review), 64 generated functions, 13 extensions, 27 workflows.
    15 No downstream test, benchmarks not tied to the code partly downstream.yaml still passes downstreams: '[]'; test/downstream/runtests.jl clones BVDOutbreakSize but no workflow calls it. All 267 rows of benchmark/results/docs.csv carry one revision, d41af96e. #953 recorded item times: 2 of 639 default items have none, against 129 of 607. The budget test still weighs an unrecorded item as the median and does not fail on it.
    16 Docs long and repetitive still true 37 pages, 33,802 words. Shift is still two different types in extending.md:132 and extending-parameters.md:44. The README's ReverseDiff badges are now explained in adjoints-and-backends.md:103. #922 is open and removes that page. Read, not built.

    Can wait

    Item Status Evidence today
    No history returns zeros; a short history is padded still true Recurrence([0.5, 0.5])(fill(1.2, 4)) returns zeros with no warning.
    A State from another operator is accepted still true A four-lag recurrence resumed from a three-lag state and returned values.
    Depletion(-5.0) and a negative gain run still true Both return numbers with no error.
    show in a container prints the full type still true repr([Depletion(100.0)]) prints the type parameters; text/plain is Depletion(pools (:S,), draw Hazard(), population 100.0).
    First Mooncake gradient is slow to prepare not run
    Reverse allocations not run
    Reverse rules tested three times still true test/unit/adjoints.jl (1,805 lines), test/ad/adjoints.jl (2,816) and the registry all exist. Read.
    Fixture shims for older designs still true, by design test/ADFixtures/src/ADFixtures.jl:30-68; its comment says the benchmark history loads the fixtures with earlier releases. Read.
    Allocation assertions skipped under coverage resolved threads.yaml runs the allocations items without coverage. Read.
    test/cuda has no workflow resolved in the docs adjoints-and-backends.md:239 says the CUDA checks are run by hand. Read.

    What I did not run

    • The full test suite, the AD registry, the Reactant suite, the docs build and the benchmark suite.
    • Anything on Julia 1.11 or 1.12, or on a real GPU.
    • The shared workflows in EpiAware/.github: claims about CI are from this repository's workflow files.
    • The review's own 15 gradient cases were not posted, so the Enzyme table uses 16 of mine.

    Next

    Fixes follow as pull requests, must-fix first: finding 2, then the public surface (3), Enzyme's default mode (5), the facts for the 1.11 choice (6), and the should-fix items that are small (9, 11, 12, 13's docs line).
    Each finding left unfixed gets its reason here.


    Generated by Claude Code

  2. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Finding 6: the Julia 1.11 floor, for the owner to decide

    No code is changed for this finding; the choice is between two pieces of work.
    Facts are read from this repository's workflow and test files at cc74265; the shared workflows in EpiAware/.github were not read.

    What runs on 1.11 today

    Where When What
    threads.yaml, unit each pull request the unit suite with skip_quality, 4 threads, Runic removed from the environment
    threads.yaml, ad each pull request the 21 compat_floor AD items (the Enzyme reverse registry in 4 slices, test_adjoint on one operator of each kind, 13 single cases) and the executor allocation items
    ad-versions.yaml weekly, and on a pull request that edits the workflow every AD item for Enzyme reverse and Mooncake reverse, on 1.11 and 1.12 (8 jobs, about 7 runner-hours by the workflow's own header)

    What does not run on 1.11

    • test.yaml passes julia_versions: '["1"]', so the quality set (Aqua, doctests, the standards) and the downgrade job run on the current release only.
    • ad.yaml names no version, so the per-pull-request jobs of ForwardDiff, ReverseDiff, Mooncake forward and Enzyme forward do not run on 1.11 or 1.12 by name.
    • JET, trim, Reactant and OpenCL run on 1.12.
    • The docs build and its tutorials.

    What 1.11 costs in the code and docs

    • Two tests are marked broken on 1.11 only (test/ad/adjoints.jl:939 and :1419): Enzyme reverse loses a scalar's gradient in code Julia cannot infer, and finds no shadow for a vector index under NoAdjoint.
    • A third is narrowed on 1.11 (:2519): plain reverse mode of a NoAdjoint operator with threads can crash in the garbage collector, so only the runtime-activity mode is tested.
    • _stored_coupling (recurrence.jl:233) and _ADLeaves (adjoints.jl:204, used at three places in the Enzyme extension) exist for 1.11, with two VERSION < v"1.12" guards in the Enzyme extension and one in the EnzymeTestUtils extension, which checks an operator as Const only on 1.11.
    • Two rows of the Enzyme page's known issues are 1.11 only, one of them a silent zero gradient with a warning.

    The two options

    1. Test 1.11 properly.
      Add 1.11 to test.yaml's versions and run the five forward-mode and ReverseDiff AD jobs on it per pull request.
      Going by the weekly job (two backends on two versions in about 7 runner-hours), all seven backends on one more version is of the order of 12 runner-hours per pull request.
      The two broken tests and the silent zero gradient stay, as they are defects of Enzyme on 1.11 that the package can warn about and not fix.
    2. Raise the floor to 1.12.
      julia = "1.12, 1.13", delete _stored_coupling, the three VERSION guards, the two broken markers and the two known-issue rows, and drop 1.11 from threads.yaml and ad-versions.yaml.
      _ADLeaves needs a check on 1.12 before it goes, as the Mooncake rule also routes through it.
      I could not read the two consumers' compat entries; they would need to allow it.

    Recommendation

    Raise the floor to 1.12.
    The claim then matches what is tested, and the one failure mode a release cannot carry, a gradient that is silently zero on a supported version, leaves the support matrix.
    1.11 is not the long-term-support line, so the floor protects few users.
    I have not made the change: it is a compat change for the owner, and I can open it as its own pull request on request.


    Generated by Claude Code

  3. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Every finding accounted for

    Pull requests against main at cc74265, none merged.
    The triage and its evidence are in the comment above; the 1.11 choice has its own comment.

    Must fix

    # Outcome
    1 Not mine to fix: #928, #922, #955, #954 and #956 are still open. The surface table in #986 is written against main and says where #928 would add to it.
    2 Fixed in #981. A step that reads a float parameter from the modifier is an ArgumentError in the plain call and under every backend.
    3 Fixed in #986, one commit per decision, with the proposed frozen surface as a table.
    4 Resolved before this pass.
    5 #984 tests the default mode on each rule and states the requirement on the Enzyme page and in the README. The rule needs no runtime activity; forward mode, plain AD and const global arrays read inside the loss do, for reasons given there.
    6 Facts and a recommendation (raise the floor to 1.12) are in the comment above. No code changed: it is the owner's choice.

    Should fix

    # Outcome Reason where not fixed
    7 Not fixed What remains is pullback! returning partials for Local and the coupling interface. Renaming the Local method changes a public signature that three pages teach, and #916 has an open question on whether Local stays public at all; that decision comes first. A pure form for couplings is a design of its own, not a release fix.
    8 Not fixed The reproducer's false message is gone, and late definitions work. Replacing 16 Core._hasmethod lookups with a declared trait changes how every extension declares itself, one day after #920 settled that. The risk that stays is the use of a Julia internal, which the tests on each Julia version cover.
    9 Fixed in #981 (a step returning the value alone) and #991 (a single modifier, and host inputs with a device kernel).
    10 Not fixed here #955 is open on exactly this, the silent plain route and its message. The ratio itself (3 against 27 times the primal on Mooncake) is the cost of plain AD, not a defect. The primal slowdown after a gradient did not reproduce.
    11 Partly, nothing further proposed step = is already width =. ComposableRecurrences.step is public and not exported, so it shadows Base.step only inside the module. Pressure() and Trace() as both role and marker is #916's decision 1, and each names one quantity. The gain is the recurrence's input and a convolution's option, which the argument positions follow. The one inconsistency left is option style: overflow = :queue and trace_imports = Val(true) beside struct options. I recommend deciding those two before the freeze and have not changed them, as #916 did not rule on them.
    12 Not fixed, decision needed Numbers in the triage: at Auto's threshold the two methods tie and the order depends on the machine; loading FFTW changes results at 1e-13. I recommend the FFT only on request, method = FFTMethod(), and removing Auto. That touches 33 references, three registry scenarios and their recorded results, so I have not opened it without a yes. The smaller option is to raise the threshold to 500 lags and 2000 steps, where the FFT was twice as fast here; it leaves the dependence on what is loaded.
    13 Docs line in #991; code unchanged The three-lag margin did not reproduce: 1.23 to 1.68 times across five sizes, and a tie at four lags, so the bound is where the gain ends. Threaded below min_work was 1.05 times Serial, a tie. The docs now say outputs agree across loops to rounding.
    14 Not fixed Marking Allocate, Recent, computed kernels, change points and the Reactant extension experimental is a statement about semver for the owner. #916 kept Allocate, Survival, Increments and Normalised because consumers use them. The surface table marks Recent and Local as the two names still open.
    15 Not fixed Item times are now recorded for all but two items. The downstream list is in a managed workflow file, which is not hand-edited, and both consumers are outside this session's repository access. Regenerating benchmark/results/docs.csv belongs at the release commit. Making the budget test fail on an unrecorded item is a small change I have left, as #953 just reworked that file.
    16 Not fixed #922 is open on the structure of the docs and moves the pages involved. The two Shift types in the extending pages are still to rename, best done on top of #922.

    Can wait

    Item Outcome
    Zero history and padding without a warning Left: documented behaviour, and a warning in a hot call needs a design.
    A State from another operator Left for #928, which changes what a State holds.
    Depletion(-5.0), negative gain Left: a value check on a parameter that may be a dual number or traced belongs with the NaN-check design.
    show in a container Left: cosmetic.
    Mooncake preparation time, reverse allocations Not measured in this pass.
    Rules tested three times Left: removing tests before a release lowers cover for no gain in the release.
    Fixture shims Kept by design: the benchmark history loads the fixtures with earlier releases.
    Allocation assertions under coverage Resolved: threads.yaml runs them without coverage.
    No CUDA workflow Resolved in the docs, which say the CUDA checks are run by hand.

    What was and was not run

    Each pull request lists its own runs.
    Across all of them: no full test suite, no full AD registry, no Reactant suite, no docs build, nothing on Julia 1.11 or 1.12 and nothing on a real GPU.
    CI on each pull request is the check for those.


    Generated by Claude Code

  4. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Finding 2: three routes compared, for the owner

    The cause is that a parameter is reachable by two names inside a step, m.a and θ.a, and only the second carries the derivative.
    Nothing here is implemented beyond #981, which is held.
    Figures for B and C are estimates from reading the code; only A has been run.

    A. The modifier with its float parameters replaced by a marker (#981)

    • Code: about 110 lines in src: a marker type that is a Real whose arithmetic throws, a generated function that rebuilds the modifier with Expr(:new) past its constructors, and a try/catch around the rebuilt type.
    • What an author writes: nothing new; step(::M, θ, v, s) as today.
    • What still fails silently: a mutable modifier is passed as it is. A field declared a::Float64 cannot hold the marker and reads as NaN, which is a wrong value and not an error.
    • Compiled step: unchanged, checked on four modifier types by comparing LLVM.
    • GPU: the marker is isbits; a misread inside a kernel fails to compile, with a compiler message and not the package's.
    • Reactant: not run.
    • Does it remove the cause: no. Both names remain and one is booby-trapped.

    B. One object: the modifier with its parameters read at the stratum and time

    The step becomes step(m, v, s), where m is the modifier rebuilt with each parameter field read at (k, t).
    m.a is then the right and only spelling, and θ leaves step, init, step_pullback and trace.

    • Code: _theta today builds a named tuple of the read fields; B builds the modifier from the same values, so the read is unchanged and the rebuild replaces the named tuple.
      The rule's dual pass seeds the fields of the rebuilt modifier where it seeds θ today.
      I estimate the change in src at the size of A, plus the mechanical edit below.
    • What rebuilding costs:
      • How it is rebuilt. ConstructionBase.constructorof(typeof(m))(fields...) is already how PieceInterface rebuilds a type (21 uses of constructorof in src). For a struct with the default constructor it infers and is free once inlined. A type with a checking inner constructor would run its check at every step, on scalars where it may expect arrays, so such a type defines constructorof, as Depletion does. Rebuilding past the constructor with Expr(:new) avoids that and brings back the machinery objected to in A, so I would not.
      • Concrete Float64 fields under dual numbers. A field declared a::Float64 cannot hold the dual the local derivative seeds. That is decidable from the type, so _rule_fields can send such a modifier to plain AD, which is correct and shows in gradient_routes, or the constructor can refuse it. Either way nothing is silent. Requiring a parametric field type for a differentiated parameter settles it, and is already what ForwardDiff through the operator requires.
      • Type stability. The rebuilt type follows from the field types, so it infers where constructorof does.
      • Device kernels. A PerStratum of a device array becomes a scalar field, so the rebuilt modifier is isbits where the original is not. This is no worse than θ today.
    • What an author writes: step(m::Smooth, v, s) = (s′ = m.a * s + (1 - m.a) * v; (s′, s′)). One argument fewer and no rule to remember.
    • What it breaks: every existing step. There are 172 CR.step( definitions and calls in 38 files of src, docs, test and benchmark, and both consumers, one day after Make the pure step the single way to extend the package #920 settled step(m, θ, v, s).
    • Open point: a depletion form reads the population as θ.N, which is not a field of the form (8 uses). B needs a place for it: a fourth argument for forms, which is the two-signature problem of finding 7 again, or a form rebuilt with N beside its fields.
    • What still fails silently: nothing through a field read. A float array that is not a parameter still takes plain AD, as today.
    • Compiled step, GPU, Reactant: expected as today, since the rebuilt struct is scalarised like the named tuple; not measured.
    • Does it remove the cause: yes.

    C. No change to what step receives; a check when the operator is built

    Call the step once with θ perturbed and the modifier's floats held, or compare a dual pass in θ with one in the fields, and throw the same message; refuse a type that cannot be checked.

    • Code: about 40 to 60 lines, most of it the _reads_theta and _perturbed logic that PieceInterface's :step check already has, moved to the constructor.
    • What an author writes: nothing new.
    • What still fails silently:
      • A value check sees one point. A misread in a branch the probe does not take, or one that does not change the result at the probe (m.a * 0), passes.
      • The probe needs a value and a state. The state's type comes from init on a history the constructor does not have, so the check either guesses or moves to the first call.
      • A step that is only defined on part of its domain throws at an arbitrary probe, which is a false error.
    • Cost: operators are built inside the loss, so the check runs at every evaluation unless it is cached by type, which adds a lock or a table to a constructor now at 2 ns. Under plain AD the backend would also differentiate the check unless each extension marks it inactive. A traced construction under Reactant cannot branch on the comparison and would have to skip it.
    • Compiled step: unchanged by construction.
    • Does it remove the cause: no. It tests for the symptom at one point.

    Summary

    A (#981) B C
    Removes the two names no yes no
    New code in src about 110 lines about the same, plus 172 call sites in 38 files 40 to 60 lines
    Author's signature unchanged step(m, v, s) unchanged
    Silent cases left mutable types; NaN for concrete float fields none through a field untaken branches, insensitive probes
    Refused types none checking constructors without constructorof types that cannot be rebuilt
    Compiled step unchanged (measured) expected unchanged unchanged
    Cost outside the step none none every construction, or a cache

    Recommendation

    B, if the step's signature can still change before the freeze.
    It is the only route that removes the cause, it makes the interface smaller, and its rules (a parametric field for a differentiated parameter, constructorof for a checking constructor) are ones Julia authors already meet.
    Its price is a second signature change in two days and a decision on where a depletion form gets its population.

    If the signature is frozen as #920 left it, A with the NaN arm removed: a modifier with a concretely typed float field is refused when the operator is built, which deletes the _nan helper and the silent case, and leaves mutable types to PieceInterface.
    I would not take C: it costs something on every construction and still passes the mistakes it does not happen to probe.

    I can prototype B on one built-in and one user step, with the LLVM comparison and an ab.jl run, before anything is decided.


    Generated by Claude Code

  5. seabbs commented on Dec 2, 2026

    @seabbs
    Member

    Note we really want enzyme running in no activitiy mode its okay if this needs our rule support to get it working well.

  6. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Finding 6, addendum: the two failures of the weekly 1.11 job, re-run today

    Re-run on main at 6159cbf with Julia 1.11.9, Mooncake 0.5.74 and the Enzyme release the AD environment resolves today.
    Both failures of the scheduled ad-versions run on 4b4bc8c reproduce, and neither is a wrong gradient.

    1. Enzyme reverse: a broken marker that now passes

    • Item "User modifiers: functions, index ranges and constructors", test/ad/adjoints.jl:940-942.
    • Result: 98 pass and 2 errors, both Unexpected Pass on broken = w === NoAdjoint && m(0.8) isa Pick{<:Vector} && backend isa AutoEnzyme && VERSION < v"1.12".
    • Cause: the marker records an Enzyme defect on 1.11 ("finds no shadow for a vector index") that the current Enzyme release no longer has. The gradient is correct.
    • What it needs: delete the marker, so the line is an ordinary @test. One line, and one fewer 1.11 branch in the tests.

    2. Mooncake reverse: no rule for jl_genericmemory_slice

    • Scenarios: "NoAdjoint Recurrence bed cap with a stay that is not geometric, entry by entry" and one DifferentiationInterfaceTest correctness case, both through _layout_sums (src/operators/convolution.jl:524).
    • Cause, isolated outside the package: on Julia 1.11, reshape(x, :, 1) of a Vector whose memory is longer than the vector, or that starts at an offset, calls jl_genericmemory_slice, and Mooncake has no rule for that call on 1.11.
    Call under Mooncake reverse Julia 1.11.9 Julia 1.13.4
    sum(abs2, reshape(x, :, 1)), x with exact memory correct not run
    the same, x = sizehint!(copy(x), 64) No rrule!! available for foreigncall … jl_genericmemory_slice correct
    the same, x after popfirst! the same error not run
    Convolution(k)(x) by its rule, x with spare capacity correct not run
    NoAdjoint(Convolution(k))(x), x with exact memory correct not run
    NoAdjoint(Convolution(k))(x), x with spare capacity the same error not run
    • So it is reached only on a plain-AD route, when the input vector was grown or trimmed in place, and it is an error, not a wrong value.
    • What supporting 1.11 would need, one of:
      • a rule for this call in Mooncake on 1.11, upstream;
      • the same rule in the Mooncake extension behind VERSION < v"1.12", which adds to the 1.11-only code;
      • _layout_sums calling a vector method in place of reshape(xr, :, 1). That removes the call from this path, and would have to be justified on its own, since any other reshape of such a vector under plain AD fails the same way.

    Effect on the choice

    The cost of 1.11 in the first comment grows by one stale marker to delete and one missing upstream rule to carry or work around.
    The weekly job has been red on 1.11 since at least 23 November for these reasons, and no pull request sees it, as it runs on a schedule.
    With the floor at 1.12 both items vanish: the marker's condition is VERSION < v"1.12", and the scheduled run's four 1.12 jobs passed.
    The recommendation stands: raise the floor to 1.12.
    If 1.11 stays, the marker should go now and the Mooncake rule be raised upstream; I have changed neither.


    Generated by Claude Code

  7. seabbs commented on Dec 2, 2026

    @seabbs
    Member

    its fine to have things that need rules can't work with noadjoint I think?

  8. changed the title [-]Independent review before release[/-] [+]Independent review before release: findings still open[/+] on Dec 2, 2026
  9. seabbs-bot commented on Dec 2, 2026

    @seabbs-bot
    CollaboratorAuthor

    Julia floor 1.12: paused. Pushed to claude/julia-1.12-floor at bdf0fd1, with main merged up to 80945f6. No PR is open yet.
    Passed on Julia 1.12: the full suite (649 items, 42,377 pass, 8 broken), the ForwardDiff AD group (3,339 pass) and Mooncake registry slices 3–4 (2,944 pass).
    The docs build passes except for the github.com link checks, which this container's proxy answers with 403.
    Not run: Mooncake reverse slices 1–2 and the Mooncake items outside scenarios.jl; the permission check refused the restart after the pause.
    Kept, as they are not 1.11-only: the integer scale of the stored identity coupling (it sets the integer output type) and the plain-AD hook (#955 uses it).
    No managed workflow names 1.11, so nothing goes to EpiAwarePackageTools.jl#567.
    Next: (1) run those Mooncake items on 1.12; (2) open the PR from the branch (opening it from here was refused); (3) merge main before review.


    Generated by Claude Code

  10. seabbs-bot commented on Dec 4, 2026

    @seabbs-bot
    CollaboratorAuthor

    Status against main at d1f52c3

    Done:

    Remaining:


    Generated by Claude Code

  11. seabbs commented on Dec 4, 2026

    @seabbs
    Member

    I have no idea what you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions