From 243418d0ddecaddd7ddabf99a196d478518e939c Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Wed, 15 Jan 2025 10:15:56 +0100 Subject: [PATCH 1/3] [SYCL][E2E] Re-enable test case for exp(float) on win --- sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp b/sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp index 992cd6147b535..c0c4d4cc85e91 100644 --- a/sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp +++ b/sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp @@ -333,13 +333,6 @@ template bool test() { } else if (std::isfinite(testcases[i].imag()) && std::abs(testcases[i].imag()) <= 1) { CHECK(!std::signbit(r.real()), passed, i); -#ifdef _WIN32 - // This check fails on win, temporary skipping: - // CMPLRLLVM-61834 - // TODO: Delete this macro block when fixed - if (std::is_same_v) - continue; -#endif CHECK(std::signbit(r.imag()) == std::signbit(testcases[i].imag()), passed, i); // Those tests were taken from oneDPL, not sure what is the corner case From 23da6b1a94bb9d90a24d59cd2558535f7122120e Mon Sep 17 00:00:00 2001 From: jinge90 Date: Thu, 13 Mar 2025 15:24:46 +0800 Subject: [PATCH 2/3] [SYCL][libdevice] Keep siginbit of result for std::sin(-0) For input '-0', __spirv_ocl_sin returns +0 for float and returns -0 for double, although no definition exists in standard for -0 input, MSVC complex math implementation does depend on this, discarding the signbit for sin(-0) will lead to some corner case failures in exp(std::complex) e2e tests. This patch is a workaround for the issue. --- libdevice/fallback-cmath.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libdevice/fallback-cmath.cpp b/libdevice/fallback-cmath.cpp index 37b2250b4b6aa..4ef10af34d01e 100644 --- a/libdevice/fallback-cmath.cpp +++ b/libdevice/fallback-cmath.cpp @@ -168,8 +168,13 @@ float __devicelib_fmaf(float x, float y, float z) { return __spirv_ocl_fma(x, y, z); } +#if !defined(__NVPTX__) && !defined(__AMDGCN__) +DEVICE_EXTERN_C_INLINE +float __devicelib_sinf(float x) { return (x == 0.0f) ? x : __spirv_ocl_sin(x); } +#else DEVICE_EXTERN_C_INLINE float __devicelib_sinf(float x) { return __spirv_ocl_sin(x); } +#endif DEVICE_EXTERN_C_INLINE float __devicelib_cosf(float x) { return __spirv_ocl_cos(x); } From 483761a645745a0fe3062479284a6e3319813558 Mon Sep 17 00:00:00 2001 From: "Kornev, Nikita" Date: Mon, 17 Mar 2025 10:07:23 +0100 Subject: [PATCH 3/3] Revert "[SYCL][libdevice] Keep siginbit of result for std::sin(-0)" This reverts commit 23da6b1a94bb9d90a24d59cd2558535f7122120e. --- libdevice/fallback-cmath.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/libdevice/fallback-cmath.cpp b/libdevice/fallback-cmath.cpp index 4ef10af34d01e..37b2250b4b6aa 100644 --- a/libdevice/fallback-cmath.cpp +++ b/libdevice/fallback-cmath.cpp @@ -168,13 +168,8 @@ float __devicelib_fmaf(float x, float y, float z) { return __spirv_ocl_fma(x, y, z); } -#if !defined(__NVPTX__) && !defined(__AMDGCN__) -DEVICE_EXTERN_C_INLINE -float __devicelib_sinf(float x) { return (x == 0.0f) ? x : __spirv_ocl_sin(x); } -#else DEVICE_EXTERN_C_INLINE float __devicelib_sinf(float x) { return __spirv_ocl_sin(x); } -#endif DEVICE_EXTERN_C_INLINE float __devicelib_cosf(float x) { return __spirv_ocl_cos(x); }