Skip to content

Commit

Permalink
Update numio/std.hpp to reflect changes to FloatIO and add half-preci…
Browse files Browse the repository at this point in the history
…sion preset. Additionally add some popular non-IEEE 754 floating-point formats in numio/fp_extra.hpp
  • Loading branch information
DeltaRazero committed Nov 15, 2023
1 parent d451542 commit 64cebf0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
26 changes: 26 additions & 0 deletions include/numio/fp_extra.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#ifndef FP_EXTRA_H
#define FP_EXTRA_H

// ****************************************************************************

#include "../numio.hpp"
#include <cstdint>

namespace NumIO
{
/// @brief Google Brain bfloat16 (brain floating point)
using bfloat16_IO = FloatIO<float, std::uint16_t, 8, 7>;

/// @brief NVidia TensorFloat
using nv_tf32_IO = FloatIO<float, std::uint32_t, 8, 10>;

/// @brief AMD fp24
using amd_fp24_IO = FloatIO<float, std::uint32_t, 7, 16>;

/// @brief Pixar PXR24
using pxr24_IO = FloatIO<float, std::uint32_t, 8, 15>;
}

// ****************************************************************************

#endif /* FP_EXTRA_H */
5 changes: 3 additions & 2 deletions include/numio/std.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace NumIO
using u32_IO = IntIO<std::uint32_t>;
using u64_IO = IntIO<std::uint64_t>;

using f32_IO = FloatIO<float>;
using f64_IO = FloatIO<double>;
using fp16_IO = FloatIO<float, std::uint16_t, 5, 10>;
using fp32_IO = FloatIO<float, std::uint32_t>;
using fp64_IO = FloatIO<double, std::uint64_t>;
}

// ****************************************************************************
Expand Down

0 comments on commit 64cebf0

Please sign in to comment.