Skip to content

Replace inner_product with generic dot - #87

Open
danieltowner wants to merge 1 commit into
scatter-64bit-index-stackfrom
dot-generic-stack
Open

danieltowner wants to merge 1 commit into
scatter-64bit-index-stackfrom
dot-generic-stack

Conversation

@danieltowner

Copy link
Copy Markdown
Contributor

Replace the FP16-only inner_product API with dot(lhs, rhs, init) and dot(lhs, rhs). Preserve FP32 accumulation for FP16 inputs and add generic integer dot products, tests, and performance scenarios.

@danieltowner
danieltowner added this pull request to stack #79 November 30, 2026 21:39
@danieltowner
danieltowner requested a balanced review from Copilot December 1, 2026 11:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
What changed in this PR

This PR replaces the FP16-only inner_product API with a generic dot(lhs, rhs, init) / dot(lhs, rhs) API, preserving FP32 accumulation for FP16+FP32-init while expanding dot support (and coverage) to integer combinations and adding performance scenarios/baselines.

Changes:

  • Introduces a generic dot implementation (including integer wrapping semantics and scalar fallback) and updates the public API/docs accordingly.
  • Updates the x86 AVX10.2 FP16 specialized path from inner_product to dot.
  • Adds/updates unit tests, performance scenarios, baseline expectations, and changelog entry for the new dot API.
File Description
test/​performance/​scenarios/​dot_u8_u8_i32.cpp Adds a perf scenario entry point for u8·u8 → i32 dot with init.
test/​performance/​scenarios/​dot_u8_i8_i32.cpp Adds a perf scenario entry point for u8·i8 → i32 dot with init.
test/​performance/​scenarios/​dot_u16_i16_i32.cpp Adds a perf scenario entry point for u16·i16 → i32 dot with init.
test/​performance/​scenarios/​dot_i8_i32.cpp Adds a perf scenario entry point for i8·i8 → i32 dot with init.
test/​performance/​scenarios/​dot_i16_i32.cpp Adds a perf scenario entry point for i16·i16 → i32 dot with init.
test/​performance/​scenarios/​dot_f16.cpp Renames the perf scenario from inner_product to dot for FP16.
test/​performance/​baselines.json Adds baselines for new dot scenarios and removes inner_product_f16 baseline.
test/​TestSimdInnerProduct.cpp Renames/extends tests to validate dot for FP16 and integer cases, plus overload resolution and constexpr.
include/​xvec/​x86/​x86_impl.hpp Renames AVX10.2 FP16 path to dot and constrains it to float init to avoid ambiguity.
include/​xvec/​generic/​generic_impl.hpp Adds generic dot implementation with wrapping integer accumulation, vectorizable and scalar fallback paths.
include/​xvec/​detail/​std_numeric.hpp Replaces the public inner_product API/docs with dot overloads (with/without init).
CHANGELOG.md Documents the new dot API and behavior.

Review effort: Lite

Comment thread include/xvec/detail/std_numeric.hpp Resolved
Comment thread include/xvec/detail/std_numeric.hpp Resolved
Comment thread test/TestSimdInnerProduct.cpp Resolved

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants