Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8318703

C2 SuperWord: take reduction nodes into account in early unrolling analysis

    XMLWordPrintable

Details

    Description

      Early unrolling analysis (SuperWord::unrolling_analysis()) informs the loop unrolling factor computed by the unrolling policy (IdealLoopTree::policy_unroll()) via IdealLoopTree::policy_unroll_slp_analysis(). This analysis currently ignores reduction nodes [1]. For pure reduction loops (loops whose body consists only of reduction nodes), that leads the analysis to always request maximum unrolling (unroll factor of Matcher::superword_max_vector_size(T_BYTE) [2]) independently of the type of the reduction nodes.

      The attached program reproduces this behavior (on JDK 22 b20), leading to a non-vectorized main loop with 512 floating point additions. Run with:

      $ java -Xcomp -XX:CompileOnly=Test::test Test.java

      [1] https://github.com/openjdk/jdk/blob/fd332da1c8a689e91b7124fc342f02b6e0d3dff5/src/hotspot/share/opto/superword.cpp#L192
      [2] https://github.com/openjdk/jdk/blob/fd332da1c8a689e91b7124fc342f02b6e0d3dff5/src/hotspot/share/opto/superword.cpp#L185

      Attachments

        Issue Links

          Activity

            People

              epeter Emanuel Peter
              rcastanedalo Roberto Castaneda Lozano
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: