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

Incorrect result with unwrapped iotaShuffle.

    XMLWordPrintable

Details

    • b05

    Backports

      Description

        Following test shows incorrect results with -XX:-TieredCompilation, but works fine with -XX:TieredStopAtLevel=1

        IPROMPT>java --add-modules=jdk.incubator.vector -cp . shuffle
        WARNING: Using incubator modules: jdk.incubator.vector
        [res] 30378688 [time] 35 ms
        IPROMPT>java --add-modules=jdk.incubator.vector -XX:TieredStopAtLevel=1 -cp . shuffle
        WARNING: Using incubator modules: jdk.incubator.vector
        [res] 4096 [time] 1351 ms

        ------------------------------------------------------------------------------------------
        import jdk.incubator.vector.*;

        public class shuffle {
           public static int micro(int i) {
              return ShortVector.SPECIES_512.iotaShuffle(i, 1, false)
                                            .toVector()
                                            .reinterpretAsShorts()
                                            .reduceLanes(VectorOperators.ADD);
           }
           public static void main(String [] args) {
              int res = 0;
              for (int i = 0; i < 10000; i++) {
                  res += micro(i & 31);
              }
              long t1 = System.currentTimeMillis();
              for (int i = 0; i < 1000000; i++) {
                  res += micro(i & 31);
              }
              long t2 = System.currentTimeMillis();
              System.out.println("[res] " + res + " [time] " + (t2-t1) + " ms");
           }
        }
        --------------------------------------------------------------------------------------------

        Looks like the problem with the comparison predicate in iotaShuffle inline expander.

        Attachments

          Issue Links

            Activity

              People

                jbhateja Jatin Bhateja
                jbhateja Jatin Bhateja
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: