mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-04-20 14:59:17 +00:00
modified half function in math_v2.hpp (#528)
Co-authored-by: Chao Liu <chao.liu2@amd.com>
This commit is contained in:
@@ -114,7 +114,16 @@ static inline __device__ int4_t abs(int4_t x)
|
||||
};
|
||||
#endif
|
||||
|
||||
static inline __device__ half_t abs(half_t x) { return ::__habs(x); };
|
||||
static inline __device__ half_t abs(half_t x)
|
||||
{
|
||||
uint16_t xx = ck::bit_cast<uint16_t>(x);
|
||||
|
||||
uint16_t abs_xx = xx & 0x7fff;
|
||||
|
||||
half_t abs_x = ck::bit_cast<half_t>(abs_xx);
|
||||
|
||||
return abs_x;
|
||||
};
|
||||
|
||||
static inline __device__ bool isnan(float x) { return ::isnan(x); };
|
||||
|
||||
@@ -140,7 +149,12 @@ static inline __device__ bool isnan(int4_t x)
|
||||
};
|
||||
#endif
|
||||
|
||||
static inline __device__ bool isnan(half_t x) { return ::__hisnan(x); };
|
||||
static inline __device__ bool isnan(half_t x)
|
||||
{
|
||||
uint16_t xx = ck::bit_cast<uint16_t>(x);
|
||||
|
||||
return (xx & 0x7FFF) > 0x7C00;
|
||||
};
|
||||
|
||||
static inline __device__ float sqrt(float x) { return ::sqrtf(x); };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user