diff --git a/runtime/core/portable_type/c10/c10/macros/Macros.h b/runtime/core/portable_type/c10/c10/macros/Macros.h index 1429eda2acb..919eb6c8567 100644 --- a/runtime/core/portable_type/c10/c10/macros/Macros.h +++ b/runtime/core/portable_type/c10/c10/macros/Macros.h @@ -241,7 +241,7 @@ using namespace c10::xpu; #ifdef __HIPCC__ // Unlike CUDA, HIP requires a HIP header to be included for __host__ to work. // We do this #include here so that C10_HOST_DEVICE and friends will Just Work. -// See https://github.com/ROCm/hip/issues/441 +// See https://github.com/ROCm-Developer-Tools/HIP/issues/441 #include #endif diff --git a/runtime/core/portable_type/c10/c10/util/Half.h b/runtime/core/portable_type/c10/c10/util/Half.h index b77cf7b1f4a..373881f21e5 100644 --- a/runtime/core/portable_type/c10/c10/util/Half.h +++ b/runtime/core/portable_type/c10/c10/util/Half.h @@ -243,7 +243,12 @@ C10_HOST_DEVICE inline float fp16_ieee_to_fp32_value(uint16_t h) { // const float exp_scale = 0x1.0p-112f; constexpr uint32_t scale_bits = (uint32_t)15 << 23; float exp_scale_val = 0; +#if defined(_MSC_VER) && defined(__clang__) + __builtin_memcpy(&exp_scale_val, &scale_bits, sizeof(exp_scale_val)); +#else std::memcpy(&exp_scale_val, &scale_bits, sizeof(exp_scale_val)); +#endif + const float exp_scale = exp_scale_val; const float normalized_value = fp32_from_bits((two_w >> 4) + exp_offset) * exp_scale; diff --git a/runtime/core/portable_type/c10/c10/util/bit_cast.h b/runtime/core/portable_type/c10/c10/util/bit_cast.h index c1d2c102886..380cfa7db1c 100644 --- a/runtime/core/portable_type/c10/c10/util/bit_cast.h +++ b/runtime/core/portable_type/c10/c10/util/bit_cast.h @@ -3,7 +3,7 @@ #include #include -#if __has_include() && (__cplusplus >= 202002L || (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L)) +#if __has_include() && (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L) #include #define C10_HAVE_STD_BIT_CAST 1 #else diff --git a/runtime/core/portable_type/c10/c10/util/irange.h b/runtime/core/portable_type/c10/c10/util/irange.h index 81104d9568f..f5310510099 100644 --- a/runtime/core/portable_type/c10/c10/util/irange.h +++ b/runtime/core/portable_type/c10/c10/util/irange.h @@ -24,7 +24,7 @@ struct integer_iterator { using pointer = I*; using reference = I&; - explicit constexpr integer_iterator(I value_) : value(value_) {} + explicit constexpr integer_iterator(I value) : value(value) {} constexpr I operator*() const { return value; @@ -103,7 +103,7 @@ template < typename Integer2, std::enable_if_t, bool> = true, std::enable_if_t, bool> = true> -integer_range irange(Integer1 begin, Integer2 end) { +constexpr integer_range irange(Integer1 begin, Integer2 end) { // If end<=begin then the range is empty; we can achieve this effect by // choosing the larger of {begin, end} as the loop terminator return {