RFR[S]:8241874 [PPC64] Improve performance of Long.reverseBytes() and Integer.reverseBytes() on Power9

Michihiro Horie HORIE at jp.ibm.com
Thu Apr 2 14:27:10 UTC 2020


Hi Corey,

I’m not a reviewer, but I can run your benchmark in my local P9 node if you
share it.

Best regards,
Michihiro


 ----- Original message -----
 From: Corey Ashford <cjashfor at linux.ibm.com>
 Sent by: "hotspot-compiler-dev"
 <hotspot-compiler-dev-bounces at openjdk.java.net>
 To: hotspot-compiler-dev at openjdk.java.net
 Cc:
 Subject: [EXTERNAL] RFR[S]:8241874 [PPC64] Improve performance of
 Long.reverseBytes() and Integer.reverseBytes() on Power9
 Date: Tue, Mar 31, 2020 7:52 AM

 Hello,

 This is my first OpenJDK patch for review.  It increases the performance
 of byte reversal for Integer.reverseBytes() and Long.reverseBytes() on
 Power9 via its VSX xxbrw and xxbrd vector instructions.

 https://urldefense.proofpoint.com/v2/url?u=https-3A__bugs.openjdk.java.net_browse_JDK-2D8241874&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=oecsIpYF-cifqq2i1JEH0Q&m=Q0ug0imG7nRw-N8m1U0RobPS3M9D2mmT8nY3GnID3io&s=TXqhnYzhTVyILKGJBOpWSmqe-iP6ixmCAqwxYT19K8E&e=

 https://urldefense.proofpoint.com/v2/url?u=http-3A__cr.openjdk.java.net_-7Egromero_8241874_v1_&d=DwICaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=oecsIpYF-cifqq2i1JEH0Q&m=Q0ug0imG7nRw-N8m1U0RobPS3M9D2mmT8nY3GnID3io&s=1elFXKQoR_CB9mG6g4TM0z5-Da27XveB77RBXKwQi3I&e=


 I have tested on Power9 and see a 38%+ performance improvement on
 Long.reverseBytes() and 15%+ on Integer.reverseBytes().  (I add the +
 because the benchmark code has a fair amount of fixed overhead).
 Testing on Power8 reveals no regressions.

 I believe the patch itself is pretty self-explanatory.  It adds
 definitions for four instructions that are needed to get the data in and
 out of the vector registers, and to perform the reversal operation, and
 it adds the instructs to use them.  Also VM_Version::initialize()
 autodetects that the instructions are available, and warns for trying to
 set the UseVectorByteReverseInstructionsPPC64 flag on earlier Power
 processors that don't possess these PowerISA 3.0 instructions.

 Thanks to Michihiro Horie, Jose Ricardo Ziviani, and Gustav Romero for
 their help!

 Please review this patch.

 Thanks for your consideration,

 Corey Ashford




More information about the hotspot-compiler-dev mailing list