-
Notifications
You must be signed in to change notification settings - Fork 61
Added float16 datatype #2092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Added float16 datatype #2092
Conversation
|
Thank you for the PR! |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2092 +/- ##
==========================================
- Coverage 91.69% 91.68% -0.01%
==========================================
Files 89 89
Lines 13942 13999 +57
==========================================
+ Hits 12784 12835 +51
- Misses 1158 1164 +6
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thank you for the PR! |
|
Thank you for the PR! |
|
Thank you for the PR! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request adds support for the float16 (half precision) datatype to HeAT and performs a significant refactoring of the type system to make adding new datatypes easier.
Changes:
- Added
ht.float16andht.halfdatatype classes with appropriate casting rules - Refactored type management from static lookup tables to dynamic class-based attributes
- Updated type checking functions to use the new class-based system
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| heat/core/types.py | Added float16 class, refactored type system from static tables to class attributes, added can_cast_to method to datatype base class |
| heat/core/tests/test_types.py | Added tests for float16/half datatype, corrected same_kind casting test behavior |
| heat/core/statistics.py | Updated to use heat_type_is_complexfloating function instead of _complexfloating tuple |
| heat/core/io.py | Replaced __type_codes lookup with dynamic type name indexing |
| heat/core/arithmetics.py | Updated to use heat_type_is_complexfloating function instead of _complexfloating tuple |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thank you for the PR! |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Thank you for the PR! |
|
Thank you for the PR! |
|
Thank you for the PR! |
Due Diligence
Description
Remember the single rack exascale machine with the tiny caveat that it reaches 1.4 exaflops only in 4 bit precision? Well, for half precision, they still manage 360 petaflops, whereas for single precision they quote a lousy 5 petaflops. Maybe I am misinterpreting their specifications. But, anyways, supporting half precision, and in the future also no precision, is clearly important to stay cool.
In this PR, I simply add
ht.float16and the aliasht.halfand a basic test as for the other types. I am not sure if this is enough. On my laptop all tests pass, but I have to do the PR to trigger the CI and see if there are more failures in other places.I noticed that adding datatypes is made very difficult by somewhat hard-to-handle tables. The functionality also depends on the order of rows and columns of the tables, which is not obvious at all. I refactored the file
core/types.pya lot to get rid of all this stuff.Now, when adding a datatype, all information is handled in the datatype class itself. In particular, casting rules and mappings.
Issue/s resolved: #94
Changes proposed:
ht.float16andht.halfcore/types.pyType of change
New feature (non-breaking change which adds functionality)