RFR(XS): 8238596: AVX enabled by default for Skylake even when unsupported

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Feb 7 09:16:12 UTC 2020


Hi David,

> webrev: http://cr.openjdk.java.net/~dbuck/8238596.0/

Good catch! Overall, looks good.

What do you think about the following variant?

diff --git a/src/hotspot/cpu/x86/vm_version_x86.cpp 
b/src/hotspot/cpu/x86/vm_version_x86.cpp
--- a/src/hotspot/cpu/x86/vm_version_x86.cpp
+++ b/src/hotspot/cpu/x86/vm_version_x86.cpp
@@ -672,11 +672,14 @@
      }
    }
    if (FLAG_IS_DEFAULT(UseAVX)) {
-    FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
-    if (is_intel_family_core() && _model == CPU_MODEL_SKYLAKE && 
_stepping < 5) {
-      FLAG_SET_DEFAULT(UseAVX, 2);  //Set UseAVX=2 for Skylake
+    // Don't use AVX-512 on older Skylakes unless explicitly requested.
+    if (use_avx_limit > 2 && is_intel_skylake() && _stepping < 5) {
+      FLAG_SET_DEFAULT(UseAVX, 2);
+    } else {
+      FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
      }
-  } else if (UseAVX > use_avx_limit) {
+  }
+  if (UseAVX > use_avx_limit) {
      warning("UseAVX=%d is not supported on this CPU, setting it to 
UseAVX=%d", (int) UseAVX, use_avx_limit);
      FLAG_SET_DEFAULT(UseAVX, use_avx_limit);
    } else if (UseAVX < 0) {
diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp 
b/src/hotspot/cpu/x86/vm_version_x86.hpp
--- a/src/hotspot/cpu/x86/vm_version_x86.hpp
+++ b/src/hotspot/cpu/x86/vm_version_x86.hpp
@@ -868,6 +868,9 @@
    static bool is_intel_family_core() { return is_intel() &&
                                         extended_cpu_family() == 
CPU_FAMILY_INTEL_CORE; }

+  static bool is_intel_skylake() { return is_intel_family_core() &&
+                                          extended_cpu_model() == 
CPU_MODEL_SKYLAKE; }
+
    static bool is_intel_tsc_synched_at_init()  {
      if (is_intel_family_core()) {
        uint32_t ext_model = extended_cpu_model();


Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list