[vectorIntrinsics] RFR: 8261394: [vector] Crash with "assert(Matcher::vector_size_supported(elem_bt, length)) failed: length in range"

Xiaohong Gong xgong at openjdk.java.net
Fri Feb 19 06:58:51 UTC 2021


On Thu, 18 Feb 2021 22:21:13 GMT, Sandhya Viswanathan <sviswanathan at openjdk.org> wrote:

>> For ACOSDouble64VectorTests, I think @sviswa7 would like to generate code like this:
>> 
>> 098     B6: #   out( B14 B7 ) <- in( B5 )  Freq: 0.999977
>> 098     # checkcastPP of RBX
>> 098     movl    R11, [RBX + #12 (8-bit)]        # compressed ptr ! Field: jdk/internal/vm/vector/VectorSupport$VectorPayload.payload (constant)
>> 09c     load_vector XMM0,[R12 + R11 << 3 + #16] (compressed oop addressing)
>> 0a3     call_leaf,vector  vector_acos_double64
>>         No JVM State Info
>>         #
>> 
>> However, the fix will generate code like this.
>> 
>> 095     B6: #   out( B18 B7 ) <- in( B5 )  Freq: 0.999977
>> 095     movq    R9, RAX # spill
>> 098     # checkcastPP of R9
>> 098     movq    RDI, jdk/incubator/vector/DoubleVector$$Lambda$27+0x0000000801052e28:exact *    # ptr
>> 0a2     movl    RSI, #108       # int
>> 0a7     movq    RDX, java/lang/Class:exact *    # ptr
>> 0b1     movq    RCX, java/lang/Class:exact *    # ptr
>> 0bb     movl    R8, #1  # int
>>         nop     # 3 bytes pad for loops and calls
>> 0c4     call,static  jdk.internal.vm.vector.VectorSupport::unaryOp
>>         # jdk.incubator.vector.DoubleVector::lanewiseTemplate @ bci:71 (line 554) L[0]=_ L[1]=_ L[2]=_
>>         # jdk.incubator.vector.Double64Vector::lanewise @ bci:2 (line 273) L[0]=_ L[1]=_
>>         # jdk.incubator.vector.Double64Vector::lanewise @ bci:2 (line 41) L[0]=_ L[1]=_
>>         # Test::ACOSDouble64VectorTests @ bci:15 (line 10) L[0]=_
>>         # OopMap {rbp=Oop off=204/0xcc}
>> 
>> Maybe, it's OK to call vector_acos_double64 for Double64Vector on x86.
>> Thanks.
>
> @DamonFool is correct, with this change the vector stubs are not being called at all.
> @XiaohongGong @nsjian The correct fix would be as follows:
> diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp
> index 056c415..b0ac90f 100644
> --- a/src/hotspot/share/opto/vectorIntrinsics.cpp
> +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
> @@ -253,6 +253,9 @@ bool LibraryCallKit::inline_vector_nary_operation(int n) {
>        }
>        return false;
>      }
> +    if (!Matcher::vector_size_supported(elem_bt, num_elem)) {
> +      return false;
> +    }
>    }
> 
>    // TODO When mask usage is supported, VecMaskNotUsed needs to be VecMaskUseLoad.

Hi @sviswa7 @DamonFool, the suggested solution makes sense to me. Thanks for looking at this change. I will update the patch ASAP.

-------------

PR: https://git.openjdk.java.net/panama-vector/pull/38


More information about the panama-dev mailing list