RFR: 8317976: Optimize SIMD sort for AMD Zen 4 [v2]

Rohit Arul Raj rraj at openjdk.org
Fri Mar 28 10:08:17 UTC 2025


On Wed, 26 Mar 2025 18:34:38 GMT, Srinivas Vamsi Parasa <sparasa at openjdk.org> wrote:

>> src/hotspot/cpu/x86/vm_version_x86.hpp line 778:
>> 
>>> 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()); }
>> 
>> It's quite hard to parse. The following looks clearer to me:
>> 
>> if (supports_avx512dq()) {
>>   // Disable AVX512 version of SIMD Sort on AMD Zen4 Processors.
>>   if (is_amd() && cpu_family() == CPU_FAMILY_AMD_19H) {
>>     return false;
>>   } 
>>   return true;
>> }
>> return false;
>
> I second the suggested refactoring. Need to make sure the original `is_intel()` check is also included appropriately in the logic :)

> It's quite hard to parse. The following looks clearer to me:
> 
> ```
> if (supports_avx512dq()) {
>   // Disable AVX512 version of SIMD Sort on AMD Zen4 Processors.
>   if (is_amd() && cpu_family() == CPU_FAMILY_AMD_19H) {
>     return false;
>   } 
>   return true;
> }
> return false;
> ```

Done.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/24053#discussion_r2018295775


More information about the hotspot-compiler-dev mailing list