JDK-8319889 : Vector API tests trigger VM crashes with -XX:+StressIncrementalInlining
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 22,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-11-10
  • Updated: 2024-08-01
  • Resolved: 2024-03-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 23
23 b15Fixed
Related Reports
Blocks :  
Relates :  
Description
Some vector tests fails with -XX:+StressIncrementalInlining (new stress option that will be added by JDK-8319879):

# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (workspace/open/src/hotspot/share/opto/type.hpp:2082), pid=15407, tid=15469
#  assert(_base == InstPtr) failed: Not an object pointer
#
# JRE version: Java(TM) SE Runtime Environment (22.0) (fastdebug build 22-internal-2023-11-10-0904089.tobias.hartmann.jdk3)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-internal-2023-11-10-0904089.tobias.hartmann.jdk3, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x18161bd]  GraphKit::unbox_vector(Node*, TypeInstPtr const*, BasicType, int, bool)+0x77d

Current CompileTask:
C2:9809 1825             jdk.incubator.vector.Byte256Vector::slice (7 bytes)

Stack: [0x00007f3e515f7000,0x00007f3e516f7000],  sp=0x00007f3e516f1c10,  free space=1003k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x18161bd]  GraphKit::unbox_vector(Node*, TypeInstPtr const*, BasicType, int, bool)+0x77d  (type.hpp:2082)
V  [libjvm.so+0x181fb0c]  LibraryCallKit::inline_vector_blend()+0x4bc  (vectorIntrinsics.cpp:1896)
V  [libjvm.so+0x1239ee1]  LibraryIntrinsic::generate(JVMState*)+0x1c1  (library_call.cpp:118)
V  [libjvm.so+0x851965]  CallGenerator::do_late_inline_helper()+0x9b5  (callGenerator.cpp:697)
V  [libjvm.so+0x9f5e6c]  Compile::inline_incrementally_one()+0xec  (compile.cpp:2037)
V  [libjvm.so+0x9f6cb9]  Compile::inline_incrementally(PhaseIterGVN&)+0x239  (compile.cpp:2120)
V  [libjvm.so+0x9f8c28]  Compile::Optimize()+0x418  (compile.cpp:2255)
V  [libjvm.so+0x9fd19d]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1b4d  (compile.cpp:856)
V  [libjvm.so+0x8496d7]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207  (c2compiler.cpp:134)
V  [libjvm.so+0xa09340]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980  (compileBroker.cpp:2292)
V  [libjvm.so+0xa0a0d8]  CompileBroker::compiler_thread_loop()+0x508  (compileBroker.cpp:1951)
V  [libjvm.so+0xec472c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x17a3fca]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14acfba]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:787)

Observed with the following tests:
jdk/incubator/vector/VectorReshapeTests.java
jdk/incubator/vector/VectorMaxConversionTests.java


# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/workspace/open/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp:4538), pid=26849, tid=26869
#  fatal error: Unsupported masked operation
#
# JRE version: Java(TM) SE Runtime Environment (22.0) (fastdebug build 22-internal-2023-11-10-0951004.tobias.hartmann.jdk3)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-internal-2023-11-10-0951004.tobias.hartmann.jdk3, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x83c4c0]  C2_MacroAssembler::evmasked_op(int, BasicType, KRegister, XMMRegister, XMMRegister, Address, bool, int)+0x70

Current CompileTask:
C2:11880 1213 %  b        Short512VectorTests::LSHLShort512VectorTestsMasked @ 102 (189 bytes)

Stack: [0x00007fab43cfe000,0x00007fab43dfe000],  sp=0x00007fab43df9990,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x83c4c0]  C2_MacroAssembler::evmasked_op(int, BasicType, KRegister, XMMRegister, XMMRegister, Address, bool, int)+0x70  (c2_MacroAssembler_x86.cpp:4538)
V  [libjvm.so+0x4443e0]  vlshift_mem_maskedNode::emit(CodeBuffer&, PhaseRegAlloc*) const+0x2d0  (x86.ad:9663)
V  [libjvm.so+0x14cc567]  PhaseOutput::scratch_emit_size(Node const*)+0x387  (output.cpp:3305)
V  [libjvm.so+0x14c4da2]  PhaseOutput::shorten_branches(unsigned int*)+0x312  (output.cpp:539)
V  [libjvm.so+0x14d59af]  PhaseOutput::Output()+0xa4f  (output.cpp:340)
V  [libjvm.so+0x9fa5a3]  Compile::Code_Gen()+0x483  (compile.cpp:3011)
V  [libjvm.so+0x9fd28b]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1c3b  (compile.cpp:889)
V  [libjvm.so+0x8496d7]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x207  (c2compiler.cpp:134)
V  [libjvm.so+0xa09340]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x980  (compileBroker.cpp:2292)
V  [libjvm.so+0xa0a0d8]  CompileBroker::compiler_thread_loop()+0x508  (compileBroker.cpp:1951)
V  [libjvm.so+0xec472c]  JavaThread::thread_main_inner()+0xcc  (javaThread.cpp:720)
V  [libjvm.so+0x17a3fca]  Thread::call_run()+0xba  (thread.cpp:220)
V  [libjvm.so+0x14acfba]  thread_native_entry(Thread*)+0x12a  (os_linux.cpp:787)

Observed with the following tests:
jdk/incubator/vector/Short64VectorTests.java
jdk/incubator/vector/Short512VectorTests.java
jdk/incubator/vector/Int512VectorTests.java


Unfortunately, with -XX:+StressIncrementalInlining we currently always hit JDK-8319764, so to reproduce this, JDK-8312980 needs to be backed out. It could therefore well be that this is caused by JDK-8312980.
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/18282 Date: 2024-03-13 17:19:40 +0000
01-08-2024

[~jbhateja] Thanks! I think it's perfectly fine to have a test only reproduce the issue intermittently, i.e. adding -XX:+StressIncrementalInlining to one or a few jdk/incubator/vector/... tests.
22-04-2024

Hi Tobias, I was able to reproduce the issue over latest JDK mainline with replay files, its tricky to get a test reproducer due to randomization of Incremental In-lining. I validated the patch with multiple Vector API JTREG test runs with StressIncrementalInlining. Will spend time more time over it.
26-03-2024

> [~thartmann] Can you validate the patch on your internal tests. [~jbhateja] I see that this was already integrated now. Wouldn't it make sense to add a targeted regression test?
20-03-2024

Changeset: 2dd5fba3 Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2024-03-19 01:14:06 +0000 URL: https://git.openjdk.org/jdk/commit/2dd5fba3bd37c577b8442b67a67dbcb22b9a530e
19-03-2024

[~thartmann] Can you validate the patch on your internal tests.
16-03-2024

Thanks, Jatin. No worries.
26-02-2024

Hi Tobias, Apologies for a late response on this, will analyze and get back.
25-02-2024

[~jbhateja], any update on this?
09-02-2024

Both asserts still reproduces with the fix for JDK-8319764.
16-11-2023

Pre-ILW = Asserts during C2 compilation (might not be an issue with current code), intermittent with preview feature and stress option, disable vector intrinsics or compilation of affected code = MLM = P4 We should re-evaluate if these turn out to be issues with current code.
10-11-2023

Setting fix version to JDK 23 for now. Please reset if a fix is ready in the JDK 22 time frame.
10-11-2023