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

C2 SuperWord: investigate failed RCE for MemorySegment test

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 25
    • hotspot

      In the attached Test.java, there are 2 methods, one that loads things via arguments (vectorizes) and one that loads things via fields (does not vectorize).

      It seems the issue is missing RCE. Investigate the difference.
      Is a case related to JDK-8331659 and JDK-8347545.

      emanuel@emanuel-oracle:/oracle-work/jdk-fork1/build/linux-x64-debug/jdk/bin$ ./java -XX:CompileCommand=compileonly,Test::test* -XX:CompileCommand=printcompilation,Test::* -XX:+TraceNewVectors -XX:CompileCommand=TraceAutoVectorization,Test::test*,PRECONDITIONS Test.java
      CompileCommand: compileonly Test.test* bool compileonly = true
      CompileCommand: PrintCompilation Test.* bool PrintCompilation = true
      CompileCommand: TraceAutoVectorization Test.test* const char* TraceAutoVectorization = 'PRECONDITIONS'
      9301 107 % 3 Test::testFields @ 6 (63 bytes)
      9322 108 3 Test::testFields (63 bytes)
      9451 109 % 3 Test::testArgs @ 2 (56 bytes)
      9471 110 3 Test::testArgs (56 bytes)
      9482 111 % 4 Test::testFields @ 6 (63 bytes)
      9505 114 % 4 Test::testArgs @ 2 (56 bytes)
      9525 115 4 Test::testFields (63 bytes)

      VLoop::check_preconditions
                Loop: N4056/N1701 limit_check counted [int,int),+8 (38044 iters) main rc has_sfpt rce strip_mined
       4056 CountedLoop === 4056 3348 1701 [[ 4056 4058 4059 4067 4068 ]] inner stride: 8 main of N4056 strip mined !orig=[3349],[3035],[2749],[2378],[2243],[2142],[1982],[1876],[1793],[1749],[138] !jvms: Test::testFields @ bci:19 (line 20)
      VLoop::check_preconditions: fails because of control flow.
        cl_exit 3344 3344 CountedLoopEnd === 2248 3343 [[ 4077 1701 ]] [lt] P=0.999974, C=114000.000000 !orig=[3036],[3010],[2746]
        cl_exit->in(0) 2248 2248 IfTrue === 2247 [[ 2230 2225 2223 1609 882 3344 2135 2137 ]] #1 !orig=[2152],[1322],[1596] !jvms: AbstractMemorySegmentImpl::checkBounds @ bci:16 (line 382) AbstractMemorySegmentImpl::checkAccess @ bci:9 (line 336) AbstractMemorySegmentImpl::checkEnclosingLayout @ bci:10 (line 341) VarHandleSegmentAsBytes::checkSegment @ bci:18 (line 83) VarHandleSegmentAsBytes::set @ bci:10 (line 113) 0x00000000651b0400::invokeStatic @ bci:20 0x00000000651b1400::invoke @ bci:37 VarHandleGuards::guard_LJI_V @ bci:134 (line 1017) AbstractMemorySegmentImpl::set @ bci:10 (line 679) Test::testFields @ bci:50 (line 22)
        lpt->_head 4056 4056 CountedLoop === 4056 3348 1701 [[ 4056 4058 4059 4067 4068 ]] inner stride: 8 main of N4056 strip mined !orig=[3349],[3035],[2749],[2378],[2243],[2142],[1982],[1876],[1793],[1749],[138] !jvms: Test::testFields @ bci:19 (line 20)
                Loop: N4056/N1701 limit_check counted [int,int),+8 (38044 iters) main rc has_sfpt rce strip_mined
      VLoop::check_preconditions: failed: control flow in loop not allowed
      9632 116 4 Test::testArgs (56 bytes)

      VLoop::check_preconditions
            Loop: N2221/N1615 limit_check counted [int,int),+2 (45467 iters) main has_sfpt strip_mined
       2221 CountedLoop === 2221 1946 1615 [[ 2214 2217 2220 2221 857 2225 1559 1942 ]] inner stride: 2 main of N2221 strip mined !orig=[1947],[1756],[1655],[1650],[132] !jvms: Test::testArgs @ bci:13 (line 29)

      VLoop::check_preconditions
            Loop: N3072/N1615 limit_check counted [int,int),+64 (45467 iters) main has_sfpt strip_mined
       3072 CountedLoop === 3072 1946 1615 [[ 2879 2881 2882 2884 2885 2887 2888 2890 2891 2893 2894 2896 2897 2899 2900 2902 2903 2905 2906 2908 2909 2911 2912 2914 2915 2917 2918 2920 2921 2923 2924 2926 2927 2929 2930 2932 2933 2935 2936 2938 2939 2941 2942 2944 2945 2947 2948 2950 2952 2954 2955 2957 2958 2960 2961 2963 2964 2966 2967 2969 2970 2972 2973 3036 3071 3072 2655 3075 2657 2658 2660 2661 2663 2664 2666 2667 2669 2670 2672 2673 2675 2676 2678 2680 2682 2683 2685 2686 2688 2689 2691 2692 2694 2695 2697 2698 2700 2701 2732 2217 2510 2512 2513 2515 2516 2518 2519 2521 2522 2524 2525 2527 2528 2530 2531 2547 1942 2405 2407 2408 2410 2411 2413 2414 2422 857 2318 2320 2321 2325 1559 2214 ]] inner stride: 64 main of N3072 strip mined !orig=[2752],[2559],[2425],[2328],[2221],[1947],[1756],[1655],[1650],[132] !jvms: Test::testArgs @ bci:13 (line 29)
      TraceNewVectors [AutoVectorization]: 3262 Replicate === _ 62 [[ ]] #vectorz<B,64>
      TraceNewVectors [AutoVectorization]: 3263 LoadVector === 3072 3075 3037 [[ ]] @rawptr:BotPTR, idx=Raw; mismatched #vectorz<B,64> (does not depend only on test, unknown control)
      TraceNewVectors [AutoVectorization]: 3264 AddVB === _ 3263 3262 [[ ]] #vectorz<B,64>
      TraceNewVectors [AutoVectorization]: 3265 StoreVector === 3072 3075 3037 3264 [[ ]] @rawptr:BotPTR, idx=Raw; mismatched Memory: @rawptr:BotPTR, idx=Raw;

      VLoop::check_preconditions
            Loop: N4148/N1615 limit_check counted [int,int),+4096 (45467 iters) main vector has_sfpt strip_mined
       4148 CountedLoop === 4148 1946 1615 [[ 3988 3990 3991 3993 3994 3996 3997 3999 4000 4002 4003 4005 4006 4008 4009 4011 4012 4014 4015 4017 4018 4020 4021 4023 4024 4026 4027 4029 4030 4032 4033 4035 4036 4038 4039 4041 4042 4044 4045 4047 4048 4050 4051 4053 4054 4056 4057 4059 4060 4062 4063 4065 4066 4068 4069 4071 4072 4074 4075 4077 4078 4080 4081 4145 4148 3759 4151 4184 3761 3762 3764 3765 3767 3768 3770 3771 3773 3774 3776 3777 3779 3780 3782 3783 3785 3786 3788 3789 3791 3792 3794 3795 3797 3798 3800 3801 3803 3804 3836 3330 3610 3612 3613 3615 3616 3618 3619 3621 3622 3624 3625 3627 3628 3630 3631 3647 3263 3501 3503 3504 3506 3507 3509 3510 3518 1942 3412 3414 3415 3419 3265 3328 ]] inner stride: 4096 main of N4148 strip mined !orig=[3839],[3650],[3521],[3422],[3333],[3072],[2752],[2559],[2425],[2328],[2221],[1947],[1756],[1655],[1650],[132] !jvms: Test::testArgs @ bci:13 (line 29)
      VLoop::check_preconditions: failed: loop already vectorized

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

              Created:
              Updated: