8230015: [instruction selector] generic vector operands support.
Vladimir Ivanov
vladimir.x.ivanov at oracle.com
Sat Oct 12 00:41:12 UTC 2019
Hi Jatin,
FTR I'm looking at:
http://cr.openjdk.java.net/~jbhateja/genericVectorOperands/webrev.03/
Good work, Jatin. The reduction in number of instructions looks
impressive. Also, it's nice to see excessive vec? <-> legVec? moves
being eliminated.
High-level comments on the patch:
- Please, separate the patch in 2 changes: generic vector type
support and AD instruction unification. It would significantly simplify
review.
- Try to avoid x86-specific changes (#ifdefs) in shared files.
I'm still looking through the implementation, but here are the bugs in
AD unification spotted so far:
====================================================================
src/hotspot/cpu/x86/x86_64.ad:
+operand vecG() %{
+ constraint(ALLOC_IN_RC(vectorg_reg));
+operand legVecG() %{
+ constraint(ALLOC_IN_RC(vectorg_reg));
legVecG definition shouldn't be equivalent to vecG: on AVX512-capable
host legVecG should never include zmm16-zmm31 while vecG can.
====================================================================
src/hotspot/cpu/x86/x86.ad:
+instruct ReplF_zero_avx(vecG dst, immF0 zero) %{
+ predicate(UseAVX < 3 &&
UseAVX > 0 check is missing (same with ReplD_zero_avx).
====================================================================
+instruct vaddB_mem(vecG dst, vecG src, memory mem) %{
+ predicate(UseAVX && (UseAVX <= 2 || VM_Version::supports_avx512bw()) &&
+ n->as_Vector()->length() >= 4 && n->as_Vector()->length()
<= 64);
It doesn't match the following case anymore:
UseAVX == 3 &&
VM_Version::supports_avx512bw() == false &&
n->as_Vector()->length() < 64 // smaller than 512bit
There are other AD instructions (with VMVersion::supports_avx512bw()
check) which are affected the same way.
Best regards,
Vladimir Ivanov
On 22/08/2019 09:49, Bhateja, Jatin wrote:
> Hi All,
>
> Please find below a patch for generic vector operands[1] support during
> instruction selection.
>
> Motivation behind the patch is to reduce the number of vector selection
> patterns whose operands meagerly differ in vector lengths.
>
> This will not only result in lesser code being generated by ADLC which
> effectively translates to size reduction in libjvm.so but also
>
> help in better maintenance of AD files.
>
> Using generic operands we were able to collapse multiple vector patterns
> over mainline
>
> Initial number of vector instruction patterns (vec[XYZSD]
> + legVec[ZXYSD] : *510*
>
> Reduced vector instruction patterns (vecG +
> legVecG) : *222*
>
> **
>
> With this we could see around 1MB size reduction in libjvm.so.
>
> In order to have minimal impact over downstream compiler passes, a
> post-selection pass has been introduced (currently enabled only for X86
> target)
>
> which replaces these generic operands with their corresponding concreter
> vector length variants.
>
> JBS : https://bugs.openjdk.java.net/browse/JDK-8230015
>
> Patch :
> http://cr.openjdk.java.net/~jbhateja/genericVectorOperands/webrev.00/
>
> Kindly review and share your feedback.
>
> Best Regards,
>
> Jatin Bhateja
>
> [1]
> http://cr.openjdk.java.net/~jbhateja/genericVectorOperands/generic_operands_support_v1.0.pdf
>
More information about the hotspot-compiler-dev
mailing list