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