Skip to content

[SYCL][LIT] Auto-detect device aspects in sycl/test-e2e/lit.cfg.py #8344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 2 additions & 5 deletions sycl/test-e2e/AtomicRef/assignment_atomic64.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// REQUIRES: aspect-atomic64

// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand All @@ -12,11 +14,6 @@ int main() {

device dev = q.get_device();

if (!dev.has(aspect::atomic64)) {
std::cout << "Skipping test\n";
return 0;
}

const bool DoublesSupported = dev.has(sycl::aspect::fp64);

constexpr int N = 32;
Expand Down
6 changes: 1 addition & 5 deletions sycl/test-e2e/AtomicRef/assignment_atomic64_generic.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: aspect-atomic64
// RUN: %clangxx -fsycl -fsycl-device-code-split=per_kernel -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand All @@ -12,11 +13,6 @@ int main() {

device dev = q.get_device();

if (!dev.has(aspect::atomic64)) {
std::cout << "Skipping test\n";
return 0;
}

const bool DoublesSupported = dev.has(sycl::aspect::fp64);

constexpr int N = 32;
Expand Down
38 changes: 19 additions & 19 deletions sycl/test-e2e/BFloat16/bfloat16_builtins.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: aspect-ext_oneapi_bfloat16_math_functions
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %if cuda %{ -Xsycl-target-backend --cuda-gpu-arch=sm_80 %} %s -o %t.out
// Currently the feature isn't supported on FPGA.
// RUN: %CPU_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -222,28 +223,27 @@ bool check(bool a, bool b) { return (a != b); }
int main() {
queue q;

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

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

TEST_BUILTIN_1(fabs, bfloat16);
TEST_BUILTIN_2(fmin);
TEST_BUILTIN_2(fmax);
TEST_BUILTIN_3(fma);
TEST_BUILTIN_1(fabs, bfloat16);
TEST_BUILTIN_2(fmin);
TEST_BUILTIN_2(fmax);
TEST_BUILTIN_3(fma);

float check_nan = 0;
TEST_BUILTIN_2_NAN(fmin);
TEST_BUILTIN_2_NAN(fmax);
float check_nan = 0;
TEST_BUILTIN_2_NAN(fmin);
TEST_BUILTIN_2_NAN(fmax);

// Insert NAN value in a to test isnan
a[0] = a[N - 1] = NAN;
TEST_BUILTIN_1(isnan, bool);

// Insert NAN value in a to test isnan
a[0] = a[N - 1] = NAN;
TEST_BUILTIN_1(isnan, bool);
}
return 0;
}
5 changes: 1 addition & 4 deletions sycl/test-e2e/Basic/event_profiling_info.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: aspect-queue_profiling
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
//
// RUN: %CPU_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -41,10 +42,6 @@ bool verifyProfiling(event Event) {
// event to complete execution.
int main() {
device Dev;
if (!Dev.has(aspect::queue_profiling)) {
std::cout << "Profiling is not supported, skipping the test" << std::endl;
return 0;
}

const size_t Size = 10000;
int Data[Size] = {0};
Expand Down
5 changes: 1 addition & 4 deletions sycl/test-e2e/Basic/event_profiling_workaround.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// UNSUPPORTED: aspect-queue_profiling
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
//
// RUN: %ACC_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -48,10 +49,6 @@ bool verifyProfiling(event Event) {
// devices.
int main() {
device Dev;
if (Dev.has(aspect::queue_profiling)) {
std::cout << "Profiling is fully supported, skipping the test" << std::endl;
return 0;
}

const size_t Size = 10000;
int Data[Size] = {0};
Expand Down
8 changes: 1 addition & 7 deletions sycl/test-e2e/Basic/half_builtins.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: aspect-fp16
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -166,13 +167,6 @@ template <int N> bool check(vec<float, N> a, vec<float, N> b) {
int main() {
queue q;

if (!q.get_device().has(sycl::aspect::fp16)) {
std::cout
<< "Test was skipped because the selected device does not support fp16"
<< std::endl;
return 0;
}

float16 a, b, c, d;
for (int i = 0; i < SZ_max; i++) {
a[i] = i / (float)SZ_max;
Expand Down
6 changes: 1 addition & 5 deletions sycl/test-e2e/Basic/half_type.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// REQUIRES: aspect-fp16
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down Expand Up @@ -238,11 +239,6 @@ int main() {
constexpr_verify_div();

device dev{default_selector_v};
if (!dev.has(sycl::aspect::fp16)) {
std::cout << "This device doesn't support the extension cl_khr_fp16"
<< std::endl;
return 0;
}

std::vector<half> vec_a(N, 5.0);
std::vector<half> vec_b(N, 2.0);
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: hip || gpu-intel-pvc
// REQUIRES: aspect-image
// UNSUPPORTED: hip
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_accessor_range.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// REQUIRES: aspect-image
// FIXME: Investigate OS-agnostic failures
// REQUIRES: TEMPORARY_DISABLED

// UNSUPPORTED: cuda || hip || gpu-intel-pvc
// UNSUPPORTED: cuda || hip
// CUDA does not support SYCL 1.2.1 images.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_accessor_readsampler.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: cuda || hip || (windows && level_zero) || gpu-intel-pvc
// REQUIRES: aspect-image
// UNSUPPORTED: cuda || hip || (windows && level_zero)
// unsupported on windows (level-zero) due to fail of Jenkins/pre-ci-windows
// CUDA cannot support SYCL 1.2.1 images.
//
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_accessor_readwrite.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
// REQUIRES: aspect-image
// UNSUPPORTED: cuda || hip
// CUDA cannot support SYCL 1.2.1 images.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
Expand Down
8 changes: 2 additions & 6 deletions sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: cuda || hip || gpu-intel-pvc
// REQUIRES: aspect-fp16, aspect-image
// UNSUPPORTED: cuda || hip
// CUDA cannot support SYCL 1.2.1 images.
//
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
Expand Down Expand Up @@ -148,11 +149,6 @@ int main() {
// Checking if default selected device supports half datatype.
// Same device will be selected in the write/read functions.
s::device Dev{s::default_selector_v};
if (!Dev.has(sycl::aspect::fp16)) {
std::cout << "This device doesn't support the extension cl_khr_fp16"
<< std::endl;
return 0;
}
// Checking only for dimension=1.
// create image:
char HostPtr[100];
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_max_size.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// REQUIRES: aspect-image
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out

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

Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_read.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: hip || gpu-intel-pvc
// REQUIRES: aspect-image
// UNSUPPORTED: hip
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand Down
9 changes: 3 additions & 6 deletions sycl/test-e2e/Basic/image/image_read_fp16.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
// UNSUPPORTED: hip || gpu-intel-pvc
// REQUIRES: aspect-fp16, aspect-image
// UNSUPPORTED: hip
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out

#include "image_read.h"

int main() {
s::queue myQueue(s::default_selector_v);

// Device doesn't support cl_khr_fp16 extension - skip.
if (!myQueue.get_device().has(sycl::aspect::fp16))
return 0;
s::queue myQueue;

// Half image
if (!test<s::half4, s::image_channel_type::fp16>(myQueue))
Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_sample.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// REQUIRES: aspect-image
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
// Temporarily disable test on Windows due to regressions in GPU driver.
// UNSUPPORTED: hip, windows, gpu-intel-pvc
// UNSUPPORTED: hip, windows

#include <sycl/sycl.hpp>

Expand Down
3 changes: 2 additions & 1 deletion sycl/test-e2e/Basic/image/image_write.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// REQUIRES: aspect-image
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out

// UNSUPPORTED: cuda || hip || gpu-intel-pvc
// UNSUPPORTED: cuda || hip
// TODO: re-enable on cuda device.
// See https://github.com/intel/llvm/issues/1542#issuecomment-707877817 for more
// details.
Expand Down
7 changes: 2 additions & 5 deletions sycl/test-e2e/Basic/image/image_write_fp16.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// UNSUPPORTED: hip || cuda || gpu-intel-pvc
// REQUIRES: aspect-fp16, aspect-image
// UNSUPPORTED: hip || cuda
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out
// RUN: %GPU_RUN_PLACEHOLDER %t.out
Expand All @@ -8,10 +9,6 @@
int main() {
s::queue myQueue(s::default_selector_v);

// Device doesn't support cl_khr_fp16 extension - skip.
if (!myQueue.get_device().has(sycl::aspect::fp16))
return 0;

// Half image
if (!test<s::half4, s::image_channel_type::fp16>(myQueue))
return -1;
Expand Down
28 changes: 8 additions & 20 deletions sycl/test-e2e/Basic/image/srgba-read.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// REQUIRES: aspect-ext_oneapi_srgb, aspect-image
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: %CPU_RUN_PLACEHOLDER %t.out %CPU_CHECK_PLACEHOLDER
// RUN: %GPU_RUN_PLACEHOLDER %t.out %GPU_CHECK_PLACEHOLDER

// Only opencl plugin has implemented the supoort.
// REQUIRES: opencl

#include <iostream>
#include <sycl/sycl.hpp>

Expand Down Expand Up @@ -92,30 +90,20 @@ int main() {
queue Q;
device D = Q.get_device();

// test aspect
if (D.has(aspect::ext_oneapi_srgb))
std::cout << "aspect::ext_oneapi_srgb detected" << std::endl;

if (D.has(aspect::image)) {
// RGBA -- (normal, non-linearized)
std::cout << "rgba -------" << std::endl;
test_rd(image_channel_order::rgba, image_channel_type::unorm_int8);
// RGBA -- (normal, non-linearized)
std::cout << "rgba -------" << std::endl;
test_rd(image_channel_order::rgba, image_channel_type::unorm_int8);

// sRGBA -- (linearized reads)
std::cout << "srgba -------" << std::endl;
test_rd(image_channel_order::ext_oneapi_srgba,
image_channel_type::unorm_int8);
} else {
std::cout << "device does not support image operations" << std::endl;
}
// sRGBA -- (linearized reads)
std::cout << "srgba -------" << std::endl;
test_rd(image_channel_order::ext_oneapi_srgba,
image_channel_type::unorm_int8);

return 0;
}

// clang-format off
// CHECK: SYCL_EXT_ONEAPI_SRGB defined
// CHECK: aspect::ext_oneapi_srgb detected

// CHECK: rgba -------
// CHECK-NEXT: read four pixels, no sampler
// these next four reads should all be close to 0.5
Expand Down
Loading