-
Bug
-
Resolution: Fixed
-
P3
-
21, 22
-
b11
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8321905 | 21.0.3-oracle | Tobias Hartmann | P3 | Resolved | Fixed | b01 |
JDK-8322776 | 21.0.3 | Goetz Lindenmaier | P3 | Resolved | Fixed | b01 |
Found this while trying to find a reproducer for JDK-8313345.
Reproduce:
java -Xbatch -XX:CompileCommand=compileonly,Test2::test -XX:+TraceLoopOpts -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally -XX:+TraceSuperWord -XX:+TraceNewVectors -XX:MaxVectorSize=64 Test2.java
fail: 100 1.0 != 0.0 : 1.0 1.0
Exception in thread "main" java.lang.RuntimeException: There were wrong results
at Test2.verify(Test2.java:56)
at Test2.main(Test2.java:44)
I suspect the reason is the mixed comparison values in the Bool pack (le / lt):
Pack: 11
align: 0 1708 Bool === _ 1709 [[ 1707 ]] [le] !orig=1462,1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 4 1702 Bool === _ 1703 [[ 1701 ]] [lt] !orig=1456,1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 8 1696 Bool === _ 1697 [[ 1695 ]] [le] !orig=1450,163 !jvms: Test2::test @ bci:24 (line 16)
align: 12 1690 Bool === _ 1691 [[ 1689 ]] [lt] !orig=1444,255 !jvms: Test2::test @ bci:48 (line 17)
align: 16 1684 Bool === _ 1685 [[ 1683 ]] [le] !orig=1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 20 1678 Bool === _ 1679 [[ 1677 ]] [lt] !orig=1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 24 1666 Bool === _ 1667 [[ 1665 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 28 1660 Bool === _ 1661 [[ 1659 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 32 1462 Bool === _ 1463 [[ 1461 ]] [le] !orig=1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 36 1456 Bool === _ 1457 [[ 1455 ]] [lt] !orig=1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 40 1450 Bool === _ 1451 [[ 1449 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 44 1444 Bool === _ 1445 [[ 1443 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 48 1241 Bool === _ 1242 [[ 1240 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 52 1235 Bool === _ 1236 [[ 1234 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 56 163 Bool === _ 162 [[ 317 ]] [le] !jvms: Test2::test @ bci:24 (line 16)
align: 60 255 Bool === _ 254 [[ 318 ]] [lt] !jvms: Test2::test @ bci:48 (line 17)
The logic I implemented inJDK-8306302 did not take account of hand unrolled loops, where the comparisons can be different.
Reproduce:
java -Xbatch -XX:CompileCommand=compileonly,Test2::test -XX:+TraceLoopOpts -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally -XX:+TraceSuperWord -XX:+TraceNewVectors -XX:MaxVectorSize=64 Test2.java
fail: 100 1.0 != 0.0 : 1.0 1.0
Exception in thread "main" java.lang.RuntimeException: There were wrong results
at Test2.verify(Test2.java:56)
at Test2.main(Test2.java:44)
I suspect the reason is the mixed comparison values in the Bool pack (le / lt):
Pack: 11
align: 0 1708 Bool === _ 1709 [[ 1707 ]] [le] !orig=1462,1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 4 1702 Bool === _ 1703 [[ 1701 ]] [lt] !orig=1456,1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 8 1696 Bool === _ 1697 [[ 1695 ]] [le] !orig=1450,163 !jvms: Test2::test @ bci:24 (line 16)
align: 12 1690 Bool === _ 1691 [[ 1689 ]] [lt] !orig=1444,255 !jvms: Test2::test @ bci:48 (line 17)
align: 16 1684 Bool === _ 1685 [[ 1683 ]] [le] !orig=1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 20 1678 Bool === _ 1679 [[ 1677 ]] [lt] !orig=1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 24 1666 Bool === _ 1667 [[ 1665 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 28 1660 Bool === _ 1661 [[ 1659 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 32 1462 Bool === _ 1463 [[ 1461 ]] [le] !orig=1241,163 !jvms: Test2::test @ bci:24 (line 16)
align: 36 1456 Bool === _ 1457 [[ 1455 ]] [lt] !orig=1235,255 !jvms: Test2::test @ bci:48 (line 17)
align: 40 1450 Bool === _ 1451 [[ 1449 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 44 1444 Bool === _ 1445 [[ 1443 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 48 1241 Bool === _ 1242 [[ 1240 ]] [le] !orig=163 !jvms: Test2::test @ bci:24 (line 16)
align: 52 1235 Bool === _ 1236 [[ 1234 ]] [lt] !orig=255 !jvms: Test2::test @ bci:48 (line 17)
align: 56 163 Bool === _ 162 [[ 317 ]] [le] !jvms: Test2::test @ bci:24 (line 16)
align: 60 255 Bool === _ 254 [[ 318 ]] [lt] !jvms: Test2::test @ bci:48 (line 17)
The logic I implemented in
- backported by
-
JDK-8321905 C2 SuperWord: wrong result with -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally
- Resolved
-
JDK-8322776 C2 SuperWord: wrong result with -XX:+UseVectorCmov -XX:+UseCMoveUnconditionally
- Resolved
- relates to
-
JDK-8306302 C2 Superword fix: use VectorMaskCmp and VectorBlend instead of CMoveVF/D
- Resolved
- links to
-
Commit openjdk/jdk21u-dev/9e248626
-
Commit openjdk/jdk/d46f0fb3
-
Review openjdk/jdk21u-dev/98
-
Review openjdk/jdk/15274
(2 links to)