diff --git a/sycl/test-e2e/Basic/half_builtins.cpp b/sycl/test-e2e/Basic/half_builtins.cpp index 34fab08c8992e..fc5555ef4b267 100644 --- a/sycl/test-e2e/Basic/half_builtins.cpp +++ b/sycl/test-e2e/Basic/half_builtins.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -166,12 +167,7 @@ template bool check(vec a, vec 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; - } + assert(q.get_device().has(sycl::aspect::fp16) && "Requires fp16"); float16 a, b, c, d; for (int i = 0; i < SZ_max; i++) { diff --git a/sycl/test-e2e/Basic/half_type.cpp b/sycl/test-e2e/Basic/half_type.cpp index 004ef340ac131..ebd40365ec288 100644 --- a/sycl/test-e2e/Basic/half_type.cpp +++ b/sycl/test-e2e/Basic/half_type.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -238,11 +239,7 @@ 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; - } + assert(dev.has(sycl::aspect::fp16) && "Requires fp16"); std::vector vec_a(N, 5.0); std::vector vec_b(N, 2.0); diff --git a/sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp b/sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp index 9deec2ccb1f5d..142d4ab338fbe 100644 --- a/sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp +++ b/sycl/test-e2e/Basic/image/image_accessor_readwrite_half.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // UNSUPPORTED: cuda || hip || gpu-intel-pvc // CUDA cannot support SYCL 1.2.1 images. // @@ -148,11 +149,7 @@ 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; - } + assert(Dev.has(sycl::aspect::fp16) && "Requires fp16"); // Checking only for dimension=1. // create image: char HostPtr[100]; diff --git a/sycl/test-e2e/Basic/image/image_read_fp16.cpp b/sycl/test-e2e/Basic/image/image_read_fp16.cpp index 9e8b258a3ad13..0af0a3cacec4e 100644 --- a/sycl/test-e2e/Basic/image/image_read_fp16.cpp +++ b/sycl/test-e2e/Basic/image/image_read_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // UNSUPPORTED: hip || gpu-intel-pvc // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out @@ -9,8 +10,7 @@ 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; + assert(myQueue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); // Half image if (!test(myQueue)) diff --git a/sycl/test-e2e/DeviceLib/built-ins/ext_native_math_fp16.cpp b/sycl/test-e2e/DeviceLib/built-ins/ext_native_math_fp16.cpp index 74bd0f82132e9..ee2b3de1ae9ad 100644 --- a/sycl/test-e2e/DeviceLib/built-ins/ext_native_math_fp16.cpp +++ b/sycl/test-e2e/DeviceLib/built-ins/ext_native_math_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-device-code-split=per_kernel %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -15,11 +16,7 @@ int main() { sycl::queue q; - if (!q.get_device().has(sycl::aspect::fp16)) { - std::cout << "skipping fp16 tests: requires fp16 device aspect." - << std::endl; - return 0; - } + assert(q.get_device().has(sycl::aspect::fp16) && "Requires fp16"); const sycl::half tv[16] = {-2.0, -1.5, -1.0, 0.0, 2.0, 1.5, 1.0, 0.0, -1.7, 1.7, -1.2, 1.2, -3.0, 3.0, -10.0, 10.0}; diff --git a/sycl/test-e2e/DeviceLib/cmath_fp64_test.cpp b/sycl/test-e2e/DeviceLib/cmath_fp64_test.cpp index e435d8def5b3b..389e3e0200f6c 100644 --- a/sycl/test-e2e/DeviceLib/cmath_fp64_test.cpp +++ b/sycl/test-e2e/DeviceLib/cmath_fp64_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out @@ -162,9 +163,8 @@ template void device_cmath_test(s::queue &deviceQueue) { int main() { s::queue deviceQueue; - if (deviceQueue.get_device().has(sycl::aspect::fp64)) { - device_cmath_test(deviceQueue); - std::cout << "Pass" << std::endl; - } + assert(deviceQueue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + device_cmath_test(deviceQueue); + std::cout << "Pass" << std::endl; return 0; } diff --git a/sycl/test-e2e/DeviceLib/imf_double2half.cpp b/sycl/test-e2e/DeviceLib/imf_double2half.cpp index 24b3a2271debe..b700fbbb12332 100644 --- a/sycl/test-e2e/DeviceLib/imf_double2half.cpp +++ b/sycl/test-e2e/DeviceLib/imf_double2half.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 && fp64 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -19,15 +20,9 @@ int main() { << device_queue.get_device().get_info() << "\n"; - if (!device_queue.get_device().has(sycl::aspect::fp64)) { - std::cout << "Test skipped on platform without fp64 support." << std::endl; - return 0; - } - - if (!device_queue.get_device().has(sycl::aspect::fp16)) { - std::cout << "Test skipped on platform without fp16 support." << std::endl; - return 0; - } + assert(device_queue.get_device().has(sycl::aspect::fp16) && + device_queue.get_device().has(sycl::aspect::fp64) && + "Requires fp16 and fp64"); { std::initializer_list input_vals = { diff --git a/sycl/test-e2e/DeviceLib/imf_fp16_trivial_test.cpp b/sycl/test-e2e/DeviceLib/imf_fp16_trivial_test.cpp index 5cc9425520716..9bfef0e003ac3 100644 --- a/sycl/test-e2e/DeviceLib/imf_fp16_trivial_test.cpp +++ b/sycl/test-e2e/DeviceLib/imf_fp16_trivial_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -14,10 +15,7 @@ int main(int, char **) { << device_queue.get_device().get_info() << "\n"; - if (!device_queue.get_device().has(sycl::aspect::fp16)) { - std::cout << "Test skipped on platform without fp16 support." << std::endl; - return 0; - } + assert(device_queue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); { std::initializer_list input_vals1 = {0.5f, -1.125f, 100.5f, diff --git a/sycl/test-e2e/DeviceLib/imf_fp64_test.cpp b/sycl/test-e2e/DeviceLib/imf_fp64_test.cpp index 7be6a29c127ea..7c4d971795e23 100644 --- a/sycl/test-e2e/DeviceLib/imf_fp64_test.cpp +++ b/sycl/test-e2e/DeviceLib/imf_fp64_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out @@ -60,10 +61,7 @@ int main(int, char **) { std::cout << "Running on " << device_queue.get_device().get_info() << "\n"; - if (!device_queue.get_device().has(sycl::aspect::fp64)) { - std::cout << "Test skipped on platform without fp64 support." << std::endl; - return 0; - } + assert(device_queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); { std::initializer_list input_vals = {0.0, diff --git a/sycl/test-e2e/DeviceLib/imf_half_type_cast.cpp b/sycl/test-e2e/DeviceLib/imf_half_type_cast.cpp index 9254bd42b988c..30637922f61f8 100644 --- a/sycl/test-e2e/DeviceLib/imf_half_type_cast.cpp +++ b/sycl/test-e2e/DeviceLib/imf_half_type_cast.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -70,10 +71,7 @@ int main() { << device_queue.get_device().get_info() << "\n"; - if (!device_queue.get_device().has(sycl::aspect::fp16)) { - std::cout << "Test skipped on platform without fp16 support." << std::endl; - return 0; - } + assert(device_queue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); // half2int tests { diff --git a/sycl/test-e2e/DeviceLib/math_fp64_test.cpp b/sycl/test-e2e/DeviceLib/math_fp64_test.cpp index 8f55710f8f8c3..27a72a2621287 100644 --- a/sycl/test-e2e/DeviceLib/math_fp64_test.cpp +++ b/sycl/test-e2e/DeviceLib/math_fp64_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // UNSUPPORTED: hip // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out @@ -165,9 +166,8 @@ void device_math_test(s::queue &deviceQueue) { int main() { s::queue deviceQueue; - if (deviceQueue.get_device().has(sycl::aspect::fp64)) { - device_math_test(deviceQueue); - std::cout << "Pass" << std::endl; - } + assert(deviceQueue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + device_math_test(deviceQueue); + std::cout << "Pass" << std::endl; return 0; } diff --git a/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp b/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp index dd82ede2e4075..8eeea189fde8d 100644 --- a/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp +++ b/sycl/test-e2e/DeviceLib/math_fp64_windows_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // UNSUPPORTED: windows // Disabled on windows due to bug VS 2019 missing math builtins @@ -125,9 +126,8 @@ void device_math_test(s::queue &deviceQueue) { int main() { s::queue deviceQueue; - if (deviceQueue.get_device().has(sycl::aspect::fp64)) { - device_math_test(deviceQueue); - std::cout << "Pass" << std::endl; - } + assert(deviceQueue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + device_math_test(deviceQueue); + std::cout << "Pass" << std::endl; return 0; } diff --git a/sycl/test-e2e/DeviceLib/math_test_marray_vec_fp16.cpp b/sycl/test-e2e/DeviceLib/math_test_marray_vec_fp16.cpp index 7db7350ece12f..4f783d11a1e49 100644 --- a/sycl/test-e2e/DeviceLib/math_test_marray_vec_fp16.cpp +++ b/sycl/test-e2e/DeviceLib/math_test_marray_vec_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out @@ -11,11 +12,8 @@ int main() { queue deviceQueue; - if (!deviceQueue.get_device().has(sycl::aspect::fp16)) { - std::cout << "skipping fp16 tests: requires fp16 device aspect." - << std::endl; - return 0; - } + assert(deviceQueue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); + math_tests_4(deviceQueue); math_tests_4>(deviceQueue); math_tests_3(deviceQueue); diff --git a/sycl/test-e2e/DeviceLib/std_complex_math_fp64_test.cpp b/sycl/test-e2e/DeviceLib/std_complex_math_fp64_test.cpp index 4080d3aa1860f..d94d43813ce98 100644 --- a/sycl/test-e2e/DeviceLib/std_complex_math_fp64_test.cpp +++ b/sycl/test-e2e/DeviceLib/std_complex_math_fp64_test.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out @@ -198,8 +199,7 @@ void device_complex_test(s::queue &deviceQueue) { int main() { s::queue deviceQueue; - if (deviceQueue.get_device().has(sycl::aspect::fp64)) { - device_complex_test(deviceQueue); - std::cout << "Pass" << std::endl; - } + assert(deviceQueue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + device_complex_test(deviceQueue); + std::cout << "Pass" << std::endl; } diff --git a/sycl/test-e2e/ESIMD/vadd_half.cpp b/sycl/test-e2e/ESIMD/vadd_half.cpp index ecdb42513a916..6d7467e12613e 100644 --- a/sycl/test-e2e/ESIMD/vadd_half.cpp +++ b/sycl/test-e2e/ESIMD/vadd_half.cpp @@ -6,7 +6,7 @@ // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// -// REQUIRES: gpu +// REQUIRES: gpu && fp16 // UNSUPPORTED: gpu-intel-gen9 && windows // UNSUPPORTED: cuda || hip // RUN: %clangxx -fsycl %s -o %t.out @@ -60,12 +60,7 @@ int main(int argc, char **argv) { auto dev = q.get_device(); std::cout << "Running on " << dev.get_info() << "\n"; - if (!dev.has(sycl::aspect::fp16)) { - std::cout << "Test was skipped becasue the selected device does not " - "support sycl::aspect::fp16" - << std::endl; - return 0; - } + assert(dev.has(sycl::aspect::fp16) && "Requires fp16"); TstT *A = malloc_shared(Size, q); SrcT *B = malloc_shared(Size, q); diff --git a/sycl/test-e2e/Regression/fp16-with-unnamed-lambda.cpp b/sycl/test-e2e/Regression/fp16-with-unnamed-lambda.cpp index ad7d055b9dc39..74aad1d5eeb86 100644 --- a/sycl/test-e2e/Regression/fp16-with-unnamed-lambda.cpp +++ b/sycl/test-e2e/Regression/fp16-with-unnamed-lambda.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple -fsycl-unnamed-lambda %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out @@ -20,8 +21,7 @@ int main() { sycl::queue Q(AsyncHandler); sycl::device D = Q.get_device(); - if (!D.has(sycl::aspect::fp16)) - return 0; // Skip the test if halfs are not supported + assert(D.has(sycl::aspect::fp16) && "Requires fp16"); sycl::buffer Buf(1); diff --git a/sycl/test-e2e/SubGroup/broadcast_fp64.cpp b/sycl/test-e2e/SubGroup/broadcast_fp64.cpp index a7762706904a7..3975557d3d423 100644 --- a/sycl/test-e2e/SubGroup/broadcast_fp64.cpp +++ b/sycl/test-e2e/SubGroup/broadcast_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -15,12 +16,8 @@ int main() { queue Queue; - if (Queue.get_device().has(sycl::aspect::fp64)) { - check(Queue); - std::cout << "Test passed." << std::endl; - } else { - std::cout << "Test skipped because device doesn't support aspect::fp64" - << std::endl; - } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + check(Queue); + std::cout << "Test passed." << std::endl; return 0; } diff --git a/sycl/test-e2e/SubGroup/reduce_fp16.cpp b/sycl/test-e2e/SubGroup/reduce_fp16.cpp index 9c1193791f50a..db086416c304e 100644 --- a/sycl/test-e2e/SubGroup/reduce_fp16.cpp +++ b/sycl/test-e2e/SubGroup/reduce_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // @@ -10,11 +11,11 @@ int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp16)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); check(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/reduce_fp64.cpp b/sycl/test-e2e/SubGroup/reduce_fp64.cpp index 523ff2550cd70..59ea33d837a8f 100644 --- a/sycl/test-e2e/SubGroup/reduce_fp64.cpp +++ b/sycl/test-e2e/SubGroup/reduce_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -9,11 +10,11 @@ int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp64)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); check(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/reduce_spirv13_fp16.cpp b/sycl/test-e2e/SubGroup/reduce_spirv13_fp16.cpp index 7cedd8af5da26..7fa882045290d 100644 --- a/sycl/test-e2e/SubGroup/reduce_spirv13_fp16.cpp +++ b/sycl/test-e2e/SubGroup/reduce_spirv13_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // UNSUPPORTED: hip // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out @@ -10,11 +11,11 @@ int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp16)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); check_mul(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/reduce_spirv13_fp64.cpp b/sycl/test-e2e/SubGroup/reduce_spirv13_fp64.cpp index 9d1f75e2de42c..35c96d5f01c25 100644 --- a/sycl/test-e2e/SubGroup/reduce_spirv13_fp64.cpp +++ b/sycl/test-e2e/SubGroup/reduce_spirv13_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // UNSUPPORTED: hip // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out @@ -12,11 +13,11 @@ #include int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp64)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); check_mul(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/scan_fp64.cpp b/sycl/test-e2e/SubGroup/scan_fp64.cpp index 328334c222ad8..c97581429823b 100644 --- a/sycl/test-e2e/SubGroup/scan_fp64.cpp +++ b/sycl/test-e2e/SubGroup/scan_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -10,11 +11,11 @@ #include int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp64)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); check(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/scan_spirv13_fp64.cpp b/sycl/test-e2e/SubGroup/scan_spirv13_fp64.cpp index ee521e51dbaef..81439012b2cb8 100644 --- a/sycl/test-e2e/SubGroup/scan_spirv13_fp64.cpp +++ b/sycl/test-e2e/SubGroup/scan_spirv13_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // UNSUPPORTED: hip // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out @@ -13,11 +14,11 @@ int main() { queue Queue; - if (!core_sg_supported(Queue.get_device()) || - !Queue.get_device().has(sycl::aspect::fp64)) { + if (!core_sg_supported(Queue.get_device())) { std::cout << "Skipping test\n"; return 0; } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); check(Queue); std::cout << "Test passed." << std::endl; return 0; diff --git a/sycl/test-e2e/SubGroup/shuffle_fp16.cpp b/sycl/test-e2e/SubGroup/shuffle_fp16.cpp index 70224da203d35..c3c7a6211ef53 100644 --- a/sycl/test-e2e/SubGroup/shuffle_fp16.cpp +++ b/sycl/test-e2e/SubGroup/shuffle_fp16.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp16 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out // @@ -22,12 +23,8 @@ int main() { queue Queue; - if (Queue.get_device().has(sycl::aspect::fp16)) { - check(Queue); - std::cout << "Test passed." << std::endl; - } else { - std::cout << "Test skipped because device doesn't support aspect::fp16" - << std::endl; - } + assert(Queue.get_device().has(sycl::aspect::fp16) && "Requires fp16"); + check(Queue); + std::cout << "Test passed." << std::endl; return 0; } diff --git a/sycl/test-e2e/SubGroup/shuffle_fp64.cpp b/sycl/test-e2e/SubGroup/shuffle_fp64.cpp index a0aa02b116d5e..05c55f019c195 100644 --- a/sycl/test-e2e/SubGroup/shuffle_fp64.cpp +++ b/sycl/test-e2e/SubGroup/shuffle_fp64.cpp @@ -1,3 +1,4 @@ +// REQUIRES: fp64 // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out // RUN: %CPU_RUN_PLACEHOLDER %t.out // RUN: %GPU_RUN_PLACEHOLDER %t.out @@ -16,16 +17,12 @@ int main() { queue Queue; - if (Queue.get_device().has(sycl::aspect::fp64)) { - check(Queue); - check(Queue); - check(Queue); - check(Queue); - check(Queue); - std::cout << "Test passed." << std::endl; - } else { - std::cout << "Test skipped because device doesn't support aspect::fp64" - << std::endl; - } + assert(Queue.get_device().has(sycl::aspect::fp64) && "Requires fp64"); + check(Queue); + check(Queue); + check(Queue); + check(Queue); + check(Queue); + std::cout << "Test passed." << std::endl; return 0; } diff --git a/sycl/test-e2e/lit.cfg.py b/sycl/test-e2e/lit.cfg.py index b05e8911b1262..655f0e5e628b1 100644 --- a/sycl/test-e2e/lit.cfg.py +++ b/sycl/test-e2e/lit.cfg.py @@ -459,6 +459,32 @@ else: lit_config.warning("Couldn't find pre-installed AOT device compiler " + aot_tool) +aspects = [ 'fp16', 'fp64', ] + +check_aspect_file = 'check_aspects.cpp' +with open(check_aspect_file, 'w') as ff: + ff.write('#include \n') + ff.write('int main() {\n') + ff.write(' sycl::device dev;\n') + for a in aspects: + ff.write(f' int {a} = dev.has(sycl::aspect::{a});\n') + ff.write(f' printf("{":".join(["%d"] * len(aspects))}\\n",' + f'{",".join([a for a in aspects])});\n') + ff.write(' return 0;\n') + ff.write('}\n') + +status = subprocess.getstatusoutput(config.dpcpp_compiler + ' -fsycl ' + + check_aspect_file + ' -o check_aspects') +if status[0] == 0: + status = subprocess.getstatusoutput('./check_aspects') + if status[0] == 0: + supported_aspects = map(int, status[1].split(':')) + for aspect,supported in zip(aspects, supported_aspects): + if supported: + config.available_features.add(aspect) +else: + lit_config.error("Unable to determine supported aspects") + # Check if kernel fusion is available by compiling a small program that will # be ill-formed (compilation stops with non-zero exit code) if the feature # test macro for kernel fusion is not defined.