Skip to content

Commit 27ab422

Browse files
authored
[SYCL][libdevice] Fix complex exp corner cases on Windows (#15808)
Currently, some corner case test is disabled in exp complex edge test due to some bug in _Exp util function in libdevice, this PR fixes it. --------- Signed-off-by: jinge90 <ge.jin@intel.com>
1 parent edfe16e commit 27ab422

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

libdevice/cmath_wrapper_fp64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,9 +394,9 @@ short _Exp(double *px, double y,
394394
_Dconst _Inf = {INIT(_DMAX << _DOFF)};
395395
short ret = 0;
396396
if (*px < -HUGE_EXP || y == 0.0) // certain underflow
397-
*px = 0.0;
397+
*px = __spirv_ocl_copysign(0.0, y);
398398
else if (HUGE_EXP < *px) { // certain overflow
399-
*px = _Inf._Double * (y < 0.F ? -1.F : 1.F);
399+
*px = __spirv_ocl_copysign(_Inf._Double, y);
400400
ret = _INFCODE;
401401
} else { // xexp won't overflow
402402
double g = *px * invln2;

libdevice/msvc_math.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,9 @@ short _FExp(float *px, float y,
193193
static const float invln2 = 1.4426950408889634073599246810018921F;
194194
short ret = 0;
195195
if (*px < -hugexp || y == 0.0F) { // certain underflow
196-
*px = 0.0F;
196+
*px = __spirv_ocl_copysign(0.0F, y);
197197
} else if (hugexp < *px) { // certain overflow
198-
*px = _FInf._Float * (y < 0.F ? -1.F : 1.F);
198+
*px = __spirv_ocl_copysign(_FInf._Float, y);
199199
ret = _INFCODE;
200200
} else { // xexp won't overflow
201201
float g = *px * invln2;

sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,8 @@ template <typename T> bool test() {
290290
} else if (std::isfinite(testcases[i].imag()) &&
291291
std::abs(testcases[i].imag()) <= 1) {
292292
CHECK(!std::signbit(r.real()), passed, i);
293-
// TODO: This case fails on win. Need to investigate and remove this macro
294-
// check.
295-
// CMPLRLLVM-62905
296-
#ifndef _WIN32
297293
CHECK(std::signbit(r.imag()) == std::signbit(testcases[i].imag()),
298294
passed, i);
299-
#endif
300295
// Those tests were taken from oneDPL, not sure what is the corner case
301296
// they are covering here
302297
} else if (std::isinf(r.real()) && testcases[i].imag() == 0) {

0 commit comments

Comments
 (0)