From 0da954f20ef62bb614f97ea5874266979883b13c Mon Sep 17 00:00:00 2001 From: foreman Date: Mon, 6 May 2019 17:20:00 -0400 Subject: [PATCH] P4 to Git Change 1778949 by michliao@hliao-dev-00-hip.rocm-workspace on 2019/05/06 16:36:53 SWDEV-144570 - Fix build failure after switching to gcc-7 - Hex representation of float needs gnu++11. We'd better not relying on that. Change the float in hex format into alternative representation. RBT: http://ocltc.amd.com/reviews/r/17300/ Affected files ... ... //depot/stg/opencl/drivers/opencl/api/hip/hip_platform.cpp#29 edit --- hipamd/api/hip/hip_platform.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hipamd/api/hip/hip_platform.cpp b/hipamd/api/hip/hip_platform.cpp index ec34db8c0a..5203c8123a 100644 --- a/hipamd/api/hip/hip_platform.cpp +++ b/hipamd/api/hip/hip_platform.cpp @@ -642,9 +642,9 @@ static inline int clamp_int(int i, int l, int h) { return std::min(std::max(i, l // half float, the f16 is in the low 16 bits of the input argument static inline float __convert_half_to_float(std::uint32_t a) noexcept { std::uint32_t u = ((a << 13) + 0x70000000U) & 0x8fffe000U; - std::uint32_t v = f32_as_u32(u32_as_f32(u) * 0x1.0p+112f) + 0x38000000U; + std::uint32_t v = f32_as_u32(u32_as_f32(u) * u32_as_f32(0x77800000U)/*0x1.0p+112f*/) + 0x38000000U; u = (a & 0x7fff) != 0 ? v : u; - return u32_as_f32(u) * 0x1.0p-112f; + return u32_as_f32(u) * u32_as_f32(0x07800000U)/*0x1.0p-112f*/; } // float half with nearest even rounding