FP8 Support #226
Closed
naturalcandy wants to merge 4 commits into
Closed
Conversation
naturalcandy
commented
Jul 25, 2024
Contributor
- E4M5 and E5M2 format support on host side.
chhwang
pushed a commit
that referenced
this pull request
Jun 11, 2026
…float8.{h,cpp}, register FP8_E4M3/FP8_E5M2 in data_type, add Python bindings, and write float8_test.cpp coverage. Rebase from PR #226 onto main.
chhwang
added a commit
that referenced
this pull request
Jun 12, 2026
Add FP8 host-side data types (E4M3/E5M2) Add `float8_e4m3_t` and `float8_e5m2_t` host-side types with float conversion, arithmetic, comparison operators, and `std::numeric_limits` specializations. Register `FP8_E4M3` and `FP8_E5M2` in the data-type registry and expose them in the Python bindings. Ported from PR #226 (`noli/fp8`) with two correctness fixes: - E4M3 `numeric_limits::lowest()` returns −448.0 (`0xfe`), not +448.0. - E4M3 `has_infinity` set to `false` (OCP E4M3 has no infinity encoding). NumPy and PyTorch have no stable FP8 dtypes, so `np`/`torch` mappings are set to `None` in the Python registry. New files: - `ark/float8.h` — templated `_float8` struct, E4M3/E5M2 type aliases. - `ark/float8.cpp` — float↔FP8 conversion routines. - `ark/float8_test.cpp` — 386-line test suite covering both types: round-trip, subnormals, ±zero, NaN, ±Inf, overflow saturation, arithmetic, all comparison operators, `numeric_limits` invariants. Changed files: - `ark/api/data_type.cpp` — register FP8_E4M3, FP8_E5M2. - `ark/include/ark/data_type.hpp` — declare extern constants. - `python/data_type_py.cpp` — pybind11 bindings. - `python/ark/data_type.py` — Python-side constants.
Contributor
|
Superseded by #259, which lands FP8 host-side E4M3/E5M2 data types on current main. Closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.