mirror of
https://github.com/HDFGroup/hdf5.git
synced 2026-09-25 04:09:44 +03:00
Add predefined datatypes for bfloat16 data (#5402)
Adds predefined datatypes for little- and big-endian bfloat16 data Does not add support for any native bfloat16 types; datatype conversions are performed in software Also adds missing float16 predefined types to fortran
This commit is contained in:
@@ -1121,6 +1121,10 @@ public class HDF5Constants {
|
||||
/** */
|
||||
public static final long H5T_IEEE_F64LE = H5T_IEEE_F64LE();
|
||||
/** */
|
||||
public static final long H5T_FLOAT_BFLOAT16BE = H5T_FLOAT_BFLOAT16BE();
|
||||
/** */
|
||||
public static final long H5T_FLOAT_BFLOAT16LE = H5T_FLOAT_BFLOAT16LE();
|
||||
/** */
|
||||
public static final int H5T_INTEGER = H5T_INTEGER();
|
||||
/** */
|
||||
public static final long H5T_INTEL_B16 = H5T_INTEL_B16();
|
||||
@@ -2632,6 +2636,10 @@ public class HDF5Constants {
|
||||
|
||||
private static native final long H5T_IEEE_F64LE();
|
||||
|
||||
private static native final long H5T_FLOAT_BFLOAT16BE();
|
||||
|
||||
private static native final long H5T_FLOAT_BFLOAT16LE();
|
||||
|
||||
private static native final int H5T_INTEGER();
|
||||
|
||||
private static native final long H5T_INTEL_B16();
|
||||
|
||||
@@ -2736,6 +2736,16 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1IEEE_1F64LE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_IEEE_F64LE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT_1BFLOAT16BE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_FLOAT_BFLOAT16BE;
|
||||
}
|
||||
JNIEXPORT jlong JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT_1BFLOAT16LE(JNIEnv *env, jclass cls)
|
||||
{
|
||||
return H5T_FLOAT_BFLOAT16LE;
|
||||
}
|
||||
JNIEXPORT jint JNICALL
|
||||
Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls)
|
||||
{
|
||||
|
||||
+14
-4
@@ -2166,8 +2166,13 @@ h5str_get_little_endian_type(hid_t tid)
|
||||
}
|
||||
|
||||
case H5T_FLOAT: {
|
||||
if (size == 2)
|
||||
p_type = H5Tcopy(H5T_IEEE_F16LE);
|
||||
if (size == 2) {
|
||||
if (true == H5Tequal(tid, H5T_IEEE_F16LE) || true == H5Tequal(tid, H5T_IEEE_F16BE))
|
||||
p_type = H5Tcopy(H5T_IEEE_F16LE);
|
||||
else if (true == H5Tequal(tid, H5T_FLOAT_BFLOAT16LE) ||
|
||||
true == H5Tequal(tid, H5T_FLOAT_BFLOAT16BE))
|
||||
p_type = H5Tcopy(H5T_FLOAT_BFLOAT16LE);
|
||||
}
|
||||
else if (size == 4)
|
||||
p_type = H5Tcopy(H5T_IEEE_F32LE);
|
||||
else if (size == 8)
|
||||
@@ -2273,8 +2278,13 @@ h5str_get_big_endian_type(hid_t tid)
|
||||
}
|
||||
|
||||
case H5T_FLOAT: {
|
||||
if (size == 2)
|
||||
p_type = H5Tcopy(H5T_IEEE_F16BE);
|
||||
if (size == 2) {
|
||||
if (true == H5Tequal(tid, H5T_IEEE_F16LE) || true == H5Tequal(tid, H5T_IEEE_F16BE))
|
||||
p_type = H5Tcopy(H5T_IEEE_F16BE);
|
||||
else if (true == H5Tequal(tid, H5T_FLOAT_BFLOAT16LE) ||
|
||||
true == H5Tequal(tid, H5T_FLOAT_BFLOAT16BE))
|
||||
p_type = H5Tcopy(H5T_FLOAT_BFLOAT16BE);
|
||||
}
|
||||
else if (size == 4)
|
||||
p_type = H5Tcopy(H5T_IEEE_F32BE);
|
||||
else if (size == 8)
|
||||
|
||||
Reference in New Issue
Block a user