-
Notifications
You must be signed in to change notification settings - Fork 89
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
bit_cast operator #3655
bit_cast operator #3655
Conversation
CharlieL7
commented
Nov 22, 2024
- Converts between types while keeping the data the same. Basically an extension of reinterpret_cast without undefined behavior
- Needed for conversion pass between fp8e4m3fn to fp8e4m3fnuz.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3655 +/- ##
========================================
Coverage 92.20% 92.20%
========================================
Files 513 514 +1
Lines 21658 21678 +20
========================================
+ Hits 19970 19989 +19
- Misses 1688 1689 +1 ☔ View full report in Codecov by Sentry. |
What is the exact error are you getting when doing only one overload for template <typename To,
typename From,
MIGRAPHX_REQUIRES(is_trivially_copyable<To>{} and is_trivially_copyable<From>{})>
inline constexpr auto bit_cast(From fr) noexcept
{
return vec_transform(fr)([](auto x) -> To {
static_assert(sizeof(To) == sizeof(decltype(x)));
return __builtin_bit_cast(To, x);
});
} |
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.
Looks good. Just add test cases for THROWs
Check results before merge 🔆 |
🔴bert_large_uncased_fp16: FAILED: MIGraphX is not within tolerance - check verbose output |