You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Mar 21, 2024. It is now read-only.
The half-float [1] type would interoperate with standard 32-bit and 64-bit floats. Also, to avoid redundant conversions the arithmetic operators should yield a float32_t result. This behavior is consistent with the use of half-floats as a compressed storage format.
The half-float [1] type would interoperate with standard 32-bit and 64-bit floats. Also, to avoid redundant conversions the arithmetic operators should yield a float32_t result. This behavior is consistent with the use of half-floats as a compressed storage format.
This enhancement would likely depend on issue NVIDIA/libcudacxx#216 .
class float16_t
{
unsigned short s;
public:
// constructors
host device
float16_t()
: s(float32_t()) {}
host device
float16_t(const float32_t& f)
: s(__float2half_rn(f)) {}
// arithmetic
host device
float32_t operator+(const float16_t& f) const
{
// note: return a float
return static_cast<float32_t>(*this) + static_cast<float32_t>(f);
}
// cast to float
host device
operator float32_t(void) const
{
return __half2float(s);
}
};
[1] http://en.wikipedia.org/wiki/Half_precision_floating-point_format
Forwarded from http://code.google.com/p/thrust/issues/detail?id=259
The text was updated successfully, but these errors were encountered: