Template Library: need to tag Float16.float16ToRawShortBits as having non-deterministic result because of multiple NaN bit patterns

XMLWordPrintable

    • master

      In JDK-8370922, I added Float16 support to the Template Library. I missed to tag Float16.float16ToRawShortBits as having non-deterministic result.
      We need to do that, just like for float and double equivalents:
      Arithmetic operations (e.g. add, mul, fma, ...) are allowed to pick either input if it gets two NaNs of different bit patterns.
      That way, those operations can generate different NaN bit patterns depending on if we use interpreter/C1/C2.
      If we now convert to raw bits, we get different bits, and would wrongly conclude that we get a wrong result.

      -------------------------- ORIGINAL REPORT ----------------------------

      Error Output
      ------------
      WARNING: Using incubator modules: jdk.incubator.vector
      ERROR: Equality matching failed: value mismatch: 126 vs 254
        aParent: [Ljava.lang.Object;@438a6d22
        bParent: [Ljava.lang.Object;@30b77ca
        field: [0]
        a: 126
        b: 254
      Exception in thread "main" compiler.lib.ir_framework.shared.TestRunException:

      Test Failures (1)
      -----------------
      Base Test: @Test primitiveConTest_2395:
      compiler.lib.ir_framework.shared.TestRunException: There was an error while invoking @Test method public static void compiler.igvn.templated.ExpressionFuzzerInnerTest.primitiveConTest_2395(). Target: null. Arguments: <void>
      at compiler.lib.ir_framework.test.BaseTest.invokeTestMethod(BaseTest.java:84)
      at compiler.lib.ir_framework.test.BaseTest.invokeTest(BaseTest.java:71)
      at compiler.lib.ir_framework.test.AbstractTest.run(AbstractTest.java:100)
      at compiler.lib.ir_framework.test.TestVM.runTests(TestVM.java:865)
      at compiler.lib.ir_framework.test.TestVM.start(TestVM.java:255)
      at compiler.lib.ir_framework.test.TestVM.main(TestVM.java:168)
      Caused by: java.lang.reflect.InvocationTargetException
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:119)
      at java.base/java.lang.reflect.Method.invoke(Method.java:565)
      at compiler.lib.ir_framework.test.BaseTest.invokeTestMethod(BaseTest.java:80)
      ... 5 more
      Caused by: compiler.lib.verify.VerifyException: Value verification failed:
      Value mismatch: 126 vs 254
      at compiler.lib.verify.Verify.checkEQimpl(Verify.java:193)
      at compiler.lib.verify.Verify.checkEQdispatch(Verify.java:134)
      at compiler.lib.verify.Verify.checkEQimpl(Verify.java:432)
      at compiler.lib.verify.Verify.checkEQdispatch(Verify.java:131)
      at compiler.lib.verify.Verify.checkEQ(Verify.java:98)
      at compiler.igvn.templated.ExpressionFuzzerInnerTest.primitiveConTest_2395(ExpressionFuzzerInnerTest.java:4350)
      at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
      ... 7 more

            Assignee:
            Emanuel Peter
            Reporter:
            David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: