From 0523b99ab765aab51e9c97352d3a1193afbba8d9 Mon Sep 17 00:00:00 2001 From: Jordan Henderson Date: Mon, 22 Sep 2025 18:39:37 -0500 Subject: [PATCH] Add predefined datatypes for FP8 formats Adds predefined datatypes for FP8 data in E4M3 and E5M2 formats Does not add support for any native FP8 types; datatype conversions are performed in software --- c++/src/H5PredType.cpp | 8 + c++/src/H5PredType.h | 4 + doxygen/dox/DDLBNF200.dox | 1 + .../examples/tables/predefinedDatatypes.dox | 8 + fortran/src/H5_f.c | 4 + fortran/src/H5_ff.F90 | 2 + fortran/src/H5f90global.F90 | 6 +- hl/src/H5LT.c | 6 + hl/src/H5LTanalyze.c | 532 +++++------ hl/src/H5LTanalyze.l | 2 + hl/src/H5LTparse.c | 855 +++++++++--------- hl/src/H5LTparse.h | 76 +- hl/src/H5LTparse.y | 3 + hl/test/test_lite.c | 14 + java/src/hdf/hdf5lib/HDF5Constants.java | 8 + java/src/jni/h5Constants.c | 10 + java/src/jni/h5util.c | 24 +- release_docs/CHANGELOG.md | 28 +- src/H5T.c | 38 + src/H5Tmodule.h | 1 + src/H5Tnative.c | 59 +- src/H5Tpublic.h | 34 + src/H5trace.c | 4 + test/API/H5_api_dataset_test.c | 4 +- test/API/H5_api_test_util.c | 8 +- test/dt_arith.c | 341 +++++++ test/dtypes.c | 428 ++++++++- test/ntypes.c | 84 ++ tools/lib/h5diff_util.c | 4 + tools/lib/h5tools_dump.c | 4 + tools/lib/h5tools_type.c | 24 +- tools/src/h5import/h5import.c | 87 ++ tools/src/h5ls/h5ls.c | 6 + tools/test/h5dump/CMakeTests.cmake | 13 + tools/test/h5dump/expected/tfloat8.ddl | 227 +++++ tools/test/h5dump/h5dumpgentest.c | 307 +++++++ tools/test/h5dump/h5dumpgentest.h | 2 + tools/test/h5gentest.c | 2 + tools/test/h5ls/CMakeTests.cmake | 5 + tools/test/h5ls/expected/tfloat8.ls | 43 + tools/test/testfiles/tfloat8.h5 | Bin 0 -> 6416 bytes 41 files changed, 2588 insertions(+), 728 deletions(-) create mode 100644 tools/test/h5dump/expected/tfloat8.ddl create mode 100644 tools/test/h5ls/expected/tfloat8.ls create mode 100644 tools/test/testfiles/tfloat8.h5 diff --git a/c++/src/H5PredType.cpp b/c++/src/H5PredType.cpp index f8a63b34b2b..304f70f81d2 100644 --- a/c++/src/H5PredType.cpp +++ b/c++/src/H5PredType.cpp @@ -154,6 +154,8 @@ PredType *PredType::IEEE_F64LE_; PredType *PredType::FLOAT_BFLOAT16BE_; PredType *PredType::FLOAT_BFLOAT16LE_; +PredType *PredType::FLOAT_F8E4M3_; +PredType *PredType::FLOAT_F8E5M2_; PredType *PredType::UNIX_D32BE_; PredType *PredType::UNIX_D32LE_; @@ -344,6 +346,8 @@ PredType::makePredTypes() FLOAT_BFLOAT16BE_ = new PredType(H5T_FLOAT_BFLOAT16BE); FLOAT_BFLOAT16LE_ = new PredType(H5T_FLOAT_BFLOAT16LE); + FLOAT_F8E4M3_ = new PredType(H5T_FLOAT_F8E4M3); + FLOAT_F8E5M2_ = new PredType(H5T_FLOAT_F8E5M2); UNIX_D32BE_ = new PredType(H5T_UNIX_D32BE); UNIX_D32LE_ = new PredType(H5T_UNIX_D32LE); @@ -500,6 +504,8 @@ PredType::deleteConstants() delete FLOAT_BFLOAT16BE_; delete FLOAT_BFLOAT16LE_; + delete FLOAT_F8E4M3_; + delete FLOAT_F8E5M2_; delete UNIX_D32BE_; delete UNIX_D32LE_; @@ -660,6 +666,8 @@ const PredType &PredType::IEEE_F64LE = *IEEE_F64LE_; const PredType &PredType::FLOAT_BFLOAT16BE = *FLOAT_BFLOAT16BE_; const PredType &PredType::FLOAT_BFLOAT16LE = *FLOAT_BFLOAT16LE_; +const PredType &PredType::FLOAT_F8E4M3 = *FLOAT_F8E4M3_; +const PredType &PredType::FLOAT_F8E5M2 = *FLOAT_F8E5M2_; const PredType &PredType::UNIX_D32BE = *UNIX_D32BE_; const PredType &PredType::UNIX_D32LE = *UNIX_D32LE_; diff --git a/c++/src/H5PredType.h b/c++/src/H5PredType.h index 7668755b6c4..dbc17a5c733 100644 --- a/c++/src/H5PredType.h +++ b/c++/src/H5PredType.h @@ -94,6 +94,8 @@ class H5CPP_DLL PredType : public AtomType { static const PredType &FLOAT_BFLOAT16BE; static const PredType &FLOAT_BFLOAT16LE; + static const PredType &FLOAT_F8E4M3; + static const PredType &FLOAT_F8E5M2; static const PredType &UNIX_D32BE; static const PredType &UNIX_D32LE; @@ -267,6 +269,8 @@ class H5CPP_DLL PredType : public AtomType { static PredType *FLOAT_BFLOAT16BE_; static PredType *FLOAT_BFLOAT16LE_; + static PredType *FLOAT_F8E4M3_; + static PredType *FLOAT_F8E5M2_; static PredType *UNIX_D32BE_; static PredType *UNIX_D32LE_; diff --git a/doxygen/dox/DDLBNF200.dox b/doxygen/dox/DDLBNF200.dox index 9ea466e25e4..1e5c8d611a0 100644 --- a/doxygen/dox/DDLBNF200.dox +++ b/doxygen/dox/DDLBNF200.dox @@ -100,6 +100,7 @@ This section contains a brief explanation of the symbols used in the DDL. H5T_IEEE_F32BE | H5T_IEEE_F32LE | H5T_IEEE_F64BE | H5T_IEEE_F64LE | H5T_FLOAT_BFLOAT16BE | H5T_FLOAT_BFLOAT16LE | + H5T_FLOAT_F8E4M3 | H5T_FLOAT_F8E5M2 | H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT | H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE diff --git a/doxygen/examples/tables/predefinedDatatypes.dox b/doxygen/examples/tables/predefinedDatatypes.dox index ead4daca4f3..4ec666dea08 100644 --- a/doxygen/examples/tables/predefinedDatatypes.dox +++ b/doxygen/examples/tables/predefinedDatatypes.dox @@ -50,6 +50,14 @@ #H5T_FLOAT_BFLOAT16LE 16-bit little-endian bfloat16 floating point + +#H5T_FLOAT_F8E4M3 +8-bit FP8 E4M3 (4 exponent bits, 3 mantissa bits) floating point + + +#H5T_FLOAT_F8E5M2 +8-bit FP8 E5M2 (5 exponent bits, 2 mantissa bits) floating point + //! [predefined_alt_float_datatypes_table] * diff --git a/fortran/src/H5_f.c b/fortran/src/H5_f.c index a9300d9c045..5f72111ad81 100644 --- a/fortran/src/H5_f.c +++ b/fortran/src/H5_f.c @@ -253,6 +253,10 @@ h5init_types_c(hid_t_f *types, hid_t_f *floatingtypes, hid_t_f *integertypes) return ret_value; if ((floatingtypes[7] = (hid_t_f)H5Tcopy(H5T_FLOAT_BFLOAT16LE)) < 0) return ret_value; + if ((floatingtypes[8] = (hid_t_f)H5Tcopy(H5T_FLOAT_F8E4M3)) < 0) + return ret_value; + if ((floatingtypes[9] = (hid_t_f)H5Tcopy(H5T_FLOAT_F8E5M2)) < 0) + return ret_value; if ((integertypes[0] = (hid_t_f)H5Tcopy(H5T_STD_I8BE)) < 0) return ret_value; diff --git a/fortran/src/H5_ff.F90 b/fortran/src/H5_ff.F90 index 33e62b16b62..76582208297 100644 --- a/fortran/src/H5_ff.F90 +++ b/fortran/src/H5_ff.F90 @@ -295,6 +295,8 @@ END FUNCTION h5init1_flags_c H5T_IEEE_F16LE = floating_types(6) H5T_FLOAT_BFLOAT16BE = floating_types(7) H5T_FLOAT_BFLOAT16LE = floating_types(8) + H5T_FLOAT_F8E4M3 = floating_types(9) + H5T_FLOAT_F8E5M2 = floating_types(10) H5T_STD_I8BE = integer_types(1) H5T_STD_I8LE = integer_types(2) diff --git a/fortran/src/H5f90global.F90 b/fortran/src/H5f90global.F90 index 7e691ee38bf..6d8dd2c4685 100644 --- a/fortran/src/H5f90global.F90 +++ b/fortran/src/H5f90global.F90 @@ -63,7 +63,7 @@ MODULE H5GLOBAL ! Do not forget to change these values when new predefined ! datatypes are added INTEGER, PARAMETER :: PREDEF_TYPES_LEN = 19 - INTEGER, PARAMETER :: FLOATING_TYPES_LEN = 8 + INTEGER, PARAMETER :: FLOATING_TYPES_LEN = 10 INTEGER, PARAMETER :: INTEGER_TYPES_LEN = 28 ! These arrays need to be global because they are used in @@ -91,6 +91,8 @@ MODULE H5GLOBAL !DEC$ATTRIBUTES DLLEXPORT :: H5T_IEEE_F16LE !DEC$ATTRIBUTES DLLEXPORT :: H5T_FLOAT_BFLOAT16BE !DEC$ATTRIBUTES DLLEXPORT :: H5T_FLOAT_BFLOAT16LE + !DEC$ATTRIBUTES DLLEXPORT :: H5T_FLOAT_F8E4M3 + !DEC$ATTRIBUTES DLLEXPORT :: H5T_FLOAT_F8E5M2 !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I8BE !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I8LE !DEC$ATTRIBUTES DLLEXPORT :: H5T_STD_I16BE @@ -145,6 +147,8 @@ MODULE H5GLOBAL INTEGER(HID_T) :: H5T_IEEE_F16LE !< H5T_IEEE_F16LE INTEGER(HID_T) :: H5T_FLOAT_BFLOAT16BE !< H5T_FLOAT_BFLOAT16BE INTEGER(HID_T) :: H5T_FLOAT_BFLOAT16LE !< H5T_FLOAT_BFLOAT16LE + INTEGER(HID_T) :: H5T_FLOAT_F8E4M3 !< H5T_FLOAT_F8E4M3 + INTEGER(HID_T) :: H5T_FLOAT_F8E5M2 !< H5T_FLOAT_F8E5M2 INTEGER(HID_T) :: H5T_STD_I8BE !< H5T_STD_I8BE INTEGER(HID_T) :: H5T_STD_I8LE !< H5T_STD_I8LE INTEGER(HID_T) :: H5T_STD_I16BE !< H5T_STD_I16BE diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index e737009d99b..73c91cdc436 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2311,6 +2311,12 @@ H5LT_dtype_to_text(hid_t dtype, char *dt_str, H5LT_lang_t lang, size_t *slen, bo else if (H5Tequal(dtype, H5T_FLOAT_BFLOAT16LE)) { snprintf(dt_str, *slen, "H5T_FLOAT_BFLOAT16LE"); } + else if (H5Tequal(dtype, H5T_FLOAT_F8E4M3)) { + snprintf(dt_str, *slen, "H5T_FLOAT_F8E4M3"); + } + else if (H5Tequal(dtype, H5T_FLOAT_F8E5M2)) { + snprintf(dt_str, *slen, "H5T_FLOAT_F8E5M2"); + } #ifdef H5_HAVE__FLOAT16 else if (H5Tequal(dtype, H5T_NATIVE_FLOAT16)) { snprintf(dt_str, *slen, "H5T_NATIVE_FLOAT16"); diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index 300332facd5..591f875df2c 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -645,8 +645,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 79 -#define YY_END_OF_BUFFER 80 +#define YY_NUM_RULES 81 +#define YY_END_OF_BUFFER 82 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -654,47 +654,47 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[352] = +static const flex_int16_t yy_accept[361] = { 0, - 78, 78, 80, 79, 78, 79, 70, 76, 77, 79, - 79, 79, 79, 74, 75, 72, 73, 78, 0, 70, - 0, 0, 0, 0, 0, 71, 0, 0, 0, 0, - 0, 52, 0, 0, 0, 0, 0, 53, 0, 0, + 80, 80, 82, 81, 80, 81, 72, 78, 79, 81, + 81, 81, 81, 76, 77, 74, 75, 80, 0, 72, + 0, 0, 0, 0, 0, 73, 0, 0, 0, 0, + 0, 54, 0, 0, 0, 0, 0, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 69, 50, 0, 0, 0, 59, 63, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, + 0, 0, 0, 71, 52, 0, 0, 0, 61, 65, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, - 68, 64, 0, 0, 0, 0, 0, 0, 0, 0, + 70, 66, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 67, 0, 0, 0, 0, 0, - 0, 0, 0, 49, 0, 0, 0, 66, 0, 0, + 0, 0, 0, 0, 69, 0, 0, 0, 0, 0, + 0, 0, 0, 51, 0, 0, 0, 68, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, - 9, 10, 0, 0, 61, 0, 0, 58, 0, 0, + 0, 0, 0, 0, 1, 2, 0, 0, 0, 0, + 0, 0, 9, 10, 0, 0, 63, 0, 0, 60, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, - 4, 5, 6, 7, 8, 11, 12, 13, 14, 15, - 16, 0, 0, 0, 0, 57, 0, 60, 28, 29, - 30, 31, 32, 33, 0, 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 17, 0, 0, 0, 0, 24, 0, - 0, 0, 23, 0, 0, 0, 55, 0, 0, 0, - 0, 0, 37, 0, 26, 18, 20, 19, 0, 25, - 0, 54, 56, 0, 0, 38, 0, 0, 0, 27, + 0, 0, 3, 4, 5, 6, 7, 8, 11, 12, + 13, 14, 15, 16, 0, 0, 0, 0, 59, 0, + 0, 0, 62, 28, 29, 30, 31, 32, 33, 0, + 0, 0, 22, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 17, 0, 0, 0, 0, 24, 0, 0, 0, 23, + 0, 0, 0, 57, 0, 0, 0, 0, 36, 37, + 0, 39, 0, 26, 18, 20, 19, 0, 25, 0, - 21, 0, 0, 0, 36, 0, 39, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 34, 35, + 56, 58, 0, 0, 40, 0, 0, 0, 27, 21, + 0, 0, 0, 38, 0, 41, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 34, 35, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 41, 42, 43, 44, 45, 0, 0, - 0, 0, 0, 0, 0, 46, 0, 47, 0, 48, - 0 + 0, 42, 43, 44, 45, 46, 47, 0, 0, 0, + 0, 0, 0, 0, 48, 0, 49, 0, 50, 0 } ; static const YY_CHAR yy_ec[256] = @@ -738,93 +738,95 @@ static const YY_CHAR yy_meta[42] = 1 } ; -static const flex_int16_t yy_base[354] = +static const flex_int16_t yy_base[363] = { 0, - 0, 0, 377, 378, 374, 0, 0, 378, 378, 12, - 366, 347, 342, 378, 378, 378, 378, 370, 368, 0, - 352, 334, 337, 339, 337, 378, 334, 337, 324, 323, - 17, 378, 343, 34, 15, 346, 337, 378, 329, 31, - 332, 28, 338, 341, 327, 322, 35, 330, 337, 333, - 313, 319, 323, 328, 315, 312, 317, 313, 323, 309, - 325, 45, 309, 319, 300, 315, 378, 316, 319, 305, - 300, 325, 305, 314, 296, 308, 303, 296, 284, 33, - 300, 296, 302, 378, 378, 284, 40, 279, 378, 378, - 286, 287, 276, 281, 281, 43, 287, 43, 297, 378, - - 378, 378, 292, 277, 55, 269, 293, 287, 287, 286, - 71, 78, 283, 270, 274, 285, 265, 273, 267, 265, - 280, 269, 85, 254, 378, 282, 285, 282, 56, 279, - 282, 279, 71, 378, 263, 271, 261, 244, 265, 265, - 261, 260, 239, 267, 270, 267, 80, 78, 83, 85, - 256, 255, 90, 92, 94, 254, 253, 247, 253, 250, - 245, 378, 244, 254, 241, 233, 96, 99, 101, 241, - 235, 237, 234, 103, 102, 105, 240, 239, 238, 237, - 236, 235, 378, 378, 234, 233, 232, 231, 230, 229, - 378, 378, 53, 228, 378, 227, 222, 378, 217, 237, - - 223, 222, 221, 220, 219, 218, 221, 202, 207, 201, - 205, 204, 204, 207, 201, 205, 200, 107, 203, 378, - 378, 378, 378, 378, 378, 378, 378, 378, 378, 378, - 378, 209, 204, 194, 202, 378, 205, 378, 378, 378, - 378, 378, 378, 378, 189, 202, 202, 378, 183, 189, - 193, 198, 182, 196, 178, 182, 182, 180, 188, 175, - 189, 184, 170, 378, 177, 168, 183, 177, 378, 167, - 164, 165, 378, 168, 172, 162, 378, 166, 172, 149, - 182, 168, 86, 162, 378, 378, 378, 378, 164, 378, - 152, 378, 378, 163, 171, 141, 169, 162, 159, 378, - - 378, 127, 116, 160, 378, 149, 135, 163, 166, 163, - 152, 151, 142, 143, 150, 121, 123, 125, 378, 378, - 141, 137, 137, 144, 143, 142, 141, 140, 139, 129, - 132, 130, 378, 378, 378, 378, 378, 378, 130, 134, - 123, 129, 111, 120, 108, 378, 123, 378, 70, 378, - 378, 148, 74 + 0, 0, 386, 387, 383, 0, 0, 387, 387, 12, + 375, 356, 351, 387, 387, 387, 387, 379, 377, 0, + 361, 343, 346, 348, 346, 387, 343, 346, 333, 332, + 17, 387, 352, 34, 15, 355, 346, 387, 338, 31, + 341, 28, 347, 350, 336, 331, 35, 339, 346, 342, + 322, 328, 332, 337, 324, 321, 326, 322, 332, 318, + 334, 45, 318, 328, 309, 324, 387, 325, 328, 314, + 309, 334, 314, 323, 305, 317, 312, 305, 293, 33, + 309, 305, 311, 387, 387, 293, 40, 288, 387, 387, + 295, 296, 285, 290, 290, 43, 296, 43, 306, 387, + + 387, 387, 301, 286, 55, 278, 302, 296, 296, 295, + 71, 78, 292, 279, 283, 294, 274, 282, 276, 274, + 65, 279, 85, 264, 387, 292, 295, 292, 56, 289, + 292, 289, 71, 387, 273, 281, 271, 254, 275, 275, + 271, 270, 277, 248, 276, 279, 276, 80, 78, 83, + 85, 265, 264, 90, 92, 94, 263, 262, 256, 262, + 259, 254, 387, 253, 263, 250, 254, 241, 96, 99, + 101, 249, 243, 245, 242, 103, 102, 105, 248, 247, + 246, 245, 244, 243, 387, 387, 242, 241, 240, 239, + 238, 237, 387, 387, 103, 236, 387, 235, 230, 387, + + 225, 123, 245, 231, 230, 229, 228, 227, 226, 229, + 210, 215, 209, 213, 212, 212, 215, 209, 213, 208, + 110, 211, 387, 387, 387, 387, 387, 387, 387, 387, + 387, 387, 387, 387, 217, 212, 202, 210, 387, 213, + 202, 201, 387, 387, 387, 387, 387, 387, 387, 195, + 208, 208, 387, 189, 195, 199, 204, 188, 202, 184, + 188, 188, 186, 194, 181, 195, 190, 176, 199, 199, + 387, 181, 172, 187, 181, 387, 171, 168, 169, 387, + 172, 176, 166, 387, 170, 176, 153, 186, 387, 387, + 172, 86, 166, 387, 387, 387, 387, 168, 387, 156, + + 387, 387, 167, 175, 145, 173, 166, 163, 387, 387, + 132, 123, 164, 387, 153, 139, 167, 170, 167, 156, + 155, 146, 147, 154, 125, 126, 128, 387, 387, 145, + 141, 141, 148, 147, 146, 145, 144, 143, 133, 136, + 134, 387, 387, 387, 387, 387, 387, 134, 138, 128, + 135, 116, 124, 111, 387, 126, 387, 70, 387, 387, + 151, 74 } ; -static const flex_int16_t yy_def[354] = +static const flex_int16_t yy_def[363] = { 0, - 351, 1, 351, 351, 351, 352, 353, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 352, 353, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 0, 351, 351 + 360, 1, 360, 360, 360, 361, 362, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 361, 362, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 0, + 360, 360 } ; -static const flex_int16_t yy_nxt[420] = +static const flex_int16_t yy_nxt[429] = { 0, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 9, 4, 4, 10, 4, 4, 4, 4, @@ -833,48 +835,49 @@ static const flex_int16_t yy_nxt[420] = 17, 21, 22, 36, 48, 49, 37, 39, 63, 40, 57, 41, 42, 58, 97, 43, 53, 64, 44, 45, 54, 79, 103, 46, 111, 104, 47, 114, 119, 55, - 151, 98, 115, 80, 112, 126, 20, 127, 152, 232, - 128, 129, 130, 233, 131, 156, 120, 132, 133, 144, - 297, 145, 177, 157, 146, 170, 171, 179, 172, 181, - - 178, 173, 174, 350, 185, 180, 187, 182, 189, 175, - 201, 176, 186, 203, 188, 205, 190, 214, 202, 211, - 216, 204, 215, 206, 298, 212, 217, 218, 213, 256, - 311, 308, 257, 309, 219, 324, 310, 326, 312, 328, - 349, 348, 347, 325, 346, 327, 345, 329, 19, 344, - 19, 343, 342, 341, 340, 339, 338, 337, 336, 335, - 334, 333, 332, 331, 330, 323, 322, 321, 320, 319, - 318, 317, 316, 315, 314, 313, 307, 306, 305, 304, - 303, 302, 301, 300, 299, 296, 295, 294, 293, 292, - 291, 290, 289, 288, 287, 286, 285, 284, 283, 282, - - 281, 280, 279, 278, 277, 276, 275, 274, 273, 272, - 271, 270, 269, 268, 267, 266, 265, 264, 263, 262, - 261, 260, 259, 258, 255, 254, 253, 252, 251, 250, - 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, - 239, 238, 237, 236, 235, 234, 231, 230, 229, 228, - 227, 226, 225, 224, 223, 222, 221, 220, 210, 209, - 208, 207, 200, 199, 198, 197, 196, 195, 194, 193, - 192, 191, 184, 183, 169, 168, 167, 166, 165, 164, - 163, 162, 161, 160, 159, 158, 155, 154, 153, 150, - 149, 148, 147, 143, 142, 141, 140, 139, 138, 137, - - 136, 135, 134, 125, 124, 123, 122, 121, 118, 117, - 116, 113, 110, 109, 108, 107, 106, 105, 102, 101, - 100, 99, 96, 95, 94, 93, 92, 91, 90, 89, - 88, 87, 86, 85, 84, 83, 82, 81, 78, 77, - 76, 75, 74, 73, 72, 71, 70, 69, 68, 67, - 66, 65, 62, 61, 60, 59, 56, 52, 51, 50, - 38, 35, 34, 33, 32, 31, 30, 29, 28, 27, - 26, 18, 25, 24, 23, 18, 351, 3, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351 + 152, 98, 115, 80, 112, 126, 20, 127, 153, 142, + 128, 129, 130, 143, 131, 157, 120, 132, 133, 145, + 306, 146, 179, 158, 147, 172, 173, 181, 174, 183, + + 180, 175, 176, 359, 187, 182, 189, 184, 191, 177, + 204, 178, 188, 206, 190, 208, 192, 217, 205, 214, + 219, 207, 218, 209, 307, 215, 220, 221, 216, 235, + 241, 242, 261, 236, 222, 262, 317, 320, 318, 333, + 335, 319, 337, 358, 357, 321, 356, 334, 336, 355, + 338, 19, 354, 19, 353, 352, 351, 350, 349, 348, + 347, 346, 345, 344, 343, 342, 341, 340, 339, 332, + 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, + 316, 315, 314, 313, 312, 311, 310, 309, 308, 305, + 304, 303, 302, 301, 300, 299, 298, 297, 296, 295, + + 294, 293, 292, 291, 290, 289, 288, 287, 286, 285, + 284, 283, 282, 281, 280, 279, 278, 277, 276, 275, + 274, 273, 272, 271, 270, 269, 268, 267, 266, 265, + 264, 263, 260, 259, 258, 257, 256, 255, 254, 253, + 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 240, 239, 238, 237, 234, 233, 232, 231, 230, 229, + 228, 227, 226, 225, 224, 223, 213, 212, 211, 210, + 203, 202, 201, 200, 199, 198, 197, 196, 195, 194, + 193, 186, 185, 171, 170, 169, 168, 167, 166, 165, + 164, 163, 162, 161, 160, 159, 156, 155, 154, 151, + + 150, 149, 148, 144, 141, 140, 139, 138, 137, 136, + 135, 134, 125, 124, 123, 122, 121, 118, 117, 116, + 113, 110, 109, 108, 107, 106, 105, 102, 101, 100, + 99, 96, 95, 94, 93, 92, 91, 90, 89, 88, + 87, 86, 85, 84, 83, 82, 81, 78, 77, 76, + 75, 74, 73, 72, 71, 70, 69, 68, 67, 66, + 65, 62, 61, 60, 59, 56, 52, 51, 50, 38, + 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, + 18, 25, 24, 23, 18, 360, 3, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360 } ; -static const flex_int16_t yy_chk[420] = +static const flex_int16_t yy_chk[429] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -883,45 +886,46 @@ static const flex_int16_t yy_chk[420] = 1, 10, 10, 31, 35, 35, 31, 34, 47, 34, 42, 34, 34, 42, 80, 34, 40, 47, 34, 34, 40, 62, 87, 34, 96, 87, 34, 98, 105, 40, - 129, 80, 98, 62, 96, 111, 353, 111, 129, 193, - 111, 111, 112, 193, 112, 133, 105, 112, 112, 123, - 283, 123, 148, 133, 123, 147, 147, 149, 147, 150, - - 148, 147, 147, 349, 153, 149, 154, 150, 155, 147, - 167, 147, 153, 168, 154, 169, 155, 175, 167, 174, - 176, 168, 175, 169, 283, 174, 176, 176, 174, 218, - 303, 302, 218, 302, 176, 316, 302, 317, 303, 318, - 347, 345, 344, 316, 343, 317, 342, 318, 352, 341, - 352, 340, 339, 332, 331, 330, 329, 328, 327, 326, - 325, 324, 323, 322, 321, 315, 314, 313, 312, 311, - 310, 309, 308, 307, 306, 304, 299, 298, 297, 296, - 295, 294, 291, 289, 284, 282, 281, 280, 279, 278, - 276, 275, 274, 272, 271, 270, 268, 267, 266, 265, - - 263, 262, 261, 260, 259, 258, 257, 256, 255, 254, - 253, 252, 251, 250, 249, 247, 246, 245, 237, 235, - 234, 233, 232, 219, 217, 216, 215, 214, 213, 212, - 211, 210, 209, 208, 207, 206, 205, 204, 203, 202, - 201, 200, 199, 197, 196, 194, 190, 189, 188, 187, - 186, 185, 182, 181, 180, 179, 178, 177, 173, 172, - 171, 170, 166, 165, 164, 163, 161, 160, 159, 158, - 157, 156, 152, 151, 146, 145, 144, 143, 142, 141, + 129, 80, 98, 62, 96, 111, 362, 111, 129, 121, + 111, 111, 112, 121, 112, 133, 105, 112, 112, 123, + 292, 123, 149, 133, 123, 148, 148, 150, 148, 151, + + 149, 148, 148, 358, 154, 150, 155, 151, 156, 148, + 169, 148, 154, 170, 155, 171, 156, 177, 169, 176, + 178, 170, 177, 171, 292, 176, 178, 178, 176, 195, + 202, 202, 221, 195, 178, 221, 311, 312, 311, 325, + 326, 311, 327, 356, 354, 312, 353, 325, 326, 352, + 327, 361, 351, 361, 350, 349, 348, 341, 340, 339, + 338, 337, 336, 335, 334, 333, 332, 331, 330, 324, + 323, 322, 321, 320, 319, 318, 317, 316, 315, 313, + 308, 307, 306, 305, 304, 303, 300, 298, 293, 291, + 288, 287, 286, 285, 283, 282, 281, 279, 278, 277, + + 275, 274, 273, 272, 270, 269, 268, 267, 266, 265, + 264, 263, 262, 261, 260, 259, 258, 257, 256, 255, + 254, 252, 251, 250, 242, 241, 240, 238, 237, 236, + 235, 222, 220, 219, 218, 217, 216, 215, 214, 213, + 212, 211, 210, 209, 208, 207, 206, 205, 204, 203, + 201, 199, 198, 196, 192, 191, 190, 189, 188, 187, + 184, 183, 182, 181, 180, 179, 175, 174, 173, 172, + 168, 167, 166, 165, 164, 162, 161, 160, 159, 158, + 157, 153, 152, 147, 146, 145, 144, 143, 142, 141, 140, 139, 138, 137, 136, 135, 132, 131, 130, 128, - 127, 126, 124, 122, 121, 120, 119, 118, 117, 116, - - 115, 114, 113, 110, 109, 108, 107, 106, 104, 103, - 99, 97, 95, 94, 93, 92, 91, 88, 86, 83, - 82, 81, 79, 78, 77, 76, 75, 74, 73, 72, - 71, 70, 69, 68, 66, 65, 64, 63, 61, 60, - 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, - 49, 48, 46, 45, 44, 43, 41, 39, 37, 36, - 33, 30, 29, 28, 27, 25, 24, 23, 22, 21, - 19, 18, 13, 12, 11, 5, 3, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - - 351, 351, 351, 351, 351, 351, 351, 351, 351, 351, - 351, 351, 351, 351, 351, 351, 351, 351, 351 + + 127, 126, 124, 122, 120, 119, 118, 117, 116, 115, + 114, 113, 110, 109, 108, 107, 106, 104, 103, 99, + 97, 95, 94, 93, 92, 91, 88, 86, 83, 82, + 81, 79, 78, 77, 76, 75, 74, 73, 72, 71, + 70, 69, 68, 66, 65, 64, 63, 61, 60, 59, + 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, + 48, 46, 45, 44, 43, 41, 39, 37, 36, 33, + 30, 29, 28, 27, 25, 24, 23, 22, 21, 19, + 18, 13, 12, 11, 5, 3, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360, 360, 360, + 360, 360, 360, 360, 360, 360, 360, 360 } ; static yy_state_type yy_last_accepting_state; @@ -980,8 +984,8 @@ static int my_yyinput(char *, int); extern char *myinput; extern size_t input_len; -#line 954 "hl/src//H5LTanalyze.c" -#line 955 "hl/src//H5LTanalyze.c" +#line 958 "hl/src//H5LTanalyze.c" +#line 959 "hl/src//H5LTanalyze.c" #define INITIAL 0 @@ -1193,7 +1197,7 @@ YY_DECL #line 53 "hl/src//H5LTanalyze.l" -#line 1167 "hl/src//H5LTanalyze.c" +#line 1171 "hl/src//H5LTanalyze.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { @@ -1220,13 +1224,13 @@ YY_DECL while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 352 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 378 ); + while ( yy_base[yy_current_state] != 387 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1428,232 +1432,242 @@ YY_RULE_SETUP case 36: YY_RULE_SETUP #line 93 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_FLOAT16_TOKEN);} +{return hid(H5T_FLOAT_F8E4M3_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP #line 94 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_FLOAT_TOKEN);} +{return hid(H5T_FLOAT_F8E5M2_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP #line 95 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_DOUBLE_TOKEN);} +{return hid(H5T_NATIVE_FLOAT16_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP #line 96 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} +{return hid(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 98 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F16BE_TOKEN);} +#line 97 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 99 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F16LE_TOKEN);} +#line 98 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP #line 100 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F32BE_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F16BE_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP #line 101 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F32LE_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F16LE_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP #line 102 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F64BE_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F32BE_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP #line 103 "hl/src//H5LTanalyze.l" -{return hid(H5T_COMPLEX_IEEE_F64LE_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F32LE_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP #line 104 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_FLOAT_COMPLEX_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F64BE_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP #line 105 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_DOUBLE_COMPLEX_TOKEN);} +{return hid(H5T_COMPLEX_IEEE_F64LE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP #line 106 "hl/src//H5LTanalyze.l" -{return hid(H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN);} +{return hid(H5T_NATIVE_FLOAT_COMPLEX_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 108 "hl/src//H5LTanalyze.l" -{return token(H5T_STRING_TOKEN);} +#line 107 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_DOUBLE_COMPLEX_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 109 "hl/src//H5LTanalyze.l" -{return token(STRSIZE_TOKEN);} +#line 108 "hl/src//H5LTanalyze.l" +{return hid(H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP #line 110 "hl/src//H5LTanalyze.l" -{return token(STRPAD_TOKEN);} +{return token(H5T_STRING_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP #line 111 "hl/src//H5LTanalyze.l" -{return token(CSET_TOKEN);} +{return token(STRSIZE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP #line 112 "hl/src//H5LTanalyze.l" -{return token(CTYPE_TOKEN);} +{return token(STRPAD_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP #line 113 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_NULLTERM_TOKEN);} +{return token(CSET_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP #line 114 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_NULLPAD_TOKEN);} +{return token(CTYPE_TOKEN);} YY_BREAK case 56: YY_RULE_SETUP #line 115 "hl/src//H5LTanalyze.l" -{return token(H5T_STR_SPACEPAD_TOKEN);} +{return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 57: YY_RULE_SETUP #line 116 "hl/src//H5LTanalyze.l" -{return token(H5T_CSET_ASCII_TOKEN);} +{return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 58: YY_RULE_SETUP #line 117 "hl/src//H5LTanalyze.l" -{return token(H5T_CSET_UTF8_TOKEN);} +{return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 59: YY_RULE_SETUP #line 118 "hl/src//H5LTanalyze.l" -{return token(H5T_C_S1_TOKEN);} +{return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 60: YY_RULE_SETUP #line 119 "hl/src//H5LTanalyze.l" -{return token(H5T_FORTRAN_S1_TOKEN);} +{return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 61: YY_RULE_SETUP #line 120 "hl/src//H5LTanalyze.l" -{return token(H5T_VARIABLE_TOKEN);} +{return token(H5T_C_S1_TOKEN);} YY_BREAK case 62: YY_RULE_SETUP -#line 122 "hl/src//H5LTanalyze.l" -{return token(H5T_COMPOUND_TOKEN);} +#line 121 "hl/src//H5LTanalyze.l" +{return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 63: YY_RULE_SETUP -#line 123 "hl/src//H5LTanalyze.l" -{return token(H5T_ENUM_TOKEN);} +#line 122 "hl/src//H5LTanalyze.l" +{return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 64: YY_RULE_SETUP #line 124 "hl/src//H5LTanalyze.l" -{return token(H5T_ARRAY_TOKEN);} +{return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 65: YY_RULE_SETUP #line 125 "hl/src//H5LTanalyze.l" -{return token(H5T_VLEN_TOKEN);} +{return token(H5T_ENUM_TOKEN);} YY_BREAK case 66: YY_RULE_SETUP #line 126 "hl/src//H5LTanalyze.l" -{return token(H5T_COMPLEX_TOKEN);} +{return token(H5T_ARRAY_TOKEN);} YY_BREAK case 67: YY_RULE_SETUP -#line 128 "hl/src//H5LTanalyze.l" -{return token(H5T_OPAQUE_TOKEN);} +#line 127 "hl/src//H5LTanalyze.l" +{return token(H5T_VLEN_TOKEN);} YY_BREAK case 68: YY_RULE_SETUP -#line 129 "hl/src//H5LTanalyze.l" -{return token(OPQ_SIZE_TOKEN);} +#line 128 "hl/src//H5LTanalyze.l" +{return token(H5T_COMPLEX_TOKEN);} YY_BREAK case 69: YY_RULE_SETUP #line 130 "hl/src//H5LTanalyze.l" -{return token(OPQ_TAG_TOKEN);} +{return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 70: YY_RULE_SETUP +#line 131 "hl/src//H5LTanalyze.l" +{return token(OPQ_SIZE_TOKEN);} + YY_BREAK +case 71: +YY_RULE_SETUP #line 132 "hl/src//H5LTanalyze.l" +{return token(OPQ_TAG_TOKEN);} + YY_BREAK +case 72: +YY_RULE_SETUP +#line 134 "hl/src//H5LTanalyze.l" { H5LTyylval.ival = atoi(yytext); return NUMBER; } YY_BREAK -case 71: -/* rule 71 can match eol */ +case 73: +/* rule 73 can match eol */ YY_RULE_SETUP -#line 137 "hl/src//H5LTanalyze.l" +#line 139 "hl/src//H5LTanalyze.l" { H5LTyylval.sval = trim_quotes(yytext); return STRING; } YY_BREAK -case 72: -YY_RULE_SETUP -#line 142 "hl/src//H5LTanalyze.l" -{return token('{');} - YY_BREAK -case 73: -YY_RULE_SETUP -#line 143 "hl/src//H5LTanalyze.l" -{return token('}');} - YY_BREAK case 74: YY_RULE_SETUP #line 144 "hl/src//H5LTanalyze.l" -{return token('[');} +{return token('{');} YY_BREAK case 75: YY_RULE_SETUP #line 145 "hl/src//H5LTanalyze.l" -{return token(']');} +{return token('}');} YY_BREAK case 76: YY_RULE_SETUP #line 146 "hl/src//H5LTanalyze.l" -{return token(':');} +{return token('[');} YY_BREAK case 77: YY_RULE_SETUP #line 147 "hl/src//H5LTanalyze.l" -{return token(';');} +{return token(']');} YY_BREAK case 78: -/* rule 78 can match eol */ YY_RULE_SETUP #line 148 "hl/src//H5LTanalyze.l" -; +{return token(':');} YY_BREAK case 79: YY_RULE_SETUP +#line 149 "hl/src//H5LTanalyze.l" +{return token(';');} + YY_BREAK +case 80: +/* rule 80 can match eol */ +YY_RULE_SETUP #line 150 "hl/src//H5LTanalyze.l" +; + YY_BREAK +case 81: +YY_RULE_SETUP +#line 152 "hl/src//H5LTanalyze.l" ECHO; YY_BREAK -#line 1627 "hl/src//H5LTanalyze.c" +#line 1641 "hl/src//H5LTanalyze.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -1950,7 +1964,7 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 352 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; @@ -1978,11 +1992,11 @@ static int yy_get_next_buffer (void) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 352 ) + if ( yy_current_state >= 361 ) yy_c = yy_meta[yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; - yy_is_jam = (yy_current_state == 351); + yy_is_jam = (yy_current_state == 360); return yy_is_jam ? 0 : yy_current_state; } @@ -2658,7 +2672,7 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 150 "hl/src//H5LTanalyze.l" +#line 152 "hl/src//H5LTanalyze.l" /* Allocate a copy of `quoted` with the double quote character at diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 6acefd6f981..fc504873bce 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -90,6 +90,8 @@ H5T_IEEE_F64BE {return hid(H5T_IEEE_F64BE_TOKEN);} H5T_IEEE_F64LE {return hid(H5T_IEEE_F64LE_TOKEN);} H5T_FLOAT_BFLOAT16BE {return hid(H5T_FLOAT_BFLOAT16BE_TOKEN);} H5T_FLOAT_BFLOAT16LE {return hid(H5T_FLOAT_BFLOAT16LE_TOKEN);} +H5T_FLOAT_F8E4M3 {return hid(H5T_FLOAT_F8E4M3_TOKEN);} +H5T_FLOAT_F8E5M2 {return hid(H5T_FLOAT_F8E5M2_TOKEN);} H5T_NATIVE_FLOAT16 {return hid(H5T_NATIVE_FLOAT16_TOKEN);} H5T_NATIVE_FLOAT {return hid(H5T_NATIVE_FLOAT_TOKEN);} H5T_NATIVE_DOUBLE {return hid(H5T_NATIVE_DOUBLE_TOKEN);} diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 8abdf121380..7be3166e309 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -219,92 +219,94 @@ enum yysymbol_kind_t YYSYMBOL_H5T_IEEE_F64LE_TOKEN = 35, /* H5T_IEEE_F64LE_TOKEN */ YYSYMBOL_H5T_FLOAT_BFLOAT16BE_TOKEN = 36, /* H5T_FLOAT_BFLOAT16BE_TOKEN */ YYSYMBOL_H5T_FLOAT_BFLOAT16LE_TOKEN = 37, /* H5T_FLOAT_BFLOAT16LE_TOKEN */ - YYSYMBOL_H5T_NATIVE_FLOAT16_TOKEN = 38, /* H5T_NATIVE_FLOAT16_TOKEN */ - YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 39, /* H5T_NATIVE_FLOAT_TOKEN */ - YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 40, /* H5T_NATIVE_DOUBLE_TOKEN */ - YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 41, /* H5T_NATIVE_LDOUBLE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F16BE_TOKEN = 42, /* H5T_COMPLEX_IEEE_F16BE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F16LE_TOKEN = 43, /* H5T_COMPLEX_IEEE_F16LE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F32BE_TOKEN = 44, /* H5T_COMPLEX_IEEE_F32BE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F32LE_TOKEN = 45, /* H5T_COMPLEX_IEEE_F32LE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F64BE_TOKEN = 46, /* H5T_COMPLEX_IEEE_F64BE_TOKEN */ - YYSYMBOL_H5T_COMPLEX_IEEE_F64LE_TOKEN = 47, /* H5T_COMPLEX_IEEE_F64LE_TOKEN */ - YYSYMBOL_H5T_NATIVE_FLOAT_COMPLEX_TOKEN = 48, /* H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ - YYSYMBOL_H5T_NATIVE_DOUBLE_COMPLEX_TOKEN = 49, /* H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ - YYSYMBOL_H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN = 50, /* H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ - YYSYMBOL_H5T_STRING_TOKEN = 51, /* H5T_STRING_TOKEN */ - YYSYMBOL_STRSIZE_TOKEN = 52, /* STRSIZE_TOKEN */ - YYSYMBOL_STRPAD_TOKEN = 53, /* STRPAD_TOKEN */ - YYSYMBOL_CSET_TOKEN = 54, /* CSET_TOKEN */ - YYSYMBOL_CTYPE_TOKEN = 55, /* CTYPE_TOKEN */ - YYSYMBOL_H5T_VARIABLE_TOKEN = 56, /* H5T_VARIABLE_TOKEN */ - YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 57, /* H5T_STR_NULLTERM_TOKEN */ - YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 58, /* H5T_STR_NULLPAD_TOKEN */ - YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 59, /* H5T_STR_SPACEPAD_TOKEN */ - YYSYMBOL_H5T_CSET_ASCII_TOKEN = 60, /* H5T_CSET_ASCII_TOKEN */ - YYSYMBOL_H5T_CSET_UTF8_TOKEN = 61, /* H5T_CSET_UTF8_TOKEN */ - YYSYMBOL_H5T_C_S1_TOKEN = 62, /* H5T_C_S1_TOKEN */ - YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 63, /* H5T_FORTRAN_S1_TOKEN */ - YYSYMBOL_H5T_OPAQUE_TOKEN = 64, /* H5T_OPAQUE_TOKEN */ - YYSYMBOL_OPQ_SIZE_TOKEN = 65, /* OPQ_SIZE_TOKEN */ - YYSYMBOL_OPQ_TAG_TOKEN = 66, /* OPQ_TAG_TOKEN */ - YYSYMBOL_H5T_COMPOUND_TOKEN = 67, /* H5T_COMPOUND_TOKEN */ - YYSYMBOL_H5T_ENUM_TOKEN = 68, /* H5T_ENUM_TOKEN */ - YYSYMBOL_H5T_ARRAY_TOKEN = 69, /* H5T_ARRAY_TOKEN */ - YYSYMBOL_H5T_VLEN_TOKEN = 70, /* H5T_VLEN_TOKEN */ - YYSYMBOL_H5T_COMPLEX_TOKEN = 71, /* H5T_COMPLEX_TOKEN */ - YYSYMBOL_STRING = 72, /* STRING */ - YYSYMBOL_NUMBER = 73, /* NUMBER */ - YYSYMBOL_74_ = 74, /* '{' */ - YYSYMBOL_75_ = 75, /* '}' */ - YYSYMBOL_76_ = 76, /* '[' */ - YYSYMBOL_77_ = 77, /* ']' */ - YYSYMBOL_78_ = 78, /* ':' */ - YYSYMBOL_79_ = 79, /* ';' */ - YYSYMBOL_YYACCEPT = 80, /* $accept */ - YYSYMBOL_start = 81, /* start */ - YYSYMBOL_ddl_type = 82, /* ddl_type */ - YYSYMBOL_atomic_type = 83, /* atomic_type */ - YYSYMBOL_integer_type = 84, /* integer_type */ - YYSYMBOL_fp_type = 85, /* fp_type */ - YYSYMBOL_compound_type = 86, /* compound_type */ - YYSYMBOL_87_1 = 87, /* $@1 */ - YYSYMBOL_memb_list = 88, /* memb_list */ - YYSYMBOL_memb_def = 89, /* memb_def */ - YYSYMBOL_90_2 = 90, /* $@2 */ - YYSYMBOL_field_name = 91, /* field_name */ - YYSYMBOL_field_offset = 92, /* field_offset */ - YYSYMBOL_offset = 93, /* offset */ - YYSYMBOL_array_type = 94, /* array_type */ - YYSYMBOL_95_3 = 95, /* $@3 */ - YYSYMBOL_dim_list = 96, /* dim_list */ - YYSYMBOL_dim = 97, /* dim */ - YYSYMBOL_98_4 = 98, /* $@4 */ - YYSYMBOL_99_5 = 99, /* $@5 */ - YYSYMBOL_dimsize = 100, /* dimsize */ - YYSYMBOL_vlen_type = 101, /* vlen_type */ - YYSYMBOL_complex_type = 102, /* complex_type */ - YYSYMBOL_opaque_type = 103, /* opaque_type */ - YYSYMBOL_104_6 = 104, /* @6 */ - YYSYMBOL_105_7 = 105, /* $@7 */ - YYSYMBOL_opaque_size = 106, /* opaque_size */ - YYSYMBOL_opaque_tag = 107, /* opaque_tag */ - YYSYMBOL_string_type = 108, /* string_type */ - YYSYMBOL_109_8 = 109, /* $@8 */ - YYSYMBOL_110_9 = 110, /* $@9 */ - YYSYMBOL_111_10 = 111, /* $@10 */ - YYSYMBOL_112_11 = 112, /* @11 */ - YYSYMBOL_strsize = 113, /* strsize */ - YYSYMBOL_strpad = 114, /* strpad */ - YYSYMBOL_cset = 115, /* cset */ - YYSYMBOL_ctype = 116, /* ctype */ - YYSYMBOL_enum_type = 117, /* enum_type */ - YYSYMBOL_118_12 = 118, /* $@12 */ - YYSYMBOL_enum_list = 119, /* enum_list */ - YYSYMBOL_enum_def = 120, /* enum_def */ - YYSYMBOL_121_13 = 121, /* $@13 */ - YYSYMBOL_enum_symbol = 122, /* enum_symbol */ - YYSYMBOL_enum_val = 123 /* enum_val */ + YYSYMBOL_H5T_FLOAT_F8E4M3_TOKEN = 38, /* H5T_FLOAT_F8E4M3_TOKEN */ + YYSYMBOL_H5T_FLOAT_F8E5M2_TOKEN = 39, /* H5T_FLOAT_F8E5M2_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT16_TOKEN = 40, /* H5T_NATIVE_FLOAT16_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT_TOKEN = 41, /* H5T_NATIVE_FLOAT_TOKEN */ + YYSYMBOL_H5T_NATIVE_DOUBLE_TOKEN = 42, /* H5T_NATIVE_DOUBLE_TOKEN */ + YYSYMBOL_H5T_NATIVE_LDOUBLE_TOKEN = 43, /* H5T_NATIVE_LDOUBLE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F16BE_TOKEN = 44, /* H5T_COMPLEX_IEEE_F16BE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F16LE_TOKEN = 45, /* H5T_COMPLEX_IEEE_F16LE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F32BE_TOKEN = 46, /* H5T_COMPLEX_IEEE_F32BE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F32LE_TOKEN = 47, /* H5T_COMPLEX_IEEE_F32LE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F64BE_TOKEN = 48, /* H5T_COMPLEX_IEEE_F64BE_TOKEN */ + YYSYMBOL_H5T_COMPLEX_IEEE_F64LE_TOKEN = 49, /* H5T_COMPLEX_IEEE_F64LE_TOKEN */ + YYSYMBOL_H5T_NATIVE_FLOAT_COMPLEX_TOKEN = 50, /* H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ + YYSYMBOL_H5T_NATIVE_DOUBLE_COMPLEX_TOKEN = 51, /* H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ + YYSYMBOL_H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN = 52, /* H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ + YYSYMBOL_H5T_STRING_TOKEN = 53, /* H5T_STRING_TOKEN */ + YYSYMBOL_STRSIZE_TOKEN = 54, /* STRSIZE_TOKEN */ + YYSYMBOL_STRPAD_TOKEN = 55, /* STRPAD_TOKEN */ + YYSYMBOL_CSET_TOKEN = 56, /* CSET_TOKEN */ + YYSYMBOL_CTYPE_TOKEN = 57, /* CTYPE_TOKEN */ + YYSYMBOL_H5T_VARIABLE_TOKEN = 58, /* H5T_VARIABLE_TOKEN */ + YYSYMBOL_H5T_STR_NULLTERM_TOKEN = 59, /* H5T_STR_NULLTERM_TOKEN */ + YYSYMBOL_H5T_STR_NULLPAD_TOKEN = 60, /* H5T_STR_NULLPAD_TOKEN */ + YYSYMBOL_H5T_STR_SPACEPAD_TOKEN = 61, /* H5T_STR_SPACEPAD_TOKEN */ + YYSYMBOL_H5T_CSET_ASCII_TOKEN = 62, /* H5T_CSET_ASCII_TOKEN */ + YYSYMBOL_H5T_CSET_UTF8_TOKEN = 63, /* H5T_CSET_UTF8_TOKEN */ + YYSYMBOL_H5T_C_S1_TOKEN = 64, /* H5T_C_S1_TOKEN */ + YYSYMBOL_H5T_FORTRAN_S1_TOKEN = 65, /* H5T_FORTRAN_S1_TOKEN */ + YYSYMBOL_H5T_OPAQUE_TOKEN = 66, /* H5T_OPAQUE_TOKEN */ + YYSYMBOL_OPQ_SIZE_TOKEN = 67, /* OPQ_SIZE_TOKEN */ + YYSYMBOL_OPQ_TAG_TOKEN = 68, /* OPQ_TAG_TOKEN */ + YYSYMBOL_H5T_COMPOUND_TOKEN = 69, /* H5T_COMPOUND_TOKEN */ + YYSYMBOL_H5T_ENUM_TOKEN = 70, /* H5T_ENUM_TOKEN */ + YYSYMBOL_H5T_ARRAY_TOKEN = 71, /* H5T_ARRAY_TOKEN */ + YYSYMBOL_H5T_VLEN_TOKEN = 72, /* H5T_VLEN_TOKEN */ + YYSYMBOL_H5T_COMPLEX_TOKEN = 73, /* H5T_COMPLEX_TOKEN */ + YYSYMBOL_STRING = 74, /* STRING */ + YYSYMBOL_NUMBER = 75, /* NUMBER */ + YYSYMBOL_76_ = 76, /* '{' */ + YYSYMBOL_77_ = 77, /* '}' */ + YYSYMBOL_78_ = 78, /* '[' */ + YYSYMBOL_79_ = 79, /* ']' */ + YYSYMBOL_80_ = 80, /* ':' */ + YYSYMBOL_81_ = 81, /* ';' */ + YYSYMBOL_YYACCEPT = 82, /* $accept */ + YYSYMBOL_start = 83, /* start */ + YYSYMBOL_ddl_type = 84, /* ddl_type */ + YYSYMBOL_atomic_type = 85, /* atomic_type */ + YYSYMBOL_integer_type = 86, /* integer_type */ + YYSYMBOL_fp_type = 87, /* fp_type */ + YYSYMBOL_compound_type = 88, /* compound_type */ + YYSYMBOL_89_1 = 89, /* $@1 */ + YYSYMBOL_memb_list = 90, /* memb_list */ + YYSYMBOL_memb_def = 91, /* memb_def */ + YYSYMBOL_92_2 = 92, /* $@2 */ + YYSYMBOL_field_name = 93, /* field_name */ + YYSYMBOL_field_offset = 94, /* field_offset */ + YYSYMBOL_offset = 95, /* offset */ + YYSYMBOL_array_type = 96, /* array_type */ + YYSYMBOL_97_3 = 97, /* $@3 */ + YYSYMBOL_dim_list = 98, /* dim_list */ + YYSYMBOL_dim = 99, /* dim */ + YYSYMBOL_100_4 = 100, /* $@4 */ + YYSYMBOL_101_5 = 101, /* $@5 */ + YYSYMBOL_dimsize = 102, /* dimsize */ + YYSYMBOL_vlen_type = 103, /* vlen_type */ + YYSYMBOL_complex_type = 104, /* complex_type */ + YYSYMBOL_opaque_type = 105, /* opaque_type */ + YYSYMBOL_106_6 = 106, /* @6 */ + YYSYMBOL_107_7 = 107, /* $@7 */ + YYSYMBOL_opaque_size = 108, /* opaque_size */ + YYSYMBOL_opaque_tag = 109, /* opaque_tag */ + YYSYMBOL_string_type = 110, /* string_type */ + YYSYMBOL_111_8 = 111, /* $@8 */ + YYSYMBOL_112_9 = 112, /* $@9 */ + YYSYMBOL_113_10 = 113, /* $@10 */ + YYSYMBOL_114_11 = 114, /* @11 */ + YYSYMBOL_strsize = 115, /* strsize */ + YYSYMBOL_strpad = 116, /* strpad */ + YYSYMBOL_cset = 117, /* cset */ + YYSYMBOL_ctype = 118, /* ctype */ + YYSYMBOL_enum_type = 119, /* enum_type */ + YYSYMBOL_120_12 = 120, /* $@12 */ + YYSYMBOL_enum_list = 121, /* enum_list */ + YYSYMBOL_enum_def = 122, /* enum_def */ + YYSYMBOL_123_13 = 123, /* $@13 */ + YYSYMBOL_enum_symbol = 124, /* enum_symbol */ + YYSYMBOL_enum_val = 125 /* enum_val */ }; typedef enum yysymbol_kind_t yysymbol_kind_t; @@ -630,21 +632,21 @@ union yyalloc #endif /* !YYCOPY_NEEDED */ /* YYFINAL -- State number of the termination state. */ -#define YYFINAL 75 +#define YYFINAL 77 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 245 +#define YYLAST 251 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 80 +#define YYNTOKENS 82 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 44 /* YYNRULES -- Number of rules. */ -#define YYNRULES 108 +#define YYNRULES 110 /* YYNSTATES -- Number of states. */ -#define YYNSTATES 153 +#define YYNSTATES 155 /* YYMAXUTOK -- Last valid token kind. */ -#define YYMAXUTOK 328 +#define YYMAXUTOK 330 /* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM @@ -663,14 +665,14 @@ static const yytype_int8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 78, 79, + 2, 2, 2, 2, 2, 2, 2, 2, 80, 81, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 76, 2, 77, 2, 2, 2, 2, 2, 2, + 2, 78, 2, 79, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 74, 2, 75, 2, 2, 2, 2, + 2, 2, 2, 76, 2, 77, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -690,24 +692,26 @@ static const yytype_int8 yytranslate[] = 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, - 65, 66, 67, 68, 69, 70, 71, 72, 73 + 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, + 75 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_int16 yyrline[] = { - 0, 109, 109, 110, 112, 113, 114, 115, 116, 118, - 119, 120, 121, 122, 125, 126, 127, 128, 129, 130, - 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, - 151, 154, 155, 156, 157, 158, 159, 160, 161, 162, - 163, 164, 165, 169, 168, 177, 178, 180, 180, 217, - 225, 226, 229, 231, 231, 240, 241, 243, 244, 243, - 251, 254, 258, 259, 260, 261, 262, 263, 264, 265, - 266, 267, 274, 279, 271, 286, 288, 293, 300, 309, - 316, 290, 340, 341, 343, 344, 345, 347, 348, 350, - 351, 355, 354, 359, 360, 362, 362, 412, 414 + 0, 110, 110, 111, 113, 114, 115, 116, 117, 119, + 120, 121, 122, 123, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, + 152, 155, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 165, 166, 167, 168, 172, 171, 180, 181, 183, + 183, 220, 228, 229, 232, 234, 234, 243, 244, 246, + 247, 246, 254, 257, 261, 262, 263, 264, 265, 266, + 267, 268, 269, 270, 277, 282, 274, 289, 291, 296, + 303, 312, 319, 293, 343, 344, 346, 347, 348, 350, + 351, 353, 354, 358, 357, 362, 363, 365, 365, 415, + 417 }; #endif @@ -738,6 +742,7 @@ static const char *const yytname[] = "H5T_IEEE_F16LE_TOKEN", "H5T_IEEE_F32BE_TOKEN", "H5T_IEEE_F32LE_TOKEN", "H5T_IEEE_F64BE_TOKEN", "H5T_IEEE_F64LE_TOKEN", "H5T_FLOAT_BFLOAT16BE_TOKEN", "H5T_FLOAT_BFLOAT16LE_TOKEN", + "H5T_FLOAT_F8E4M3_TOKEN", "H5T_FLOAT_F8E5M2_TOKEN", "H5T_NATIVE_FLOAT16_TOKEN", "H5T_NATIVE_FLOAT_TOKEN", "H5T_NATIVE_DOUBLE_TOKEN", "H5T_NATIVE_LDOUBLE_TOKEN", "H5T_COMPLEX_IEEE_F16BE_TOKEN", "H5T_COMPLEX_IEEE_F16LE_TOKEN", @@ -783,22 +788,22 @@ yysymbol_name (yysymbol_kind_t yysymbol) STATE-NUM. */ static const yytype_int16 yypact[] = { - 144, -24, -24, -24, -24, -24, -24, -24, -24, -24, + 148, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, -24, -21, - -15, -24, -14, -24, -4, -2, 123, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, 72, 60, - 53, 213, 54, 144, 144, -24, 70, 56, -24, 51, - -24, 57, 58, -24, -24, 52, -24, 55, 71, -24, - -3, -24, -24, -24, -24, -24, -24, -24, -24, -24, - 61, -24, 84, 78, 73, -23, 124, -24, -1, 126, - -24, 118, -24, -24, -24, -24, -24, -24, -24, -24, - -24, 120, -24, 121, 128, 125, 129, 130, -24, -24, - -24, -24, -24, -24, 127, -24, 149, 134, -24, -10, - -24, -24, -24, 131, -24, 150, 0, -24, -24, 164, - -24, 169, -24 + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -21, -15, -24, -14, -24, -4, -2, 127, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + 74, 62, 55, 219, 56, 148, 148, -24, 72, 58, + -24, 53, -24, 59, 60, -24, -24, 54, -24, 57, + 73, -24, -3, -24, -24, -24, -24, -24, -24, -24, + -24, -24, 63, -24, 86, 80, 75, -23, 128, -24, + -1, 130, -24, 122, -24, -24, -24, -24, -24, -24, + -24, -24, -24, 124, -24, 125, 132, 129, 133, 134, + -24, -24, -24, -24, -24, -24, 131, -24, 153, 138, + -24, -10, -24, -24, -24, 135, -24, 154, 0, -24, + -24, 168, -24, 173, -24 }; /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. @@ -810,24 +815,24 @@ static const yytype_int8 yydefact[] = 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 76, 75, 78, 77, 80, 79, 72, 73, 74, 0, - 0, 53, 0, 63, 0, 0, 0, 3, 4, 9, - 10, 5, 6, 7, 8, 13, 11, 12, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 55, 0, - 65, 0, 0, 92, 93, 0, 85, 0, 0, 101, - 0, 71, 81, 87, 82, 54, 57, 56, 103, 67, - 0, 66, 0, 0, 0, 0, 0, 64, 0, 0, - 59, 60, 107, 102, 104, 105, 70, 68, 94, 95, - 96, 0, 86, 0, 0, 0, 0, 0, 88, 83, - 62, 61, 58, 108, 0, 69, 0, 0, 106, 0, - 84, 97, 98, 0, 89, 0, 0, 99, 100, 0, - 90, 0, 91 + 53, 54, 78, 77, 80, 79, 82, 81, 74, 75, + 76, 0, 0, 55, 0, 65, 0, 0, 0, 3, + 4, 9, 10, 5, 6, 7, 8, 13, 11, 12, + 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, + 57, 0, 67, 0, 0, 94, 95, 0, 87, 0, + 0, 103, 0, 73, 83, 89, 84, 56, 59, 58, + 105, 69, 0, 68, 0, 0, 0, 0, 0, 66, + 0, 0, 61, 62, 109, 104, 106, 107, 72, 70, + 96, 97, 98, 0, 88, 0, 0, 0, 0, 0, + 90, 85, 64, 63, 60, 110, 0, 71, 0, 0, + 108, 0, 86, 99, 100, 0, 91, 0, 0, 101, + 102, 0, 92, 0, 93 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -24, -24, -19, -24, 174, -24, -24, -24, -24, -24, + -24, -24, -19, -24, 178, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, @@ -837,11 +842,11 @@ static const yytype_int16 yypgoto[] = /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_uint8 yydefgoto[] = { - 0, 56, 57, 58, 59, 60, 61, 70, 88, 97, - 104, 111, 125, 131, 62, 72, 90, 101, 106, 127, - 117, 63, 64, 65, 103, 137, 87, 123, 66, 102, - 136, 145, 151, 85, 121, 143, 149, 67, 98, 105, - 114, 126, 115, 134 + 0, 58, 59, 60, 61, 62, 63, 72, 90, 99, + 106, 113, 127, 133, 64, 74, 92, 103, 108, 129, + 119, 65, 66, 67, 105, 139, 89, 125, 68, 104, + 138, 147, 153, 87, 123, 145, 151, 69, 100, 107, + 116, 128, 117, 136 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -853,27 +858,28 @@ static const yytype_uint8 yytable[] = 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 112, - 141, 142, 113, 68, 81, 82, 118, 119, 120, 69, - 71, 50, 147, 148, 51, 52, 53, 54, 55, 96, - 73, 100, 74, 99, 1, 2, 3, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, - 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, - 47, 48, 49, 75, 76, 77, 83, 78, 80, 86, - 89, 93, 91, 92, 94, 50, 107, 108, 51, 52, - 53, 54, 55, 84, 109, 110, 95, 1, 2, 3, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 124, 116, 122, 128, - 129, 130, 133, 139, 132, 146, 138, 135, 50, 140, - 144, 51, 52, 53, 54, 55, 1, 2, 3, 4, + 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, + 51, 114, 143, 144, 115, 70, 83, 84, 120, 121, + 122, 71, 73, 52, 149, 150, 53, 54, 55, 56, + 57, 98, 75, 102, 76, 101, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 150, 152, 79 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49, 50, 51, 77, 78, 79, + 85, 80, 82, 88, 91, 95, 93, 94, 96, 52, + 109, 110, 53, 54, 55, 56, 57, 86, 111, 112, + 97, 1, 2, 3, 4, 5, 6, 7, 8, 9, + 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, + 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, + 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, + 50, 51, 126, 118, 124, 130, 131, 132, 135, 141, + 134, 148, 140, 137, 52, 142, 146, 53, 54, 55, + 56, 57, 1, 2, 3, 4, 5, 6, 7, 8, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 23, 24, 25, 26, 27, 152, + 154, 81 }; static const yytype_int8 yycheck[] = @@ -882,27 +888,28 @@ static const yytype_int8 yycheck[] = 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 72, - 60, 61, 75, 74, 73, 74, 57, 58, 59, 74, - 74, 64, 62, 63, 67, 68, 69, 70, 71, 88, - 74, 90, 74, 76, 3, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, - 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 50, 51, 0, 52, 65, 56, 74, 74, 73, - 79, 79, 75, 75, 79, 64, 75, 53, 67, 68, - 69, 70, 71, 73, 66, 72, 75, 3, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 78, 73, 72, 79, - 79, 73, 73, 54, 79, 55, 79, 77, 64, 75, - 79, 67, 68, 69, 70, 71, 3, 4, 5, 6, + 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, + 53, 74, 62, 63, 77, 76, 75, 76, 59, 60, + 61, 76, 76, 66, 64, 65, 69, 70, 71, 72, + 73, 90, 76, 92, 76, 78, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 79, 75, 71 + 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 47, 48, 49, 50, 51, 52, 53, 0, 54, 67, + 58, 76, 76, 75, 81, 81, 77, 77, 81, 66, + 77, 55, 69, 70, 71, 72, 73, 75, 68, 74, + 77, 3, 4, 5, 6, 7, 8, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, + 52, 53, 80, 75, 74, 81, 81, 75, 75, 56, + 81, 57, 81, 79, 66, 77, 81, 69, 70, 71, + 72, 73, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 81, + 77, 73 }; /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of @@ -914,33 +921,34 @@ static const yytype_int8 yystos[] = 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 64, 67, 68, 69, 70, 71, 81, 82, 83, 84, - 85, 86, 94, 101, 102, 103, 108, 117, 74, 74, - 87, 74, 95, 74, 74, 0, 52, 65, 74, 84, - 74, 82, 82, 56, 73, 113, 73, 106, 88, 79, - 96, 75, 75, 79, 79, 75, 82, 89, 118, 76, - 82, 97, 109, 104, 90, 119, 98, 75, 53, 66, - 72, 91, 72, 75, 120, 122, 73, 100, 57, 58, - 59, 114, 72, 107, 78, 92, 121, 99, 79, 79, - 73, 93, 79, 73, 123, 77, 110, 105, 79, 54, - 75, 60, 61, 115, 79, 111, 55, 62, 63, 116, - 79, 112, 75 + 52, 53, 66, 69, 70, 71, 72, 73, 83, 84, + 85, 86, 87, 88, 96, 103, 104, 105, 110, 119, + 76, 76, 89, 76, 97, 76, 76, 0, 54, 67, + 76, 86, 76, 84, 84, 58, 75, 115, 75, 108, + 90, 81, 98, 77, 77, 81, 81, 77, 84, 91, + 120, 78, 84, 99, 111, 106, 92, 121, 100, 77, + 55, 68, 74, 93, 74, 77, 122, 124, 75, 102, + 59, 60, 61, 116, 74, 109, 80, 94, 123, 101, + 81, 81, 75, 95, 81, 75, 125, 79, 112, 107, + 81, 56, 77, 62, 63, 117, 81, 113, 57, 64, + 65, 118, 81, 114, 77 }; /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ static const yytype_int8 yyr1[] = { - 0, 80, 81, 81, 82, 82, 82, 82, 82, 83, - 83, 83, 83, 83, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, - 84, 85, 85, 85, 85, 85, 85, 85, 85, 85, - 85, 85, 85, 87, 86, 88, 88, 90, 89, 91, - 92, 92, 93, 95, 94, 96, 96, 98, 99, 97, - 100, 101, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 104, 105, 103, 106, 107, 109, 110, 111, - 112, 108, 113, 113, 114, 114, 114, 115, 115, 116, - 116, 118, 117, 119, 119, 121, 120, 122, 123 + 0, 82, 83, 83, 84, 84, 84, 84, 84, 85, + 85, 85, 85, 85, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 89, 88, 90, 90, 92, + 91, 93, 94, 94, 95, 97, 96, 98, 98, 100, + 101, 99, 102, 103, 104, 104, 104, 104, 104, 104, + 104, 104, 104, 104, 106, 107, 105, 108, 109, 111, + 112, 113, 114, 110, 115, 115, 116, 116, 116, 117, + 117, 118, 118, 120, 119, 121, 121, 123, 122, 124, + 125 }; /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ @@ -951,12 +959,13 @@ static const yytype_int8 yyr2[] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 5, 0, 2, 0, 5, 1, - 0, 2, 1, 0, 6, 0, 2, 0, 0, 5, - 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 0, 0, 11, 1, 1, 0, 0, 0, - 0, 19, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 7, 0, 2, 0, 4, 1, 1 + 1, 1, 1, 1, 1, 0, 5, 0, 2, 0, + 5, 1, 0, 2, 1, 0, 6, 0, 2, 0, + 0, 5, 1, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 0, 0, 11, 1, 1, 0, + 0, 0, 0, 19, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 7, 0, 2, 0, 4, 1, + 1 }; @@ -1420,275 +1429,287 @@ yyparse (void) switch (yyn) { case 2: /* start: %empty */ -#line 109 "hl/src//H5LTparse.y" +#line 110 "hl/src//H5LTparse.y" { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } -#line 1397 "hl/src//H5LTparse.c" +#line 1406 "hl/src//H5LTparse.c" break; case 3: /* start: ddl_type */ -#line 110 "hl/src//H5LTparse.y" +#line 111 "hl/src//H5LTparse.y" { return (yyval.hid);} -#line 1403 "hl/src//H5LTparse.c" +#line 1412 "hl/src//H5LTparse.c" break; case 14: /* integer_type: H5T_STD_I8BE_TOKEN */ -#line 125 "hl/src//H5LTparse.y" +#line 126 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8BE); } -#line 1409 "hl/src//H5LTparse.c" +#line 1418 "hl/src//H5LTparse.c" break; case 15: /* integer_type: H5T_STD_I8LE_TOKEN */ -#line 126 "hl/src//H5LTparse.y" +#line 127 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I8LE); } -#line 1415 "hl/src//H5LTparse.c" +#line 1424 "hl/src//H5LTparse.c" break; case 16: /* integer_type: H5T_STD_I16BE_TOKEN */ -#line 127 "hl/src//H5LTparse.y" +#line 128 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16BE); } -#line 1421 "hl/src//H5LTparse.c" +#line 1430 "hl/src//H5LTparse.c" break; case 17: /* integer_type: H5T_STD_I16LE_TOKEN */ -#line 128 "hl/src//H5LTparse.y" +#line 129 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I16LE); } -#line 1427 "hl/src//H5LTparse.c" +#line 1436 "hl/src//H5LTparse.c" break; case 18: /* integer_type: H5T_STD_I32BE_TOKEN */ -#line 129 "hl/src//H5LTparse.y" +#line 130 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32BE); } -#line 1433 "hl/src//H5LTparse.c" +#line 1442 "hl/src//H5LTparse.c" break; case 19: /* integer_type: H5T_STD_I32LE_TOKEN */ -#line 130 "hl/src//H5LTparse.y" +#line 131 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I32LE); } -#line 1439 "hl/src//H5LTparse.c" +#line 1448 "hl/src//H5LTparse.c" break; case 20: /* integer_type: H5T_STD_I64BE_TOKEN */ -#line 131 "hl/src//H5LTparse.y" +#line 132 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64BE); } -#line 1445 "hl/src//H5LTparse.c" +#line 1454 "hl/src//H5LTparse.c" break; case 21: /* integer_type: H5T_STD_I64LE_TOKEN */ -#line 132 "hl/src//H5LTparse.y" +#line 133 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_I64LE); } -#line 1451 "hl/src//H5LTparse.c" +#line 1460 "hl/src//H5LTparse.c" break; case 22: /* integer_type: H5T_STD_U8BE_TOKEN */ -#line 133 "hl/src//H5LTparse.y" +#line 134 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8BE); } -#line 1457 "hl/src//H5LTparse.c" +#line 1466 "hl/src//H5LTparse.c" break; case 23: /* integer_type: H5T_STD_U8LE_TOKEN */ -#line 134 "hl/src//H5LTparse.y" +#line 135 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U8LE); } -#line 1463 "hl/src//H5LTparse.c" +#line 1472 "hl/src//H5LTparse.c" break; case 24: /* integer_type: H5T_STD_U16BE_TOKEN */ -#line 135 "hl/src//H5LTparse.y" +#line 136 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16BE); } -#line 1469 "hl/src//H5LTparse.c" +#line 1478 "hl/src//H5LTparse.c" break; case 25: /* integer_type: H5T_STD_U16LE_TOKEN */ -#line 136 "hl/src//H5LTparse.y" +#line 137 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U16LE); } -#line 1475 "hl/src//H5LTparse.c" +#line 1484 "hl/src//H5LTparse.c" break; case 26: /* integer_type: H5T_STD_U32BE_TOKEN */ -#line 137 "hl/src//H5LTparse.y" +#line 138 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32BE); } -#line 1481 "hl/src//H5LTparse.c" +#line 1490 "hl/src//H5LTparse.c" break; case 27: /* integer_type: H5T_STD_U32LE_TOKEN */ -#line 138 "hl/src//H5LTparse.y" +#line 139 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U32LE); } -#line 1487 "hl/src//H5LTparse.c" +#line 1496 "hl/src//H5LTparse.c" break; case 28: /* integer_type: H5T_STD_U64BE_TOKEN */ -#line 139 "hl/src//H5LTparse.y" +#line 140 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64BE); } -#line 1493 "hl/src//H5LTparse.c" +#line 1502 "hl/src//H5LTparse.c" break; case 29: /* integer_type: H5T_STD_U64LE_TOKEN */ -#line 140 "hl/src//H5LTparse.y" +#line 141 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_STD_U64LE); } -#line 1499 "hl/src//H5LTparse.c" +#line 1508 "hl/src//H5LTparse.c" break; case 30: /* integer_type: H5T_NATIVE_CHAR_TOKEN */ -#line 141 "hl/src//H5LTparse.y" +#line 142 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_CHAR); } -#line 1505 "hl/src//H5LTparse.c" +#line 1514 "hl/src//H5LTparse.c" break; case 31: /* integer_type: H5T_NATIVE_SCHAR_TOKEN */ -#line 142 "hl/src//H5LTparse.y" +#line 143 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SCHAR); } -#line 1511 "hl/src//H5LTparse.c" +#line 1520 "hl/src//H5LTparse.c" break; case 32: /* integer_type: H5T_NATIVE_UCHAR_TOKEN */ -#line 143 "hl/src//H5LTparse.y" +#line 144 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UCHAR); } -#line 1517 "hl/src//H5LTparse.c" +#line 1526 "hl/src//H5LTparse.c" break; case 33: /* integer_type: H5T_NATIVE_SHORT_TOKEN */ -#line 144 "hl/src//H5LTparse.y" +#line 145 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_SHORT); } -#line 1523 "hl/src//H5LTparse.c" +#line 1532 "hl/src//H5LTparse.c" break; case 34: /* integer_type: H5T_NATIVE_USHORT_TOKEN */ -#line 145 "hl/src//H5LTparse.y" +#line 146 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_USHORT); } -#line 1529 "hl/src//H5LTparse.c" +#line 1538 "hl/src//H5LTparse.c" break; case 35: /* integer_type: H5T_NATIVE_INT_TOKEN */ -#line 146 "hl/src//H5LTparse.y" +#line 147 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_INT); } -#line 1535 "hl/src//H5LTparse.c" +#line 1544 "hl/src//H5LTparse.c" break; case 36: /* integer_type: H5T_NATIVE_UINT_TOKEN */ -#line 147 "hl/src//H5LTparse.y" +#line 148 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_UINT); } -#line 1541 "hl/src//H5LTparse.c" +#line 1550 "hl/src//H5LTparse.c" break; case 37: /* integer_type: H5T_NATIVE_LONG_TOKEN */ -#line 148 "hl/src//H5LTparse.y" +#line 149 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LONG); } -#line 1547 "hl/src//H5LTparse.c" +#line 1556 "hl/src//H5LTparse.c" break; case 38: /* integer_type: H5T_NATIVE_ULONG_TOKEN */ -#line 149 "hl/src//H5LTparse.y" +#line 150 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULONG); } -#line 1553 "hl/src//H5LTparse.c" +#line 1562 "hl/src//H5LTparse.c" break; case 39: /* integer_type: H5T_NATIVE_LLONG_TOKEN */ -#line 150 "hl/src//H5LTparse.y" +#line 151 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LLONG); } -#line 1559 "hl/src//H5LTparse.c" +#line 1568 "hl/src//H5LTparse.c" break; case 40: /* integer_type: H5T_NATIVE_ULLONG_TOKEN */ -#line 151 "hl/src//H5LTparse.y" +#line 152 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_ULLONG); } -#line 1565 "hl/src//H5LTparse.c" +#line 1574 "hl/src//H5LTparse.c" break; case 41: /* fp_type: H5T_IEEE_F16BE_TOKEN */ -#line 154 "hl/src//H5LTparse.y" +#line 155 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F16BE); } -#line 1571 "hl/src//H5LTparse.c" +#line 1580 "hl/src//H5LTparse.c" break; case 42: /* fp_type: H5T_IEEE_F16LE_TOKEN */ -#line 155 "hl/src//H5LTparse.y" +#line 156 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F16LE); } -#line 1577 "hl/src//H5LTparse.c" +#line 1586 "hl/src//H5LTparse.c" break; case 43: /* fp_type: H5T_IEEE_F32BE_TOKEN */ -#line 156 "hl/src//H5LTparse.y" +#line 157 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32BE); } -#line 1583 "hl/src//H5LTparse.c" +#line 1592 "hl/src//H5LTparse.c" break; case 44: /* fp_type: H5T_IEEE_F32LE_TOKEN */ -#line 157 "hl/src//H5LTparse.y" +#line 158 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F32LE); } -#line 1589 "hl/src//H5LTparse.c" +#line 1598 "hl/src//H5LTparse.c" break; case 45: /* fp_type: H5T_IEEE_F64BE_TOKEN */ -#line 158 "hl/src//H5LTparse.y" +#line 159 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64BE); } -#line 1595 "hl/src//H5LTparse.c" +#line 1604 "hl/src//H5LTparse.c" break; case 46: /* fp_type: H5T_IEEE_F64LE_TOKEN */ -#line 159 "hl/src//H5LTparse.y" +#line 160 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_IEEE_F64LE); } -#line 1601 "hl/src//H5LTparse.c" +#line 1610 "hl/src//H5LTparse.c" break; case 47: /* fp_type: H5T_FLOAT_BFLOAT16BE_TOKEN */ -#line 160 "hl/src//H5LTparse.y" +#line 161 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_FLOAT_BFLOAT16BE); } -#line 1607 "hl/src//H5LTparse.c" +#line 1616 "hl/src//H5LTparse.c" break; case 48: /* fp_type: H5T_FLOAT_BFLOAT16LE_TOKEN */ -#line 161 "hl/src//H5LTparse.y" +#line 162 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_FLOAT_BFLOAT16LE); } -#line 1613 "hl/src//H5LTparse.c" +#line 1622 "hl/src//H5LTparse.c" break; - case 49: /* fp_type: H5T_NATIVE_FLOAT16_TOKEN */ -#line 162 "hl/src//H5LTparse.y" + case 49: /* fp_type: H5T_FLOAT_F8E4M3_TOKEN */ +#line 163 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_FLOAT_F8E4M3); } +#line 1628 "hl/src//H5LTparse.c" + break; + + case 50: /* fp_type: H5T_FLOAT_F8E5M2_TOKEN */ +#line 164 "hl/src//H5LTparse.y" + { (yyval.hid) = H5Tcopy(H5T_FLOAT_F8E5M2); } +#line 1634 "hl/src//H5LTparse.c" + break; + + case 51: /* fp_type: H5T_NATIVE_FLOAT16_TOKEN */ +#line 165 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT16); } -#line 1619 "hl/src//H5LTparse.c" +#line 1640 "hl/src//H5LTparse.c" break; - case 50: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ -#line 163 "hl/src//H5LTparse.y" + case 52: /* fp_type: H5T_NATIVE_FLOAT_TOKEN */ +#line 166 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT); } -#line 1625 "hl/src//H5LTparse.c" +#line 1646 "hl/src//H5LTparse.c" break; - case 51: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ -#line 164 "hl/src//H5LTparse.y" + case 53: /* fp_type: H5T_NATIVE_DOUBLE_TOKEN */ +#line 167 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE); } -#line 1631 "hl/src//H5LTparse.c" +#line 1652 "hl/src//H5LTparse.c" break; - case 52: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ -#line 165 "hl/src//H5LTparse.y" + case 54: /* fp_type: H5T_NATIVE_LDOUBLE_TOKEN */ +#line 168 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE); } -#line 1637 "hl/src//H5LTparse.c" +#line 1658 "hl/src//H5LTparse.c" break; - case 53: /* $@1: %empty */ -#line 169 "hl/src//H5LTparse.y" + case 55: /* $@1: %empty */ +#line 172 "hl/src//H5LTparse.y" { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } -#line 1643 "hl/src//H5LTparse.c" +#line 1664 "hl/src//H5LTparse.c" break; - case 54: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ -#line 171 "hl/src//H5LTparse.y" + case 56: /* compound_type: H5T_COMPOUND_TOKEN $@1 '{' memb_list '}' */ +#line 174 "hl/src//H5LTparse.y" { (yyval.hid) = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; cmpd_stack[csindex].first_memb = 1; csindex--; } -#line 1653 "hl/src//H5LTparse.c" +#line 1674 "hl/src//H5LTparse.c" break; - case 57: /* $@2: %empty */ -#line 180 "hl/src//H5LTparse.y" + case 59: /* $@2: %empty */ +#line 183 "hl/src//H5LTparse.y" { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } -#line 1659 "hl/src//H5LTparse.c" +#line 1680 "hl/src//H5LTparse.c" break; - case 58: /* memb_def: ddl_type $@2 field_name field_offset ';' */ -#line 182 "hl/src//H5LTparse.y" + case 60: /* memb_def: ddl_type $@2 field_name field_offset ';' */ +#line 185 "hl/src//H5LTparse.y" { size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -1723,168 +1744,168 @@ yyparse (void) new_size = H5Tget_size(dtype_id); } -#line 1698 "hl/src//H5LTparse.c" +#line 1719 "hl/src//H5LTparse.c" break; - case 59: /* field_name: STRING */ -#line 218 "hl/src//H5LTparse.y" + case 61: /* field_name: STRING */ +#line 221 "hl/src//H5LTparse.y" { (yyval.sval) = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1708 "hl/src//H5LTparse.c" +#line 1729 "hl/src//H5LTparse.c" break; - case 60: /* field_offset: %empty */ -#line 225 "hl/src//H5LTparse.y" + case 62: /* field_offset: %empty */ +#line 228 "hl/src//H5LTparse.y" { (yyval.ival) = 0; } -#line 1714 "hl/src//H5LTparse.c" +#line 1735 "hl/src//H5LTparse.c" break; - case 61: /* field_offset: ':' offset */ -#line 227 "hl/src//H5LTparse.y" + case 63: /* field_offset: ':' offset */ +#line 230 "hl/src//H5LTparse.y" { (yyval.ival) = yylval.ival; } -#line 1720 "hl/src//H5LTparse.c" +#line 1741 "hl/src//H5LTparse.c" break; - case 63: /* $@3: %empty */ -#line 231 "hl/src//H5LTparse.y" + case 65: /* $@3: %empty */ +#line 234 "hl/src//H5LTparse.y" { asindex++; /*pushd onto the stack*/ } -#line 1726 "hl/src//H5LTparse.c" +#line 1747 "hl/src//H5LTparse.c" break; - case 64: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ -#line 233 "hl/src//H5LTparse.y" + case 66: /* array_type: H5T_ARRAY_TOKEN $@3 '{' dim_list ddl_type '}' */ +#line 236 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tarray_create2((yyvsp[-1].hid), arr_stack[asindex].ndims, arr_stack[asindex].dims); arr_stack[asindex].ndims = 0; asindex--; H5Tclose((yyvsp[-1].hid)); } -#line 1737 "hl/src//H5LTparse.c" +#line 1758 "hl/src//H5LTparse.c" break; - case 67: /* $@4: %empty */ -#line 243 "hl/src//H5LTparse.y" + case 69: /* $@4: %empty */ +#line 246 "hl/src//H5LTparse.y" { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } -#line 1743 "hl/src//H5LTparse.c" +#line 1764 "hl/src//H5LTparse.c" break; - case 68: /* $@5: %empty */ -#line 244 "hl/src//H5LTparse.y" + case 70: /* $@5: %empty */ +#line 247 "hl/src//H5LTparse.y" { unsigned ndims = arr_stack[asindex].ndims; arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; arr_stack[asindex].is_dim = 0; } -#line 1753 "hl/src//H5LTparse.c" +#line 1774 "hl/src//H5LTparse.c" break; - case 71: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ -#line 255 "hl/src//H5LTparse.y" + case 73: /* vlen_type: H5T_VLEN_TOKEN '{' ddl_type '}' */ +#line 258 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tvlen_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1759 "hl/src//H5LTparse.c" +#line 1780 "hl/src//H5LTparse.c" break; - case 72: /* complex_type: H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ -#line 258 "hl/src//H5LTparse.y" + case 74: /* complex_type: H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ +#line 261 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_FLOAT_COMPLEX); } -#line 1765 "hl/src//H5LTparse.c" +#line 1786 "hl/src//H5LTparse.c" break; - case 73: /* complex_type: H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ -#line 259 "hl/src//H5LTparse.y" + case 75: /* complex_type: H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ +#line 262 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_DOUBLE_COMPLEX); } -#line 1771 "hl/src//H5LTparse.c" +#line 1792 "hl/src//H5LTparse.c" break; - case 74: /* complex_type: H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ -#line 260 "hl/src//H5LTparse.y" + case 76: /* complex_type: H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ +#line 263 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_NATIVE_LDOUBLE_COMPLEX); } -#line 1777 "hl/src//H5LTparse.c" +#line 1798 "hl/src//H5LTparse.c" break; - case 75: /* complex_type: H5T_COMPLEX_IEEE_F16LE_TOKEN */ -#line 261 "hl/src//H5LTparse.y" + case 77: /* complex_type: H5T_COMPLEX_IEEE_F16LE_TOKEN */ +#line 264 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F16LE); } -#line 1783 "hl/src//H5LTparse.c" +#line 1804 "hl/src//H5LTparse.c" break; - case 76: /* complex_type: H5T_COMPLEX_IEEE_F16BE_TOKEN */ -#line 262 "hl/src//H5LTparse.y" + case 78: /* complex_type: H5T_COMPLEX_IEEE_F16BE_TOKEN */ +#line 265 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F16BE); } -#line 1789 "hl/src//H5LTparse.c" +#line 1810 "hl/src//H5LTparse.c" break; - case 77: /* complex_type: H5T_COMPLEX_IEEE_F32LE_TOKEN */ -#line 263 "hl/src//H5LTparse.y" + case 79: /* complex_type: H5T_COMPLEX_IEEE_F32LE_TOKEN */ +#line 266 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F32LE); } -#line 1795 "hl/src//H5LTparse.c" +#line 1816 "hl/src//H5LTparse.c" break; - case 78: /* complex_type: H5T_COMPLEX_IEEE_F32BE_TOKEN */ -#line 264 "hl/src//H5LTparse.y" + case 80: /* complex_type: H5T_COMPLEX_IEEE_F32BE_TOKEN */ +#line 267 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F32BE); } -#line 1801 "hl/src//H5LTparse.c" +#line 1822 "hl/src//H5LTparse.c" break; - case 79: /* complex_type: H5T_COMPLEX_IEEE_F64LE_TOKEN */ -#line 265 "hl/src//H5LTparse.y" + case 81: /* complex_type: H5T_COMPLEX_IEEE_F64LE_TOKEN */ +#line 268 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F64LE); } -#line 1807 "hl/src//H5LTparse.c" +#line 1828 "hl/src//H5LTparse.c" break; - case 80: /* complex_type: H5T_COMPLEX_IEEE_F64BE_TOKEN */ -#line 266 "hl/src//H5LTparse.y" + case 82: /* complex_type: H5T_COMPLEX_IEEE_F64BE_TOKEN */ +#line 269 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcopy(H5T_COMPLEX_IEEE_F64BE); } -#line 1813 "hl/src//H5LTparse.c" +#line 1834 "hl/src//H5LTparse.c" break; - case 81: /* complex_type: H5T_COMPLEX_TOKEN '{' ddl_type '}' */ -#line 268 "hl/src//H5LTparse.y" + case 83: /* complex_type: H5T_COMPLEX_TOKEN '{' ddl_type '}' */ +#line 271 "hl/src//H5LTparse.y" { (yyval.hid) = H5Tcomplex_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1819 "hl/src//H5LTparse.c" +#line 1840 "hl/src//H5LTparse.c" break; - case 82: /* @6: %empty */ -#line 274 "hl/src//H5LTparse.y" + case 84: /* @6: %empty */ +#line 277 "hl/src//H5LTparse.y" { size_t size = (size_t)yylval.ival; (yyval.hid) = H5Tcreate(H5T_OPAQUE, size); } -#line 1828 "hl/src//H5LTparse.c" +#line 1849 "hl/src//H5LTparse.c" break; - case 83: /* $@7: %empty */ -#line 279 "hl/src//H5LTparse.y" + case 85: /* $@7: %empty */ +#line 282 "hl/src//H5LTparse.y" { H5Tset_tag((yyvsp[-3].hid), yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1838 "hl/src//H5LTparse.c" +#line 1859 "hl/src//H5LTparse.c" break; - case 84: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */ -#line 284 "hl/src//H5LTparse.y" + case 86: /* opaque_type: H5T_OPAQUE_TOKEN '{' OPQ_SIZE_TOKEN opaque_size ';' @6 OPQ_TAG_TOKEN opaque_tag ';' $@7 '}' */ +#line 287 "hl/src//H5LTparse.y" { (yyval.hid) = (yyvsp[-5].hid); } -#line 1844 "hl/src//H5LTparse.c" +#line 1865 "hl/src//H5LTparse.c" break; - case 87: /* $@8: %empty */ -#line 293 "hl/src//H5LTparse.y" + case 89: /* $@8: %empty */ +#line 296 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_VARIABLE_TOKEN) is_variable = 1; else str_size = yylval.ival; } -#line 1855 "hl/src//H5LTparse.c" +#line 1876 "hl/src//H5LTparse.c" break; - case 88: /* $@9: %empty */ -#line 300 "hl/src//H5LTparse.y" + case 90: /* $@9: %empty */ +#line 303 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; @@ -1893,33 +1914,33 @@ yyparse (void) else if((yyvsp[-1].ival) == H5T_STR_SPACEPAD_TOKEN) str_pad = H5T_STR_SPACEPAD; } -#line 1868 "hl/src//H5LTparse.c" +#line 1889 "hl/src//H5LTparse.c" break; - case 89: /* $@10: %empty */ -#line 309 "hl/src//H5LTparse.y" + case 91: /* $@10: %empty */ +#line 312 "hl/src//H5LTparse.y" { if((yyvsp[-1].ival) == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if((yyvsp[-1].ival) == H5T_CSET_UTF8_TOKEN) str_cset = H5T_CSET_UTF8; } -#line 1879 "hl/src//H5LTparse.c" +#line 1900 "hl/src//H5LTparse.c" break; - case 90: /* @11: %empty */ -#line 316 "hl/src//H5LTparse.y" + case 92: /* @11: %empty */ +#line 319 "hl/src//H5LTparse.y" { if((yyvsp[-1].hid) == H5T_C_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_C_S1); else if((yyvsp[-1].hid) == H5T_FORTRAN_S1_TOKEN) (yyval.hid) = H5Tcopy(H5T_FORTRAN_S1); } -#line 1890 "hl/src//H5LTparse.c" +#line 1911 "hl/src//H5LTparse.c" break; - case 91: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */ -#line 323 "hl/src//H5LTparse.y" + case 93: /* string_type: H5T_STRING_TOKEN '{' STRSIZE_TOKEN strsize ';' $@8 STRPAD_TOKEN strpad ';' $@9 CSET_TOKEN cset ';' $@10 CTYPE_TOKEN ctype ';' @11 '}' */ +#line 326 "hl/src//H5LTparse.y" { hid_t str_id = (yyvsp[-1].hid); @@ -1936,82 +1957,82 @@ yyparse (void) (yyval.hid) = str_id; } -#line 1911 "hl/src//H5LTparse.c" +#line 1932 "hl/src//H5LTparse.c" break; - case 92: /* strsize: H5T_VARIABLE_TOKEN */ -#line 340 "hl/src//H5LTparse.y" + case 94: /* strsize: H5T_VARIABLE_TOKEN */ +#line 343 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_VARIABLE_TOKEN;} -#line 1917 "hl/src//H5LTparse.c" +#line 1938 "hl/src//H5LTparse.c" break; - case 94: /* strpad: H5T_STR_NULLTERM_TOKEN */ -#line 343 "hl/src//H5LTparse.y" + case 96: /* strpad: H5T_STR_NULLTERM_TOKEN */ +#line 346 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_NULLTERM_TOKEN;} -#line 1923 "hl/src//H5LTparse.c" +#line 1944 "hl/src//H5LTparse.c" break; - case 95: /* strpad: H5T_STR_NULLPAD_TOKEN */ -#line 344 "hl/src//H5LTparse.y" + case 97: /* strpad: H5T_STR_NULLPAD_TOKEN */ +#line 347 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_NULLPAD_TOKEN;} -#line 1929 "hl/src//H5LTparse.c" +#line 1950 "hl/src//H5LTparse.c" break; - case 96: /* strpad: H5T_STR_SPACEPAD_TOKEN */ -#line 345 "hl/src//H5LTparse.y" + case 98: /* strpad: H5T_STR_SPACEPAD_TOKEN */ +#line 348 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_STR_SPACEPAD_TOKEN;} -#line 1935 "hl/src//H5LTparse.c" +#line 1956 "hl/src//H5LTparse.c" break; - case 97: /* cset: H5T_CSET_ASCII_TOKEN */ -#line 347 "hl/src//H5LTparse.y" + case 99: /* cset: H5T_CSET_ASCII_TOKEN */ +#line 350 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_CSET_ASCII_TOKEN;} -#line 1941 "hl/src//H5LTparse.c" +#line 1962 "hl/src//H5LTparse.c" break; - case 98: /* cset: H5T_CSET_UTF8_TOKEN */ -#line 348 "hl/src//H5LTparse.y" + case 100: /* cset: H5T_CSET_UTF8_TOKEN */ +#line 351 "hl/src//H5LTparse.y" {(yyval.ival) = H5T_CSET_UTF8_TOKEN;} -#line 1947 "hl/src//H5LTparse.c" +#line 1968 "hl/src//H5LTparse.c" break; - case 99: /* ctype: H5T_C_S1_TOKEN */ -#line 350 "hl/src//H5LTparse.y" + case 101: /* ctype: H5T_C_S1_TOKEN */ +#line 353 "hl/src//H5LTparse.y" {(yyval.hid) = H5T_C_S1_TOKEN;} -#line 1953 "hl/src//H5LTparse.c" +#line 1974 "hl/src//H5LTparse.c" break; - case 100: /* ctype: H5T_FORTRAN_S1_TOKEN */ -#line 351 "hl/src//H5LTparse.y" + case 102: /* ctype: H5T_FORTRAN_S1_TOKEN */ +#line 354 "hl/src//H5LTparse.y" {(yyval.hid) = H5T_FORTRAN_S1_TOKEN;} -#line 1959 "hl/src//H5LTparse.c" +#line 1980 "hl/src//H5LTparse.c" break; - case 101: /* $@12: %empty */ -#line 355 "hl/src//H5LTparse.y" + case 103: /* $@12: %empty */ +#line 358 "hl/src//H5LTparse.y" { is_enum = 1; enum_id = H5Tenum_create((yyvsp[-1].hid)); H5Tclose((yyvsp[-1].hid)); } -#line 1965 "hl/src//H5LTparse.c" +#line 1986 "hl/src//H5LTparse.c" break; - case 102: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */ -#line 357 "hl/src//H5LTparse.y" + case 104: /* enum_type: H5T_ENUM_TOKEN '{' integer_type ';' $@12 enum_list '}' */ +#line 360 "hl/src//H5LTparse.y" { is_enum = 0; /*reset*/ (yyval.hid) = enum_id; } -#line 1971 "hl/src//H5LTparse.c" +#line 1992 "hl/src//H5LTparse.c" break; - case 105: /* $@13: %empty */ -#line 362 "hl/src//H5LTparse.y" + case 107: /* $@13: %empty */ +#line 365 "hl/src//H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ enum_memb_symbol = strdup(yylval.sval); free(yylval.sval); yylval.sval = NULL; } -#line 1982 "hl/src//H5LTparse.c" +#line 2003 "hl/src//H5LTparse.c" break; - case 106: /* enum_def: enum_symbol $@13 enum_val ';' */ -#line 369 "hl/src//H5LTparse.y" + case 108: /* enum_def: enum_symbol $@13 enum_val ';' */ +#line 372 "hl/src//H5LTparse.y" { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -2054,11 +2075,11 @@ yyparse (void) H5Tclose(super); H5Tclose(native); } -#line 2029 "hl/src//H5LTparse.c" +#line 2050 "hl/src//H5LTparse.c" break; -#line 2033 "hl/src//H5LTparse.c" +#line 2054 "hl/src//H5LTparse.c" default: break; } diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 70aab7373bc..2df3383ebf2 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -89,42 +89,44 @@ extern int H5LTyydebug; H5T_IEEE_F64LE_TOKEN = 290, /* H5T_IEEE_F64LE_TOKEN */ H5T_FLOAT_BFLOAT16BE_TOKEN = 291, /* H5T_FLOAT_BFLOAT16BE_TOKEN */ H5T_FLOAT_BFLOAT16LE_TOKEN = 292, /* H5T_FLOAT_BFLOAT16LE_TOKEN */ - H5T_NATIVE_FLOAT16_TOKEN = 293, /* H5T_NATIVE_FLOAT16_TOKEN */ - H5T_NATIVE_FLOAT_TOKEN = 294, /* H5T_NATIVE_FLOAT_TOKEN */ - H5T_NATIVE_DOUBLE_TOKEN = 295, /* H5T_NATIVE_DOUBLE_TOKEN */ - H5T_NATIVE_LDOUBLE_TOKEN = 296, /* H5T_NATIVE_LDOUBLE_TOKEN */ - H5T_COMPLEX_IEEE_F16BE_TOKEN = 297, /* H5T_COMPLEX_IEEE_F16BE_TOKEN */ - H5T_COMPLEX_IEEE_F16LE_TOKEN = 298, /* H5T_COMPLEX_IEEE_F16LE_TOKEN */ - H5T_COMPLEX_IEEE_F32BE_TOKEN = 299, /* H5T_COMPLEX_IEEE_F32BE_TOKEN */ - H5T_COMPLEX_IEEE_F32LE_TOKEN = 300, /* H5T_COMPLEX_IEEE_F32LE_TOKEN */ - H5T_COMPLEX_IEEE_F64BE_TOKEN = 301, /* H5T_COMPLEX_IEEE_F64BE_TOKEN */ - H5T_COMPLEX_IEEE_F64LE_TOKEN = 302, /* H5T_COMPLEX_IEEE_F64LE_TOKEN */ - H5T_NATIVE_FLOAT_COMPLEX_TOKEN = 303, /* H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ - H5T_NATIVE_DOUBLE_COMPLEX_TOKEN = 304, /* H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ - H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN = 305, /* H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ - H5T_STRING_TOKEN = 306, /* H5T_STRING_TOKEN */ - STRSIZE_TOKEN = 307, /* STRSIZE_TOKEN */ - STRPAD_TOKEN = 308, /* STRPAD_TOKEN */ - CSET_TOKEN = 309, /* CSET_TOKEN */ - CTYPE_TOKEN = 310, /* CTYPE_TOKEN */ - H5T_VARIABLE_TOKEN = 311, /* H5T_VARIABLE_TOKEN */ - H5T_STR_NULLTERM_TOKEN = 312, /* H5T_STR_NULLTERM_TOKEN */ - H5T_STR_NULLPAD_TOKEN = 313, /* H5T_STR_NULLPAD_TOKEN */ - H5T_STR_SPACEPAD_TOKEN = 314, /* H5T_STR_SPACEPAD_TOKEN */ - H5T_CSET_ASCII_TOKEN = 315, /* H5T_CSET_ASCII_TOKEN */ - H5T_CSET_UTF8_TOKEN = 316, /* H5T_CSET_UTF8_TOKEN */ - H5T_C_S1_TOKEN = 317, /* H5T_C_S1_TOKEN */ - H5T_FORTRAN_S1_TOKEN = 318, /* H5T_FORTRAN_S1_TOKEN */ - H5T_OPAQUE_TOKEN = 319, /* H5T_OPAQUE_TOKEN */ - OPQ_SIZE_TOKEN = 320, /* OPQ_SIZE_TOKEN */ - OPQ_TAG_TOKEN = 321, /* OPQ_TAG_TOKEN */ - H5T_COMPOUND_TOKEN = 322, /* H5T_COMPOUND_TOKEN */ - H5T_ENUM_TOKEN = 323, /* H5T_ENUM_TOKEN */ - H5T_ARRAY_TOKEN = 324, /* H5T_ARRAY_TOKEN */ - H5T_VLEN_TOKEN = 325, /* H5T_VLEN_TOKEN */ - H5T_COMPLEX_TOKEN = 326, /* H5T_COMPLEX_TOKEN */ - STRING = 327, /* STRING */ - NUMBER = 328 /* NUMBER */ + H5T_FLOAT_F8E4M3_TOKEN = 293, /* H5T_FLOAT_F8E4M3_TOKEN */ + H5T_FLOAT_F8E5M2_TOKEN = 294, /* H5T_FLOAT_F8E5M2_TOKEN */ + H5T_NATIVE_FLOAT16_TOKEN = 295, /* H5T_NATIVE_FLOAT16_TOKEN */ + H5T_NATIVE_FLOAT_TOKEN = 296, /* H5T_NATIVE_FLOAT_TOKEN */ + H5T_NATIVE_DOUBLE_TOKEN = 297, /* H5T_NATIVE_DOUBLE_TOKEN */ + H5T_NATIVE_LDOUBLE_TOKEN = 298, /* H5T_NATIVE_LDOUBLE_TOKEN */ + H5T_COMPLEX_IEEE_F16BE_TOKEN = 299, /* H5T_COMPLEX_IEEE_F16BE_TOKEN */ + H5T_COMPLEX_IEEE_F16LE_TOKEN = 300, /* H5T_COMPLEX_IEEE_F16LE_TOKEN */ + H5T_COMPLEX_IEEE_F32BE_TOKEN = 301, /* H5T_COMPLEX_IEEE_F32BE_TOKEN */ + H5T_COMPLEX_IEEE_F32LE_TOKEN = 302, /* H5T_COMPLEX_IEEE_F32LE_TOKEN */ + H5T_COMPLEX_IEEE_F64BE_TOKEN = 303, /* H5T_COMPLEX_IEEE_F64BE_TOKEN */ + H5T_COMPLEX_IEEE_F64LE_TOKEN = 304, /* H5T_COMPLEX_IEEE_F64LE_TOKEN */ + H5T_NATIVE_FLOAT_COMPLEX_TOKEN = 305, /* H5T_NATIVE_FLOAT_COMPLEX_TOKEN */ + H5T_NATIVE_DOUBLE_COMPLEX_TOKEN = 306, /* H5T_NATIVE_DOUBLE_COMPLEX_TOKEN */ + H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN = 307, /* H5T_NATIVE_LDOUBLE_COMPLEX_TOKEN */ + H5T_STRING_TOKEN = 308, /* H5T_STRING_TOKEN */ + STRSIZE_TOKEN = 309, /* STRSIZE_TOKEN */ + STRPAD_TOKEN = 310, /* STRPAD_TOKEN */ + CSET_TOKEN = 311, /* CSET_TOKEN */ + CTYPE_TOKEN = 312, /* CTYPE_TOKEN */ + H5T_VARIABLE_TOKEN = 313, /* H5T_VARIABLE_TOKEN */ + H5T_STR_NULLTERM_TOKEN = 314, /* H5T_STR_NULLTERM_TOKEN */ + H5T_STR_NULLPAD_TOKEN = 315, /* H5T_STR_NULLPAD_TOKEN */ + H5T_STR_SPACEPAD_TOKEN = 316, /* H5T_STR_SPACEPAD_TOKEN */ + H5T_CSET_ASCII_TOKEN = 317, /* H5T_CSET_ASCII_TOKEN */ + H5T_CSET_UTF8_TOKEN = 318, /* H5T_CSET_UTF8_TOKEN */ + H5T_C_S1_TOKEN = 319, /* H5T_C_S1_TOKEN */ + H5T_FORTRAN_S1_TOKEN = 320, /* H5T_FORTRAN_S1_TOKEN */ + H5T_OPAQUE_TOKEN = 321, /* H5T_OPAQUE_TOKEN */ + OPQ_SIZE_TOKEN = 322, /* OPQ_SIZE_TOKEN */ + OPQ_TAG_TOKEN = 323, /* OPQ_TAG_TOKEN */ + H5T_COMPOUND_TOKEN = 324, /* H5T_COMPOUND_TOKEN */ + H5T_ENUM_TOKEN = 325, /* H5T_ENUM_TOKEN */ + H5T_ARRAY_TOKEN = 326, /* H5T_ARRAY_TOKEN */ + H5T_VLEN_TOKEN = 327, /* H5T_VLEN_TOKEN */ + H5T_COMPLEX_TOKEN = 328, /* H5T_COMPLEX_TOKEN */ + STRING = 329, /* STRING */ + NUMBER = 330 /* NUMBER */ }; typedef enum yytokentype yytoken_kind_t; #endif @@ -139,7 +141,7 @@ union YYSTYPE char *sval; /*for name string*/ hid_t hid; /*for hid_t token*/ -#line 143 "hl/src//H5LTparse.h" +#line 145 "hl/src//H5LTparse.h" }; typedef union YYSTYPE YYSTYPE; diff --git a/hl/src/H5LTparse.y b/hl/src/H5LTparse.y index 4c3db030656..c619eec765e 100644 --- a/hl/src/H5LTparse.y +++ b/hl/src/H5LTparse.y @@ -82,6 +82,7 @@ static char* enum_memb_symbol; /*enum member symbol string*/ %token H5T_IEEE_F16BE_TOKEN H5T_IEEE_F16LE_TOKEN %token H5T_IEEE_F32BE_TOKEN H5T_IEEE_F32LE_TOKEN H5T_IEEE_F64BE_TOKEN H5T_IEEE_F64LE_TOKEN %token H5T_FLOAT_BFLOAT16BE_TOKEN H5T_FLOAT_BFLOAT16LE_TOKEN +%token H5T_FLOAT_F8E4M3_TOKEN H5T_FLOAT_F8E5M2_TOKEN %token H5T_NATIVE_FLOAT16_TOKEN H5T_NATIVE_FLOAT_TOKEN H5T_NATIVE_DOUBLE_TOKEN H5T_NATIVE_LDOUBLE_TOKEN %token H5T_COMPLEX_IEEE_F16BE_TOKEN H5T_COMPLEX_IEEE_F16LE_TOKEN @@ -159,6 +160,8 @@ fp_type : H5T_IEEE_F16BE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F16BE) | H5T_IEEE_F64LE_TOKEN { $$ = H5Tcopy(H5T_IEEE_F64LE); } | H5T_FLOAT_BFLOAT16BE_TOKEN { $$ = H5Tcopy(H5T_FLOAT_BFLOAT16BE); } | H5T_FLOAT_BFLOAT16LE_TOKEN { $$ = H5Tcopy(H5T_FLOAT_BFLOAT16LE); } + | H5T_FLOAT_F8E4M3_TOKEN { $$ = H5Tcopy(H5T_FLOAT_F8E4M3); } + | H5T_FLOAT_F8E5M2_TOKEN { $$ = H5Tcopy(H5T_FLOAT_F8E5M2); } | H5T_NATIVE_FLOAT16_TOKEN { $$ = H5Tcopy(H5T_NATIVE_FLOAT16); } | H5T_NATIVE_FLOAT_TOKEN { $$ = H5Tcopy(H5T_NATIVE_FLOAT); } | H5T_NATIVE_DOUBLE_TOKEN { $$ = H5Tcopy(H5T_NATIVE_DOUBLE); } diff --git a/hl/test/test_lite.c b/hl/test/test_lite.c index 0bf8812ed47..f90755c2739 100644 --- a/hl/test/test_lite.c +++ b/hl/test/test_lite.c @@ -1207,6 +1207,20 @@ test_fps(void) if (H5Tclose(dtype) < 0) goto out; + if ((dtype = H5LTtext_to_dtype("H5T_FLOAT_F8E4M3\n", H5LT_DDL)) < 0) + goto out; + if (!H5Tequal(dtype, H5T_FLOAT_F8E4M3)) + goto out; + if (H5Tclose(dtype) < 0) + goto out; + + if ((dtype = H5LTtext_to_dtype("H5T_FLOAT_F8E5M2\n", H5LT_DDL)) < 0) + goto out; + if (!H5Tequal(dtype, H5T_FLOAT_F8E5M2)) + goto out; + if (H5Tclose(dtype) < 0) + goto out; + PASSED(); return 0; diff --git a/java/src/hdf/hdf5lib/HDF5Constants.java b/java/src/hdf/hdf5lib/HDF5Constants.java index 014d5fd2e5e..634f928579d 100644 --- a/java/src/hdf/hdf5lib/HDF5Constants.java +++ b/java/src/hdf/hdf5lib/HDF5Constants.java @@ -1125,6 +1125,10 @@ public class HDF5Constants { /** */ public static final long H5T_FLOAT_BFLOAT16LE = H5T_FLOAT_BFLOAT16LE(); /** */ + public static final long H5T_FLOAT_F8E4M3 = H5T_FLOAT_F8E4M3(); + /** */ + public static final long H5T_FLOAT_F8E5M2 = H5T_FLOAT_F8E5M2(); + /** */ public static final int H5T_INTEGER = H5T_INTEGER(); /** */ public static final long H5T_INTEL_B16 = H5T_INTEL_B16(); @@ -2640,6 +2644,10 @@ public class HDF5Constants { private static native final long H5T_FLOAT_BFLOAT16LE(); + private static native final long H5T_FLOAT_F8E4M3(); + + private static native final long H5T_FLOAT_F8E5M2(); + private static native final int H5T_INTEGER(); private static native final long H5T_INTEL_B16(); diff --git a/java/src/jni/h5Constants.c b/java/src/jni/h5Constants.c index 18ea37df1f9..9ea34d72a45 100644 --- a/java/src/jni/h5Constants.c +++ b/java/src/jni/h5Constants.c @@ -2746,6 +2746,16 @@ Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT_1BFLOAT16LE(JNIEnv *env, jclass cls) { return H5T_FLOAT_BFLOAT16LE; } +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT_1F8E4M3(JNIEnv *env, jclass cls) +{ + return H5T_FLOAT_F8E4M3; +} +JNIEXPORT jlong JNICALL +Java_hdf_hdf5lib_HDF5Constants_H5T_1FLOAT_1F8E5M2(JNIEnv *env, jclass cls) +{ + return H5T_FLOAT_F8E5M2; +} JNIEXPORT jint JNICALL Java_hdf_hdf5lib_HDF5Constants_H5T_1INTEGER(JNIEnv *env, jclass cls) { diff --git a/java/src/jni/h5util.c b/java/src/jni/h5util.c index 3946f7764e0..053513fb87d 100644 --- a/java/src/jni/h5util.c +++ b/java/src/jni/h5util.c @@ -2166,7 +2166,13 @@ h5str_get_little_endian_type(hid_t tid) } case H5T_FLOAT: { - if (size == 2) { + if (size == 1) { + if (true == H5Tequal(tid, H5T_FLOAT_F8E4M3)) + p_type = H5Tcopy(H5T_FLOAT_F8E4M3); + else if (true == H5Tequal(tid, H5T_FLOAT_F8E5M2)) + p_type = H5Tcopy(H5T_FLOAT_F8E5M2); + } + else 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) || @@ -2278,7 +2284,21 @@ h5str_get_big_endian_type(hid_t tid) } case H5T_FLOAT: { - if (size == 2) { + if (size == 1) { + if (true == H5Tequal(tid, H5T_FLOAT_F8E4M3)) { + p_type = H5Tcopy(H5T_FLOAT_F8E4M3); + + /* Though not very useful, set order to BE as expected */ + H5Tset_order(p_type, H5T_ORDER_BE); + } + else if (true == H5Tequal(tid, H5T_FLOAT_F8E5M2)) { + p_type = H5Tcopy(H5T_FLOAT_F8E5M2); + + /* Though not very useful, set order to BE as expected */ + H5Tset_order(p_type, H5T_ORDER_BE); + } + } + else 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) || diff --git a/release_docs/CHANGELOG.md b/release_docs/CHANGELOG.md index d08176bc677..b6996bcc31e 100644 --- a/release_docs/CHANGELOG.md +++ b/release_docs/CHANGELOG.md @@ -193,9 +193,24 @@ All other HDF5 library CMake options are prefixed with `HDF5_` - H5T_FLOAT_BFLOAT16LE / H5T_FLOAT_BFLOAT16BE - These macros map to IDs of HDF5 datatypes representing a little- or big-endian 16-bit floating-point datatype with 1 sign bit, 8 exponent bits and 7 fraction bits. + These macros map to IDs of HDF5 datatypes representing a little- or big-endian 16-bit floating-point datatype with 1 sign bit, 8 exponent bits and 7 fraction bits. - Note that support for a native bfloat16 datatype has not been added yet. This means that any datatype conversions to/from the new bfloat16 datatypes will be emulated in software rather than potentially using specialized hardware instructions. Until support for a native bfloat16 type is added, an application can avoid datatype conversion performance issues if it is sure that the datatype used for in-memory data buffers matches the above floating-point format (such as the __bf16 type). In this case, the application can specify one of the above macros for both the file datatype when creating a dataset or attribute and the memory datatype when performing I/O on the dataset or attribute. + Note that support for a native bfloat16 datatype has not been added yet. This means that any datatype conversions to/from the new bfloat16 datatypes will be emulated in software rather than potentially using specialized hardware instructions. Until support for a native bfloat16 type is added, an application can avoid datatype conversion performance issues if it is sure that the datatype used for in-memory data buffers matches the above floating-point format (such as the __bf16 type). In this case, the application can specify one of the above macros for both the file datatype when creating a dataset or attribute and the memory datatype when performing I/O on the dataset or attribute. + +### Added predefined datatypes for FP8 data + + Predefined datatypes have been added for FP8 data in E4M3 and E5M2 formats (https://arxiv.org/abs/2209.05433). + + The following new macros have been added: + + - H5T_FLOAT_F8E4M3 + - H5T_FLOAT_F8E5M2 + + These macros map to IDs of HDF5 datatypes representing an 8-bit floating-point datatype with 1 sign bit and either 4 exponent bits and 3 mantissa bits (E4M3 format) or 5 exponent bits and 2 mantissa bits (E5M2 format). + + Note that support for a native FP8 datatype has not been added yet. This means that any datatype conversions to/from the new FP8 datatypes will be emulated in software rather than potentially using specialized hardware instructions. Until support for a native FP8 type is added, an application can avoid datatype conversion performance issues if it is sure that the datatype used for in-memory data buffers matches one of the above floating-point formats. In this case, the application can specify one of the above macros for both the file datatype when creating a dataset or attribute and the memory datatype when performing I/O on the dataset or attribute. + + Also note that HDF5 currently has incomplete support for datatype conversions involving non-IEEE floating-point format datatypes. Refer to the 'Known Problems' section for information about datatype conversions with these new datatypes. ### Removed hbool_t from public API calls @@ -789,6 +804,15 @@ Current test results are available [here](https://my.cdash.org/index.php?project # â›” Known Problems +- When performing implicit datatype conversion on specific non-IEEE floating-point format data, HDF5 may improperly convert some data values: + + When performing I/O operations using a non-IEEE floating-point format datatype, HDF5 may improperly convert some data values due to incomplete handling of non-IEEE types. Such types include the following pre-defined datatypes: + + H5T_FLOAT_F8E4M3 + H5T_FLOAT_F8E5M2 + + If possible, an application should perform I/O with these datatypes using an in-memory type that matches the specific floating-point format and perform explicit data conversion outside of HDF5, if necessary. Otherwise, read/written values should be verified to be correct. + - When the library detects and builds in support for the _Float16 datatype, an issue has been observed on at least one MacOS 14 system where the library fails to initialize due to not being able to detect the byte order of the _Float16 type [#4310](https://github.com/HDFGroup/hdf5/issues/4310): #5: H5Tinit_float.c line 308 in H5T__fix_order(): failed to detect byte order diff --git a/src/H5T.c b/src/H5T.c index 6426016f304..3b2e391a53e 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -167,6 +167,34 @@ H5T_INIT_TYPE_BFLOAT16_COMMON(H5T_ORDER_BE) \ } +/* Define the code templates for standard FP8 E4M3 8-bit floats for the "GUTS" in the H5T_INIT_TYPE macro */ +#define H5T_INIT_TYPE_FLOAT8E4M3_CORE \ + { \ + H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_LE) /* Simply pick LE here */ \ + dt->shared->u.atomic.u.f.sign = 7; \ + dt->shared->u.atomic.u.f.epos = 3; \ + dt->shared->u.atomic.u.f.esize = 4; \ + dt->shared->u.atomic.u.f.ebias = 0x7; \ + dt->shared->u.atomic.u.f.mpos = 0; \ + dt->shared->u.atomic.u.f.msize = 3; \ + dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \ + dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; \ + } + +/* Define the code templates for standard FP8 E5M2 8-bit floats for the "GUTS" in the H5T_INIT_TYPE macro */ +#define H5T_INIT_TYPE_FLOAT8E5M2_CORE \ + { \ + H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_LE) /* Simply pick LE here */ \ + dt->shared->u.atomic.u.f.sign = 7; \ + dt->shared->u.atomic.u.f.epos = 2; \ + dt->shared->u.atomic.u.f.esize = 5; \ + dt->shared->u.atomic.u.f.ebias = 0xf; \ + dt->shared->u.atomic.u.f.mpos = 0; \ + dt->shared->u.atomic.u.f.msize = 2; \ + dt->shared->u.atomic.u.f.norm = H5T_NORM_IMPLIED; \ + dt->shared->u.atomic.u.f.pad = H5T_PAD_ZERO; \ + } + /* Define the code templates for standard floats for the "GUTS" in the H5T_INIT_TYPE macro */ #define H5T_INIT_TYPE_FLOAT_COMMON(ENDIANNESS) \ { \ @@ -459,6 +487,8 @@ hid_t H5T_IEEE_F64LE_g = H5I_INVALID_HID; hid_t H5T_FLOAT_BFLOAT16BE_g = H5I_INVALID_HID; hid_t H5T_FLOAT_BFLOAT16LE_g = H5I_INVALID_HID; +hid_t H5T_FLOAT_F8E4M3_g = H5I_INVALID_HID; +hid_t H5T_FLOAT_F8E5M2_g = H5I_INVALID_HID; hid_t H5T_COMPLEX_IEEE_F16BE_g = H5I_INVALID_HID; hid_t H5T_COMPLEX_IEEE_F16LE_g = H5I_INVALID_HID; @@ -1125,6 +1155,12 @@ H5T__init_package(void) /* 2-byte big-endian bfloat16 float type */ H5T_INIT_TYPE(BFLOAT16BE, H5T_FLOAT_BFLOAT16BE_g, COPY, native_double, SET, 2) + /* 8-bit FP8 E4M3 float type */ + H5T_INIT_TYPE(FLOAT8E4M3, H5T_FLOAT_F8E4M3_g, COPY, native_double, SET, 1) + + /* 8-bit FP8 E5M2 float type */ + H5T_INIT_TYPE(FLOAT8E5M2, H5T_FLOAT_F8E5M2_g, COPY, native_double, SET, 1) + /*------------------------------------------------------------ * VAX Types *------------------------------------------------------------ @@ -2222,6 +2258,8 @@ H5T_top_term_package(void) H5T_FLOAT_BFLOAT16BE_g = H5I_INVALID_HID; H5T_FLOAT_BFLOAT16LE_g = H5I_INVALID_HID; + H5T_FLOAT_F8E4M3_g = H5I_INVALID_HID; + H5T_FLOAT_F8E5M2_g = H5I_INVALID_HID; H5T_COMPLEX_IEEE_F16BE_g = H5I_INVALID_HID; H5T_COMPLEX_IEEE_F16LE_g = H5I_INVALID_HID; diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h index 619aa331b11..c6e146e127b 100644 --- a/src/H5Tmodule.h +++ b/src/H5Tmodule.h @@ -4014,6 +4014,7 @@ filled according to the value of this property. The padding can be: * H5T_IEEE_F32BE | H5T_IEEE_F32LE | * H5T_IEEE_F64BE | H5T_IEEE_F64LE | * H5T_FLOAT_BFLOAT16BE | H5T_FLOAT_BFLOAT16LE | + * H5T_FLOAT_F8E4M3 | H5T_FLOAT_F8E5M2 | * H5T_NATIVE_FLOAT16 | H5T_NATIVE_FLOAT | * H5T_NATIVE_DOUBLE | H5T_NATIVE_LDOUBLE * diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 357c6b38e4b..c12b8f9783b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -731,7 +731,39 @@ H5T__get_native_float(const H5T_t *dtype, H5T_direction_t direction, size_t *str H5_WARN_DUPLICATED_BRANCHES_OFF if (direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { - if (size <= 2) { + if (size == 1) { +#ifdef H5_HAVE__FLOAT16 + /* + * When _Float16 support is available, map specific types to + * the native _Float16 type and all other types of this size + * group without a specific carve-out to the native float type. + */ + H5T_t *f8_e4m3_dt = NULL; /* Datatype for FP8 E4M3 */ + H5T_t *f8_e5m2_dt = NULL; /* Datatype for FP8 E5M2 */ + + if (NULL == (f8_e4m3_dt = H5I_object(H5T_FLOAT_F8E4M3))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + if (NULL == (f8_e5m2_dt = H5I_object(H5T_FLOAT_F8E5M2))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + + if (0 == H5T_cmp(dtype, f8_e4m3_dt, false) || 0 == H5T_cmp(dtype, f8_e5m2_dt, false)) { + match = H5T_NATIVE_FLOAT_MATCH_FLOAT16; + native_size = sizeof(H5__Float16); + } + else { + match = H5T_NATIVE_FLOAT_MATCH_FLOAT; + native_size = sizeof(float); + } +#else + /* When _Float16 support is not available, just map all types of + * this size group without a specific carve-out to the native + * float type. + */ + match = H5T_NATIVE_FLOAT_MATCH_FLOAT; + native_size = sizeof(float); +#endif + } + else if (size == 2) { #ifdef H5_HAVE__FLOAT16 /* * When _Float16 support is available, map _Float16-like types @@ -795,7 +827,7 @@ H5T__get_native_float(const H5T_t *dtype, H5T_direction_t direction, size_t *str match = H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); } - else { + else if (size > 1) { /* * When _Float16 support is available, map _Float16-like types * to the native type and all other types of this size group @@ -818,6 +850,29 @@ H5T__get_native_float(const H5T_t *dtype, H5T_direction_t direction, size_t *str native_size = sizeof(float); } } + else { + /* + * When _Float16 support is available, map specific types to + * the native _Float16 type and all other types of this size + * group without a specific carve-out to the native float type. + */ + H5T_t *f8_e4m3_dt = NULL; /* Datatype for FP8 E4M3 */ + H5T_t *f8_e5m2_dt = NULL; /* Datatype for FP8 E5M2 */ + + if (NULL == (f8_e4m3_dt = H5I_object(H5T_FLOAT_F8E4M3))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + if (NULL == (f8_e5m2_dt = H5I_object(H5T_FLOAT_F8E5M2))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a data type"); + + if (0 == H5T_cmp(dtype, f8_e4m3_dt, false) || 0 == H5T_cmp(dtype, f8_e5m2_dt, false)) { + match = H5T_NATIVE_FLOAT_MATCH_FLOAT16; + native_size = sizeof(H5__Float16); + } + else { + match = H5T_NATIVE_FLOAT_MATCH_FLOAT; + native_size = sizeof(float); + } + } #else /* When _Float16 support is not available, just map all types of * this size group without a specific carve-out to the native diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h index 38813229e92..76a4bdd736e 100644 --- a/src/H5Tpublic.h +++ b/src/H5Tpublic.h @@ -293,8 +293,42 @@ H5_DLLVAR hid_t H5T_IEEE_F64LE_g; * 16-bit little-endian bfloat16 floating-point numbers */ #define H5T_FLOAT_BFLOAT16LE (H5OPEN H5T_FLOAT_BFLOAT16LE_g) +/** + * \ingroup PDTALTFLOAT + * 8-bit FP8 E4M3 (4 exponent bits, 3 mantissa bits) floating-point numbers + * + * \parblock + * \attention Implicit datatype conversion should currently be avoided when using + * this datatype for I/O operations. Incomplete handling of non-IEEE + * floating-point formats in HDF5 can cause certain FP8 E4M3 values + * to be improperly converted to Infinities or NaN values. If possible, + * an application should perform I/O with this datatype using an + * in-memory type that matches the FP8 E4M3 format and perform explicit + * data conversion outside of HDF5, if necessary. Otherwise, read/written + * values should be verified to be correct. + * \endparblock + */ +#define H5T_FLOAT_F8E4M3 (H5OPEN H5T_FLOAT_F8E4M3_g) +/** + * \ingroup PDTALTFLOAT + * 8-bit FP8 E5M2 (5 exponent bits, 2 mantissa bits) floating-point numbers + * + * \parblock + * \attention Implicit datatype conversion should currently be avoided when using + * this datatype for I/O operations. Incomplete handling of non-IEEE + * floating-point formats in HDF5 can cause certain FP8 E5M2 values + * to be improperly converted to Infinities or NaN values. If possible, + * an application should perform I/O with this datatype using an + * in-memory type that matches the FP8 E5M2 format and perform explicit + * data conversion outside of HDF5, if necessary. Otherwise, read/written + * values should be verified to be correct. + * \endparblock + */ +#define H5T_FLOAT_F8E5M2 (H5OPEN H5T_FLOAT_F8E5M2_g) H5_DLLVAR hid_t H5T_FLOAT_BFLOAT16BE_g; H5_DLLVAR hid_t H5T_FLOAT_BFLOAT16LE_g; +H5_DLLVAR hid_t H5T_FLOAT_F8E4M3_g; +H5_DLLVAR hid_t H5T_FLOAT_F8E5M2_g; /* * Complex number types made up of IEEE floating point types diff --git a/src/H5trace.c b/src/H5trace.c index 6b9a18cb305..965dc9ca7ee 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1691,6 +1691,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) H5RS_acat(rs, "H5T_FLOAT_BFLOAT16BE"); else if (obj == H5T_FLOAT_BFLOAT16LE_g) H5RS_acat(rs, "H5T_FLOAT_BFLOAT16LE"); + else if (obj == H5T_FLOAT_F8E4M3_g) + H5RS_acat(rs, "H5T_FLOAT_F8E4M3"); + else if (obj == H5T_FLOAT_F8E5M2_g) + H5RS_acat(rs, "H5T_FLOAT_F8E5M2"); else if (obj == H5T_COMPLEX_IEEE_F16BE_g) H5RS_acat(rs, "H5T_COMPLEX_IEEE_F16BE"); else if (obj == H5T_COMPLEX_IEEE_F16LE_g) diff --git a/test/API/H5_api_dataset_test.c b/test/API/H5_api_dataset_test.c index 6d9066d6e63..3a63038686c 100644 --- a/test/API/H5_api_dataset_test.c +++ b/test/API/H5_api_dataset_test.c @@ -1218,8 +1218,8 @@ test_create_dataset_predefined_types(void H5_ATTR_UNUSED *params) H5T_STD_U64LE, H5T_STD_U64BE, H5T_STD_I64LE, H5T_STD_I64BE, H5T_IEEE_F16LE, H5T_IEEE_F16BE, H5T_IEEE_F32LE, H5T_IEEE_F32BE, H5T_IEEE_F64LE, H5T_IEEE_F64BE, H5T_FLOAT_BFLOAT16LE, H5T_FLOAT_BFLOAT16BE, - H5T_COMPLEX_IEEE_F16BE, H5T_COMPLEX_IEEE_F16LE, H5T_COMPLEX_IEEE_F32BE, H5T_COMPLEX_IEEE_F32LE, - H5T_COMPLEX_IEEE_F64BE, H5T_COMPLEX_IEEE_F64LE}; + H5T_FLOAT_F8E4M3, H5T_FLOAT_F8E5M2, H5T_COMPLEX_IEEE_F16BE, H5T_COMPLEX_IEEE_F16LE, + H5T_COMPLEX_IEEE_F32BE, H5T_COMPLEX_IEEE_F32LE, H5T_COMPLEX_IEEE_F64BE, H5T_COMPLEX_IEEE_F64LE}; TESTING("dataset creation with predefined datatypes"); diff --git a/test/API/H5_api_test_util.c b/test/API/H5_api_test_util.c index 49eaa39be5c..3f968b2bb04 100644 --- a/test/API/H5_api_test_util.c +++ b/test/API/H5_api_test_util.c @@ -44,7 +44,7 @@ /* The number of predefined floating point types in HDF5 */ -#define NUM_PREDEFINED_FLOAT_TYPES 8 +#define NUM_PREDEFINED_FLOAT_TYPES 10 /* The number of predefined complex number types in HDF5 */ @@ -327,6 +327,12 @@ generate_random_datatype_float(H5T_class_t H5_ATTR_UNUSED parent_class, bool H5_ case 7: type_to_copy = H5T_FLOAT_BFLOAT16LE; break; + case 8: + type_to_copy = H5T_FLOAT_F8E4M3; + break; + case 9: + type_to_copy = H5T_FLOAT_F8E5M2; + break; default: printf(" invalid value for floating point type; should not happen\n"); diff --git a/test/dt_arith.c b/test/dt_arith.c index 10a85e39a16..535e3e939ac 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -2220,6 +2220,344 @@ test_bfloat16(void) return 1; } +/*------------------------------------------------------------------------- + * Function: test_fp8 + * + * Purpose: Tests special values for FP8 datatypes + * + * Return: Success: 0 + * Failure: number of errors + * + *------------------------------------------------------------------------- + */ +static int +test_fp8(void) +{ + const unsigned char *buf_ptr; + H5T_order_t native_type_order; + uint8_t fp8_val; + uint8_t fp8_convval; + size_t float_spos; + size_t float_mpos; + size_t float_epos; + size_t float_msize; + size_t float_esize; + hid_t src_fp8_type; + float val_buf; + + TESTING("FP8 datatype special values"); + + /* Until native support for FP8 type is added, use uint8_t to + * represent initial value, then check properties after using + * H5T to convert to float. + */ + buf_ptr = (const unsigned char *)&val_buf; + + if ((native_type_order = H5Tget_order(H5T_NATIVE_FLOAT)) < 0) { + H5_FAILED(); + printf("Can't check endian-ness of native float type\n"); + goto error; + } + + /* Just test on little- or big-endian systems */ + if (native_type_order != H5T_ORDER_LE && native_type_order != H5T_ORDER_BE) { + SKIPPED(); + return 0; + } + + if (H5Tget_fields(H5T_NATIVE_FLOAT, &float_spos, &float_epos, &float_esize, &float_mpos, &float_msize) < + 0) { + H5_FAILED(); + printf("Can't get floating-point bit field information for native float type\n"); + goto error; + } + + /* + * Check E4M3 special values + */ + src_fp8_type = H5T_FLOAT_F8E4M3; + + /* FP8 E4M3 doesn't have infinities, but the library converts some + * of the larger values into infinities due to trying to interpret + * the values according to the IEEE standard. So, just check NaN + * values here. For NaN values, don't bother checking the value + * after converting back. The library sets all bits in the significand + * to 1 when a NaN is encountered, so the values won't match. Note + * that at least on x86 and ARM CPUs this should convert the NaNs + * into quiet NaNs. However, this may convert the NaNs to signaling + * NaNs on some CPUs which could be problematic if the buffer is + * used in almost any fashion. The my_isnan() function might attempt + * to print the value into a buffer to compare against NaN strings, + * which could cause a floating-point exception for some values. So + * far, this hasn't been an issue in practice, but may need some + * exception handling here if it becomes an issue. + */ + + fp8_val = 0x7f; /* One of the two NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E4M3 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E4M3 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E4M3 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0xff; /* The other NaN value */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E4M3 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E4M3 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E4M3 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + /* + * Check E5M2 special values + */ + src_fp8_type = H5T_FLOAT_F8E5M2; + + fp8_val = 0x7c; /* +Inf */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (0 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 positive infinity value wasn't infinity after conversion\n"); + goto error; + } + + if (1 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 positive infinity value matched NaN\n"); + goto error; + } + + /* Convert value back and check */ + if (H5Tconvert(H5T_NATIVE_FLOAT, src_fp8_type, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert float value to FP8 E5M2 value\n"); + goto error; + } + + memcpy(&fp8_convval, &val_buf, 1); + if (0 != memcmp(&fp8_convval, &fp8_val, 1)) { + H5_FAILED(); + printf("FP8 E5M2 value wasn't preserved between conversions\n"); + goto error; + } + + fp8_val = 0xfc; /* -Inf */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (0 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 negative infinity value wasn't infinity after conversion\n"); + goto error; + } + + if (1 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 negative infinity value matched NaN\n"); + goto error; + } + + /* Convert value back and check */ + if (H5Tconvert(H5T_NATIVE_FLOAT, src_fp8_type, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert float value to FP8 E5M2 value\n"); + goto error; + } + + memcpy(&fp8_convval, &val_buf, 1); + if (0 != memcmp(&fp8_convval, &fp8_val, 1)) { + H5_FAILED(); + printf("FP8 E5M2 value wasn't preserved between conversions\n"); + goto error; + } + + /* + * For NaN values, don't bother checking the value after converting + * back. The library sets all bits in the significand to 1 when a + * NaN is encountered, so the values won't match. Note that at least + * on x86 and ARM CPUs this should convert the NaNs into quiet NaNs. + * However, this may convert the NaNs to signaling NaNs on some CPUs + * which could be problematic if the buffer is used in almost any + * fashion. The my_isnan() function might attempt to print the value + * into a buffer to compare against NaN strings, which could cause + * a floating-point exception for some values. So far, this hasn't + * been an issue in practice, but may need some exception handling + * here if it becomes an issue. + */ + + fp8_val = 0x7d; /* One of the three positive NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0x7e; /* Another of the three positive NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0x7f; /* Last of the three positive NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0xfd; /* One of the three negative NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0xfe; /* Another of the three negative NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + fp8_val = 0xff; /* Last of the three negative NaN values */ + memcpy(&val_buf, &fp8_val, 1); + if (H5Tconvert(src_fp8_type, H5T_NATIVE_FLOAT, 1, &val_buf, NULL, H5P_DEFAULT) < 0) { + H5_FAILED(); + printf("Couldn't convert FP8 E5M2 value to float\n"); + goto error; + } + + if (1 == my_isinf((int)native_type_order, buf_ptr, sizeof(float), float_mpos, float_msize, float_epos, + float_esize)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value was an infinity value after conversion\n"); + goto error; + } + + if (0 == my_isnan(FLT_FLOAT, &val_buf)) { + H5_FAILED(); + printf("FP8 E5M2 NaN value wasn't a NaN value after conversion\n"); + goto error; + } + + PASSED(); + + return 0; + +error: + return 1; +} + /*------------------------------------------------------------------------- * Function: test_conv_int_1 * @@ -10177,6 +10515,9 @@ main(void) /* Test bfloat16 special values */ nerrors += (unsigned long)test_bfloat16(); + /* Test fp8 special values */ + nerrors += (unsigned long)test_fp8(); + /* Test degenerate cases */ nerrors += (unsigned long)run_fp_tests("noop"); diff --git a/test/dtypes.c b/test/dtypes.c index 4b7468c6681..7d83eb97242 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -74,9 +74,10 @@ } \ } while (0) -static const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", "dtypes5", - "dtypes6", "dtypes7", "dtypes8", "dtypes9", "dtypes10", "dtypes11", - "dtypes12", "dtypes13", "dtypes14", "dtypes15", "dtypes16", NULL}; +static const char *FILENAME[] = {"dtypes0", "dtypes1", "dtypes2", "dtypes3", "dtypes4", + "dtypes5", "dtypes6", "dtypes7", "dtypes8", "dtypes9", + "dtypes10", "dtypes11", "dtypes12", "dtypes13", "dtypes14", + "dtypes15", "dtypes16", "dtypes17", NULL}; #define TESTFILE "bad_compound.h5" @@ -7166,6 +7167,426 @@ test_bfloat16(void) return 1; } +/*------------------------------------------------------------------------- + * Function: test_fp8 + * + * Purpose: Tests the FP8 datatypes. + * + * Return: Success: 0 + * Failure: number of errors + *------------------------------------------------------------------------- + */ +static int +test_fp8(void) +{ + H5T_class_t type_class; + H5T_order_t type_order; + H5T_norm_t type_norm; + H5T_pad_t lsb_pad; + H5T_pad_t msb_pad; + H5T_pad_t inpad; + hsize_t dims[1]; + size_t type_size; + size_t type_prec; + size_t sign_pos; + size_t expo_pos; + size_t mant_pos; + size_t expo_size; + size_t mant_size; + size_t expo_bias; + hid_t fid = H5I_INVALID_HID; + hid_t space_id = H5I_INVALID_HID; + hid_t dset_id = H5I_INVALID_HID; + hid_t dcpl_id = H5I_INVALID_HID; + char filename[256] = {0}; + int type_offset; + + TESTING("FP8 datatypes"); + + /* Check characteristics of the predefined types */ + + if ((type_class = H5Tget_class(H5T_FLOAT_F8E4M3)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype class for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (H5T_FLOAT != type_class) { + H5_FAILED(); + printf("Datatype class for H5T_FLOAT_F8E4M3 wasn't H5T_FLOAT\n"); + goto error; + } + + if ((type_class = H5Tget_class(H5T_FLOAT_F8E5M2)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype class for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (H5T_FLOAT != type_class) { + H5_FAILED(); + printf("Datatype class for H5T_FLOAT_F8E5M2 wasn't H5T_FLOAT\n"); + goto error; + } + + if ((type_size = H5Tget_size(H5T_FLOAT_F8E4M3)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype size for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (type_size != 1) { + H5_FAILED(); + printf("Datatype size for H5T_FLOAT_F8E4M3 was incorrect (expected 1, got %zu)\n", type_size); + goto error; + } + + if ((type_size = H5Tget_size(H5T_FLOAT_F8E5M2)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype size for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (type_size != 1) { + H5_FAILED(); + printf("Datatype size for H5T_FLOAT_F8E5M2 was incorrect (expected 1, got %zu)\n", type_size); + goto error; + } + + if ((type_order = H5Tget_order(H5T_FLOAT_F8E4M3)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype order for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (type_order != H5T_ORDER_LE) { + H5_FAILED(); + printf("Datatype order for H5T_FLOAT_F8E4M3 wasn't H5T_ORDER_LE\n"); + goto error; + } + + if ((type_order = H5Tget_order(H5T_FLOAT_F8E5M2)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype order for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (type_order != H5T_ORDER_LE) { + H5_FAILED(); + printf("Datatype order for H5T_FLOAT_F8E5M2 wasn't H5T_ORDER_LE\n"); + goto error; + } + + if ((type_prec = H5Tget_precision(H5T_FLOAT_F8E4M3)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype precision for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (type_prec != 8) { + H5_FAILED(); + printf("Datatype precision for H5T_FLOAT_F8E4M3 was incorrect (expected 8, got %zu)\n", type_prec); + goto error; + } + + if ((type_prec = H5Tget_precision(H5T_FLOAT_F8E5M2)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype precision for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (type_prec != 8) { + H5_FAILED(); + printf("Datatype precision for H5T_FLOAT_F8E5M2 was incorrect (expected 8, got %zu)\n", type_prec); + goto error; + } + + if ((type_offset = H5Tget_offset(H5T_FLOAT_F8E4M3)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype offset for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (type_offset != 0) { + H5_FAILED(); + printf("Datatype offset for H5T_FLOAT_F8E4M3 was incorrect (expected 0, got %d)\n", type_offset); + goto error; + } + + if ((type_offset = H5Tget_offset(H5T_FLOAT_F8E5M2)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype offset for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (type_offset != 0) { + H5_FAILED(); + printf("Datatype offset for H5T_FLOAT_F8E5M2 was incorrect (expected 0, got %d)\n", type_offset); + goto error; + } + + if (H5Tget_pad(H5T_FLOAT_F8E4M3, &lsb_pad, &msb_pad) < 0) { + H5_FAILED(); + printf("Couldn't get datatype padding type for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (lsb_pad != H5T_PAD_ZERO || msb_pad != H5T_PAD_ZERO) { + H5_FAILED(); + printf("Datatype padding type for H5T_FLOAT_F8E4M3 was incorrect (expected H5T_PAD_ZERO, got lsb pad " + "type %d, msb pad type %d)\n", + lsb_pad, msb_pad); + goto error; + } + + if (H5Tget_pad(H5T_FLOAT_F8E5M2, &lsb_pad, &msb_pad) < 0) { + H5_FAILED(); + printf("Couldn't get datatype padding type for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (lsb_pad != H5T_PAD_ZERO || msb_pad != H5T_PAD_ZERO) { + H5_FAILED(); + printf("Datatype padding type for H5T_FLOAT_F8E5M2 was incorrect (expected H5T_PAD_ZERO, got lsb pad " + "type %d, msb pad type %d)\n", + lsb_pad, msb_pad); + goto error; + } + + if (H5Tget_fields(H5T_FLOAT_F8E4M3, &sign_pos, &expo_pos, &expo_size, &mant_pos, &mant_size) < 0) { + H5_FAILED(); + printf("Couldn't get floating-point bit field information for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (sign_pos != 7 || expo_pos != 3 || mant_pos != 0 || expo_size != 4 || mant_size != 3) { + H5_FAILED(); + printf("H5T_FLOAT_F8E4M3 didn't match FP8 E4M3 specification " + "(expected spos=7, epos=3, esize=4, mpos=0, msize=3, " + "got spos=%zu, epos=%zu, esize=%zu, mpos=%zu, msize=%zu)\n", + sign_pos, expo_pos, expo_size, mant_pos, mant_size); + goto error; + } + + if (H5Tget_fields(H5T_FLOAT_F8E5M2, &sign_pos, &expo_pos, &expo_size, &mant_pos, &mant_size) < 0) { + H5_FAILED(); + printf("Couldn't get floating-point bit field information for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (sign_pos != 7 || expo_pos != 2 || mant_pos != 0 || expo_size != 5 || mant_size != 2) { + H5_FAILED(); + printf("H5T_FLOAT_F8E5M2 didn't match FP8 E5M2 specification " + "(expected spos=7, epos=2, esize=5, mpos=0, msize=2, " + "got spos=%zu, epos=%zu, esize=%zu, mpos=%zu, msize=%zu)\n", + sign_pos, expo_pos, expo_size, mant_pos, mant_size); + goto error; + } + + if ((expo_bias = H5Tget_ebias(H5T_FLOAT_F8E4M3)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype exponent bias for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (expo_bias != 7) { + H5_FAILED(); + printf("Datatype exponent bias for H5T_FLOAT_F8E4M3 was incorrect (expected 7, got %zu)\n", + expo_bias); + goto error; + } + + if ((expo_bias = H5Tget_ebias(H5T_FLOAT_F8E5M2)) == 0) { + H5_FAILED(); + printf("Couldn't get datatype exponent bias for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (expo_bias != 15) { + H5_FAILED(); + printf("Datatype exponent bias for H5T_FLOAT_F8E5M2 was incorrect (expected 15, got %zu)\n", + expo_bias); + goto error; + } + + if ((type_norm = H5Tget_norm(H5T_FLOAT_F8E4M3)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype mantissa normalization type for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (type_norm != H5T_NORM_IMPLIED) { + H5_FAILED(); + printf("Datatype mantissa normalization type for H5T_FLOAT_F8E4M3 wasn't H5T_NORM_IMPLIED\n"); + goto error; + } + + if ((type_norm = H5Tget_norm(H5T_FLOAT_F8E5M2)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype mantissa normalization type for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (type_norm != H5T_NORM_IMPLIED) { + H5_FAILED(); + printf("Datatype mantissa normalization type for H5T_FLOAT_F8E5M2 wasn't H5T_NORM_IMPLIED\n"); + goto error; + } + + if ((inpad = H5Tget_inpad(H5T_FLOAT_F8E4M3)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype unused bits padding type for H5T_FLOAT_F8E4M3\n"); + goto error; + } + + if (inpad != H5T_PAD_ZERO) { + H5_FAILED(); + printf("Datatype unused bits padding type for H5T_FLOAT_F8E4M3 was incorrect (expected H5T_PAD_ZERO, " + "got pad type %d)\n", + inpad); + goto error; + } + + if ((inpad = H5Tget_inpad(H5T_FLOAT_F8E5M2)) < 0) { + H5_FAILED(); + printf("Couldn't get datatype unused bits padding type for H5T_FLOAT_F8E5M2\n"); + goto error; + } + + if (inpad != H5T_PAD_ZERO) { + H5_FAILED(); + printf("Datatype unused bits padding type for H5T_FLOAT_F8E5M2 was incorrect (expected H5T_PAD_ZERO, " + "got pad type %d)\n", + inpad); + goto error; + } + + /* + * Ensure that some random conversions on the FP8 datatypes + * are currently covered by general software routines rather + * than compiler conversions. + */ + + if (H5Tcompiler_conv(H5T_FLOAT_F8E4M3, H5T_IEEE_F16LE) != false) { + H5_FAILED(); + printf("Conversion path for H5T_FLOAT_F8E4M3 -> H5T_IEEE_F16LE was not a software conversion\n"); + goto error; + } + + if (H5Tcompiler_conv(H5T_FLOAT_F8E4M3, H5T_NATIVE_INT) != false) { + H5_FAILED(); + printf("Conversion path for H5T_FLOAT_F8E4M3 -> H5T_NATIVE_INT was not a software conversion\n"); + goto error; + } + + if (H5Tcompiler_conv(H5T_FLOAT_F8E5M2, H5T_IEEE_F16LE) != false) { + H5_FAILED(); + printf("Conversion path for H5T_FLOAT_F8E5M2 -> H5T_IEEE_F16LE was not a software conversion\n"); + goto error; + } + + if (H5Tcompiler_conv(H5T_FLOAT_F8E5M2, H5T_NATIVE_INT) != false) { + H5_FAILED(); + printf("Conversion path for H5T_FLOAT_F8E5M2 -> H5T_NATIVE_INT was not a software conversion\n"); + goto error; + } + + /* + * Create datasets with the FP8 datatypes and check the dataset raw data storage size + */ + h5_fixname(FILENAME[17], H5P_DEFAULT, filename, sizeof filename); + + if ((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) { + H5_FAILED(); + AT(); + printf("Can't create file!\n"); + goto error; + } + + dims[0] = 10000; + if ((space_id = H5Screate_simple(1, dims, NULL)) < 0) { + H5_FAILED(); + AT(); + printf("Can't create dataspace\n"); + goto error; + } + + if ((dcpl_id = H5Pcreate(H5P_DATASET_CREATE)) < 0) { + H5_FAILED(); + AT(); + printf("Can't create DCPL\n"); + goto error; + } + + if (H5Pset_alloc_time(dcpl_id, H5D_ALLOC_TIME_EARLY) < 0) { + H5_FAILED(); + AT(); + printf("Can't set alloc time\n"); + goto error; + } + + if ((dset_id = H5Dcreate2(fid, "DatasetE4M3", H5T_FLOAT_F8E4M3, space_id, H5P_DEFAULT, dcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + AT(); + printf("Can't create dataset\n"); + goto error; + } + + if (H5Dget_storage_size(dset_id) != dims[0] /* 1 byte datatype */) { + H5_FAILED(); + AT(); + printf("Incorrect dataset raw data storage size allocated in file\n"); + goto error; + } + + if (H5Dclose(dset_id) < 0) + TEST_ERROR; + + if ((dset_id = H5Dcreate2(fid, "DatasetE5M2", H5T_FLOAT_F8E5M2, space_id, H5P_DEFAULT, dcpl_id, + H5P_DEFAULT)) < 0) { + H5_FAILED(); + AT(); + printf("Can't create dataset\n"); + goto error; + } + + if (H5Dget_storage_size(dset_id) != dims[0] /* 1 byte datatype */) { + H5_FAILED(); + AT(); + printf("Incorrect dataset raw data storage size allocated in file\n"); + goto error; + } + + if (H5Pclose(dcpl_id) < 0) + TEST_ERROR; + if (H5Sclose(space_id) < 0) + TEST_ERROR; + if (H5Dclose(dset_id) < 0) + TEST_ERROR; + if (H5Fclose(fid) < 0) + TEST_ERROR; + if (H5Fdelete(filename, H5P_DEFAULT) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Pclose(dcpl_id); + H5Sclose(space_id); + H5Dclose(dset_id); + H5Fclose(fid); + H5Fdelete(filename, H5P_DEFAULT); + } + H5E_END_TRY + + return 1; +} + /*------------------------------------------------------------------------- * Function: test_complex_type * @@ -13362,6 +13783,7 @@ main(void) nerrors += test__Float16(); nerrors += test_bfloat16(); + nerrors += test_fp8(); nerrors += test_complex_type(); #ifdef H5_HAVE_COMPLEX_NUMBERS nerrors += test_complex_type_conv_funcs(); diff --git a/test/ntypes.c b/test/ntypes.c index bfe6c307e9f..c4d99542d8e 100644 --- a/test/ntypes.c +++ b/test/ntypes.c @@ -3213,6 +3213,89 @@ test_bfloat16(void) return -1; } +static herr_t +test_fp8(void) +{ + hid_t native_type = H5I_INVALID_HID; + + TESTING("fp8 datatypes"); + + /* + * Just ensure that the fp8 types are currently promoted + * to either float16 or float, depending on whether float16 + * support is enabled. Until native support is added for a + * fp8 type, conversion from fp8 to float16 should be fine. + */ + if ((native_type = H5Tget_native_type(H5T_FLOAT_F8E4M3, H5T_DIR_ASCEND)) < 0) + TEST_ERROR; + +#ifdef H5_HAVE__FLOAT16 + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT16)) + TEST_ERROR; +#else + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT)) + TEST_ERROR; +#endif + + if (H5Tclose(native_type) < 0) + TEST_ERROR; + + if ((native_type = H5Tget_native_type(H5T_FLOAT_F8E4M3, H5T_DIR_DESCEND)) < 0) + TEST_ERROR; + +#ifdef H5_HAVE__FLOAT16 + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT16)) + TEST_ERROR; +#else + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT)) + TEST_ERROR; +#endif + + if (H5Tclose(native_type) < 0) + TEST_ERROR; + + if ((native_type = H5Tget_native_type(H5T_FLOAT_F8E5M2, H5T_DIR_ASCEND)) < 0) + TEST_ERROR; + +#ifdef H5_HAVE__FLOAT16 + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT16)) + TEST_ERROR; +#else + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT)) + TEST_ERROR; +#endif + + if (H5Tclose(native_type) < 0) + TEST_ERROR; + + if ((native_type = H5Tget_native_type(H5T_FLOAT_F8E5M2, H5T_DIR_DESCEND)) < 0) + TEST_ERROR; + +#ifdef H5_HAVE__FLOAT16 + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT16)) + TEST_ERROR; +#else + if (true != H5Tequal(native_type, H5T_NATIVE_FLOAT)) + TEST_ERROR; +#endif + + if (H5Tclose(native_type) < 0) + TEST_ERROR; + + PASSED(); + + return 0; + +error: + H5E_BEGIN_TRY + { + H5Tclose(native_type); + } + H5E_END_TRY + + return -1; +} + #ifdef H5_HAVE_COMPLEX_NUMBERS static herr_t test_complex(hid_t file) @@ -3392,6 +3475,7 @@ main(void) #endif nerrors += test_bfloat16() < 0 ? 1 : 0; + nerrors += test_fp8() < 0 ? 1 : 0; #ifdef H5_HAVE_COMPLEX_NUMBERS nerrors += test_complex(file) < 0 ? 1 : 0; diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c index a71e662dcd1..38b22ca3454 100644 --- a/tools/lib/h5diff_util.c +++ b/tools/lib/h5diff_util.c @@ -136,6 +136,10 @@ print_type(hid_t type) parallel_print("H5T_FLOAT_BFLOAT16BE"); else if (H5Tequal(type, H5T_FLOAT_BFLOAT16LE)) parallel_print("H5T_FLOAT_BFLOAT16LE"); + else if (H5Tequal(type, H5T_FLOAT_F8E4M3)) + parallel_print("H5T_FLOAT_F8E4M3"); + else if (H5Tequal(type, H5T_FLOAT_F8E5M2)) + parallel_print("H5T_FLOAT_F8E5M2"); #ifdef H5_HAVE__FLOAT16 else if (H5Tequal(type, H5T_NATIVE_FLOAT16)) parallel_print("H5T_NATIVE_FLOAT16"); diff --git a/tools/lib/h5tools_dump.c b/tools/lib/h5tools_dump.c index 0871b8e3bf4..ad7495a9a37 100644 --- a/tools/lib/h5tools_dump.c +++ b/tools/lib/h5tools_dump.c @@ -2212,6 +2212,10 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_ h5tools_str_append(buffer, "H5T_FLOAT_BFLOAT16BE"); else if (H5Tequal(type, H5T_FLOAT_BFLOAT16LE) == true) h5tools_str_append(buffer, "H5T_FLOAT_BFLOAT16LE"); + else if (H5Tequal(type, H5T_FLOAT_F8E4M3) == true) + h5tools_str_append(buffer, "H5T_FLOAT_F8E4M3"); + else if (H5Tequal(type, H5T_FLOAT_F8E5M2) == true) + h5tools_str_append(buffer, "H5T_FLOAT_F8E5M2"); else if (H5Tequal(type, H5T_VAX_F32) == true) h5tools_str_append(buffer, "H5T_VAX_F32"); else if (H5Tequal(type, H5T_VAX_F64) == true) diff --git a/tools/lib/h5tools_type.c b/tools/lib/h5tools_type.c index e8db7e9b0d1..32a90cd3148 100644 --- a/tools/lib/h5tools_type.c +++ b/tools/lib/h5tools_type.c @@ -55,7 +55,13 @@ h5tools_get_little_endian_type(hid_t tid) break; case H5T_FLOAT: - if (size == 2) { + if (size == 1) { + if (true == H5Tequal(tid, H5T_FLOAT_F8E4M3)) + p_type = H5Tcopy(H5T_FLOAT_F8E4M3); + else if (true == H5Tequal(tid, H5T_FLOAT_F8E5M2)) + p_type = H5Tcopy(H5T_FLOAT_F8E5M2); + } + else 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) || @@ -150,7 +156,21 @@ h5tools_get_big_endian_type(hid_t tid) break; case H5T_FLOAT: - if (size == 2) { + if (size == 1) { + if (true == H5Tequal(tid, H5T_FLOAT_F8E4M3)) { + p_type = H5Tcopy(H5T_FLOAT_F8E4M3); + + /* Though not very useful, set order to BE as expected */ + H5Tset_order(p_type, H5T_ORDER_BE); + } + else if (true == H5Tequal(tid, H5T_FLOAT_F8E5M2)) { + p_type = H5Tcopy(H5T_FLOAT_F8E5M2); + + /* Though not very useful, set order to BE as expected */ + H5Tset_order(p_type, H5T_ORDER_BE); + } + } + else 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) || diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index c9034cedc1d..0cb613883f9 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -3283,6 +3283,48 @@ getInputClassType(struct Input *in, char *buffer) kindex = 3; } + else if (!strcmp(buffer, "H5T_FLOAT_F8E4M3")) { + in->inputSize = 8; + in->configOptionVector[INPUT_SIZE] = 1; + + if ((kindex = OutputArchStrToInt("FLOAT")) == -1) { + (void)fprintf(stderr, "%s", err2); + return (-1); + } + in->outputArchitecture = kindex; + + if ((kindex = OutputByteOrderStrToInt("LE")) == -1) { + (void)fprintf(stderr, "%s", err3); + return (-1); + } + in->outputByteOrder = kindex; +#ifdef H5DEBUGIMPORT + printf("h5dump inputByteOrder %d\n", in->inputByteOrder); +#endif + + kindex = 3; + } + else if (!strcmp(buffer, "H5T_FLOAT_F8E5M2")) { + in->inputSize = 8; + in->configOptionVector[INPUT_SIZE] = 1; + + if ((kindex = OutputArchStrToInt("FLOAT")) == -1) { + (void)fprintf(stderr, "%s", err2); + return (-1); + } + in->outputArchitecture = kindex; + + if ((kindex = OutputByteOrderStrToInt("LE")) == -1) { + (void)fprintf(stderr, "%s", err3); + return (-1); + } + in->outputByteOrder = kindex; +#ifdef H5DEBUGIMPORT + printf("h5dump inputByteOrder %d\n", in->inputByteOrder); +#endif + + kindex = 3; + } else if (!strcmp(buffer, "H5T_VAX_F32")) { in->inputSize = 32; in->configOptionVector[INPUT_SIZE] = 1; @@ -4140,6 +4182,31 @@ createOutputDataType(struct Input *in) case 8: switch (in->outputSize) { + case 8: + /* + * NOTE: h5import does not currently have a way to specify + * which FP8 format to use for output. E4M3 is arbitrarily + * chosen here, but this can be problematic for data that + * is intended to be in the E5M2 format. + */ + switch (in->outputByteOrder) { + case -1: + case 0: + new_type = H5Tcopy(H5T_FLOAT_F8E4M3); + /* Though not very useful, set order to BE as expected */ + H5Tset_order(new_type, H5T_ORDER_BE); + break; + + case 1: + new_type = H5Tcopy(H5T_FLOAT_F8E4M3); + break; + + default: + (void)fprintf(stderr, "%s", err3); + return (-1); + } + break; + case 16: switch (in->outputByteOrder) { case -1: @@ -4543,6 +4610,26 @@ createInputDataType(struct Input *in) case 8: switch (in->inputSize) { + case 8: + /* + * NOTE: h5import does not currently have a way to specify + * which FP8 format to use for input. E4M3 is arbitrarily + * chosen here, but this can be problematic for data that + * is intended to be in the E5M2 format. + */ + switch (in->inputByteOrder) { + case -1: + case 0: + case 1: + new_type = H5Tcopy(H5T_FLOAT_F8E4M3); + break; + + default: + (void)fprintf(stderr, "%s", err3); + return (-1); + } + break; + case 16: switch (in->inputByteOrder) { case -1: diff --git a/tools/src/h5ls/h5ls.c b/tools/src/h5ls/h5ls.c index 15c5ef55ae9..ce0d9f896cc 100644 --- a/tools/src/h5ls/h5ls.c +++ b/tools/src/h5ls/h5ls.c @@ -605,6 +605,12 @@ print_specific_float_type(h5tools_str_t *buffer, hid_t type, int ind) else if (H5Tequal(type, H5T_FLOAT_BFLOAT16LE) == true) { h5tools_str_append(buffer, "bfloat16 16-bit little-endian float"); } + else if (H5Tequal(type, H5T_FLOAT_F8E4M3) == true) { + h5tools_str_append(buffer, "FP8 E4M3 8-bit float"); + } + else if (H5Tequal(type, H5T_FLOAT_F8E5M2) == true) { + h5tools_str_append(buffer, "FP8 E5M2 8-bit float"); + } else { return print_float_type(buffer, type, ind); } diff --git a/tools/test/h5dump/CMakeTests.cmake b/tools/test/h5dump/CMakeTests.cmake index d2816db8f7c..d96c14295be 100644 --- a/tools/test/h5dump/CMakeTests.cmake +++ b/tools/test/h5dump/CMakeTests.cmake @@ -119,6 +119,7 @@ set (HDF5_REFERENCE_FILES tfill.ddl tfletcher32.ddl tfloatsattrs.ddl + tfloat8.ddl tfloat16.ddl tfloat16_be.ddl tfpformat.ddl @@ -313,6 +314,7 @@ set (HDF5_REFERENCE_TEST_FILES tfcontents2.h5 tfilters.h5 tfloatsattrs.h5 + tfloat8.h5 tfloat16.h5 tfloat16_be.h5 tfpformat.h5 @@ -1313,6 +1315,17 @@ ADD_H5_TEST (tfloat16_be RESULT_CODE 0 --enable-error-stack TARGET_FILE tfloat16 ADD_H5_TEST (tbfloat16 RESULT_CODE 0 --enable-error-stack TARGET_FILE tbfloat16.h5) ADD_H5_TEST (tbfloat16_be RESULT_CODE 0 --enable-error-stack TARGET_FILE tbfloat16_be.h5) +# Add test for FP8 types - To avoid printing out of some values that are, or are currently +# interpreted as, NaN values, subsetting is used on specific datasets and printing out of +# attributes is currently disabled. The output format of NaN values is implementation-dependent +# and can vary across platforms, causing output file diffing failures. This should be +# adjusted once HDF5 can properly support non-IEEE floating-point formats. +ADD_H5_TEST (tfloat8 RESULT_CODE 0 --enable-error-stack -A 0 -d /DS8BITSE4M3 + -d /DS8BITSE4M3_ALLVALS --start="0,0" --stride="1,1" --count="15,1" --block="1,16" + -d /DS8BITSE4M3_ALLVALS_CONVERT -d /DS8BITSE5M2 + -d /DS8BITSE5M2_ALLVALS --start="0,0" --stride="1,1" --count="15,1" --block="1,16" + -d /DS8BITSE5M2_ALLVALS_CONVERT TARGET_FILE tfloat8.h5) + # Add tests for complex numbers. For portability, use a fixed floating-point # precision and skip dumping of the "long double _Complex" dataset. The "long # double _Complex" dataset may display differently across platforms, e.g. diff --git a/tools/test/h5dump/expected/tfloat8.ddl b/tools/test/h5dump/expected/tfloat8.ddl new file mode 100644 index 00000000000..823b46af0db --- /dev/null +++ b/tools/test/h5dump/expected/tfloat8.ddl @@ -0,0 +1,227 @@ +HDF5 "tfloat8.h5" { +DATASET "/DS8BITSE4M3" { + DATATYPE H5T_FLOAT_F8E4M3 + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, + (1,0): 15, 0.5625, 1.125, 1.625, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, + (1,14): 7, 7.5, + (2,0): 14, 0.625, 1.125, 1.625, 2.25, 2.75, 3.25, 3.75, 4, 4.5, 5, 5.5, 6, + (2,13): 6.5, 7, 7.5, + (3,0): 13, 0.6875, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4, 4.5, 5, 5.5, 6, + (3,13): 6.5, 7, 7.5, + (4,0): 12, 0.75, 1.25, 1.75, 2.25, 2.75, 3.25, 3.75, 4.5, 5, 5.5, 6, 6.5, + (4,13): 7, 7.5, 8, + (5,0): 11, 0.8125, 1.375, 1.875, 2.25, 2.75, 3.25, 3.75, 4.5, 5, 5.5, 6, + (5,12): 6.5, 7, 7.5, 8, + (6,0): 10, 0.875, 1.375, 1.875, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, + (6,14): 7.5, 8, + (7,0): 9, 0.9375, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8 + } +} +DATASET "/DS8BITSE4M3_ALLVALS" { + DATATYPE H5T_FLOAT_F8E4M3 + DATASPACE SIMPLE { ( 16, 16 ) / ( 16, 16 ) } + SUBSET { + START ( 0, 0 ); + STRIDE ( 1, 1 ); + COUNT ( 15, 1 ); + BLOCK ( 1, 16 ); + DATA { + (0,0): 0, 0.00195312, 0.00390625, 0.00585938, 0.0078125, 0.00976562, + (0,6): 0.0117188, 0.0136719, 0.015625, 0.0175781, 0.0195312, 0.0214844, + (0,12): 0.0234375, 0.0253906, 0.0273438, 0.0292969, + (1,0): 0.03125, 0.0351562, 0.0390625, 0.0429688, 0.046875, 0.0507812, + (1,6): 0.0546875, 0.0585938, 0.0625, 0.0703125, 0.078125, 0.0859375, + (1,12): 0.09375, 0.101562, 0.109375, 0.117188, + (2,0): 0.125, 0.140625, 0.15625, 0.171875, 0.1875, 0.203125, 0.21875, + (2,7): 0.234375, 0.25, 0.28125, 0.3125, 0.34375, 0.375, 0.40625, + (2,14): 0.4375, 0.46875, + (3,0): 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, + (3,9): 1.125, 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, + (4,0): 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 6.5, + (4,14): 7, 7.5, + (5,0): 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, + (6,0): 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, + (6,15): 120, + (7,0): 128, 144, 160, 176, 192, 208, 224, 240, inf, nan, nan, nan, nan, + (7,13): nan, nan, nan, + (8,0): -0, -0.00195312, -0.00390625, -0.00585938, -0.0078125, + (8,5): -0.00976562, -0.0117188, -0.0136719, -0.015625, -0.0175781, + (8,10): -0.0195312, -0.0214844, -0.0234375, -0.0253906, -0.0273438, + (8,15): -0.0292969, + (9,0): -0.03125, -0.0351562, -0.0390625, -0.0429688, -0.046875, + (9,5): -0.0507812, -0.0546875, -0.0585938, -0.0625, -0.0703125, + (9,10): -0.078125, -0.0859375, -0.09375, -0.101562, -0.109375, + (9,15): -0.117188, + (10,0): -0.125, -0.140625, -0.15625, -0.171875, -0.1875, -0.203125, + (10,6): -0.21875, -0.234375, -0.25, -0.28125, -0.3125, -0.34375, + (10,12): -0.375, -0.40625, -0.4375, -0.46875, + (11,0): -0.5, -0.5625, -0.625, -0.6875, -0.75, -0.8125, -0.875, + (11,7): -0.9375, -1, -1.125, -1.25, -1.375, -1.5, -1.625, -1.75, + (11,15): -1.875, + (12,0): -2, -2.25, -2.5, -2.75, -3, -3.25, -3.5, -3.75, -4, -4.5, -5, + (12,11): -5.5, -6, -6.5, -7, -7.5, + (13,0): -8, -9, -10, -11, -12, -13, -14, -15, -16, -18, -20, -22, -24, + (13,13): -26, -28, -30, + (14,0): -32, -36, -40, -44, -48, -52, -56, -60, -64, -72, -80, -88, + (14,12): -96, -104, -112, -120 + } + } +} +DATASET "/DS8BITSE4M3_ALLVALS_CONVERT" { + DATATYPE H5T_FLOAT_F8E4M3 + DATASPACE SIMPLE { ( 16, 16 ) / ( 16, 16 ) } + DATA { + (0,0): 0, 0.00195312, 0.00195312, 0.00585938, 0.00390625, 0.00976562, + (0,6): 0.0117188, 0.0136719, 0.0078125, 0.0175781, 0.0195312, 0.0214844, + (0,12): 0.0234375, 0.0253906, 0.0273438, 0.0292969, + (1,0): 0.03125, 0.0351562, 0.0390625, 0.0429688, 0.046875, 0.0507812, + (1,6): 0.0546875, 0.0585938, 0.0625, 0.0703125, 0.078125, 0.0859375, + (1,12): 0.09375, 0.101562, 0.109375, 0.117188, + (2,0): 0.125, 0.140625, 0.15625, 0.171875, 0.1875, 0.203125, 0.21875, + (2,7): 0.234375, 0.25, 0.28125, 0.3125, 0.34375, 0.375, 0.40625, 0.4375, + (2,15): 0.46875, + (3,0): 0.5, 0.5625, 0.625, 0.6875, 0.75, 0.8125, 0.875, 0.9375, 1, 1.125, + (3,10): 1.25, 1.375, 1.5, 1.625, 1.75, 1.875, + (4,0): 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4, 4.5, 5, 5.5, 6, 6.5, 7, + (4,15): 7.5, + (5,0): 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 30, + (6,0): 32, 36, 40, 44, 48, 52, 56, 60, 64, 72, 80, 88, 96, 104, 112, 120, + (7,0): 128, 144, 160, 176, 192, 208, 224, 240, inf, inf, inf, inf, inf, + (7,13): inf, inf, 0, + (8,0): -0, -0.00195312, -0.00195312, -0.00585938, -0.00390625, + (8,5): -0.00976562, -0.0117188, -0.0136719, -0.0078125, -0.0175781, + (8,10): -0.0195312, -0.0214844, -0.0234375, -0.0253906, -0.0273438, + (8,15): -0.0292969, + (9,0): -0.03125, -0.0351562, -0.0390625, -0.0429688, -0.046875, + (9,5): -0.0507812, -0.0546875, -0.0585938, -0.0625, -0.0703125, -0.078125, + (9,11): -0.0859375, -0.09375, -0.101562, -0.109375, -0.117188, + (10,0): -0.125, -0.140625, -0.15625, -0.171875, -0.1875, -0.203125, + (10,6): -0.21875, -0.234375, -0.25, -0.28125, -0.3125, -0.34375, -0.375, + (10,13): -0.40625, -0.4375, -0.46875, + (11,0): -0.5, -0.5625, -0.625, -0.6875, -0.75, -0.8125, -0.875, -0.9375, + (11,8): -1, -1.125, -1.25, -1.375, -1.5, -1.625, -1.75, -1.875, + (12,0): -2, -2.25, -2.5, -2.75, -3, -3.25, -3.5, -3.75, -4, -4.5, -5, + (12,11): -5.5, -6, -6.5, -7, -7.5, + (13,0): -8, -9, -10, -11, -12, -13, -14, -15, -16, -18, -20, -22, -24, + (13,13): -26, -28, -30, + (14,0): -32, -36, -40, -44, -48, -52, -56, -60, -64, -72, -80, -88, -96, + (14,13): -104, -112, -120, + (15,0): -128, -144, -160, -176, -192, -208, -224, -240, -inf, -inf, -inf, + (15,11): -inf, -inf, -inf, -inf, 0 + } +} +DATASET "/DS8BITSE5M2" { + DATATYPE H5T_FLOAT_F8E5M2 + DATASPACE SIMPLE { ( 8, 16 ) / ( 8, 16 ) } + DATA { + (0,0): 16, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 5, 6, 6, 7, 7, 8, + (1,0): 16, 0.625, 1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 5, 6, 6, 7, 7, 8, + (2,0): 14, 0.625, 1.25, 1.75, 2, 2.5, 3, 3.5, 4, 5, 5, 6, 6, 7, 7, 8, + (3,0): 14, 0.75, 1.25, 1.75, 2, 2.5, 3, 3.5, 4, 5, 5, 6, 6, 7, 7, 8, + (4,0): 12, 0.75, 1.25, 1.75, 2.5, 3, 3.5, 4, 4, 5, 5, 6, 6, 7, 7, 8, + (5,0): 12, 0.875, 1.25, 1.75, 2.5, 3, 3.5, 4, 4, 5, 5, 6, 6, 7, 7, 8, + (6,0): 10, 0.875, 1.5, 2, 2.5, 3, 3.5, 4, 4, 5, 5, 6, 6, 7, 7, 8, + (7,0): 10, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4, 5, 5, 6, 6, 7, 7, 8 + } +} +DATASET "/DS8BITSE5M2_ALLVALS" { + DATATYPE H5T_FLOAT_F8E5M2 + DATASPACE SIMPLE { ( 16, 16 ) / ( 16, 16 ) } + SUBSET { + START ( 0, 0 ); + STRIDE ( 1, 1 ); + COUNT ( 15, 1 ); + BLOCK ( 1, 16 ); + DATA { + (0,0): 0, 1.52588e-05, 3.05176e-05, 4.57764e-05, 6.10352e-05, + (0,5): 7.62939e-05, 9.15527e-05, 0.000106812, 0.00012207, 0.000152588, + (0,10): 0.000183105, 0.000213623, 0.000244141, 0.000305176, + (0,14): 0.000366211, 0.000427246, + (1,0): 0.000488281, 0.000610352, 0.000732422, 0.000854492, 0.000976562, + (1,5): 0.0012207, 0.00146484, 0.00170898, 0.00195312, 0.00244141, + (1,10): 0.00292969, 0.00341797, 0.00390625, 0.00488281, 0.00585938, + (1,15): 0.00683594, + (2,0): 0.0078125, 0.00976562, 0.0117188, 0.0136719, 0.015625, + (2,5): 0.0195312, 0.0234375, 0.0273438, 0.03125, 0.0390625, 0.046875, + (2,11): 0.0546875, 0.0625, 0.078125, 0.09375, 0.109375, + (3,0): 0.125, 0.15625, 0.1875, 0.21875, 0.25, 0.3125, 0.375, 0.4375, + (3,8): 0.5, 0.625, 0.75, 0.875, 1, 1.25, 1.5, 1.75, + (4,0): 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, + (5,0): 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, + (5,14): 384, 448, + (6,0): 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 2560, 3072, + (6,11): 3584, 4096, 5120, 6144, 7168, + (7,0): 8192, 10240, 12288, 14336, 16384, 20480, 24576, 28672, 32768, + (7,9): 40960, 49152, 57344, inf, nan, nan, nan, + (8,0): -0, -1.52588e-05, -3.05176e-05, -4.57764e-05, -6.10352e-05, + (8,5): -7.62939e-05, -9.15527e-05, -0.000106812, -0.00012207, + (8,9): -0.000152588, -0.000183105, -0.000213623, -0.000244141, + (8,13): -0.000305176, -0.000366211, -0.000427246, + (9,0): -0.000488281, -0.000610352, -0.000732422, -0.000854492, + (9,4): -0.000976562, -0.0012207, -0.00146484, -0.00170898, -0.00195312, + (9,9): -0.00244141, -0.00292969, -0.00341797, -0.00390625, -0.00488281, + (9,14): -0.00585938, -0.00683594, + (10,0): -0.0078125, -0.00976562, -0.0117188, -0.0136719, -0.015625, + (10,5): -0.0195312, -0.0234375, -0.0273438, -0.03125, -0.0390625, + (10,10): -0.046875, -0.0546875, -0.0625, -0.078125, -0.09375, + (10,15): -0.109375, + (11,0): -0.125, -0.15625, -0.1875, -0.21875, -0.25, -0.3125, -0.375, + (11,7): -0.4375, -0.5, -0.625, -0.75, -0.875, -1, -1.25, -1.5, -1.75, + (12,0): -2, -2.5, -3, -3.5, -4, -5, -6, -7, -8, -10, -12, -14, -16, + (12,13): -20, -24, -28, + (13,0): -32, -40, -48, -56, -64, -80, -96, -112, -128, -160, -192, + (13,11): -224, -256, -320, -384, -448, + (14,0): -512, -640, -768, -896, -1024, -1280, -1536, -1792, -2048, + (14,9): -2560, -3072, -3584, -4096, -5120, -6144, -7168 + } + } +} +DATASET "/DS8BITSE5M2_ALLVALS_CONVERT" { + DATATYPE H5T_FLOAT_F8E5M2 + DATASPACE SIMPLE { ( 16, 16 ) / ( 16, 16 ) } + DATA { + (0,0): 0, 1.52588e-05, 1.52588e-05, 4.57764e-05, 3.05176e-05, 7.62939e-05, + (0,6): 9.15527e-05, 0.000106812, 0.00012207, 0.000152588, 0.000183105, + (0,11): 0.000213623, 0.000244141, 0.000305176, 0.000366211, 0.000427246, + (1,0): 0.000488281, 0.000610352, 0.000732422, 0.000854492, 0.000976562, + (1,5): 0.0012207, 0.00146484, 0.00170898, 0.00195312, 0.00244141, + (1,10): 0.00292969, 0.00341797, 0.00390625, 0.00488281, 0.00585938, + (1,15): 0.00683594, + (2,0): 0.0078125, 0.00976562, 0.0117188, 0.0136719, 0.015625, 0.0195312, + (2,6): 0.0234375, 0.0273438, 0.03125, 0.0390625, 0.046875, 0.0546875, + (2,12): 0.0625, 0.078125, 0.09375, 0.109375, + (3,0): 0.125, 0.15625, 0.1875, 0.21875, 0.25, 0.3125, 0.375, 0.4375, 0.5, + (3,9): 0.625, 0.75, 0.875, 1, 1.25, 1.5, 1.75, + (4,0): 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, + (5,0): 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, + (5,15): 448, + (6,0): 512, 640, 768, 896, 1024, 1280, 1536, 1792, 2048, 2560, 3072, 3584, + (6,12): 4096, 5120, 6144, 7168, + (7,0): 8192, 10240, 12288, 14336, 16384, 20480, 24576, 28672, 32768, + (7,9): 40960, 49152, 57344, inf, 0, 0, 0, + (8,0): -0, -1.52588e-05, -1.52588e-05, -4.57764e-05, -3.05176e-05, + (8,5): -7.62939e-05, -9.15527e-05, -0.000106812, -0.00012207, + (8,9): -0.000152588, -0.000183105, -0.000213623, -0.000244141, + (8,13): -0.000305176, -0.000366211, -0.000427246, + (9,0): -0.000488281, -0.000610352, -0.000732422, -0.000854492, + (9,4): -0.000976562, -0.0012207, -0.00146484, -0.00170898, -0.00195312, + (9,9): -0.00244141, -0.00292969, -0.00341797, -0.00390625, -0.00488281, + (9,14): -0.00585938, -0.00683594, + (10,0): -0.0078125, -0.00976562, -0.0117188, -0.0136719, -0.015625, + (10,5): -0.0195312, -0.0234375, -0.0273438, -0.03125, -0.0390625, + (10,10): -0.046875, -0.0546875, -0.0625, -0.078125, -0.09375, -0.109375, + (11,0): -0.125, -0.15625, -0.1875, -0.21875, -0.25, -0.3125, -0.375, + (11,7): -0.4375, -0.5, -0.625, -0.75, -0.875, -1, -1.25, -1.5, -1.75, + (12,0): -2, -2.5, -3, -3.5, -4, -5, -6, -7, -8, -10, -12, -14, -16, -20, + (12,14): -24, -28, + (13,0): -32, -40, -48, -56, -64, -80, -96, -112, -128, -160, -192, -224, + (13,12): -256, -320, -384, -448, + (14,0): -512, -640, -768, -896, -1024, -1280, -1536, -1792, -2048, -2560, + (14,10): -3072, -3584, -4096, -5120, -6144, -7168, + (15,0): -8192, -10240, -12288, -14336, -16384, -20480, -24576, -28672, + (15,8): -32768, -40960, -49152, -57344, -inf, 0, 0, 0 + } +} +} diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 3875442216f..f3a1bf85db4 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -132,6 +132,7 @@ #define FILE107 "trefer_reg.h5" #define FILE108 "trefer_reg_1d.h5" #define FILE109 "tvms.h5" +#define FILE110 "tfloat8.h5" #define ONION_TEST_FIXNAME_SIZE 1024 #define ONION_TEST_PAGE_SIZE (uint32_t)32 @@ -452,6 +453,94 @@ typedef struct s1_t { /* "FILE101" macros */ #define F101_DSET "AHFINDERDIRECT::ah_centroid_t[0] it=0 tl=0" +/* "FILE110" macros */ +#define F110_XDIM 8 +#define F110_YDIM 16 +#define F110_DATASET "DS8BITSE4M3" +#define F110_DATASET2 "DS8BITSE5M2" +#define F110_DATASET3 "DS8BITSE4M3_ALLVALS" +#define F110_DATASET4 "DS8BITSE5M2_ALLVALS" +#define F110_DATASET5 "DS8BITSE4M3_ALLVALS_CONVERT" +#define F110_DATASET6 "DS8BITSE5M2_ALLVALS_CONVERT" + +/* Since there are only 256 FP8 values, it's simple enough to + * list them all here for reference when checking to make sure + * the datatypes are represented correctly. + */ +static float fp8_e4m3_vals[256] = { + 0.0f, 0.001953f, 0.003906f, 0.005859f, 0.007812f, 0.009766f, 0.01172f, 0.01367f, 0.01562f, + 0.01758f, 0.01953f, 0.02148f, 0.02344f, 0.02539f, 0.02734f, 0.0293f, 0.03125f, 0.03516f, + 0.03906f, 0.04297f, 0.04688f, 0.05078f, 0.05469f, 0.05859f, 0.0625f, 0.07031f, 0.07812f, + 0.08594f, 0.09375f, 0.1016f, 0.1094f, 0.1172f, 0.125f, 0.1406f, 0.1562f, 0.1719f, + 0.1875f, 0.2031f, 0.2188f, 0.2344f, 0.25f, 0.2812f, 0.3125f, 0.3438f, 0.375f, + 0.4062f, 0.4375f, 0.4688f, 0.5f, 0.5625f, 0.625f, 0.6875f, 0.75f, 0.8125f, + 0.875f, 0.9375f, 1.0f, 1.125f, 1.25f, 1.375f, 1.5f, 1.625f, 1.75f, + 1.875f, 2.0f, 2.25f, 2.5f, 2.75f, 3.0f, 3.25f, 3.5f, 3.75f, + 4.0f, 4.5f, 5.0f, 5.5f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, + 9.0f, 10.0f, 11.0f, 12.0f, 13.0f, 14.0f, 15.0f, 16.0f, 18.0f, + 20.0f, 22.0f, 24.0f, 26.0f, 28.0f, 30.0f, 32.0f, 36.0f, 40.0f, + 44.0f, 48.0f, 52.0f, 56.0f, 60.0f, 64.0f, 72.0f, 80.0f, 88.0f, + 96.0f, 104.0f, 112.0f, 120.0f, 128.0f, 144.0f, 160.0f, 176.0f, 192.0f, + 208.0f, 224.0f, 240.0f, 256.0f, 288.0f, 320.0f, 352.0f, 384.0f, 416.0f, + 448.0f, 0.0f, /* 1 NaN value, ignore with 0.0f */ + -0.0f, -0.001953f, -0.003906f, -0.005859f, -0.007812f, -0.009766f, -0.01172f, -0.01367f, -0.01562f, + -0.01758f, -0.01953f, -0.02148f, -0.02344f, -0.02539f, -0.02734f, -0.0293f, -0.03125f, -0.03516f, + -0.03906f, -0.04297f, -0.04688f, -0.05078f, -0.05469f, -0.05859f, -0.0625f, -0.07031f, -0.07812f, + -0.08594f, -0.09375f, -0.1016f, -0.1094f, -0.1172f, -0.125f, -0.1406f, -0.1562f, -0.1719f, + -0.1875f, -0.2031f, -0.2188f, -0.2344f, -0.25f, -0.2812f, -0.3125f, -0.3438f, -0.375f, + -0.4062f, -0.4375f, -0.4688f, -0.5f, -0.5625f, -0.625f, -0.6875f, -0.75f, -0.8125f, + -0.875f, -0.9375f, -1.0f, -1.125f, -1.25f, -1.375f, -1.5f, -1.625f, -1.75f, + -1.875f, -2.0f, -2.25f, -2.5f, -2.75f, -3.0f, -3.25f, -3.5f, -3.75f, + -4.0f, -4.5f, -5.0f, -5.5f, -6.0f, -6.5f, -7.0f, -7.5f, -8.0f, + -9.0f, -10.0f, -11.0f, -12.0f, -13.0f, -14.0f, -15.0f, -16.0f, -18.0f, + -20.0f, -22.0f, -24.0f, -26.0f, -28.0f, -30.0f, -32.0f, -36.0f, -40.0f, + -44.0f, -48.0f, -52.0f, -56.0f, -60.0f, -64.0f, -72.0f, -80.0f, -88.0f, + -96.0f, -104.0f, -112.0f, -120.0f, -128.0f, -144.0f, -160.0f, -176.0f, -192.0f, + -208.0f, -224.0f, -240.0f, -256.0f, -288.0f, -320.0f, -352.0f, -384.0f, -416.0f, + -448.0f, 0.0f /* 1 NaN value, ignore with 0.0f */ +}; + +static float fp8_e5m2_vals[256] = { + 0.0f, 0.0000153f, 0.0000305f, 0.0000458f, 0.000061f, 0.0000763f, 0.0000916f, + 0.0001068f, 0.0001221f, 0.0001526f, 0.0001831f, 0.0002136f, 0.0002441f, 0.0003052f, + 0.0003662f, 0.0004272f, 0.0004883f, 0.0006104f, 0.0007324f, 0.0008545f, 0.0009766f, + 0.001221f, 0.001465f, 0.001709f, 0.001953f, 0.002441f, 0.00293f, 0.003418f, + 0.003906f, 0.004883f, 0.005859f, 0.006836f, 0.007812f, 0.009766f, 0.01172f, + 0.01367f, 0.01562f, 0.01953f, 0.02344f, 0.02734f, 0.03125f, 0.03906f, + 0.04688f, 0.05469f, 0.0625f, 0.07812f, 0.09375f, 0.1094f, 0.125f, + 0.1562f, 0.1875f, 0.2188f, 0.25f, 0.3125f, 0.375f, 0.4375f, + 0.5f, 0.625f, 0.75f, 0.875f, 1.0f, 1.25f, 1.5f, + 1.75f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 5.0f, + 6.0f, 7.0f, 8.0f, 10.0f, 12.0f, 14.0f, 16.0f, + 20.0f, 24.0f, 28.0f, 32.0f, 40.0f, 48.0f, 56.0f, + 64.0f, 80.0f, 96.0f, 112.0f, 128.0f, 160.0f, 192.0f, + 224.0f, 256.0f, 320.0f, 384.0f, 448.0f, 512.0f, 640.0f, + 768.0f, 896.0f, 1024.0f, 1280.0f, 1536.0f, 1792.0f, 2048.0f, + 2560.0f, 3072.0f, 3584.0f, 4096.0f, 5120.0f, 6144.0f, 7168.0f, + 8192.0f, 10240.0f, 12288.0f, 14336.0f, 16384.0f, 20480.0f, 24576.0f, + 28672.0f, 32768.0f, 40960.0f, 49152.0f, 57344.0f, INFINITY, 0.0f, + 0.0f, 0.0f, /* 3 NaN values, ignore with 0.0f */ + -0.0f, -0.0000153f, -0.0000305f, -0.0000458f, -0.000061f, -0.0000763f, -0.0000916f, + -0.0001068f, -0.0001221f, -0.0001526f, -0.0001831f, -0.0002136f, -0.0002441f, -0.0003052f, + -0.0003662f, -0.0004272f, -0.0004883f, -0.0006104f, -0.0007324f, -0.0008545f, -0.0009766f, + -0.001221f, -0.001465f, -0.001709f, -0.001953f, -0.002441f, -0.00293f, -0.003418f, + -0.003906f, -0.004883f, -0.005859f, -0.006836f, -0.007812f, -0.009766f, -0.01172f, + -0.01367f, -0.01562f, -0.01953f, -0.02344f, -0.02734f, -0.03125f, -0.03906f, + -0.04688f, -0.05469f, -0.0625f, -0.07812f, -0.09375f, -0.1094f, -0.125f, + -0.1562f, -0.1875f, -0.2188f, -0.25f, -0.3125f, -0.375f, -0.4375f, + -0.5f, -0.625f, -0.75f, -0.875f, -1.0f, -1.25f, -1.5f, + -1.75f, -2.0f, -2.5f, -3.0f, -3.5f, -4.0f, -5.0f, + -6.0f, -7.0f, -8.0f, -10.0f, -12.0f, -14.0f, -16.0f, + -20.0f, -24.0f, -28.0f, -32.0f, -40.0f, -48.0f, -56.0f, + -64.0f, -80.0f, -96.0f, -112.0f, -128.0f, -160.0f, -192.0f, + -224.0f, -256.0f, -320.0f, -384.0f, -448.0f, -512.0f, -640.0f, + -768.0f, -896.0f, -1024.0f, -1280.0f, -1536.0f, -1792.0f, -2048.0f, + -2560.0f, -3072.0f, -3584.0f, -4096.0f, -5120.0f, -6144.0f, -7168.0f, + -8192.0f, -10240.0f, -12288.0f, -14336.0f, -16384.0f, -20480.0f, -24576.0f, + -28672.0f, -32768.0f, -40960.0f, -49152.0f, -57344.0f, -INFINITY, 0.0f, + 0.0f, 0.0f /* 3 NaN values, ignore with 0.0f */ +}; + void gent_group(void) { @@ -14347,3 +14436,221 @@ gent_tvms(void) return 0; } + +void +gent_float8(void) +{ + hsize_t dims[2], adims[1]; + hid_t fid = H5I_INVALID_HID; + hid_t attr = H5I_INVALID_HID; + hid_t dataset = H5I_INVALID_HID; + hid_t space = H5I_INVALID_HID; + hid_t aspace = H5I_INVALID_HID; + + /* + * Just use float as the in-memory type for the standard + * datasets for now, until wide support for a native FP8 + * type is available. Note that this will cause several of + * the values to be rounded by the library's datatype + * conversion process due to the mantissa size of float + * being larger than that of the FP8 types. But this is not + * particularly interesting test data anyway and is mostly + * just meant to check that something is not very obviously + * wrong with the data after float values which can't be + * represented in FP8 are converted into values that can + * be. The more interesting parts of the file generated + * here are whether or not the datatype displays correctly + * and whether the datasets which contain all the possible + * FP8 values display correctly. Other tests ensure that the + * FP8 types are in the correct format. + */ + struct { + float arr[F110_XDIM][F110_YDIM]; + } *dset8; + + float *aset8 = NULL; + float val; + + uint8_t all_vals_buf[256]; + + dset8 = malloc(sizeof(*dset8)); + + aset8 = calloc(F110_XDIM * F110_YDIM, sizeof(float)); + + fid = H5Fcreate(FILE110, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + dims[0] = F110_XDIM; + dims[1] = F110_YDIM; + space = H5Screate_simple(2, dims, NULL); + + adims[0] = F110_XDIM * F110_YDIM; + aspace = H5Screate_simple(1, adims, NULL); + + val = (float)F110_YDIM; + for (size_t i = 0; i < dims[0]; i++) { + dset8->arr[i][0] = val; + aset8[i * dims[1]] = dset8->arr[i][0]; + + for (size_t j = 1; j < dims[1]; j++) { + dset8->arr[i][j] = (float)(j * dims[0] + i) / (float)F110_YDIM; + aset8[i * dims[1] + j] = dset8->arr[i][j]; + } + + val -= (float)1; + } + + /* Populate all_vals_buf with every FP8 number. Note + * that uint8_t is used for the buffer here since we + * don't currently have support for an FP8 type to + * use and there are currently conversion issues when + * converting larger types to the FP8 types. Writing + * a uint8_t buffer allows bypassing the datatype + * conversion process. + */ + all_vals_buf[0] = 0; + for (size_t i = 1; i < 256; i++) + all_vals_buf[i] = all_vals_buf[i - 1] + 1; + + /* Dataset of 8-bit FP8 E4M3 */ + dataset = H5Dcreate2(fid, F110_DATASET, H5T_FLOAT_F8E4M3, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + + /* Attribute of 8-bit FP8 E4M3 */ + attr = H5Acreate2(dataset, F110_DATASET, H5T_FLOAT_F8E4M3, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_NATIVE_FLOAT, aset8); + + H5Aclose(attr); + H5Dclose(dataset); + + /* Dataset of 8-bit FP8 E5M2 */ + dataset = H5Dcreate2(fid, F110_DATASET2, H5T_FLOAT_F8E5M2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, dset8); + + /* Attribute of 8-bit FP8 E5M2 */ + attr = H5Acreate2(dataset, F110_DATASET2, H5T_FLOAT_F8E5M2, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_NATIVE_FLOAT, aset8); + + H5Aclose(attr); + H5Dclose(dataset); + H5Sclose(aspace); + H5Sclose(space); + + dims[0] = 16; + dims[1] = 16; + space = H5Screate_simple(2, dims, NULL); + + adims[0] = 256; + aspace = H5Screate_simple(1, adims, NULL); + + /* Dataset of 8-bit FP8 E4M3 with all values written without datatype conversion. + * This dataset will have the correct data in the file, but will currently display + * incorrectly. The library converts the data into a native type, either float16 or + * float, on read, but the E4M3 format doesn't follow the IEEE standard. This causes + * the library to interpret certain values as infinities or NaNs when the format has + * no infinities and only one NaN. + */ + dataset = H5Dcreate2(fid, F110_DATASET3, H5T_FLOAT_F8E4M3, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_FLOAT_F8E4M3, H5S_ALL, H5S_ALL, H5P_DEFAULT, all_vals_buf); + + /* Attribute of 8-bit FP8 E4M3 with all values written without datatype conversion. + * This attribute will have the correct data in the file, but will currently display + * incorrectly. The library converts the data into a native type, either float16 or + * float, on read, but the E4M3 format doesn't follow the IEEE standard. This causes + * the library to interpret certain values as infinities or NaNs when the format has + * no infinities and only one NaN. + */ + attr = H5Acreate2(dataset, F110_DATASET3, H5T_FLOAT_F8E4M3, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_FLOAT_F8E4M3, all_vals_buf); + + H5Aclose(attr); + H5Dclose(dataset); + + /* Dataset of 8-bit FP8 E5M2 with all values written without datatype conversion. + * This dataset will have the correct data in the file and should display correctly. + */ + dataset = H5Dcreate2(fid, F110_DATASET4, H5T_FLOAT_F8E5M2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_FLOAT_F8E5M2, H5S_ALL, H5S_ALL, H5P_DEFAULT, all_vals_buf); + + /* Attribute of 8-bit FP8 E5M2 with all values written without datatype conversion. + * This attribute will have the correct data in the file and should display correctly. + */ + attr = H5Acreate2(dataset, F110_DATASET4, H5T_FLOAT_F8E5M2, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_FLOAT_F8E5M2, all_vals_buf); + + H5Aclose(attr); + H5Dclose(dataset); + + /* Dataset of 8-bit FP8 E4M3 with all values written with datatype conversion from + * float. This dataset will currently have incorrect data in the file. Some of the + * smaller values appear to be incorrectly rounded by the library, while some of the + * larger values get converted to infinities by the datatype conversion process due + * to the fact that the E4M3 format doesn't follow the IEEE standard. While bit + * patterns that have all exponent bits set are normal values in the E4M3 format + * (other than the two NaN values S1111111), these are interpreted by the library as + * infinities according to the IEEE standard and are converted into infinities in the + * file. + */ + dataset = H5Dcreate2(fid, F110_DATASET5, H5T_FLOAT_F8E4M3, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fp8_e4m3_vals); + + /* Attribute of 8-bit FP8 E4M3 with all values written with datatype conversion from + * float. This attribute will currently have incorrect data in the file. Some of the + * smaller values appear to be incorrectly rounded by the library, while some of the + * larger values get converted to infinities by the datatype conversion process due + * to the fact that the E4M3 format doesn't follow the IEEE standard. While bit + * patterns that have all exponent bits set are normal values in the E4M3 format + * (other than the two NaN values S1111111), these are interpreted by the library as + * infinities according to the IEEE standard and are converted into infinities in the + * file. + */ + attr = H5Acreate2(dataset, F110_DATASET5, H5T_FLOAT_F8E4M3, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_NATIVE_FLOAT, fp8_e4m3_vals); + + H5Aclose(attr); + H5Dclose(dataset); + + /* Dataset of 8-bit FP8 E5M2 with all values written with datatype conversion from + * float. This dataset will have nearly all values correct in the file. However, a + * few of the smaller values appear to be incorrectly rounded by the library, at + * least when converting from IEEE 32-bit float. + */ + dataset = H5Dcreate2(fid, F110_DATASET6, H5T_FLOAT_F8E5M2, space, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + H5Dwrite(dataset, H5T_NATIVE_FLOAT, H5S_ALL, H5S_ALL, H5P_DEFAULT, fp8_e5m2_vals); + + /* Attribute of 8-bit FP8 E5M2 with all values written with datatype conversion from + * float. This attribute will have nearly all values correct in the file. However, a + * few of the smaller values appear to be incorrectly rounded by the library, at + * least when converting from IEEE 32-bit float. + */ + attr = H5Acreate2(dataset, F110_DATASET6, H5T_FLOAT_F8E5M2, aspace, H5P_DEFAULT, H5P_DEFAULT); + + H5Awrite(attr, H5T_NATIVE_FLOAT, fp8_e5m2_vals); + + H5Aclose(attr); + H5Dclose(dataset); + +error: + free(aset8); + free(dset8); + + H5E_BEGIN_TRY + { + H5Aclose(attr); + H5Sclose(aspace); + H5Sclose(space); + H5Dclose(dataset); + H5Fclose(fid); + } + H5E_END_TRY; +} diff --git a/tools/test/h5dump/h5dumpgentest.h b/tools/test/h5dump/h5dumpgentest.h index 9f8577520ad..df8b0d17ccd 100644 --- a/tools/test/h5dump/h5dumpgentest.h +++ b/tools/test/h5dump/h5dumpgentest.h @@ -128,6 +128,8 @@ void gent_complex_be(void); void gent_bfloat16(void); void gent_bfloat16_be(void); +void gent_float8(void); + void gent_trefer_attr(void); void gent_tattr4_be(void); void gent_tno_subset(void); diff --git a/tools/test/h5gentest.c b/tools/test/h5gentest.c index 5707db5b50d..ba3f5d9dcb3 100644 --- a/tools/test/h5gentest.c +++ b/tools/test/h5gentest.c @@ -267,6 +267,8 @@ gen_h5dump_files(void) gent_bfloat16(); gent_bfloat16_be(); + gent_float8(); + gent_trefer_attr(); gent_tattr4_be(); gent_tno_subset(); diff --git a/tools/test/h5ls/CMakeTests.cmake b/tools/test/h5ls/CMakeTests.cmake index ae4354f98aa..5c3fe3af656 100644 --- a/tools/test/h5ls/CMakeTests.cmake +++ b/tools/test/h5ls/CMakeTests.cmake @@ -41,6 +41,7 @@ set (LIST_HDF5_TEST_FILES textlink.h5 textlinksrc.h5 textlinktar.h5 + tfloat8.h5 tfloat16.h5 tfloat16_be.h5 tgroup.h5 @@ -100,6 +101,7 @@ set (LIST_OTHER_TEST_FILES textlinksrc-7-old.ls textlinksrc-nodangle-1.ls textlinksrc-nodangle-2.ls + tfloat8.ls tfloat16.ls tfloat16_nosupport.ls tfloat16_be.ls @@ -505,6 +507,9 @@ endif () ADD_H5_TEST (tbfloat16 RESULT_CODE 0 -w80 -v tbfloat16.h5) ADD_H5_TEST (tbfloat16_be RESULT_CODE 0 -w80 -v tbfloat16_be.h5) +# test for FP8 types +ADD_H5_TEST (tfloat8 RESULT_CODE 0 -w80 -v tfloat8.h5) + # tests for complex numbers if (${${HDF_PREFIX}_HAVE_COMPLEX_NUMBERS}) # If support is available for complex numbers, the second test diff --git a/tools/test/h5ls/expected/tfloat8.ls b/tools/test/h5ls/expected/tfloat8.ls new file mode 100644 index 00000000000..64aaac18489 --- /dev/null +++ b/tools/test/h5ls/expected/tfloat8.ls @@ -0,0 +1,43 @@ +Opened "tfloat8.h5" with sec2 driver. +DS8BITSE4M3 Dataset {8/8, 16/16} + Attribute: DS8BITSE4M3 {128} + Type: FP8 E4M3 8-bit float + Location: 1:800 + Links: 1 + Storage: 128 logical bytes, 128 allocated bytes, 100.00% utilization + Type: FP8 E4M3 8-bit float +DS8BITSE4M3_ALLVALS Dataset {16/16, 16/16} + Attribute: DS8BITSE4M3_ALLVALS {256} + Type: FP8 E4M3 8-bit float + Location: 1:4096 + Links: 1 + Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization + Type: FP8 E4M3 8-bit float +DS8BITSE4M3_ALLVALS_CONVERT Dataset {16/16, 16/16} + Attribute: DS8BITSE4M3_ALLVALS_CONVERT {256} + Type: FP8 E4M3 8-bit float + Location: 1:5104 + Links: 1 + Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization + Type: FP8 E4M3 8-bit float +DS8BITSE5M2 Dataset {8/8, 16/16} + Attribute: DS8BITSE5M2 {128} + Type: FP8 E5M2 8-bit float + Location: 1:1608 + Links: 1 + Storage: 128 logical bytes, 128 allocated bytes, 100.00% utilization + Type: FP8 E5M2 8-bit float +DS8BITSE5M2_ALLVALS Dataset {16/16, 16/16} + Attribute: DS8BITSE5M2_ALLVALS {256} + Type: FP8 E5M2 8-bit float + Location: 1:4600 + Links: 1 + Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization + Type: FP8 E5M2 8-bit float +DS8BITSE5M2_ALLVALS_CONVERT Dataset {16/16, 16/16} + Attribute: DS8BITSE5M2_ALLVALS_CONVERT {256} + Type: FP8 E5M2 8-bit float + Location: 1:5904 + Links: 1 + Storage: 256 logical bytes, 256 allocated bytes, 100.00% utilization + Type: FP8 E5M2 8-bit float diff --git a/tools/test/testfiles/tfloat8.h5 b/tools/test/testfiles/tfloat8.h5 new file mode 100644 index 0000000000000000000000000000000000000000..43f1128c4bc0903317c01aed27eabb206ac5cde1 GIT binary patch literal 6416 zcmeD5aB<`1lHy_j0S*oZ76t(@6Gr@p0s%>g2#gPtPk=HQp>zk7Ucm%mFfxE31A_!q zTo7tLy1I}cS62q0N|^aD8mf)KfCa*;fC-G!BPs+uTpa^I9^L@;^$eKrMPUru(2NWm z;PeY2Kq*uMY!M?9B*k+;t%cSKkP&%^{VkOP`i zm_ZhUK?77Jgc5=ZgUnoa`C^6uG(T0aLgX*NRfB^I&Z8D1*w5dEk%0~7I0gk~{3b&} z3#bMbKsb~~K*c`@<4^z^7ird^A9()v_IRvK4a#r*>mR3o4;V;qQy&=E?d50<*L zVdJLFTefc7zGLUE-Fx=#+kfETp~FXx9y@;GWe&gn?+js8X zyZ_+fqsLF4K70P+<*V0k-oAVP;p3;zU%r0({^RGb-+%u8`_C}q{m;nE1dM+cddGhS z7%((6Ha0f_78>bM1 z!0JbOy+@09M{YOcZm%;y#+pD;iUf#_cVK%RXS^fZKN|1Y+k1q@GjQc|m^cObof{h6 zc;g*5p0NQsu9E;)9e|WtsLw?2f5Z5&{vnJH?4P5gKbSarx`c@%sgHN|_X~3k3IRJF zCXb{KMIPpD*mwub$2<%XU@1lh8C>NdiaDg0izB-|3@aBuKqCNs90QgQaM9TE2XeWD ir(EQL#xX4F!CcI85qtdON=L}?kL(WI<>Sci4*&p$;S#$5 literal 0 HcmV?d00001