File tree Expand file tree Collapse file tree 5 files changed +9
-14
lines changed
.ci/docker/ci_commit_pins
runtime/core/portable_type/c10/c10/util Expand file tree Collapse file tree 5 files changed +9
-14
lines changed Original file line number Diff line number Diff line change 1- 7cda4017ddda554752e89069ae205be5e8388f59
1+ 87b2ac5d1992c9b4f4167517251b99b513c328a8
Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ def python_is_compatible():
7171#
7272# NOTE: If you're changing, make the corresponding change in .ci/docker/ci_commit_pins/pytorch.txt
7373# by picking the hash from the same date in https://hud.pytorch.org/hud/pytorch/pytorch/nightly/
74- NIGHTLY_VERSION = "dev20250706 "
74+ NIGHTLY_VERSION = "dev20250711 "
7575
7676
7777def install_requirements (use_pytorch_nightly ):
Original file line number Diff line number Diff line change 44// 1 bit for the sign, 8 bits for the exponent and 7 bits for the mantissa.
55
66#include < c10/macros/Macros.h>
7+ #include < c10/util/bit_cast.h>
78#include < cmath>
89#include < cstdint>
910#include < cstring>
@@ -67,13 +68,7 @@ inline C10_HOST_DEVICE uint16_t round_to_nearest_even(float src) {
6768#endif
6869 return UINT16_C (0x7FC0 );
6970 } else {
70- // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init)
71- union {
72- uint32_t U32; // NOLINT(facebook-hte-BadMemberName)
73- float F32; // NOLINT(facebook-hte-BadMemberName)
74- };
75-
76- F32 = src;
71+ const uint32_t U32 = c10::bit_cast<uint32_t >(src);
7772 uint32_t rounding_bias = ((U32 >> 16 ) & 1 ) + UINT32_C (0x7FFF );
7873 return static_cast <uint16_t >((U32 + rounding_bias) >> 16 );
7974 }
@@ -111,9 +106,7 @@ struct alignas(2) BFloat16 {
111106#endif
112107};
113108
114- C10_API inline std::ostream& operator <<(
115- std::ostream& out,
116- const BFloat16& value) {
109+ inline std::ostream& operator <<(std::ostream& out, const BFloat16& value) {
117110 out << (float )value;
118111 return out;
119112}
Original file line number Diff line number Diff line change @@ -414,7 +414,7 @@ struct alignas(2) Half {
414414#endif
415415};
416416
417- C10_API inline std::ostream& operator <<(std::ostream& out, const Half& value) {
417+ inline std::ostream& operator <<(std::ostream& out, const Half& value) {
418418 out << (float )value;
419419 return out;
420420}
Original file line number Diff line number Diff line change 33#include < cstring>
44#include < type_traits>
55
6+ #include < c10/macros/Macros.h>
7+
68#if __has_include(<bit>) && (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L)
79#include < bit>
810#define C10_HAVE_STD_BIT_CAST 1
@@ -23,7 +25,7 @@ using std::bit_cast;
2325// See https://en.cppreference.com/w/cpp/numeric/bit_cast for more
2426// information as well as the source of our implementations.
2527template <class To , class From >
26- std::enable_if_t <
28+ C10_HOST_DEVICE std::enable_if_t <
2729 sizeof (To) == sizeof (From) && std::is_trivially_copyable_v<From> &&
2830 std::is_trivially_copyable_v<To>,
2931 To>
You can’t perform that action at this time.
0 commit comments