Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/core/portable_type/c10/c10/macros/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hip/hip_runtime.h>
#endif

Expand Down
5 changes: 5 additions & 0 deletions runtime/core/portable_type/c10/c10/util/Half.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion runtime/core/portable_type/c10/c10/util/bit_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <cstring>
#include <type_traits>

#if __has_include(<bit>) && (__cplusplus >= 202002L || (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L))
#if __has_include(<bit>) && (defined(__cpp_lib_bit_cast) && __cpp_lib_bit_cast >= 201806L)
#include <bit>
#define C10_HAVE_STD_BIT_CAST 1
#else
Expand Down
4 changes: 2 additions & 2 deletions runtime/core/portable_type/c10/c10/util/irange.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -103,7 +103,7 @@ template <
typename Integer2,
std::enable_if_t<std::is_integral_v<Integer1>, bool> = true,
std::enable_if_t<std::is_integral_v<Integer2>, bool> = true>
integer_range<Integer2> irange(Integer1 begin, Integer2 end) {
constexpr integer_range<Integer2> 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 {
Expand Down