+1 to that idea. My only Q would be whether the initialization/autodetection would have always already happened before users would have a chance to call these methods, or whether they would indeed trigger that check, or return "unknown" if it hadn't yet happened? not sure when IMPL gets determined. Also, there is a further switch that may happen within the native implementation depending on the hardware. I think this would typically be done using an iFunc (one-time dynamic loading callback ) that determines which native impl gets used. It would be nice to expose that too, although maybe not a strict requirement.
On Thu, Feb 5, 2026 at 6:33 PM Chris Hostetter <[email protected]> wrote: > > > I know that when the o.a.l.util.VectorUtil gets loaded, there is some JUL > log messsages from the underlying VectorizationProvider to help inform > people running the application whether they are or are not getting the > Panama optimized vectorization support -- and if not why not. > > What I'm wondering: is there is any downside to having some really simple > (public) introspection API that apps could call to report (using their own > loging or metrics reporting APIs) what implementation is in use? > > > Maybe something as simple as ... > > VectorUtil: > > public static boolean isImplNativeCodeOptimized() { > return IMPL.isNativeCodeOptimized(); > } > public static String getImplDescription() { > return IMPL.getDescription(); > } > > VectorUtilSupport: > > default boolean isNativeCodeOptimized() { return false; } > String getDescription(); > > DefaultVectorUtilSupport: > > public String getDescription() { return "Default"; } > > PanamaVectorUtilSupport: > > public boolean isNativeCodeOptimized() { return true; } > public String getDescription() { > return String.format( > Locale.ENGLISH, > "Java vector incubator API enabled; uses > preferredBitSize=%d%s%s", > PanamaVectorConstants.PREFERRED_VECTOR_BITSIZE, > Constants.HAS_FAST_VECTOR_FMA ? "; FMA enabled" : "", > VectorizationProvider.TESTS_VECTOR_SIZE.isPresent() ? "; > testMode enabled" : "") > } > > PanamaVectorizationProvider: > // change logIncubatorSetup() ... > // call this.vectorUtilSupport.getDescription() > > > > > > -Hoss > http://www.lucidworks.com/ > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
