JDK-8333890 : Fatal error in auto-vectorizer with float16 kernel.
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 20,21,22,23,24
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • CPU: generic
  • Submitted: 2024-06-10
  • Updated: 2024-08-01
  • Resolved: 2024-07-08
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 24
24 b06Fixed
Related Reports
Relates :  
Relates :  
Description
Auto-vectorization of following float16 kernel results into a fatal error.

import java.util.Arrays;

public class float16_mainline_add {
  public static short sum(short a, short b) {
    return (short)Float.float16ToFloat(Float.floatToFloat16(Float.float16ToFloat(a) + Float.float16ToFloat(b)));
  }
  public static void micro(short [] r, short [] a, short [] b) {
    for (int i = 0; i < a.length; i++) {
      r[i] = sum(a[i], b[i]);
    }
  }

  public static void main (String [] args) {
    short [] res = new short[1024];
    short [] src1 = new short[1024];
    short [] src2 = new short[1024];
    Arrays.fill(src1, (short)1);
    Arrays.fill(src2, (short)2);
    for (int i = 0;i < 100000; i++) {
      micro(res, src1, src2);
    }
    System.out.println("[res] " + res[3]);
  }
}


# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/home/jatinbha/sandboxes/jdk/jdk/src/hotspot/share/opto/vectornode.cpp:1386), pid=3638113, tid=3638127
#  Error: assert(bt == T_SHORT) failed
#
# JRE version: OpenJDK Runtime Environment (24.0) (slowdebug build 24-internal-adhoc.root.jdk)
# Java VM: OpenJDK 64-Bit Server VM (slowdebug 24-internal-adhoc.root.jdk, mixed mode, sharing, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x16b29f7]  VectorCastNode::opcode(int, BasicType, bool)+0xcd
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P %E" (or dumping to /home/jatinbha/code/java/FP16/core.3638113)
#
# An error report file with more information is saved as:
# /home/jatinbha/code/java/FP16/hs_err_pid3638113.log
#
# Compiler replay data is saved as:
# /home/jatinbha/code/java/FP16/replay_pid3638113.log
#
# If you would like to submit a bug report, please visit:
#   https://bugreport.java.com/bugreport/crash.jsp
#
Aborted (core dumped)

Command Line: java -XX:+TraceSuperWord -XX:CompileOnly=float16_mainline_add::micro -Xbatch -XX:-TieredCompilation -cp . float16_mainline_add
Comments
A pull request was submitted for review. Branch: master URL: https://git.openjdk.org/jdk/pull/20062 Date: 2024-07-06 18:34:54 +0000
01-08-2024

Changeset: 55fd1ed2 Author: Jatin Bhateja <jbhateja@openjdk.org> Date: 2024-07-08 06:42:46 +0000 URL: https://git.openjdk.org/jdk/commit/55fd1ed228ea3c42aaf92579e5dcb818fe14351d
08-07-2024

ILW = Crash when vectorizing float16ToFloat, rare?, disable compilation of affected method or use -XX:-UseSuperWord = HLM = P3
11-06-2024

Starts to fail after introducing auto-vectorization for `Float::float16ToFloat*` (JDK-8294588). Since this is not a new regression, I'm targeting this to JDK 24.
11-06-2024