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

Vladimir Ivanov vlivanov at openjdk.org
Tue Mar 25 23:35:18 UTC 2025


On Mon, 17 Mar 2025 15:28:12 GMT, Rohit Arul Raj <rraj at openjdk.org> wrote:

>> In JDK-8309130, Array sort was optimized using  AVX512 SIMD instructions for x86_64. Currently, this optimization has been disabled for AMD Zen 4 [JDK-8317763] due to bad performance of compressstoreu. 
>> Ref: https://www.reddit.com/r/java/comments/171t5sj/heads_up_openjdk_implementation_of_avx512_based/.
>> 
>> This patch enables Zen 4 to pick optimized AVX2 version of SIMD sort and Zen 5 picks the AVX512 version.
>> 
>> JTREG Tests: Completed Tier1 & Tier2 tests on Zen4 & Zen5 - No Regressions.
>> 
>> Attaching ArraySort performance data for Zen4 & Zen5.
>> [Zen4-ArraySort-Data.txt](https://github.com/user-attachments/files/19245831/Zen4-ArraySort-Data.txt)
>> [Zen5-ArraySort-Data.txt](https://github.com/user-attachments/files/19245833/Zen5-ArraySort-Data.txt)
>
> Rohit Arul Raj has updated the pull request incrementally with one additional commit since the last revision:
> 
>   create a separate method to check for cpu's supporting avx512 version of simd sort

Overall, looks good.

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;

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

PR Review: https://git.openjdk.org/jdk/pull/24053#pullrequestreview-2715414909
PR Review Comment: https://git.openjdk.org/jdk/pull/24053#discussion_r2013066260


More information about the hotspot-compiler-dev mailing list