Skip to content

Fix scalar indexing in fallback compute_stages! for >17-stage tableaus - #4705

Merged
ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:erk-fallback-stages-gpu
Oct 3, 2026
Merged

ChrisRackauckas merged 1 commit into
SciML:masterfrom
ChrisRackauckas-Claude:erk-fallback-stages-gpu

Conversation

@ChrisRackauckas-Claude

@ChrisRackauckas-Claude ChrisRackauckas-Claude commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

The fallback compute_stages! used for tableaus with more than 17 stages zeroed the stage accumulator with zero(kk[1][1]), which scalar-indexes the state array and errors on GPU-like arrays under allowscalar(false). This replaces both sites with zero(eltype(kk[1])), which needs no scalar read, and adds a regression test solving a 19-stage tableau on a JLArray under allowscalar(false). JLArrays was not a test dependency of this sublibrary, so it is added via [extras]/[targets] with compat 0.3 (no test/Project.toml).

Failing-before: with the src change stashed, the repro errors with Scalar indexing is disallowed ... getindex ... compute_stages! ... explicit_rk_perform_step.jl:171 (exit 1, saved in before.txt); the Vector{Float64} solve succeeds. Passing-after: with the fix, both CPU and JLArray solves return Success with bitwise-equal u[end] (BITWISE_EQUAL: true, exit 0, saved in after.txt); the Vector{Float64} result is bitwise identical before/after the fix.

Test-group tails (GROUP=QA, Pkg.test(), exit 0, Testing OrdinaryDiffEqExplicitRK tests passed):
Generic RK Tests | 27 27, Allocation Tests | 1 1, JET Tests | 1 pass, 2 broken (pre-existing), Aqua | 21 21. Targeted run of interpolation_tests.jl: all testsets pass including fallback compute_stages! (>17 stages) on JLArray | 3 3. Regression repro also passes on Julia 1.10.12 (BITWISE_EQUAL: true). Runic and typos clean on changed files.

What was NOT verified: GPU hardware (only JLArrays CPU emulation); downstream packages; the other genericity items in the audit (Float32 c promotion, empty-αEEst tableau, Dual-Θ dense output) are untouched.

What a reviewer should push back on: whether zero(eltype(kk[1])) is the preferred spelling versus zero(eltype(eltype(kk))) (avoids even the outer kk[1] index); whether the regression test belongs in interpolation_tests.jl or a new GPU test file/group; whether JLArrays = "0.3" compat is the right floor.

Please ignore until reviewed by @ChrisRackauckas.

Risk assessment

  • Risk: low
  • Blast radius: OrdinaryDiffEqExplicitRK fallback stage computation for >17-stage tableaus only; zero(x) is value-independent so CPU numerics are unchanged (verified bitwise identical)
  • Evidence: failing-before/passing-after repro (before.txt/after.txt); test-group tails above
  • Independent review: Claude Code (claude-sonnet-5-5) rated it low, high confidence: two-line value-independent zero(eltype(...)) change, bitwise identical to master across Float64/Unitful/ArrayPartition/Dual, fails-before/passes-after on 1.10 and 1.12. Sonnet is not a top-tier reviewer, so this needs human review rather than auto-merge. Textual conflict with OrdinaryDiffEqExplicitRK: make indexed dense interpolation generic over Θ type #4704 (Project.toml extras, end of test/interpolation_tests.jl).
  • Merge: needs human review — first PR adding a test-only dependency to this sublibrary

🤖 Generated with opencode 1.18.31 (model: opencode/muse-spark-1.3-contributor-free), transcript /home/crackauc/sandbox/goals/performance/jobs/pr-erk-gpu-zero/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv

Risk assessment

  • Risk: low
  • Blast radius: In-place ExplicitRK solves using tableaus with more than 17 stages; adds a test-only JLArrays dependency. No new dependency internals, public API changes, or weakened assertions found; intended behavior change is a GPU scalar-indexing bug fix, not a SemVer-breaking change.
  • Evidence: Head e7036c9 has four failures, all pre-existing, matching master commit 7393799 and still failing on recent October 3 commits: SciMLSensitivity.jl/Core1/1 / Downstream Tests - Core1—MooncakeAdjoint constructor error (baseline); downgrade-sublibraries / test (lib/DiffEqBase)—29 passed, 1 failed, 3 errored; downgrade-sublibraries / test (lib/OrdinaryDiffEqDifferentiation)—missing diag(::ScalarOperator) (baseline); tests / GPU (julia 1, self-hosted Linux X64 gpu) / Tests - GPU (Julia 1)—same three QNDF assertions (baseline). ExplicitRK sublibrary and downgrade checks pass. No observed test regressions. No review comments exist. The description omits these CI failures and baseline comparisons.
  • Independent review: Codex CLI 0.156.1 (Mac) / gpt-6-astra rated it low, high confidence: the two-line fix removes state scalar reads, adds a focused regression test, and all failing checks reproduce on the default branch.
  • Merge: auto-merge candidate

🤖 Risk assessment posted by an AI agent (fleet master) — harness: Codex CLI 0.156.1 (Mac) / gpt-6-astra; dispatched by Claude Code 2.1.285 (Mac) fleet-master head, model claude-opus-5-5[1m]
Conversation: local session 3c311569-dda6-4687-bc9f-65febb212c33

Replace zero(kk[1][1]) with zero(eltype(kk[1])) so no scalar read of
GPU-like arrays is needed. Add a JLArray regression test with a
19-stage tableau under allowscalar(false).

Co-Authored-By: Chris Rackauckas <[email protected]>
Co-Authored-By: OpenCode <[email protected]>
Agent-Harness: opencode 1.18.31
Agent-Model: opencode/muse-spark-1.3-contributor-free
Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/pr-erk-gpu-zero/log.txt on amdci2
@ChrisRackauckas
ChrisRackauckas marked this pull request as ready for review October 3, 2026 12:23
@ChrisRackauckas
ChrisRackauckas merged commit 4a5c0e7 into SciML:master Oct 3, 2026
130 of 134 checks passed
ChrisRackauckas referenced this pull request Oct 14, 2026
…inaryDiffEqBDF, OrdinaryDiffEqExplicitRK, OrdinaryDiffEqFIRK, OrdinaryDiffEqFeagin, OrdinaryDiffEqHighOrderRK, OrdinaryDiffEqPDIRK, OrdinaryDiffEqRKN, OrdinaryDiffEqSDIRK, StochasticDiffEqHighOrder, StochasticDiffEqLowOrder, and StochasticDiffEqMilstein for release (#4871)

Agent-Harness: Devin CLI 3000.11.3
Agent-Model: Fusion (Claude Opus 5.5 Medium + SWE-2 Medium)
Agent-Session: local transcript ~/.local/share/devin/cli/transcripts/flash-hour.json

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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