iprithv commented on code in PR #16203:
URL: https://github.com/apache/lucene/pull/16203#discussion_r3387111494
##########
lucene/core/src/java25/org/apache/lucene/internal/vectorization/MemorySegmentBulkVectorOps.java:
##########
@@ -147,13 +204,313 @@ private void dotProductBulkImpl(
}
}
+ // -- uint8 dot product
+
+ static final class Uint8DotProduct {
+
+ private Uint8DotProduct() {}
+
+ void dotProductBulk(
+ MemorySegment seg,
+ int[] scores,
+ byte[] q,
+ long d1,
+ long d2,
+ long d3,
+ long d4,
+ int elementCount) {
+ dotProductBulkImpl(seg, scores, q, null, d1, d2, d3, d4, elementCount);
+ }
+
+ void dotProductBulk(
+ MemorySegment seg,
+ int[] scores,
+ MemorySegment qSeg,
+ long d1,
+ long d2,
+ long d3,
+ long d4,
+ int elementCount) {
+ dotProductBulkImpl(seg, scores, null, qSeg, d1, d2, d3, d4,
elementCount);
+ }
+
+ private void dotProductBulkImpl(
+ MemorySegment seg,
+ int[] scores,
+ byte[] qArray,
+ MemorySegment qSeg,
+ long d1,
+ long d2,
+ long d3,
+ long d4,
+ int elementCount) {
+ int i = 0;
+ IntVector acc1 = IntVector.zero(INT_SPECIES);
+ IntVector acc2 = IntVector.zero(INT_SPECIES);
+ IntVector acc3 = IntVector.zero(INT_SPECIES);
+ IntVector acc4 = IntVector.zero(INT_SPECIES);
Review Comment:
sorry, but these are 4 separate output values, not 4 accumulators for the
same result. acc1 goes to scores[0] (q·d1), acc2 goes to scores[1] (q·d2)....
we need all 4 because each one is a different dot product against a different
document vector. If we used a single accumulator we'd lose 3 of the 4 results.
maybe I'm misunderstanding?
--
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]