[SYSTEMDS-3920] Vector API Implementation for dense codegen primitives (Divisions, Aggregations, Comparisons, MultiplyAdd) + benchmarks #2428
+2,048
−79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a Java Vector API implementation for dense codegen primitives in the following groups:
The new vectorized implementations were benchmarked against the previous scalar-loop versions (see results below) with JMH microbenchmarks and a standalone Java benchmark suite included in this PR. In most cases, both harnesses show the same trend. In caseswhere they differ slightly, JMH is used as the primary signal due to lower volatility.
For each primitive, I compared the Vector API version to the existing scalar loop:
Benchmark setup
JDK version : 21
JMH version: 1.37
OS: macOS
Machine: (Apple M2/M, 16 GB RAM, 128-bit vector width/ SIMD)
Input size (double arrays): 1,000,000 elements
Warmup time: 1s per primitive
Measurement: 1 Iteration
JMH params: 2 Forks
Note: These benchmarks were run with a 128-bit SIMD vector width, which is only 2 lanes for doubles. On production deployments with wider SIMD (e.g., 256-bit or 512-bit where available), the vectorized implementations are expected to provide equal or better speedups due to increased lane-level parallelism.