8230015: [instruction selector] generic vector operands support.

Leslie Zhai zhaixiang at loongson.cn
Wed Apr 14 05:09:21 UTC 2021


Hi Jatin,

Thanks for your great work!

libjvm.so reduced +1MB will help SPECjvm2008 some benchmark +44% speed up.

Then I tried to port 8234391: C2: Generic vector operands for `YOURARCH` 
about LoadVector and StoreVector at first.

Only `Matcher::regmask_for_ideal_register` was able to call 
`Matcher::is_generic_vector`, but compared with X86, 
`Matcher::do_postselect_cleanup` was also able to call 
`Matcher::is_generic_vector` too.

I debug the `Matcher::do_postselect_cleanup`:

diff --git a/src/hotspot/share/opto/matcher.cpp 
b/src/hotspot/share/opto/matcher.cpp
index 0846cad3c3f..8fd644d2d93 100644
--- a/src/hotspot/share/opto/matcher.cpp
+++ b/src/hotspot/share/opto/matcher.cpp
@@ -309,6 +309,9 @@ void Matcher::match( ) {
      C->record_method_not_compilable("must be able to represent all 
call arguments in reg mask");
    }

+#ifdef YOURARCH64
+  do_postselect_cleanup();
+#endif
    if (C->failing())  return;  // bailed out on incoming arg failure

    // ---------------
@@ -2630,8 +2633,10 @@ void Matcher::specialize_generic_vector_operands() {
          int opnd_idx = m->operand_index(1);
          Node* def = m->in(opnd_idx);
          m->subsume_by(def, C);
+#if !defined(YOURARCH64)
        } else if (m->is_MachTemp()) {
          // process MachTemp nodes at use site (see 
Matcher::specialize_vector_operand)
+#endif
        } else {
          specialize_mach_node(m);
        }

But `Matcher::do_postselect_cleanup` was still not able to be called.

 > Current patch enables this support only for x86 target, to get a 
feedback from community.

Then how to port Generic vector operands for other targets?

Thanks,

Leslie Zhai


在 2019年08月22日 14:49, Bhateja, Jatin 写道:
> 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