-
Enhancement
-
Resolution: Unresolved
-
P4
-
26
I discovered yet another issue with missing RCE during work on JDK-8324751.
java -XX:CompileCommand=printcompilation,Test::* -XX:CompileCommand=compileonly,Test::test -Xbatch -XX:+TraceNewVectors -XX:CompileCommand=TraceAutoVectorization,Test::*,ALL -XX:+TraceLoopOpts Test.java
Result:
...
3062 114 b 4 Test::test (95 bytes)
Counted Loop: N1844/N1781 limit_check profile_predicated predicated sfpts={ 1770 }
...
Unroll 4 Loop: N2353/N1781 counted [int,int),+2 (1000 iters) main rc has_sfpt rce strip_mined
Loop: N0/N0 has_sfpt
Loop: N2035/N2032 limit_check profile_predicated predicated sfpts={ 2095 }
Loop: N2281/N2266 limit_check profile_predicated predicated counted [1,int),+1 (4 iters) pre rc
Loop: N2183/N2182 sfpts={ 2185 }
Loop: N2537/N1781 counted [int,int),+4 (1000 iters) main rc has_sfpt strip_mined
Loop: N2219/N2204 counted [int,int),+1 (4 iters) post rc
Peel Loop: N2697/N1781 has_sfpt rce
...
PredicatesOff
...
Multiversion Loop: N3154/N1781 limit_check predicated counted [4,int),+4 (1000 iters) rc has_sfpt strip_mined
PreMainPost Loop: N3154/N1781 limit_check counted [4,int),+4 (1000 iters) rc multiversion_fast has_sfpt strip_mined
Unroll 2 Loop: N3154/N1781 limit_check counted [int,int),+4 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
...
VLoop::check_preconditions
Loop: N4609/N1781 limit_check counted [int,int),+8 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
4609 CountedLoop === 4609 3153 1781 [[ 4604 4609 4610 4621 4622 ]] inner stride: 8 main of N4609 strip mined multiversion_fast !orig=[3154],[2697],[2537],[2353],[2184],[2058],[1844],[1827],[90] !jvms: Test::test @ bci:12 (line 20)
VLoop::check_preconditions: fails because of control flow.
cl_exit 3149 3149 CountedLoopEnd === 1413 3148 [[ 4637 1781 ]] [lt] P=0.999000, C=101898.000000 !orig=[2698],[2671],[2181]
cl_exit->in(0) 1413 1413 IfTrue === 1412 [[ 1744 1422 3149 ]] #1 !orig=[1642],[1799],[1682] !jvms: AbstractMemorySegmentImpl::checkBounds @ bci:16 (line 403) AbstractMemorySegmentImpl::checkAccess @ bci:9 (line 357) AbstractMemorySegmentImpl::checkEnclosingLayout @ bci:10 (line 362) SegmentVarHandle::checkSegment @ bci:18 (line 92) VarHandleSegmentAsInts::set @ bci:11 (line 74) VarHandleSegmentAsInts::set @ bci:12 (line 68) VarHandleGuards::guard_LJI_V @ bci:51 (line 609) AbstractMemorySegmentImpl::setAtIndex @ bci:24 (line 867) Test::test @ bci:80 (line 21)
lpt->_head 4609 4609 CountedLoop === 4609 3153 1781 [[ 4604 4609 4610 4621 4622 ]] inner stride: 8 main of N4609 strip mined multiversion_fast !orig=[3154],[2697],[2537],[2353],[2184],[2058],[1844],[1827],[90] !jvms: Test::test @ bci:12 (line 20)
Loop: N4609/N1781 limit_check counted [int,int),+8 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
VLoop::check_preconditions: failed: control flow in loop not allowed
Summary:
The loop is discovered as counted immediately.
Then unrolled. Not all RC are yet removed (not great, needs investigation), so we peel again.
We do some RC predication.
But apparently not enough, the main-loop still has RC.
Eventually, we eventually rutn off the predicates "PredicatesOff".
That must trigger some condition so that we now consider PreMainPost, and with that we consider multiversioning (because the predicates are now already removed by PredicatesOff).
In he end, we have RC remaining, and also we multiversioned.. which is useless but not harmful.
-> we should investigate why RCE does not work from the beginning.
Once fixed, we should adjust the test from JDK-8324751:
b/test/hotspot/jtreg/compiler/loopopts/superword/TestAliasingFuzzer.java
java -XX:CompileCommand=printcompilation,Test::* -XX:CompileCommand=compileonly,Test::test -Xbatch -XX:+TraceNewVectors -XX:CompileCommand=TraceAutoVectorization,Test::*,ALL -XX:+TraceLoopOpts Test.java
Result:
...
3062 114 b 4 Test::test (95 bytes)
Counted Loop: N1844/N1781 limit_check profile_predicated predicated sfpts={ 1770 }
...
Unroll 4 Loop: N2353/N1781 counted [int,int),+2 (1000 iters) main rc has_sfpt rce strip_mined
Loop: N0/N0 has_sfpt
Loop: N2035/N2032 limit_check profile_predicated predicated sfpts={ 2095 }
Loop: N2281/N2266 limit_check profile_predicated predicated counted [1,int),+1 (4 iters) pre rc
Loop: N2183/N2182 sfpts={ 2185 }
Loop: N2537/N1781 counted [int,int),+4 (1000 iters) main rc has_sfpt strip_mined
Loop: N2219/N2204 counted [int,int),+1 (4 iters) post rc
Peel Loop: N2697/N1781 has_sfpt rce
...
PredicatesOff
...
Multiversion Loop: N3154/N1781 limit_check predicated counted [4,int),+4 (1000 iters) rc has_sfpt strip_mined
PreMainPost Loop: N3154/N1781 limit_check counted [4,int),+4 (1000 iters) rc multiversion_fast has_sfpt strip_mined
Unroll 2 Loop: N3154/N1781 limit_check counted [int,int),+4 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
...
VLoop::check_preconditions
Loop: N4609/N1781 limit_check counted [int,int),+8 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
4609 CountedLoop === 4609 3153 1781 [[ 4604 4609 4610 4621 4622 ]] inner stride: 8 main of N4609 strip mined multiversion_fast !orig=[3154],[2697],[2537],[2353],[2184],[2058],[1844],[1827],[90] !jvms: Test::test @ bci:12 (line 20)
VLoop::check_preconditions: fails because of control flow.
cl_exit 3149 3149 CountedLoopEnd === 1413 3148 [[ 4637 1781 ]] [lt] P=0.999000, C=101898.000000 !orig=[2698],[2671],[2181]
cl_exit->in(0) 1413 1413 IfTrue === 1412 [[ 1744 1422 3149 ]] #1 !orig=[1642],[1799],[1682] !jvms: AbstractMemorySegmentImpl::checkBounds @ bci:16 (line 403) AbstractMemorySegmentImpl::checkAccess @ bci:9 (line 357) AbstractMemorySegmentImpl::checkEnclosingLayout @ bci:10 (line 362) SegmentVarHandle::checkSegment @ bci:18 (line 92) VarHandleSegmentAsInts::set @ bci:11 (line 74) VarHandleSegmentAsInts::set @ bci:12 (line 68) VarHandleGuards::guard_LJI_V @ bci:51 (line 609) AbstractMemorySegmentImpl::setAtIndex @ bci:24 (line 867) Test::test @ bci:80 (line 21)
lpt->_head 4609 4609 CountedLoop === 4609 3153 1781 [[ 4604 4609 4610 4621 4622 ]] inner stride: 8 main of N4609 strip mined multiversion_fast !orig=[3154],[2697],[2537],[2353],[2184],[2058],[1844],[1827],[90] !jvms: Test::test @ bci:12 (line 20)
Loop: N4609/N1781 limit_check counted [int,int),+8 (1000 iters) main rc multiversion_fast has_sfpt strip_mined
VLoop::check_preconditions: failed: control flow in loop not allowed
Summary:
The loop is discovered as counted immediately.
Then unrolled. Not all RC are yet removed (not great, needs investigation), so we peel again.
We do some RC predication.
But apparently not enough, the main-loop still has RC.
Eventually, we eventually rutn off the predicates "PredicatesOff".
That must trigger some condition so that we now consider PreMainPost, and with that we consider multiversioning (because the predicates are now already removed by PredicatesOff).
In he end, we have RC remaining, and also we multiversioned.. which is useless but not harmful.
-> we should investigate why RCE does not work from the beginning.
Once fixed, we should adjust the test from JDK-8324751:
b/test/hotspot/jtreg/compiler/loopopts/superword/TestAliasingFuzzer.java
- relates to
-
JDK-8324751 C2 SuperWord: Aliasing Analysis runtime check
-
- In Progress
-
-
JDK-8327209 C2 MemorySegment: missing RCE and vectorization
-
- Open
-
-
JDK-8359688 C2 SuperWord: missing RCE with MemorySegment
-
- Open
-
-
JDK-8324751 C2 SuperWord: Aliasing Analysis runtime check
-
- In Progress
-