Tony-X opened a new pull request, #16914:
URL: https://github.com/apache/lucene/pull/16914

   ### Description
   
   Adds `VectorUtil.dotProducts(a, aCount, b, bCount, dim, stride, out)`, which 
scores all `aCount x bCount` pairs between two sets of float vectors in one 
call. It is for graph builders that score a whole cluster of vectors against 
itself; the first user is the PiPNN merge builder proposed in #16906, which 
follows in a separate PR.
   
   The scalar implementation is a 2x2 tile. The Panama implementation uses a 
4x4 register tile (each loaded vector chunk feeds four products, so the loop is 
no longer load-port bound), scans `b` in 64-row panels that stay in L2 so each 
`b` row is fetched from shared cache once per 32-row block rather than once per 
4-row tile, and splits the dimension into 1024-float slices. Rows may carry a 
stride larger than `dim`; the javadoc notes that a stride that is a multiple of 
4 KB maps consecutive rows onto the same L1 cache sets, so callers should pad 
power-of-two dimensions.
   
   Measured on a Graviton2 (Neoverse N1), one 1024-vector cluster against 
itself:
   
   ```
   Benchmark                                           (size)   Mode  Cnt  
Score    Error   Units
   VectorUtilBenchmark.floatDotProductsBlockedScalar      128  thrpt   15  
0.018 ±  0.001  ops/us
   VectorUtilBenchmark.floatDotProductsBlockedScalar     1024  thrpt   15  
0.002 ±  0.001  ops/us
   VectorUtilBenchmark.floatDotProductsBlockedVector      128  thrpt   75  
0.101 ±  0.001  ops/us
   VectorUtilBenchmark.floatDotProductsBlockedVector     1024  thrpt   75  
0.015 ±  0.001  ops/us
   VectorUtilBenchmark.floatDotProductsPairwiseVector     128  thrpt   75  
0.019 ±  0.001  ops/us
   VectorUtilBenchmark.floatDotProductsPairwiseVector    1024  thrpt   75  
0.004 ±  0.001  ops/us
   ```
   
   Scores differ from a single-pass sum only in summation order for `dim > 
1024`.
   
   Tests: `TestVectorUtilSupport` compares both providers against a scalar 
reference across sizes, strides, blocks (`dim` above and below the slice 
length) and `dim == 0`. JMH: `VectorUtilBenchmark.dotProducts*`.
   
   Relates to #16906.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to