Skip to content

Commit

Permalink
[SYCL][E2E] Enable and fix UNSUPPORTED:windows tests (#15297)
Browse files Browse the repository at this point in the history
This commit enables and fixes a number of tests that have previously
been marked as UNSUPPORTED on Windows.

---------

Signed-off-by: Larsen, Steffen <[email protected]>
  • Loading branch information
steffenlarsen committed Sep 16, 2024
1 parent cf2e781 commit 7fc3ac2
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 212 deletions.
2 changes: 0 additions & 2 deletions sycl/test-e2e/DeviceLib/built-ins/vector_relational.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// FIXME unsupported on windows (opencl and level-zero) until fix of libdevice
// UNSUPPORTED: windows && (opencl || level_zero)
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}
// RUN: %{build} -o %t.out %{mathflags}
// RUN: %{run} %t.out
Expand Down
38 changes: 16 additions & 22 deletions sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
// UNSUPPORTED: windows
// Disabled on windows due to bug VS 2019 missing math builtins
// REQUIRES: aspect-fp64, windows

// REQUIRES: aspect-fp64
// REQUIRES: (cpu || accelerator) && windows
// RUN: %{build} -c -o %t.o
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/../bin/libsycl-cmath-fp64.o -o %t.out
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}

// RUN: %{build} %{mathflags} -o %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-device-lib-jit-link %{mathflags} %s -o %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include "math_utils.hpp"
#include <iostream>
#include <math.h>
Expand All @@ -15,11 +17,11 @@ namespace s = sycl;
constexpr s::access::mode sycl_read = s::access::mode::read;
constexpr s::access::mode sycl_write = s::access::mode::write;

#define TEST_NUM 41
#define TEST_NUM 38

double ref_val[TEST_NUM] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0.5, 0, 2, 0, 0,
1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 1,
2, 5, 0, 0, 0, 0, 0.5, 0.5, NAN, NAN, 1, 2, 0};
double ref_val[TEST_NUM] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0.5, 0, 2, 0,
0, 1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 2,
0, 1, 2, 5, 0, 0, 0, 0, 0.5, 0.5, NAN, NAN};

double refIptr = 1;

Expand All @@ -38,13 +40,13 @@ void device_math_test(s::queue &deviceQueue) {
int quo = -1;

// Varaible enm stores the enum value retured by MSVC function
short enm[2] = {10, 10};
short enm = 10;
{
s::buffer<double, 1> buffer1(result, numOfItems);
s::buffer<int, 1> buffer2(&exponent, s::range<1>{1});
s::buffer<double, 1> buffer3(&iptr, s::range<1>{1});
s::buffer<int, 1> buffer4(&quo, s::range<1>{1});
s::buffer<short, 1> buffer5(enm, s::range<1>{2});
s::buffer<short, 1> buffer5(&enm, s::range<1>{1});
deviceQueue.submit([&](sycl::handler &cgh) {
auto res_access = buffer1.template get_access<sycl_write>(cgh);
auto exp_access = buffer2.template get_access<sycl_write>(cgh);
Expand Down Expand Up @@ -92,12 +94,7 @@ void device_math_test(s::queue &deviceQueue) {
double a = NAN;
res_access[i++] = tgamma(a);
res_access[i++] = lgamma(a);
enm_access[0] = _Dtest(&a);
a = 0.0;
enm_access[1] = _Exp(&a, 1.0, 0);
res_access[i++] = a;
res_access[i++] = _Cosh(0.0, 2.0);
res_access[i++] = _Sinh(0.0, 1.0);
enm_access[0] = _dtest(&a);
});
});
}
Expand All @@ -117,10 +114,7 @@ void device_math_test(s::queue &deviceQueue) {
assert(quo == 0);

// Test enum value returned by _Dtest
assert(enm[0] == _NANCODE);

// Test enum value returned by _Exp
assert(enm[1] == _FINITE);
assert(enm == _NANCODE);
}

int main() {
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/DeviceLib/math_override_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// UNSUPPORTED: windows
// RUN: %clangxx -fsycl %s -Wno-error=unused-command-line-argument -o %t.out -fno-builtin
// RUN: %clangxx -fsycl %s -Wno-error=unused-command-line-argument -Wno-error=inconsistent-dllimport -o %t.out -fno-builtin
#include <iostream>
#include <math.h>
#include <sycl/detail/core.hpp>
Expand Down
2 changes: 0 additions & 2 deletions sycl/test-e2e/DeviceLib/math_test_marray_vec.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}

// TODO fix windows failures
// UNSUPPORTED: windows && (level_zero || opencl)
// RUN: %{build} %{mathflags} -o %t.out
// RUN: %{run} %t.out

Expand Down
40 changes: 18 additions & 22 deletions sycl/test-e2e/DeviceLib/math_windows_test.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
// UNSUPPORTED: windows
// Disabled on windows due to bug VS 2019 missing math builtins
// REQUIRES: windows

// REQUIRES: (accelerator || cpu) && windows
// RUN: %{build} -c -o %t.o
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/../bin/libsycl-cmath.o -o %t.out
// TODO: Add hypotf case back when the missing symbol is fixed.

// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}

// RUN: %{build} %{mathflags} -o %t.out
// RUN: %{run} %t.out

// RUN: %clangxx -fsycl -fsycl-device-lib-jit-link %{mathflags} %s -o %t.out
// RUN: %if !gpu %{ %{run} %t.out %}

#include "math_utils.hpp"
#include <iostream>
#include <math.h>
Expand All @@ -14,11 +19,11 @@ namespace s = sycl;
constexpr s::access::mode sycl_read = s::access::mode::read;
constexpr s::access::mode sycl_write = s::access::mode::write;

#define TEST_NUM 39
#define TEST_NUM 35

float ref_val[TEST_NUM] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0.5, 0, 0, 1,
0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 2, 0, 1,
2, 5, 0, 0, 0, 0, 0.5, 0.5, NAN, NAN, 1, 2, 0};
float ref_val[TEST_NUM] = {1, 0, 0, 0, 0, 0, 0, 1, 1, 0.5, 0, 0,
1, 0, 2, 0, 0, 0, 0, 0, 1, 0, 1, 2,
0, 1, 2, 0, 0, 0, 0, 0.5, 0.5, NAN, NAN};

float refIptr = 1;

Expand All @@ -33,13 +38,13 @@ void device_math_test(s::queue &deviceQueue) {
int quo = -1;

// Varaible enm stores the enum value retured by MSVC function
short enm[2] = {10, 10};
short enm = 10;

{
s::buffer<float, 1> buffer1(result, numOfItems);
s::buffer<float, 1> buffer2(&iptr, s::range<1>{1});
s::buffer<int, 1> buffer3(&quo, s::range<1>{1});
s::buffer<short, 1> buffer4(enm, s::range<1>{2});
s::buffer<short, 1> buffer4(&enm, s::range<1>{1});
deviceQueue.submit([&](sycl::handler &cgh) {
auto res_access = buffer1.template get_access<sycl_write>(cgh);
auto iptr_access = buffer2.template get_access<sycl_write>(cgh);
Expand Down Expand Up @@ -74,7 +79,6 @@ void device_math_test(s::queue &deviceQueue) {
res_access[i++] = expm1f(0.0f);
res_access[i++] = fdimf(1.0f, 0.0f);
res_access[i++] = fmaf(1.0f, 1.0f, 1.0f);
res_access[i++] = hypotf(3.0f, 4.0f);
res_access[i++] = ilogbf(1.0f);
res_access[i++] = log1pf(0.0f);
res_access[i++] = log2f(1.0f);
Expand All @@ -84,12 +88,7 @@ void device_math_test(s::queue &deviceQueue) {
float a = NAN;
res_access[i++] = tgammaf(a);
res_access[i++] = lgammaf(a);
enm_access[0] = _FDtest(&a);
a = 0.0f;
enm_access[1] = _FExp(&a, 1.0f, 0);
res_access[i++] = a;
res_access[i++] = _FCosh(0.0f, 2.0f);
res_access[i++] = _FSinh(0.0f, 1.0f);
enm_access[0] = _fdtest(&a);
});
});
}
Expand All @@ -106,10 +105,7 @@ void device_math_test(s::queue &deviceQueue) {
assert(quo == 0);

// Test enum value returned by _FDtest
assert(enm[0] == _NANCODE);

// Test enum value returned by _FExp
assert(enm[1] == _FINITE);
assert(enm == _NANCODE);
}

int main() {
Expand Down
3 changes: 1 addition & 2 deletions sycl/test-e2e/Printf/double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
// [1]: https://en.cppreference.com/w/cpp/io/c/fprintf
//
// REQUIRES: aspect-fp64
// Temporarily disable test on Windows due to regressions in GPU driver.
// UNSUPPORTED: hip_amd, windows
// UNSUPPORTED: hip_amd
//
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out | FileCheck %s
Expand Down
Loading

0 comments on commit 7fc3ac2

Please sign in to comment.