Skip to content

Commit 4157f90

Browse files
author
Jakub Chlanda
authored
[SYCL] Fix complex support for Cuda/HIP (#18667)
The implementation was incorrectly kept behind SPIR-V ifdefs.
1 parent bbb843d commit 4157f90

File tree

8 files changed

+11
-10
lines changed

8 files changed

+11
-10
lines changed

libdevice/complex_wrapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include "device_complex.h"
1010

11-
#if defined(__SPIR__) || defined(__SPIRV__)
11+
#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
12+
defined(__AMDGCN__)
1213

1314
DEVICE_EXTERN_C_INLINE
1415
float cimagf(float __complex__ z) { return __devicelib_cimagf(z); }

libdevice/complex_wrapper_fp64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
#include "device_complex.h"
1111

12-
#if defined(__SPIR__) || defined(__SPIRV__)
12+
#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
13+
defined(__AMDGCN__)
1314

1415
DEVICE_EXTERN_C_INLINE
1516
double cimag(double __complex__ z) { return __devicelib_cimag(z); }

libdevice/device_complex.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
#include "device.h"
1212

13-
#if defined(__SPIR__) || defined(__SPIRV__)
13+
#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
14+
defined(__AMDGCN__)
1415

1516
// TODO: This needs to be more robust.
1617
// clang doesn't recognize the c11 CMPLX macro, but it does have

libdevice/fallback-complex-fp64.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99

1010
#include "device_complex.h"
1111

12-
#if defined(__SPIR__) || defined(__SPIRV__)
12+
#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
13+
defined(__AMDGCN__)
1314
#include <cmath>
1415

1516
// To support fallback device libraries on-demand loading, please update the

libdevice/fallback-complex.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
#include "device_complex.h"
1010

11-
#if defined(__SPIR__) || defined(__SPIRV__)
11+
#if defined(__SPIR__) || defined(__SPIRV__) || defined(__NVPTX__) || \
12+
defined(__AMDGCN__)
1213
#include <cmath>
1314

1415
// To support fallback device libraries on-demand loading, please update the

sycl/test-e2e/DeviceLib/std_complex_math_fp64_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// REQUIRES: aspect-fp64
2-
// UNSUPPORTED: target-amd || target-nvidia
32
// XFAIL: windows && arch-intel_gpu_bmg_g21
43
// XFAIL-TRACKER: https://github.com/intel/llvm/issues/17165
54
// RUN: %{build} -o %t1.out

sycl/test-e2e/DeviceLib/std_complex_math_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
// DEFINE: %{mathflags} = %if cl_options %{/clang:-fno-fast-math%} %else %{-fno-fast-math%}
2-
// UNSUPPORTED: target-amd || target-nvidia
32
// RUN: %{build} %{mathflags} -o %t1.out
43
// RUN: %{run} %t1.out
54

sycl/test/e2e_test_requirements/no-unsupported-without-info.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
// tests to match the required format and in that case you should just update
5555
// (i.e. reduce) the number and the list below.
5656
//
57-
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 257
57+
// NUMBER-OF-UNSUPPORTED-WITHOUT-INFO: 255
5858
//
5959
// List of improperly UNSUPPORTED tests.
6060
// Remove the CHECK once the test has been properly UNSUPPORTED.
@@ -117,8 +117,6 @@
117117
// CHECK-NEXT: DeviceLib/imf_simd_emulate_test.cpp
118118
// CHECK-NEXT: DeviceLib/rand_test.cpp
119119
// CHECK-NEXT: DeviceLib/separate_compile_test.cpp
120-
// CHECK-NEXT: DeviceLib/std_complex_math_fp64_test.cpp
121-
// CHECK-NEXT: DeviceLib/std_complex_math_test.cpp
122120
// CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortK.cpp
123121
// CHECK-NEXT: ESIMD/PerformanceTests/BitonicSortKv2.cpp
124122
// CHECK-NEXT: ESIMD/PerformanceTests/Stencil.cpp

0 commit comments

Comments
 (0)