Skip to content

Support buffered dot product for any element type - #384

Open
blegat wants to merge 1 commit into
mainfrom
bl/buffered_dot
Open

blegat wants to merge 1 commit into
mainfrom
bl/buffered_dot

Conversation

@blegat

@blegat blegat commented Oct 28, 2026

Copy link
Copy Markdown
Member

buffer_for(LinearAlgebra.dot, ...) and buffered_operate_to!(buffer, output, LinearAlgebra.dot, x, y) were only implemented for BigFloat vectors in #193. For other element types, the buffer of the scalar add_dot is now returned and reused for every entry so that computing several dot products with the same buffer and output does not allocate. operate_to!(output, LinearAlgebra.dot, x, y) is also implemented.

Minimum time from BenchmarkTools. The buffer and the output are created once and reused across calls:

LinearAlgebra.dot buffered_operate_to!!
BigInt, n = 6 369 ns, 35 allocs 53 ns, 0 allocs
BigInt, n = 50 2.8 μs, 253 allocs 390 ns, 0 allocs
Rational{BigInt}, n = 6 1.4 μs, 121 allocs 593 ns, 0 allocs
Rational{BigInt}, n = 50 11.5 μs, 893 allocs 5.8 μs, 0 allocs

`buffer_for(LinearAlgebra.dot, ...)` and `buffered_operate_to!(buffer, output,
LinearAlgebra.dot, x, y)` were only implemented for `BigFloat` vectors. For
other element types, the buffer of the scalar `add_dot` is now returned and
reused for every entry so that computing several dot products with the same
buffer and output does not allocate. `operate_to!(output, LinearAlgebra.dot,
x, y)` is also implemented.
@codecov

codecov Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@b927ed3). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #384   +/-   ##
=======================================
  Coverage        ?   92.09%           
=======================================
  Files           ?       23           
  Lines           ?     2390           
  Branches        ?        0           
=======================================
  Hits            ?     2201           
  Misses          ?      189           
  Partials        ?        0           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant