| #include <cuda_runtime.h> |
| template<typename To, typename From> To convert(From f) { |
| return static_cast<To>(f); |
| #define AT_ALIGN(n) __attribute__((aligned(n))) |
| #define AT_ALIGN(n) __declspec(align(n)) |
| typedef struct AT_ALIGN(2) { |
| operator half() { return half{ x }; } |
| template<> Half convert(double f); |
| template<> double convert(Half f); |
| template<> Half convert(int64_t f); |
| template<> int64_t convert(Half f); |
| inline Half::operator double() { |
| return convert<double,Half>(*this); |
| template<> half convert(double d); |
| template<typename To, typename From> |
| static inline To HalfFix(From h) { |
| inline __half HalfFix<__half, Half>(Half h) { |
| inline Half HalfFix<Half, __half>(__half h) { |