JDK-8277843 : [Vector API] scalar2vector generates incorrect type info for mask operations if Op_MaskAll is unavailable
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 18
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-25
  • Updated: 2022-01-25
  • Resolved: 2021-11-30
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 18
18 b26Fixed
Related Reports
Relates :  
Description
This bug was first observed on x86_32/AVX512.
62 vector api tests fail because this bug.
```
==============================
Test summary
==============================
   TEST                                              TOTAL  PASS  FAIL ERROR
>> jtreg:test/jdk/jdk/incubator/vector                  74    12    62     0 <<
==============================
```

One kind of symptoms is crash in Matcher::pd_specialize_generic_vector_operand.
```
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/jdk/src/hotspot/cpu/x86/x86.ad:2008), pid=83792, tid=83835
#  Error: ShouldNotReachHere()
#
# JRE version: OpenJDK Runtime Environment (18.0) (fastdebug build 18-internal+0-adhoc..jdk)
# Java VM: OpenJDK Server VM (fastdebug 18-internal+0-adhoc..jdk, mixed mode, sharing, g1 gc, linux-x86)
# Problematic frame:
# V  [libjvm.so+0x24cf40]  Matcher::pd_specialize_generic_vector_operand(MachOper*, unsigned int, bool)+0x110
#

Current CompileTask:
C2:   4515  392             jdk.internal.vm.vector.VectorSupport::convert (36 bytes)

Stack: [0xade3f000,0xadf00000],  sp=0xadefd3e0,  free space=760k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x171f44]  Matcher::pd_specialize_generic_vector_operand(MachOper*, unsigned int, bool)+0x2d4
V  [libjvm.so+0xb6b13f]  Matcher::specialize_vector_operand(MachNode*, unsigned int)+0x1f1
V  [libjvm.so+0xb6b201]  Matcher::specialize_mach_node(MachNode*)+0xb7
V  [libjvm.so+0xb6b318]  Matcher::specialize_generic_vector_operands()+0x104
V  [libjvm.so+0xb6adf5]  Matcher::do_postselect_cleanup()+0x1b
V  [libjvm.so+0xb62bc6]  Matcher::match()+0xfc0
V  [libjvm.so+0x6198ec]  Compile::Code_Gen()+0x92
V  [libjvm.so+0x611989]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x1325
V  [libjvm.so+0x516e35]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x139
V  [libjvm.so+0x62b959]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x565
V  [libjvm.so+0x62a94d]  CompileBroker::compiler_thread_loop()+0x369
V  [libjvm.so+0x649bed]  CompilerThread::thread_entry(JavaThread*, JavaThread*)+0x63
V  [libjvm.so+0xe5c39b]  JavaThread::thread_main_inner()+0x15b
V  [libjvm.so+0xe5c236]  JavaThread::run()+0x16a
V  [libjvm.so+0xe5a03e]  Thread::call_run()+0x17c
V  [libjvm.so+0xc33766]  thread_native_entry(Thread*)+0x198
C  [libpthread.so.0+0x63bd]  start_thread+0xfd
```

The other kind of symptoms is `bad AD file` like the following.
```
STDOUT:
test Float512VectorLoadStoreTests.gather(float[i * 5], index[random]): success
test Float512VectorLoadStoreTests.gather(float[i + 1], index[random]): success
o312  VectorStoreMask  === _ o348 o208  [[o231 ]]  #vectorx[16]:{bool}

--N: o312  VectorStoreMask  === _ o348 o208  [[o231 ]]  #vectorx[16]:{bool}

   --N: o348  ReplicateI  === _ o369  [[o312 ]]  #vectormask[16]:{int}
   VEC  100  ReplI_M1_1
   LEGVEC  200  MoveVec2Leg

      --N: o369  ConI  === o0  [[o348 ]]  #int:-1
      IMMI  10  IMMI
      IMMI_M1  0  IMMI_M1
      IMMI8  5  IMMI8
      IMMI16  10  IMMI16
      RREGI  100  loadConI
      XREGI  100  loadConI
      EAXREGI  100  loadConI
      EBXREGI  100  loadConI
      ECXREGI  100  loadConI
      EDXREGI  100  loadConI
      EDIREGI  100  loadConI
      NAXREGI  100  loadConI
      NADXREGI  100  loadConI
      NCXREGI  100  loadConI
      ESIREGI  100  loadConI
      STACKSLOTI  200  storeSSI

   --N: o208  ConI  === o0  [[o371 o331 o136 o407 o324 o460 o290 o302 o312 o303 o521 o571 o398 o444 o512 o555 o603 o647  132  143 ]]  #int:4
   IMMI  10  IMMI
   IMMI8  5  IMMI8
   IMMU8  5  IMMU8
   IMMI16  10  IMMI16
   IMMU31  0  IMMU31
   IMMI_1_31  0  IMMI_1_31
   IMMI_4  0  IMMI_4
```
Comments
Changeset: ceae380d Author: Jie Fu <jiefu@openjdk.org> Date: 2021-11-30 08:33:00 +0000 URL: https://git.openjdk.java.net/jdk/commit/ceae380d3a3fcef5678e3073e25eb37ca0a24c46
30-11-2021

ILW = C2 assertion failure in matching, only observed on x86_32 with vector tests and AVX512 (?), no workaround = HLH = P2
26-11-2021