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

RISC-V: compiler/loopopts/superword/TestAlignVector.java fails when vlen=128

XMLWordPrintable

    • riscv
    • linux

      JDK-8352529 enables this IR verification test for riscv. This test pass when vlen=256, but fail when vlen=128.

      Error log:
      ```
      Failed IR Rules (2) of Methods (2)
      ----------------------------------
      1) Method "static java.lang.Object[] compiler.loopopts.superword.TestAlignVector.test13aIL(int[],long[])" - [Failed IR rules: 1]:
         * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={"avx2", "true", "rvv", "true"}, counts={"_#V#LOAD_VECTOR_I#_", "_@min(max_int, max_long)", "> 0", "_#V#LOAD_VECTOR_L#_", "_@min(max_int, max_long)", "> 0", "_#V#ADD_VI#_", "_@min(max_int, max_long)", "> 0", "_#V#ADD_VL#_", "_@min(max_int, max_long)", "> 0", "_#STORE_VECTOR#_", "> 0"}, applyIfPlatform={"64-bit", "true"}, failOn={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
           > Phase "PrintIdeal":
             - counts: Graph contains wrong number of nodes:
               * Constraint 1: "(\\d+(\\s){2}(LoadVector.*)+(\\s){2}===.*vector[A-Za-z]<I,2>)"
                 - Failed comparison: [found] 0 > 0 [given]
                 - No nodes matched!
               * Constraint 3: "(\\d+(\\s){2}(AddVI.*)+(\\s){2}===.*vector[A-Za-z]<I,2>)"
                 - Failed comparison: [found] 0 > 0 [given]
                 - No nodes matched!

      2) Method "static java.lang.Object[] compiler.loopopts.superword.TestAlignVector.test13bIL(int[],long[])" - [Failed IR rules: 1]:
         * @IR rule 1: "@compiler.lib.ir_framework.IR(phase={DEFAULT}, applyIfPlatformAnd={}, applyIfCPUFeatureOr={"avx2", "true", "rvv", "true"}, counts={"_#V#LOAD_VECTOR_I#_", "_@min(max_int, max_long)", "> 0", "_#V#LOAD_VECTOR_L#_", "_@min(max_int, max_long)", "> 0", "_#V#ADD_VI#_", "_@min(max_int, max_long)", "> 0", "_#V#ADD_VL#_", "_@min(max_int, max_long)", "> 0", "_#STORE_VECTOR#_", "> 0"}, applyIfPlatform={"64-bit", "true"}, failOn={}, applyIfPlatformOr={}, applyIfOr={}, applyIfCPUFeatureAnd={}, applyIf={}, applyIfCPUFeature={}, applyIfAnd={}, applyIfNot={})"
           > Phase "PrintIdeal":
             - counts: Graph contains wrong number of nodes:
               * Constraint 1: "(\\d+(\\s){2}(LoadVector.*)+(\\s){2}===.*vector[A-Za-z]<I,2>)"
                 - Failed comparison: [found] 0 > 0 [given]
                 - No nodes matched!
               * Constraint 3: "(\\d+(\\s){2}(AddVI.*)+(\\s){2}===.*vector[A-Za-z]<I,2>)"
                 - Failed comparison: [found] 0 > 0 [given]
                 - No nodes matched!

      >>> Check stdout for compilation output of the failed methods
      ```

      The error occurs because the test13aIL and test13bIL cases require ensuring that vectors are larger than what unrolling produces; otherwise, the corresponding vector IR will not be generated.

      We can use JTREG="JAVA_OPTIONS=-XX:+TraceSuperWordLoopUnrollAnalysis" during testing. We can see the tips in the error log:
      ```
      76844 1333 b 4 compiler.loopopts.superword.TestAlignVector::test13aIL (42 bytes)
      slp analysis fails: unroll limit greater than max vector

      slp analysis: set max unroll to 4
      ```

      Therefore, we need to limit MaxVectorSize to greater than or equal to 32 bytes.

            dzhang Dingli Zhang
            dzhang Dingli Zhang
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: