goankur commented on code in PR #16771:
URL: https://github.com/apache/lucene/pull/16771#discussion_r4278715681


##########
lucene/core/src/java/org/apache/lucene/codecs/lucene99/Lucene99FlatVectorsFormat.java:
##########
@@ -63,11 +63,13 @@
  *       that only in sparse case
  * </ul>
  *
- * <p>NOTE: Arm Neoverse machines have a performance overhead in reading data 
that is not aligned to
- * 64 bytes, so this format aligns the <code>.vec</code> file to that size. 
There may be a
- * performance penalty in searching of float vectors that do <b>not</b> have a 
dimension of a
- * multiple of 16 (equivalent to 64 bytes), because the alignment will not 
hold for all vectors in
- * the file.
+ * <p>NOTE: this format aligns the vector data of each field in the 
<code>.vec</code> file to 4096
+ * bytes, for every encoding. A vector whose size divides 4096 bytes or is a 
multiple of it (e.g.
+ * 1024-dim float32) then never straddles a page boundary, so reading one 
vector, as rescoring does,

Review Comment:
   Thanks @gsmiller. I don't think this needs to wait on #16145. The alignment 
fixes how many pages a vector spans, and that holds whichever path does the 
reading. With the backoff in place, though, the rerank cost is dominated by 
prefetches being skipped, so I'd expect the alignment gain to be harder to see 
until #16145 lands.
   
   @uschindler , @gsmiller , @CH-Abhinav 
   
   4 KiB is the smallest page size on the platforms we run on, and larger pages 
are multiples of it. So a vector that doesn't cross a 4 KiB boundary doesn't 
cross a 16 KiB or 64 KiB one either. Smaller pages are fine too as a page size 
below 4 KiB (1 or 2 KiB) divides 4096, so 4096-aligned data is also aligned to 
those pages, and a vector touches the minimum number of pages there as well. 
The only difference is a bit more padding than the platform strictly needs. 
Nothing gets worse for anyone, and most setups get the full benefit.
   
   On making it platform-dependent: I agree with @uschindler. Alignment is 
fixed when the segment is written, and an index often moves between machines, 
so a platform-specific value would only be right on the machine that wrote it. 
A fixed 4096 is the portable choice.



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