Skip to content

Conversation

@chloeee99
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the core label Jan 8, 2026
@tencent-adm
Copy link
Member

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


chloeeyi seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@codecov-commenter
Copy link

codecov-commenter commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 0% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.77%. Comparing base (6b4f6f9) to head (ed12b48).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/mat.cpp 0.00% 30 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6495      +/-   ##
==========================================
- Coverage   93.27%   92.77%   -0.50%     
==========================================
  Files         845      807      -38     
  Lines      266119   255130   -10989     
==========================================
- Hits       248222   236702   -11520     
- Misses      17897    18428     +531     

☔ 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.

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 PR adds float8 and bfloat8 conversion functions to support 8-bit floating-point formats. The implementation provides bidirectional conversions between float16 and two 8-bit formats: E4M3 (1-bit sign, 4-bit exponent, 3-bit mantissa) and E5M2 (1-bit sign, 5-bit exponent, 2-bit mantissa).

Key changes:

  • Added float16 ↔ float8 E4M3 conversion functions with proper handling of special values
  • Added float16 ↔ bfloat8 E5M2 inline conversion functions using direct bit truncation/extension
  • Implemented proper handling for edge cases including zero, infinity, NaN, overflow, and underflow

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/mat.h Added function declarations and inline implementations for float8 and bfloat8 conversion functions
src/mat.cpp Implemented float16_to_float8 and float8_to_float16 with comprehensive special value handling

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nihui nihui changed the title issueshot:add float trans add float8 and bfloat8 conversion functions Jan 9, 2026
@nihui nihui merged commit d522a74 into Tencent:master Jan 9, 2026
106 of 111 checks passed
@nihui
Copy link
Member

nihui commented Jan 9, 2026

Thanks for your contribution !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants