[hip] Allow from/to half conversion on host side. (#1334)

This commit is contained in:
mhbliao
2019-08-15 22:13:59 -04:00
committed by Maneesh Gupta
parent 47b832bba7
commit e919a8246e
+2 -3
View File
@@ -106,7 +106,7 @@ THE SOFTWARE.
#if !defined(__HIP_NO_HALF_CONVERSIONS__)
template<
typename T, Enable_if_t<std::is_integral<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<std::is_integral<T>{}>* = nullptr>
__device__
__host__ __device__
operator T() const { return data; }
#endif