Repository navigation
SIMD the 1-D sampled-data weight×data reduction - #381
Conversation
The AbstractVector evalrule loop is a plain sum over fast_scalar_indexing arrays; @simd cuts Trapezoidal/Simpson uniform costs ~4–6× at N=1e5 on Julia 1.12, with ~1e-14 relative reassociation vs a sequential reference. 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-simd/log.txt on amdci2
Unconditional @simd slowed TrapezoidalNonuniformWeights on Julia 1.10 (~1.65×) because the branchy getindex cannot vectorize; keep the sequential loop for NonuniformWeights and @simd only for UniformWeights. 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-simd/log.txt on amdci2
Independent review (Devin CLI 3000.11.3, model fusion-claude-opus-5-5-high-sidekick-swe-2-medium): CHANGES, risk low. Full reviewVERDICT: CHANGES Blocking findings
Non-blocking findings
What I ranAll runs were on an Apple M2 Max under Julia 1.12.7 and 1.10.12, using scratch envs that
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 |
SimpsonUniformWeights getindex is branchy; gating on UniformWeights made SimpsonsRule-on-range ~1.3× slower on Julia 1.10 aarch64. Leave all Simpson paths on the sequential master loop. 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-simd/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 PR: #381 (head 635644c, base origin/master e02a9f9). No linked issue in the PR body, and no AGENTS.md/CLAUDE.md at the repo root. I checked against The change adds Blocking findingsNone. Non-blocking findings
What I ranAll on an Apple M2 Max (aarch64),
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 1-D
SampledIntegralProblempath inevalrule(::AbstractVector, …)reducesweights[i] * data[i]with a sequential@inboundsloop (~1.2 ns/element). That loop is already gated onArrayInterface.fast_scalar_indexing(data).@simdis applied only forTrapezoidalUniformWeights(branch-freegetindexviaifelse); all other weight types — includingSimpsonUniformWeightsand everyNonuniformWeights— keep the sequential loop exactly as on master. Gating on the broaderUniformWeightsalso covered branchy Simpson uniform weights and made SimpsonsRule-on-range ~1.3× slower on Julia 1.10 aarch64. Existing Core tolerances were left unchanged and still pass.Reassociation (Trapezoidal uniform only; Simpson / nonuniform match master bitwise): vs a sequential reference on
sin-like data over N ∈ {10³,10⁴,10⁵,10⁶}, max relative difference is ~9e-15 (1.12) / ~4e-15 (1.10). Vs master on random-sign Float64 data that cancels, differences reach up to 1.9e-13 relative on Julia 1.12 and 2.6e-14 on Julia 1.10. For Float32 at N=10⁶ the Float32 result can differ by up to ~9e-5 relative from master, but the PR is more accurate: trapezoid error vs a Float64 reference drops from 8.3e-5 on master to 6.2e-7.Verification
Before/after
@benchmarkminima (JULIA_NUM_THREADS=1 taskset -c 69, amdci2 x86)Simpson paths:
reinterpret(UInt64, solve!(…).u) == reinterpret(UInt64, sequential_ref)for range and vector grids over N ∈ {8…10⁶} on both Julia 1.10.12 and 1.12.7. No Simpson speedup is claimed.Correctness: existing
rtol=1e-12sequential-reference testset kept; fullsampled_tests.jlon Julia 1.10.12 and 1.12.7 (46 pass).Test-group tails
GROUP=Core (Julia 1.12.7):
GROUP=QA (Julia 1.12.7):
Also ran Runic (
--inplace) andtyposon the changed files.Not verified
GROUP=AD/ADBatch/ Everything.evalrulepaths (already had inner@simd; untouched).fast_scalar_indexingarrays (still use_evalrule_general).SimpsonUniformWeightsbranch-free with nestedifelse(review option b; deferred — would reclaim Simpson speedup on 1.10/1.12).@simd).Reviewer pushback
SimpsonUniformWeightsgetindexso Simpson-on-range can also@simdwithout the 1.10 aarch64 regression.Vectoronce, then@simd.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-simd/log.txt on amdci2; orchestrated by Claude Code (claude-opus-5-5[1m]) https://claude.ai/code/session_01LPHREnnonfLg1VcE1EJovv
Independent review: Devin Fusion (fusion-claude-opus-5-5-high-sidekick-swe-2-medium) rated it low, verdict MERGE: #381 (comment)
Independent review (added by the fleet master)
Verdict: MERGE (reviewed head 635644c)
JULIA_NUM_THREADS=4 JULIA_NUM_PRECOMPILE_TASKS=4 JULIA_DEPOT_PATH=<local> julia +1 --project=review-env evidence/review381.jlon Julia 1.13.1: all 46 sampled tests and 11 extra Float32/Float64/ComplexF64/BigFloat/Rational/Unitful checks passed. Ran the identical PR sampled test file against base 63b17e8: 46/46 passed, including the added 16 assertions. This is a performance change, so failing-before correctness evidence is inapplicable. Timed the exact base vector method versus head at N=100000: uniform trapezoidal 120.61→25.70 μs; uniform Simpson 244.52→240.75 μs; nonuniform trapezoidal 121.00→120.83 μs; nonuniform Simpson 502.54→502.02 μs. Random-sign N=1000000 data showed the expected reassociation: Float64 absolute difference 1.01e-17; Float32 error against the Float64 sequential reference decreased from 2.05e-8 to 9.05e-9. All 15 reported PR checks pass; latest default-branch CI, downgrade, documentation and formatting runs pass. No skipped assertions, loosened existing tolerances, swallowed errors, removed coverage, or workflow changes. Full Core/QA/AD, LTS, other architectures and GPU tests were not rerun locally.🤖 Section added by an AI agent — harness: Claude Code 2.1.300 · model: claude-opus-5-5 (review by codex-cli, gpt-6.1-sol)
Conversation: https://claude.ai/code/session_01VZjwf7Ux9YtTzwHGHMqnsq