[lworld+vector] RFR: 8319945: [lworld+vector] Fix vector api jtreg crash with "-XX:-EnableVectorSupport"
Xiaohong Gong
xgong at openjdk.org
Mon Nov 27 01:19:27 UTC 2023
On Thu, 23 Nov 2023 01:17:28 GMT, Xiaohong Gong <xgong at openjdk.org> wrote:
>> Several vector api jtreg tests crash with `"-XX:-EnableVectorSupport"` when running on machines that the operations of vector payload can be vectorized.
>>
>> Here is the log:
>>
>>
>> Internal Error (valhalla/src/hotspot/share/opto/library_call.cpp:2465), pid=467482, tid=467499
>> assert(bt == alias_type->basic_type() || bt == T_PRIMITIVE_OBJECT) failed: should match
>>
>> JRE version: OpenJDK Runtime Environment (22.0) (fastdebug build 22-internal-git-5b2fa0aab)
>> Java VM: OpenJDK 64-Bit Server VM (fastdebug 22-internal-git-5b2fa0aab, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
>> Problematic frame:
>> V [[libjvm.so](http://libjvm.so/)+0x11b1738] LibraryCallKit::inline_unsafe_access(bool, BasicType, LibraryCallKit::AccessKind, bool)+0x13e8
>>
>>
>> The reason is the matched field of the given offset in the vector payload is not found when using Usafe's access methods. And the root cause is when the operations of the multifields are vectorizable in C2, only the multifield base is added into the holder klass's non-static fields list in ci stage. Hence when accessing other multifields by Unsafe's get/put methods (which is the fall-back java implementation of current vector operations), the fields cannot be found with the given field offset.
>>
>> This issue is involved by [JDK-8314980](https://bugs.openjdk.java.net/browse/JDK-8314980) (see [1]), which refactors the multifields parsing in ci stage. The special handling for multifields in `ciInstanceKlass::get_field_by_offset` is removed. Adding it back can fix this issue.
>>
>> This patch also reverted the special consideration for multifields when printing out the JVM state in a safepoint. It is not needed anymore, because the fields of an `InlineTypeNode` in C2 is always consistent with the holder klass's non-static fields after [JDK-8314980](https://bugs.openjdk.java.net/browse/JDK-8314980).
>>
>> [1] https://github.com/openjdk/valhalla/pull/918
>>
>> Verified with Vector API jtreg tests with `-XX:-EnableVectorSupport`, and all tests clean.
>
> @jatin-bhateja , could you please take a look at this PR? Thanks a lot!
> Hi @XiaohongGong , Can you please also add multifield special handling in **_ciInlineKlass::field_index_by_offset(int offset)_**. As of now its only used by C2 and functionalty looks safe.
Yes, considering that it is only used by C2 now, it's safe removing the multifields special handing. I suggest keeping it as it is now. One reason is the code may cannot be tested effectively, another is I'm considering whether we can take a further refactory to the multifields vectorization/scalarization in future. We may just keep the scalarized multifields in ci stage, and do the vectorization just in c2 compiler. So that all the special handling in ci could be cleaned-out. I plan to have a try for this in future.
-------------
PR Comment: https://git.openjdk.org/valhalla/pull/953#issuecomment-1826986123
More information about the valhalla-dev
mailing list