uschindler commented on code in PR #13636:
URL: https://github.com/apache/lucene/pull/13636#discussion_r1709899394


##########
lucene/core/src/java21/org/apache/lucene/internal/vectorization/PanamaVectorizationProvider.java:
##########
@@ -16,20 +16,56 @@
  */
 package org.apache.lucene.internal.vectorization;
 
+import java.io.IOException;
+import java.lang.foreign.MemorySegment;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.Locale;
 import java.util.logging.Logger;
 import jdk.incubator.vector.FloatVector;
+import jdk.incubator.vector.VectorShape;
+import jdk.incubator.vector.VectorSpecies;
 import org.apache.lucene.codecs.hnsw.FlatVectorsScorer;
+import org.apache.lucene.store.IndexInput;
+import org.apache.lucene.store.MemorySegmentAccessInput;
 import org.apache.lucene.util.Constants;
 import org.apache.lucene.util.SuppressForbidden;
 
 /** A vectorization provider that leverages the Panama Vector API. */
 final class PanamaVectorizationProvider extends VectorizationProvider {
 
+  /** Preferred with in bits for vectors. */
+  static final int PREFERRED_VECTOR_BITSIZE;
+
+  static final VectorSpecies<Long> PRERERRED_LONG_SPECIES;
+  static final VectorSpecies<Integer> PRERERRED_INT_SPECIES;
+
+  /** Whether integer vectors can be trusted to actually be fast. */
+  static final boolean HAS_FAST_INTEGER_VECTORS;
+
   private final VectorUtilSupport vectorUtilSupport;
 
+  static {
+    // default to platform supported bitsize
+    int vectorBitSize = VectorShape.preferredShape().vectorBitSize();

Review Comment:
   I was also afraid that the other new constants may call the bad code, as 
this problem occurs in one of the most internal classes that are called from 
almost everywhere. So my idea was to make sure the constructor is the first one 
who loads any class from vector incubator.



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to