[jdk21u-dev] RFR: 8328938: C2 SuperWord: disable vectorization for large stride and scale

Aleksey Shipilev shade at openjdk.org
Mon Apr 15 15:01:00 UTC 2024


On Fri, 12 Apr 2024 08:04:17 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

> Unclean backport to prevent accidents in C2 loop optimizations. The patch is unclean, because JDK 21u misses major SuperWord refactorings. I applied the hunk by hand in the similar place, and also used `slp->iv_stride()` in one place to get this thing to work.
> 
> @eme64, if you want to take a look at this?
> 
> Additional testing:
>  - [x] New regression test fails without the patch, passes with it
>  - [x] Linux x86_64 server fastdebug, `all`
>  - [x] Linux x86_64 server fastdebug, 100K Fuzzer tests
>  - [ ] Linux x86_64 server fastdebug, Maven CTW

Like this:


#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5b5c807f09, pid=46847, tid=46898
#
# JRE version: OpenJDK Runtime Environment (21.0.4) (fastdebug build 21.0.4-internal-adhoc.shipilev.shipilev-jdk21u-dev)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 21.0.4-internal-adhoc.shipilev.shipilev-jdk21u-dev, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x115bf09]  CountedLoopNode::stride_con() const+0x29
#

Stack: [0x00007f5b29b5b000,0x00007f5b29c5c000],  sp=0x00007f5b29c56a50,  free space=1006k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x115bf09]  CountedLoopNode::stride_con() const+0x29  (loopnode.cpp:2461)
V  [libjvm.so+0x169a609]  SWPointer::SWPointer(MemNode*, SuperWord*, Node_Stack*, bool) [clone .constprop.345]+0x439  (superword.hpp:364)
V  [libjvm.so+0x16a8cdd]  SuperWord::output()+0x5ed  (superword.cpp:2709)
V  [libjvm.so+0x16aad43]  SuperWord::SLP_extract()+0x353  (superword.cpp:667)
V  [libjvm.so+0x16aaff4]  SuperWord::transform_loop(IdealLoopTree*, bool)+0x254  (superword.cpp:178)
V  [libjvm.so+0x117728b]  PhaseIdealLoop::build_and_optimize()+0xf8b  (loopnode.cpp:4858)
V  [libjvm.so+0x991e5f]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2ef  (loopnode.hpp:1125)
V  [libjvm.so+0x98ebbc]  Compile::Optimize()+0x115c  (compile.cpp:2165)
V  [libjvm.so+0x990992]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1a32  (compile.cpp:851)
V  [libjvm.so+0x8047b0]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x320  (c2compiler.cpp:119)
V  [libjvm.so+0x99b22d]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x47d  (compileBroker.cpp:2266)
V  [libjvm.so+0x99c120]  CompileBroker::compiler_thread_loop()+0x320  (compileBroker.cpp:1945)
V  [libjvm.so+0xddc2ab]  JavaThread::thread_main_inner()+0x1bb  (javaThread.cpp:719)
V  [libjvm.so+0x171de6f]  Thread::call_run()+0x12f  (thread.cpp:218)
V  [libjvm.so+0x1355b74]  thread_native_entry(Thread*)+0x114  (os_linux.cpp:808)

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

Registers:
RAX=0x0000000000000000, RBX=0x00007f5ab412e990, RCX=0x00007f5abc1fdaa0, RDX=0x00007f5ab412ea80
RSP=0x00007f5b29c56a50, RBP=0x00007f5b29c56a70, RSI=0x0000000000000001, RDI=0x00007f5ab412e990
R8 =0x00007f5b29c56e90, R9 =0x0000000000000000, R10=0x0000000000000001, R11=0x00007f5b5d8faa84
R12=0x00007f5b29c56e90, R13=0x00007f5b5bfdb000, R14=0x00007f5abc049980, R15=0x00007f5b29c56b90
RIP=0x00007f5b5c807f09, EFLAGS=0x0000000000010246, CSGSFS=0x002b000000000033, ERR=0x0000000000000004
  TRAPNO=0x000000000000000e


I think it is from this PR addition of `slp->iv_stride()`, with `SuperWord::_lp` is not initialized yet. Hm. The refactorings gave us `VLoop` as the carrier object in mainline, I wonder how it should look in 21u then.

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

PR Comment: https://git.openjdk.org/jdk21u-dev/pull/495#issuecomment-2057066244


More information about the jdk-updates-dev mailing list