Skip to content

Commit fa89efa

Browse files
authored
Re-sync c10 (#10402)
As detected by CI script added in following PR.
1 parent 1bd7260 commit fa89efa

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

runtime/core/portable_type/c10/c10/macros/Macros.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ using namespace c10::xpu;
241241
#ifdef __HIPCC__
242242
// Unlike CUDA, HIP requires a HIP header to be included for __host__ to work.
243243
// We do this #include here so that C10_HOST_DEVICE and friends will Just Work.
244-
// See https://github.com/ROCm/hip/issues/441
244+
// See https://github.com/ROCm-Developer-Tools/HIP/issues/441
245245
#include <hip/hip_runtime.h>
246246
#endif
247247

runtime/core/portable_type/c10/c10/util/Half.h

+5
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,12 @@ C10_HOST_DEVICE inline float fp16_ieee_to_fp32_value(uint16_t h) {
243243
// const float exp_scale = 0x1.0p-112f;
244244
constexpr uint32_t scale_bits = (uint32_t)15 << 23;
245245
float exp_scale_val = 0;
246+
#if defined(_MSC_VER) && defined(__clang__)
247+
__builtin_memcpy(&exp_scale_val, &scale_bits, sizeof(exp_scale_val));
248+
#else
246249
std::memcpy(&exp_scale_val, &scale_bits, sizeof(exp_scale_val));
250+
#endif
251+
247252
const float exp_scale = exp_scale_val;
248253
const float normalized_value =
249254
fp32_from_bits((two_w >> 4) + exp_offset) * exp_scale;

runtime/core/portable_type/c10/c10/util/bit_cast.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <cstring>
44
#include <type_traits>
55

6-
#if __has_include(<bit>) && (__cplusplus >= 202002L || (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L))
6+
#if __has_include(<bit>) && (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L)
77
#include <bit>
88
#define C10_HAVE_STD_BIT_CAST 1
99
#else

runtime/core/portable_type/c10/c10/util/irange.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ struct integer_iterator {
2424
using pointer = I*;
2525
using reference = I&;
2626

27-
explicit constexpr integer_iterator(I value_) : value(value_) {}
27+
explicit constexpr integer_iterator(I value) : value(value) {}
2828

2929
constexpr I operator*() const {
3030
return value;
@@ -103,7 +103,7 @@ template <
103103
typename Integer2,
104104
std::enable_if_t<std::is_integral_v<Integer1>, bool> = true,
105105
std::enable_if_t<std::is_integral_v<Integer2>, bool> = true>
106-
integer_range<Integer2> irange(Integer1 begin, Integer2 end) {
106+
constexpr integer_range<Integer2> irange(Integer1 begin, Integer2 end) {
107107
// If end<=begin then the range is empty; we can achieve this effect by
108108
// choosing the larger of {begin, end} as the loop terminator
109109
return {

0 commit comments

Comments
 (0)