Skip to content

Conversation

@brownbaerchen
Copy link
Collaborator

@brownbaerchen brownbaerchen commented Jan 7, 2026

Due Diligence

  • General:
  • Implementation:
    • unit tests: all split configurations tested
    • unit tests: multiple dtypes tested
    • NEW unit tests: MPS tested (1 MPI process, 1 GPU)
    • benchmarks: created for new functionality
    • benchmarks: performance improved or maintained
    • documentation updated where needed

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.float16 and the alias ht.half and 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.py a 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:

  • Add ht.float16 and ht.half
  • Refactor of core/types.py

Type of change

New feature (non-breaking change which adds functionality)

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2026

Thank you for the PR!

@codecov
Copy link

codecov bot commented Jan 7, 2026

Codecov Report

❌ Patch coverage is 95.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.68%. Comparing base (55d07f1) to head (414d508).
⚠️ Report is 26 commits behind head on main.

Files with missing lines Patch % Lines
heat/core/types.py 94.73% 6 Missing ⚠️
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     
Flag Coverage Δ
unit 91.68% <95.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@brownbaerchen brownbaerchen marked this pull request as draft January 8, 2026 09:07
@brownbaerchen brownbaerchen marked this pull request as ready for review January 8, 2026 15:38
@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Thank you for the PR!

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2026

Thank you for the PR!

@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

Thank you for the PR!

Copy link
Contributor

Copilot AI left a 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.float16 and ht.half datatype 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.

@brownbaerchen brownbaerchen changed the title Added half precision datatype Added float16 datatype Jan 12, 2026
@github-actions
Copy link
Contributor

Thank you for the PR!

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

@github-actions
Copy link
Contributor

Thank you for the PR!

@brownbaerchen brownbaerchen added the HeatHub The HeatHub project, as part of Science Serve, aims to foster the Heat community. label Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core features HeatHub The HeatHub project, as part of Science Serve, aims to foster the Heat community. types

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Add float16 support to types

2 participants