slow-J opened a new pull request, #16631:
URL: https://github.com/apache/lucene/pull/16631

   I was looking into HNSW indexing performance and saw in an internal Amazon 
JFR profiler
   `OffHeapScalarQuantizedVectorValues.unpackNibbles` at ~7%  on a full index 
build.
   
   Attempting to improve performance by vectorizing it.
   Routing it through `VectorUtilSupport` as `int4Unpack` so Panama unpacks a 
register of bytes per iteration instead of one byte at a time. The output 
should be identical to the previous scalar loop.
   
   
   Benchmarked via JMH:
   
   Added a JMH test and ran
   ```
   java --module-path lucene/benchmark-jmh/build/benchmarks \
        --module org.apache.lucene.benchmark.jmh \
        'VectorUtilBenchmark.binaryHalfByteUnpack.*' -p size=128,1024,4096
   ```
   hardware:
   
   EC2 Host: m6g.16xlarge
   AWS Graviton2 (Neoverse N1), aarch64, no SVE, preferredBitSize=128; FMA 
enabled, JDK 25.0.2
   
   Benchmark                                       (size)   Mode  Cnt   Score   
Error   Units
   VectorUtilBenchmark.binaryHalfByteUnpackScalar     128  thrpt   15  13.562 ± 
0.026  ops/us
   VectorUtilBenchmark.binaryHalfByteUnpackScalar    1024  thrpt   15   2.157 ± 
0.003  ops/us
   VectorUtilBenchmark.binaryHalfByteUnpackScalar    4096  thrpt   15   0.553 ± 
0.001  ops/us
   VectorUtilBenchmark.binaryHalfByteUnpackVector     128  thrpt   15  99.676 ± 
1.297  ops/us
   VectorUtilBenchmark.binaryHalfByteUnpackVector    1024  thrpt   15  28.519 ± 
0.085  ops/us
   VectorUtilBenchmark.binaryHalfByteUnpackVector    4096  thrpt   15   8.339 ± 
0.217  ops/us
   
   7.35x at 128 dims, 13.2x at 1024, 15.1x at 4096. 
   
   
   I think this may be somewhat related to 
https://github.com/apache/lucene/issues/15697 


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