[vectorIntrinsics] RFR: 8261394: [vector] Crash with "assert(Matcher::vector_size_supported(elem_bt, length)) failed: length in range"
Jie Fu
jiefu at openjdk.java.net
Thu Feb 18 13:52:50 UTC 2021
On Thu, 18 Feb 2021 03:00:00 GMT, Ningsheng Jian <njian at openjdk.org> wrote:
>> The crash is introduced by [1] and happens when the compiler is making an unspported vector type:
>> assert(Matcher::vector_size_supported(elem_bt, length)) failed: length in range
>> Before vectorization for each vector intrinsic, the hotspot will check whether current arch supports the vector operation from several aspects like the backend implementation, the vector type and length. Once one of them is not matched, the compiler will stop the vectorization and go back to the default java implementation.
>>
>> The changes in [1] missed the check for "Op_CallLeafVector". I think the double 64-bits vector is not supported to be vectorized. However, due to the missing check, the compiler continues the progress and then the crash happens.
>>
>> This patch fixes it by making sure the check contains all opcodes.
>>
>> [1] https://bugs.openjdk.java.net/browse/JDK-8261267
>
> Looks good to me, but perhaps @sviswa7 may take a look as well?
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.
-------------
PR: https://git.openjdk.java.net/panama-vector/pull/38
More information about the panama-dev
mailing list