From 282f06014e8b4777321c6f40c62c96b74e8fd2fa Mon Sep 17 00:00:00 2001 From: mhbliao <47895780+mhbliao@users.noreply.github.com> Date: Thu, 15 Aug 2019 22:13:59 -0400 Subject: [PATCH] [hip] Allow from/to half conversion on host side. (#1334) --- hipamd/include/hip/hcc_detail/hip_fp16.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hipamd/include/hip/hcc_detail/hip_fp16.h b/hipamd/include/hip/hcc_detail/hip_fp16.h index 74424a9f8b..11e1b6be11 100644 --- a/hipamd/include/hip/hcc_detail/hip_fp16.h +++ b/hipamd/include/hip/hcc_detail/hip_fp16.h @@ -106,7 +106,7 @@ THE SOFTWARE. #if !defined(__HIP_NO_HALF_CONVERSIONS__) template< typename T, Enable_if_t{}>* = nullptr> - __device__ + __host__ __device__ __half(T x) : data{static_cast<_Float16>(x)} {} #endif @@ -233,11 +233,10 @@ THE SOFTWARE. return __half_raw{data}; } - // ACCESSORS - DEVICE ONLY #if !defined(__HIP_NO_HALF_CONVERSIONS__) template< typename T, Enable_if_t{}>* = nullptr> - __device__ + __host__ __device__ operator T() const { return data; } #endif