Repository navigation
Fix sampled evalrule silent wrong results on OffsetArrays - #379
Conversation
…xes. Fast paths looped 1:m/1:n under @inbounds; gate them out when data has offset axes so OffsetArrays take the general path. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Cursor Agent <noreply@cursor.com> Agent-Harness: Cursor Agent 2026.10.01-14929f9 Agent-Model: unknown (Cursor auto) Agent-Session: local session, transcript /home/crackauc/sandbox/goals/performance/jobs/integrals/int-offset/log.txt on amdci2
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): MERGE, risk low. Full reviewVERDICT: MERGE Two-line source change: Blocking findingsNone. Non-blocking findings
What I ranAll runs used Julia 1.12.7 unless noted, on macOS aarch64 (M2 Max). Environments were in
What I did not verify
🤖 Posted by an AI agent — harness: Devin CLI 3000.11.3 (review), Claude Code 2.1.285 (posting) · model: fusion-claude-opus-5-5-high-sidekick-swe-2-medium |
Bump version to 5.5.4 Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Harness: Claude Code 2.1.301 Agent-Model: claude-opus-5-5 Claude-Session: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq
Summary
The
@inboundsfast paths inevalruleforAbstractVector/AbstractMatrixloop over1:m/1:n, which is incorrect whendatahas offset axes. With an OffsetArray whose non-integrated axis is offset (e.g.OffsetArray(ones(2,5), 0:1, 1:5)withdim=2), this silently returns wrong values such as[1.0, 0.875]instead of[1, 1]under default bounds checking (andBoundsErrorwith--check-bounds=yes). This PR adds&& !Base.has_offset_axes(data)to both fast-path gates so OffsetArrays take_evalrule_general, while keeping@inboundson the dense 1-based path.Evidence
Regression (default bounds checking):
collect(sol.u) == [1.0, 1.0]failed with[1.0, 0.875]; OffsetVector path alsoBoundsErrorat index 6.2/2pass; fullsampled_tests.jlgreen on Julia 1.12 andjulia +1.10.Matrix fast-path timing (
JULIA_NUM_THREADS=1 taskset -c 47,@benchmarkminima, 4×10001 trapz dim=2):44189 ns(5 allocs)44210 ns/44209 ns(5 allocs) — unchanged within noise.Test groups
GROUP=Core: all passed, including
Core/sampled_tests.jl | 32 32 10.4s. Final:Testing Integrals tests passed.GROUP=QA:
QA/qa.jl | 27 27 2m34.2s. Final:Testing Integrals tests passed.Runic (inplace) and
typosclean on changed files.Not verified
fast_scalar_indexinggate._evalrule_generalpreserving OffsetArray axes on the result (vs alwayscollecting) is the preferred API; the regression usescollect(sol.u).Reviewer pushback
axes/eachindexinstead of bailing to the general path (may keep more performance for OffsetArrays).SampledIntegralProblem(SciMLBase already checks integrated-axis index agreement).Please ignore until reviewed by @ChrisRackauckas.
Risk assessment
Independent review: pending
🤖 Generated with Cursor Agent 2026.10.01-14929f9 (model: unknown (Cursor auto)), transcript /home/crackauc/sandbox/goals/performance/jobs/integrals/int-offset/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Made with Cursor
Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #379 (comment)
Risk assessment
Independent risk assessment by codex-cli (gpt-6.1-sol), reviewed head
5bc85af7e1; dispatched by the fleet master, Claude Code (claude-opus-5-5), https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq