From 78ec2a66afc457147bce96fe72965a7040a64c71 Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Mon, 9 Dec 2024 11:24:29 +0000 Subject: [PATCH] SWDEV-503299 - Do not use operator to check for nan Some libs use __HIP_NO_HALF_OPERATORS__ and __HIP_NO_HALF_CONVERSIONS__ which results in operators being hidden and can cause errors. Change-Id: I83c194d7d727cba30b46d7c296f7d396549f5fca [ROCm/clr commit: 98b33886cd9dff50a56f8943890492c8019efa29] --- projects/clr/hipamd/include/hip/amd_detail/amd_hip_fp16.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/projects/clr/hipamd/include/hip/amd_detail/amd_hip_fp16.h b/projects/clr/hipamd/include/hip/amd_detail/amd_hip_fp16.h index c8117b1bf3..1a08bb8df1 100644 --- a/projects/clr/hipamd/include/hip/amd_detail/amd_hip_fp16.h +++ b/projects/clr/hipamd/include/hip/amd_detail/amd_hip_fp16.h @@ -1679,8 +1679,9 @@ THE SOFTWARE. __HOST_DEVICE__ bool __hisinf(__half x) { - // +Inf/-Inf - return x == HIPRT_INF_FP16 || x == __ushort_as_half((unsigned short)0xFC00U); + __half_raw hr = x; + // +/-Inf + return hr.x == 0x7C00U || hr.x == 0xFC00U; } inline __HOST_DEVICE__