Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions sycl/test-e2e/DeviceLib/exp/exp-std-complex-edge-cases.hpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
// This test checks edge cases handling for std::exp(std::complex<T>) used
// in SYCL kernels.
//
// REQUIRES: aspect-fp64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note for other reviewers who may also think that this is an incorrect change: this is an .hpp file that is used from .cpp file which is the actual test, so it is fine.

// UNSUPPORTED: hip || cuda
//
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out

#include <sycl/detail/core.hpp>

#include <cmath>
#include <complex>
#include <set>

bool check(bool cond, const std::string &cond_str, int line,
unsigned testcase) {
Expand Down Expand Up @@ -203,12 +196,14 @@ template <typename T> bool test() {

constexpr unsigned N = sizeof(testcases) / sizeof(testcases[0]);

sycl::buffer<std::complex<T>> data(testcases, sycl::range{N});
sycl::buffer<std::complex<T>> results(sycl::range{N});

q.submit([&](sycl::handler &cgh) {
sycl::accessor acc_data(data, cgh, sycl::read_only);
sycl::accessor acc(results, cgh, sycl::write_only);
cgh.parallel_for(sycl::range{N}, [=](sycl::item<1> it) {
acc[it] = std::exp(testcases[it]);
acc[it] = std::exp(acc_data[it]);
});
}).wait_and_throw();

Expand Down Expand Up @@ -294,8 +289,13 @@ template <typename T> bool test() {
} else if (std::isfinite(testcases[i].imag()) &&
std::abs(testcases[i].imag()) <= 1) {
CHECK(!std::signbit(r.real()), passed, i);
// TODO: This case fails on win. Need to investigate and remove this macro
// check.
// CMPLRLLVM-62905
#ifndef _WIN32
CHECK(std::signbit(r.imag()) == std::signbit(testcases[i].imag()),
passed, i);
#endif
// Those tests were taken from oneDPL, not sure what is the corner case
// they are covering here
} else if (std::isinf(r.real()) && testcases[i].imag() == 0) {
Expand Down
Loading