Skip to content

fix: Vector API sums match Rust (float order, I64 prefix overflow) - #545

Merged
dfa1 merged 1 commit into
mainfrom
fix/vector-api-sum-parity
Oct 17, 2026
Merged

dfa1 merged 1 commit into
mainfrom
fix/vector-api-sum-parity

Conversation

@dfa1

@dfa1 dfa1 commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Closes #535.

  • Float sums add sequentially (lane-wise reduceLanes(ADD) has no defined order).
  • I64 sum vectorizes only when every element is in [-2^k, 2^k) with n * 2^k <= 2^63, so no prefix can overflow; otherwise the checked per-element loop runs ([MAX, 1, -1] is dropped, as in Rust). The range test uses shift/xor/or because NEON has no 64-bit min/max.
  • U64 unchanged (prefix overflow == total overflow for unsigned).
  • Docs, CLAUDE.md and CHANGELOG updated; tests cover the bound edge and a randomized differential.

🤖 Generated with Claude Code

Float sums add sequentially: lane-wise reduceLanes(ADD) has no defined
order. The I64 sum vectorizes only when every element is in [-2^k, 2^k)
with n * 2^k <= 2^63, so no prefix can overflow; otherwise it runs the
checked per-element loop, dropping [MAX, 1, -1] as Rust does. The range
test uses shift/xor/or because NEON has no 64-bit min/max (the min/max
variant ran 2x slower than scalar; this one is within 10%).

Closes #535

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dfa1
dfa1 merged commit 924c438 into main Oct 17, 2026
14 checks passed
@dfa1
dfa1 deleted the fix/vector-api-sum-parity branch October 18, 2026 06:18
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.

Vector API SIMD kernels: close the Rust-parity gaps (float sum, I64/U64 overflow)

1 participant