rmuir commented on code in PR #12731:
URL: https://github.com/apache/lucene/pull/12731#discussion_r1375248973
##########
lucene/core/src/java20/org/apache/lucene/internal/vectorization/PanamaVectorUtilSupport.java:
##########
@@ -77,6 +77,47 @@ final class PanamaVectorUtilSupport implements
VectorUtilSupport {
VectorizationProvider.TESTS_FORCE_INTEGER_VECTORS ||
(isAMD64withoutAVX2 == false);
}
+ private static final String MANAGEMENT_FACTORY_CLASS =
"java.lang.management.ManagementFactory";
+ private static final String HOTSPOT_BEAN_CLASS =
"com.sun.management.HotSpotDiagnosticMXBean";
+
+ // best effort to see if FMA is fast (this is architecture-independent
option)
+ private static boolean hasFastFMA() {
+ // on ARM cpus, FMA works fine but is a slight slowdown: don't use it.
+ if (Constants.OS_ARCH.equals("amd64") == false) {
+ return false;
+ }
+ try {
+ final Class<?> beanClazz = Class.forName(HOTSPOT_BEAN_CLASS);
+ // we use reflection for this, because the management factory is not part
+ // of Java 8's compact profile:
+ final Object hotSpotBean =
Review Comment:
surely we can leave comments about the module system to another issue. It
was somehow ok for ramusageestimator to do this, but not ok for vectors code?
Honestly, i havent a clue about the module system (nor a care) and no idea
how it works or what 'requires static' means or any of that. To me, it looks
like more overengineered java garbage (sorry). So I'm ill-equipped to be
updating comments inside RAMUsageEstimator. I just want to try to improve the
vectorization here.
--
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]