kaivalnp opened a new pull request, #15698:
URL: https://github.com/apache/lucene/pull/15698

   ### Description
   
   Addresses #15697 
   
   Individual dimensions of 4-bit quantized vectors are stored as packed 
nibbles (i.e. two dimensions in a single byte).
   Example: `[1 2][3 4][5 6][7 8]`
   
   These need to be "unpacked" to perform vector comparisons. Currently, we 
[take the second nibble from each byte and place them at the 
end](https://github.com/apache/lucene/blob/448c7d8e2414eaae43b68cc398fcb3e2191b4132/lucene/core/src/java/org/apache/lucene/codecs/lucene104/OffHeapScalarQuantizedVectorValues.java#L188-L194).
   Example: `[1][3][5][7][2][4][6][8]`
   
   Sometimes, we need to compare a "packed" vector with an "unpacked" one. We 
[read one byte from the "packed" vector and corresponding dimensions from the 
"unpacked" 
one](https://github.com/apache/lucene/blob/448c7d8e2414eaae43b68cc398fcb3e2191b4132/lucene/core/src/java/org/apache/lucene/internal/vectorization/DefaultVectorUtilSupport.java#L171-L182).
   
   Because of the layout of the "unpacked" vector, it can lead to CPU cache 
line misses (two consecutive dimensions are apart by `dimension count / 2` 
bytes).
   
   Proposing to unpack nibbles in dimension order.
   Example: `[1][2][3][4][5][6][7][8]`


-- 
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