Skip to content

Commit 4b37a83

Browse files
[SYCL][LIT] Auto-detect device aspects in sycl/test-e2e/lit.cfg.py (#8344)
1 parent 959fad2 commit 4b37a83

File tree

95 files changed

+607
-806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+607
-806
lines changed

sycl/test-e2e/AtomicRef/assignment_atomic64.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// REQUIRES: aspect-atomic64
2+
13
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
24
// RUN: %CPU_RUN_PLACEHOLDER %t.out
35
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -12,11 +14,6 @@ int main() {
1214

1315
device dev = q.get_device();
1416

15-
if (!dev.has(aspect::atomic64)) {
16-
std::cout << "Skipping test\n";
17-
return 0;
18-
}
19-
2017
const bool DoublesSupported = dev.has(sycl::aspect::fp64);
2118

2219
constexpr int N = 32;

sycl/test-e2e/AtomicRef/assignment_atomic64_generic.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-atomic64
12
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -12,11 +13,6 @@ int main() {
1213

1314
device dev = q.get_device();
1415

15-
if (!dev.has(aspect::atomic64)) {
16-
std::cout << "Skipping test\n";
17-
return 0;
18-
}
19-
2016
const bool DoublesSupported = dev.has(sycl::aspect::fp64);
2117

2218
constexpr int N = 32;

sycl/test-e2e/BFloat16/bfloat16_builtins.cpp

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-ext_oneapi_bfloat16_math_functions
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %if cuda %{ -Xsycl-target-backend --cuda-gpu-arch=sm_80 %} %s -o %t.out
23
// Currently the feature isn't supported on FPGA.
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
@@ -222,28 +223,27 @@ bool check(bool a, bool b) { return (a != b); }
222223
int main() {
223224
queue q;
224225

225-
if (q.get_device().has(aspect::ext_oneapi_bfloat16_math_functions)) {
226-
std::vector<float> a(N), b(N), c(N);
227-
int err = 0;
226+
std::vector<float> a(N), b(N), c(N);
227+
int err = 0;
228228

229-
for (int i = 0; i < N; i++) {
230-
a[i] = (i - N / 2) / (float)N;
231-
b[i] = (N / 2 - i) / (float)N;
232-
c[i] = (float)(3 * i);
233-
}
229+
for (int i = 0; i < N; i++) {
230+
a[i] = (i - N / 2) / (float)N;
231+
b[i] = (N / 2 - i) / (float)N;
232+
c[i] = (float)(3 * i);
233+
}
234234

235-
TEST_BUILTIN_1(fabs, bfloat16);
236-
TEST_BUILTIN_2(fmin);
237-
TEST_BUILTIN_2(fmax);
238-
TEST_BUILTIN_3(fma);
235+
TEST_BUILTIN_1(fabs, bfloat16);
236+
TEST_BUILTIN_2(fmin);
237+
TEST_BUILTIN_2(fmax);
238+
TEST_BUILTIN_3(fma);
239239

240-
float check_nan = 0;
241-
TEST_BUILTIN_2_NAN(fmin);
242-
TEST_BUILTIN_2_NAN(fmax);
240+
float check_nan = 0;
241+
TEST_BUILTIN_2_NAN(fmin);
242+
TEST_BUILTIN_2_NAN(fmax);
243+
244+
// Insert NAN value in a to test isnan
245+
a[0] = a[N - 1] = NAN;
246+
TEST_BUILTIN_1(isnan, bool);
243247

244-
// Insert NAN value in a to test isnan
245-
a[0] = a[N - 1] = NAN;
246-
TEST_BUILTIN_1(isnan, bool);
247-
}
248248
return 0;
249249
}

sycl/test-e2e/Basic/event_profiling_info.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-queue_profiling
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
//
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
@@ -41,10 +42,6 @@ bool verifyProfiling(event Event) {
4142
// event to complete execution.
4243
int main() {
4344
device Dev;
44-
if (!Dev.has(aspect::queue_profiling)) {
45-
std::cout << "Profiling is not supported, skipping the test" << std::endl;
46-
return 0;
47-
}
4845

4946
const size_t Size = 10000;
5047
int Data[Size] = {0};

sycl/test-e2e/Basic/event_profiling_workaround.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// UNSUPPORTED: aspect-queue_profiling
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
//
34
// RUN: %ACC_RUN_PLACEHOLDER %t.out
@@ -48,10 +49,6 @@ bool verifyProfiling(event Event) {
4849
// devices.
4950
int main() {
5051
device Dev;
51-
if (Dev.has(aspect::queue_profiling)) {
52-
std::cout << "Profiling is fully supported, skipping the test" << std::endl;
53-
return 0;
54-
}
5552

5653
const size_t Size = 10000;
5754
int Data[Size] = {0};

sycl/test-e2e/Basic/half_builtins.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-fp16
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -166,13 +167,6 @@ template <int N> bool check(vec<float, N> a, vec<float, N> b) {
166167
int main() {
167168
queue q;
168169

169-
if (!q.get_device().has(sycl::aspect::fp16)) {
170-
std::cout
171-
<< "Test was skipped because the selected device does not support fp16"
172-
<< std::endl;
173-
return 0;
174-
}
175-
176170
float16 a, b, c, d;
177171
for (int i = 0; i < SZ_max; i++) {
178172
a[i] = i / (float)SZ_max;

sycl/test-e2e/Basic/half_type.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: aspect-fp16
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -238,11 +239,6 @@ int main() {
238239
constexpr_verify_div();
239240

240241
device dev{default_selector_v};
241-
if (!dev.has(sycl::aspect::fp16)) {
242-
std::cout << "This device doesn't support the extension cl_khr_fp16"
243-
<< std::endl;
244-
return 0;
245-
}
246242

247243
std::vector<half> vec_a(N, 5.0);
248244
std::vector<half> vec_b(N, 2.0);

sycl/test-e2e/Basic/image/image.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: hip || gpu-intel-pvc
1+
// REQUIRES: aspect-image
2+
// UNSUPPORTED: hip
23
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
45
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test-e2e/Basic/image/image_accessor_range.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
// REQUIRES: aspect-image
12
// FIXME: Investigate OS-agnostic failures
23
// REQUIRES: TEMPORARY_DISABLED
34

4-
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
5+
// UNSUPPORTED: cuda || hip
56
// CUDA does not support SYCL 1.2.1 images.
67
//
78
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out

sycl/test-e2e/Basic/image/image_accessor_readsampler.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: cuda || hip || (windows && level_zero) || gpu-intel-pvc
1+
// REQUIRES: aspect-image
2+
// UNSUPPORTED: cuda || hip || (windows && level_zero)
23
// unsupported on windows (level-zero) due to fail of Jenkins/pre-ci-windows
34
// CUDA cannot support SYCL 1.2.1 images.
45
//

sycl/test-e2e/Basic/image/image_accessor_readwrite.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
1+
// REQUIRES: aspect-image
2+
// UNSUPPORTED: cuda || hip
23
// CUDA cannot support SYCL 1.2.1 images.
34
//
45
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out

sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
1+
// REQUIRES: aspect-fp16, aspect-image
2+
// UNSUPPORTED: cuda || hip
23
// CUDA cannot support SYCL 1.2.1 images.
34
//
45
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
@@ -148,11 +149,6 @@ int main() {
148149
// Checking if default selected device supports half datatype.
149150
// Same device will be selected in the write/read functions.
150151
s::device Dev{s::default_selector_v};
151-
if (!Dev.has(sycl::aspect::fp16)) {
152-
std::cout << "This device doesn't support the extension cl_khr_fp16"
153-
<< std::endl;
154-
return 0;
155-
}
156152
// Checking only for dimension=1.
157153
// create image:
158154
char HostPtr[100];

sycl/test-e2e/Basic/image/image_max_size.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// REQUIRES: aspect-image
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45

5-
// UNSUPPORTED: cuda || hip || (windows && opencl && gpu) || gpu-intel-pvc
6+
// UNSUPPORTED: cuda || hip || (windows && opencl && gpu)
67
// CUDA does not support info::device::image3d_max_width query.
78
// TODO: Irregular runtime fails on Windows/opencl:gpu require analysis.
89

sycl/test-e2e/Basic/image/image_read.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: hip || gpu-intel-pvc
1+
// REQUIRES: aspect-image
2+
// UNSUPPORTED: hip
23
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
45
// RUN: %GPU_RUN_PLACEHOLDER %t.out

sycl/test-e2e/Basic/image/image_read_fp16.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
1-
// UNSUPPORTED: hip || gpu-intel-pvc
1+
// REQUIRES: aspect-fp16, aspect-image
2+
// UNSUPPORTED: hip
23
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
45
// RUN: %GPU_RUN_PLACEHOLDER %t.out
56

67
#include "image_read.h"
78

89
int main() {
9-
s::queue myQueue(s::default_selector_v);
10-
11-
// Device doesn't support cl_khr_fp16 extension - skip.
12-
if (!myQueue.get_device().has(sycl::aspect::fp16))
13-
return 0;
10+
s::queue myQueue;
1411

1512
// Half image
1613
if (!test<s::half4, s::image_channel_type::fp16>(myQueue))

sycl/test-e2e/Basic/image/image_sample.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// REQUIRES: aspect-image
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45
// Temporarily disable test on Windows due to regressions in GPU driver.
5-
// UNSUPPORTED: hip, windows, gpu-intel-pvc
6+
// UNSUPPORTED: hip, windows
67

78
#include <sycl/sycl.hpp>
89

sycl/test-e2e/Basic/image/image_write.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
// REQUIRES: aspect-image
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out
45

5-
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
6+
// UNSUPPORTED: cuda || hip
67
// TODO: re-enable on cuda device.
78
// See https://github.com/intel/llvm/issues/1542#issuecomment-707877817 for more
89
// details.

sycl/test-e2e/Basic/image/image_write_fp16.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
// UNSUPPORTED: hip || cuda || gpu-intel-pvc
1+
// REQUIRES: aspect-fp16, aspect-image
2+
// UNSUPPORTED: hip || cuda
23
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
34
// RUN: %CPU_RUN_PLACEHOLDER %t.out
45
// RUN: %GPU_RUN_PLACEHOLDER %t.out
@@ -8,10 +9,6 @@
89
int main() {
910
s::queue myQueue(s::default_selector_v);
1011

11-
// Device doesn't support cl_khr_fp16 extension - skip.
12-
if (!myQueue.get_device().has(sycl::aspect::fp16))
13-
return 0;
14-
1512
// Half image
1613
if (!test<s::half4, s::image_channel_type::fp16>(myQueue))
1714
return -1;

sycl/test-e2e/Basic/image/srgba-read.cpp

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1+
// REQUIRES: aspect-ext_oneapi_srgb, aspect-image
12
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
23
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
34
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER
45

5-
// Only opencl plugin has implemented the supoort.
6-
// REQUIRES: opencl
7-
86
#include <iostream>
97
#include <sycl/sycl.hpp>
108

@@ -92,30 +90,20 @@ int main() {
9290
queue Q;
9391
device D = Q.get_device();
9492

95-
// test aspect
96-
if (D.has(aspect::ext_oneapi_srgb))
97-
std::cout << "aspect::ext_oneapi_srgb detected" << std::endl;
98-
99-
if (D.has(aspect::image)) {
100-
// RGBA -- (normal, non-linearized)
101-
std::cout << "rgba -------" << std::endl;
102-
test_rd(image_channel_order::rgba, image_channel_type::unorm_int8);
93+
// RGBA -- (normal, non-linearized)
94+
std::cout << "rgba -------" << std::endl;
95+
test_rd(image_channel_order::rgba, image_channel_type::unorm_int8);
10396

104-
// sRGBA -- (linearized reads)
105-
std::cout << "srgba -------" << std::endl;
106-
test_rd(image_channel_order::ext_oneapi_srgba,
107-
image_channel_type::unorm_int8);
108-
} else {
109-
std::cout << "device does not support image operations" << std::endl;
110-
}
97+
// sRGBA -- (linearized reads)
98+
std::cout << "srgba -------" << std::endl;
99+
test_rd(image_channel_order::ext_oneapi_srgba,
100+
image_channel_type::unorm_int8);
111101

112102
return 0;
113103
}
114104

115105
// clang-format off
116106
// CHECK: SYCL_EXT_ONEAPI_SRGB defined
117-
// CHECK: aspect::ext_oneapi_srgb detected
118-
119107
// CHECK: rgba -------
120108
// CHECK-NEXT: read four pixels, no sampler
121109
// these next four reads should all be close to 0.5

0 commit comments

Comments
 (0)