Skip to content

Commit 4201191

Browse files
committed
create a separate method to check for cpu's supporting avx512 version of simd sort
1 parent 8de2e2c commit 4201191

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

src/hotspot/cpu/x86/matcher_x86.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,7 @@
263263

264264
// Is SIMD sort supported for this CPU?
265265
static bool supports_simd_sort(BasicType bt) {
266-
if ((VM_Version::is_intel() || (VM_Version::is_amd() && (VM_Version::cpu_family() > 0x19)))
267-
&& VM_Version::supports_avx512dq()) {
266+
if (VM_Version::supports_avx512_simd_sort()) {
268267
return true;
269268
}
270269
else if (VM_Version::supports_avx2() && !is_double_word_type(bt)) {

src/hotspot/cpu/x86/stubGenerator_x86_64.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4326,14 +4326,10 @@ void StubGenerator::generate_compiler_stubs() {
43264326
if (libsimdsort != nullptr) {
43274327
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, JNI_LIB_PREFIX "simdsort" JNI_LIB_SUFFIX, p2i(libsimdsort));
43284328

4329-
snprintf(ebuf_, sizeof(ebuf_),
4330-
((VM_Version::is_intel() || (VM_Version::is_amd() && (VM_Version::cpu_family() > 0x19)))
4331-
&& VM_Version::supports_avx512dq()) ? "avx512_sort" : "avx2_sort");
4329+
snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512_simd_sort() ? "avx512_sort" : "avx2_sort");
43324330
StubRoutines::_array_sort = (address)os::dll_lookup(libsimdsort, ebuf_);
43334331

4334-
snprintf(ebuf_, sizeof(ebuf_),
4335-
((VM_Version::is_intel() || (VM_Version::is_amd() && (VM_Version::cpu_family() > 0x19)))
4336-
&& VM_Version::supports_avx512dq()) ? "avx512_partition" : "avx2_partition");
4332+
snprintf(ebuf_, sizeof(ebuf_), VM_Version::supports_avx512_simd_sort() ? "avx512_partition" : "avx2_partition");
43374333
StubRoutines::_array_partition = (address)os::dll_lookup(libsimdsort, ebuf_);
43384334
}
43394335
}

src/hotspot/cpu/x86/vm_version_x86.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,8 @@ class VM_Version : public Abstract_VM_Version {
432432
enum Extended_Family {
433433
// AMD
434434
CPU_FAMILY_AMD_11H = 0x11,
435+
CPU_FAMILY_AMD_17H = 0x17, /* Zen1 & Zen2 */
436+
CPU_FAMILY_AMD_19H = 0x19, /* Zen3 & Zen4 */
435437
// ZX
436438
CPU_FAMILY_ZX_CORE_F6 = 6,
437439
CPU_FAMILY_ZX_CORE_F7 = 7,
@@ -771,6 +773,10 @@ class VM_Version : public Abstract_VM_Version {
771773
//
772774
static bool cpu_supports_evex() { return (_cpu_features & CPU_AVX512F) != 0; }
773775

776+
static bool supports_avx512_simd_sort() {
777+
// Disable AVX512 version of SIMD Sort on AMD Zen4 Processors
778+
return ((is_intel() || (is_amd() && (cpu_family() > CPU_FAMILY_AMD_19H))) && supports_avx512dq()); }
779+
774780
// Intel features
775781
static bool is_intel_family_core() { return is_intel() &&
776782
extended_cpu_family() == CPU_FAMILY_INTEL_CORE; }

0 commit comments

Comments
 (0)