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

C2 SuperWord: schedule must remove packs with cyclic dependencies

    XMLWordPrintable

Details

    • b17

    Description

      I have found a Test.java, where we have independency on pair and pack level.
      The nodes in a pack are all mutually independent (none have a path to any other of them).
      But: the packs have cyclic dependencies between them.
      When this is SuperWord-vectorized, it leads to wrong results, operations are reordered that should not be reordered.

      Regression Test.java
      ./java -XX:CompileCommand=compileonly,Test::test -Xbatch -XX:+TraceSuperWord -XX:+TraceNewVectors Test.java

      I found this during the work of JDK-8298935. The bugs are related, but not the same. JDK-8298935 did not properly verify that the packs were independent.
      But independence on pack level is not sufficient, there can still be cyclic dependencies between the packs. This bug here reveals this.

      It seems that we missed out on this, even though the SuperWord paper mentions that one has to be careful about cyclic dependencies between the (independent) packs.

      See
      https://groups.csail.mit.edu/cag/slp/SLP-PLDI-2000.pdf
      (3.7 Scheduling)

      See also my explanations in the PR of JDK-8298935:
      https://github.com/openjdk/jdk/pull/12350#issuecomment-1465860465

      Attachments

        1. Test.java
          2 kB
        2. Test2.java
          2 kB
        3. Test3.IR.data.cycle.png
          Test3.IR.data.cycle.png
          64 kB
        4. Test3.java
          4 kB

        Issue Links

          Activity

            People

              epeter Emanuel Peter
              epeter Emanuel Peter
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: