Skip to content

perf(vector): improve dot and norm2_sq throughput#185

Merged
acgetchell merged 1 commit into
mainfrom
perf/155-vector-dot-norm2
Jul 12, 2026
Merged

perf(vector): improve dot and norm2_sq throughput#185
acgetchell merged 1 commit into
mainfrom
perf/155-vector-dot-norm2

Conversation

@acgetchell

@acgetchell acgetchell commented Jul 12, 2026

Copy link
Copy Markdown
Owner
  • Check accumulator finiteness once after the success-path reduction.
  • Replay only non-finite reductions to preserve the first failing step.
  • Preserve left-to-right fused accumulation and const evaluation.

Closes #155

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of non-finite results in dot-product and squared-norm calculations.
    • Error reporting now identifies the specific calculation step where an overflow or invalid result occurs.
    • Preserved left-to-right and fused calculation behavior for more consistent numerical results.
  • Tests

    • Added coverage for overflow scenarios, intermediate failures, and expected numerical outcomes.

- Check accumulator finiteness once after the success-path reduction.
- Replay only non-finite reductions to preserve the first failing step.
- Preserve left-to-right fused accumulation and const evaluation.

Closes #155
@acgetchell acgetchell self-assigned this Jul 12, 2026
@acgetchell acgetchell enabled auto-merge July 12, 2026 06:12
@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8dffd343-f105-4984-92e7-76801792f23e

📥 Commits

Reviewing files that changed from the base of the PR and between df7a358 and ece54d7.

📒 Files selected for processing (1)
  • src/vector.rs

📝 Walkthrough

Walkthrough

Vector::dot now completes left-to-right FMA accumulation before checking finiteness. When overflow occurs, replay identifies the first failing index. Tests cover dot and squared-norm overflow provenance, const evaluation, accumulation ordering, and middle-step failures.

Changes

Vector overflow provenance

Layer / File(s) Summary
Deferred accumulation and failure replay
src/vector.rs
dot_with_operation defers non-finite detection until accumulation ends, while dot_non_finite_error replays FMA operations to report the first failing index.
Overflow and ordering validation
src/vector.rs
Tests cover replayed overflow indices, const-evaluated errors, left-to-right FMA behavior, and failures occurring in middle accumulation steps.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: improved throughput for Vector dot and norm2_sq operations.
Linked Issues check ✅ Passed The changes address #155 by optimizing dot/norm2_sq behavior while preserving API, numerical behavior, and adding focused tests.
Out of Scope Changes check ✅ Passed The PR stays scoped to vector kernel behavior and related tests, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch perf/155-vector-dot-norm2

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.87%. Comparing base (df7a358) to head (ece54d7).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #185      +/-   ##
==========================================
+ Coverage   97.81%   97.87%   +0.05%     
==========================================
  Files           8        8              
  Lines        4859     4944      +85     
==========================================
+ Hits         4753     4839      +86     
+ Misses        106      105       -1     
Flag Coverage Δ
unittests 97.87% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@acgetchell acgetchell merged commit b1e431a into main Jul 12, 2026
18 checks passed
@acgetchell acgetchell deleted the perf/155-vector-dot-norm2 branch July 12, 2026 06:20
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.

Investigate Vector dot and norm2_sq performance

1 participant