JDK-8332487 : Regression in Crypto-AESGCMBench.encrypt (and others) after JDK-8328181
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 23
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • CPU: x86_64
  • Submitted: 2024-05-17
  • Updated: 2024-08-01
  • Resolved: 2024-05-30
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b26Fixed
Related Reports
Relates :  
Description
With the introduction of JDK-8328181... Crypto-AESGCMBench.encrypt is showing a regression that holds into later builds (graph attached):

-2.3% Crypto-AESGCMBench.encrypt on macOS-x64

It appears it may also impact the benchmark on Windows-x64 -- though the statistical measurements are less clear.

The regression also appears in the nightly measurements (graph attached).

The regression was isolated to CI build jdk-23+18-1427 (which only contains JDK-8328181) - (graph attached).

------
Added 5/21/2024:
Just isolated more benchmark regressions to the introduction of JDK-8328181...

-6% Renaissance-Mnemonics on macOS-x64
-5% Renaissance-Scrabble     on macOS-x64

------
Added 5/22/2024:
Just isolated more benchmark regressions to the introduction of JDK-8328181...

-3% to -4%   SPECjvm2008-Derby-*                on macOS-x64
-1% to -2%   SPECjvm2008-XML.transform-*  on macOS-x64

Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/19447 Date: 2024-05-29 07:49:21 +0000
01-08-2024

Changeset: 1d889e54 Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2024-05-30 17:14:07 +0000 URL: https://git.openjdk.org/jdk/commit/1d889e54fc6d6039e68191420bb377ea560e2eaa
30-05-2024

While I am able to acknowledge performance degradation with the patch on coffee lake but the patch only constrained the scope of small constant sized clear array on AVX512 systems. And coffeelake lacks AVX512 feature. Architecture: x86_64 CPU op-mode(s): 32-bit, 64-bit Address sizes: 39 bits physical, 48 bits virtual Byte Order: Little Endian CPU(s): 6 On-line CPU(s) list: 0-5 Vendor ID: GenuineIntel Model name: Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz CPU family: 6 Model: 158 Thread(s) per core: 1 Core(s) per socket: 6 Socket(s): 1 Stepping: 10 CPU max MHz: 4100.0000 CPU min MHz: 800.0000 BogoMIPS: 6000.00 Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid ss e4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities Performance numbers: Baseline: ======== DPROMPT>java -jar renaissance-jmh-0.15.0-18-g65d596e-SNAPSHOT.jar -jvmArgs "-Xms10g -Xmx10g -Xlog:alloc"* -f 1 -i 5 -wi 2 -w 30 org.renaissance.jdk.streams.JmhMnemonics.run # JMH version: 1.37 # VM version: JDK 23-internal, OpenJDK 64-Bit Server VM, 23-internal-adhoc.root.jdk # VM invoker: /home/intel/perf-builds/jdk-old2/bin/java # VM options: -Xms10g -Xmx10g -Xlog:alloc* # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 2 iterations, 30 s each # Measurement: 5 iterations, single-shot each # Timeout: 10 min per iteration # Threads: 1 thread # Benchmark mode: Single shot invocation time # Benchmark: org.renaissance.jdk.streams.JmhMnemonics.run # Run progress: 0.00% complete, ETA 00:00:00 # Fork: 1 of 1 # Warmup Iteration 1: 5512.610 ms/op # Warmup Iteration 2: 3700.693 ms/op Iteration 1: 3246.225 ms/op Iteration 2: 3253.507 ms/op Iteration 3: 3252.290 ms/op Iteration 4: 3248.665 ms/op Iteration 5: 3251.458 ms/op Benchmark Mode Cnt Score Error Units JmhMnemonics.run ss 5 3250.429 ± 11.356 ms/op With Patch: ======== DPROMPT>java -jar renaissance-jmh-0.15.0-18-g65d596e-SNAPSHOT.jar -jvmArgs "-Xms10g -Xmx10g -Xlog:alloc"* -f 1 -i 5 -wi 2 -w 30 org.renaissance.jdk.streams.JmhMnemonics.run # JMH version: 1.37 # VM version: JDK 23-internal, OpenJDK 64-Bit Server VM, 23-internal-adhoc.root.jdk # VM invoker: /home/intel/perf-builds/jdk-new2/bin/java # VM options: -Xms10g -Xmx10g -Xlog:alloc* # Blackhole mode: compiler (auto-detected, use -Djmh.blackhole.autoDetect=false to disable) # Warmup: 2 iterations, 30 s each # Measurement: 5 iterations, single-shot each # Timeout: 10 min per iteration # Threads: 1 thread # Benchmark mode: Single shot invocation time # Benchmark: org.renaissance.jdk.streams.JmhMnemonics.run # Run progress: 0.00% complete, ETA 00:00:00 # Fork: 1 of 1 # Warmup Iteration 1: 5697.776 ms/op # Warmup Iteration 2: 3798.948 ms/op Iteration 1: 3349.614 ms/op Iteration 2: 3357.295 ms/op Iteration 3: 3363.082 ms/op Iteration 4: 3356.036 ms/op Iteration 5: 3363.609 ms/op Benchmark Mode Cnt Score Error Units JmhMnemonics.run ss 5 3357.927 ± 22.116 ms/op Following is the heap dump of Renassance.Mnemonics, top row shows 2.7 million ~72 byte array allocations. Default value of InitArrayShortSize is 64 bytes on x86 target, so all these will be considered as large allocations. DPROMPT>jmap -histo:live 1321916 | head -10 num #instances #bytes class name (module) ------------------------------------------------------- 1: 279323 20146064 [B (java.base@23-internal) 2: 265759 8504288 java.util.HashMap$Node (java.base@23-internal) 3: 278540 6684960 java.lang.String (java.base@23-internal) 4: 371 2944080 [Ljava.util.HashMap$Node; (java.base@23-internal) 5: 2766 337776 java.lang.Class (java.base@23-internal) 6: 4 322728 [Ljdk.internal.vm.FillerElement; (java.base@23-internal) 7: 2218 205160 [Ljava.lang.Object; (java.base@23-internal) 8: 2247 161784 java.lang.reflect.Field (java.base@23-internal)
28-05-2024

Yes, I agree so on non-AVX512 targets, it will not emit StoreL based instruction sequence now, and is going to take a longer route by selecting one of the clear array pattern.
28-05-2024

[~jbhateja] I think you now changed: - case Op_ClearArray: case Op_VectorMaskGen: case Op_VectorCmpMasked: if (!is_LP64 || !VM_Version::supports_avx512bw()) { return false; } if ((size_in_bits != 512) && !VM_Version::supports_avx512vl()) { return false; } break; Now Op_ClearArray hit the default case: return true; // Per default match rules are supported. That seems like it would change all sorts of SSE/AVX platforms, and not just affect AVX512.
28-05-2024

Given the regressions from JDK-832818 exhibit on the macOS-x64 platform and not the other x64 platforms, is it the case that there's a processor difference for which we should be making a different code gen choice? The macOS platform we measured on is: Mac mini (2018) 1x Coffee Lake-B processor [3.0 GHz Intel Core i5-8500B] 6 cores/processor, 1 threads/core. 9 MB L3 6 total processor threads 32 GB 2666 MHz DDR4 memory The other x64 platforms we measured on are all: OCI BM.Optimized3.36 (Oracle X9-2) 2x Ice Lake-SP processors [3.0 GHz Xeon Gold 6354, Max Turbo 3.6 GHz, 60 MiB L3] 18 cores/processor, Hyperthreaded 72 total processor threads 512 GB Memory
22-05-2024

Jatin, could you please have a look? Thanks.
21-05-2024

ILW = Minor performance regression, reproducible with crypto benchmark on x86, no known workaround = MMH = P3
21-05-2024