From c9c3c73aa9f738085664c63f4575a5be024f76c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Thu, 5 Mar 2020 08:22:36 +0000 Subject: [PATCH] make execution of workgroups test optional (#643) --- CMakeLists.txt | 4 ++ test_conformance/workgroups/main.cpp | 64 +++++++++++++++++++--------- 2 files changed, 47 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01f480c1..dcf9e11e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,10 @@ add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_2_APIS=1) add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_1_APIS=1) add_definitions(-DCL_USE_DEPRECATED_OPENCL_1_0_APIS=1) +option(USE_CL_EXPERIMENTAL "Use Experimental definitions" OFF) +if(USE_CL_EXPERIMENTAL) + add_definitions(-DCL_EXPERIMENTAL) +endif(USE_CL_EXPERIMENTAL) # Support both VS2008 and VS2012. set(BUILD_DIR "$ENV{ADRENO_DRIVER}/build") diff --git a/test_conformance/workgroups/main.cpp b/test_conformance/workgroups/main.cpp index cf8a8258..df2cf7d3 100644 --- a/test_conformance/workgroups/main.cpp +++ b/test_conformance/workgroups/main.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017 The Khronos Group Inc. -// +// // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at @@ -15,35 +15,57 @@ // #include "harness/compat.h" +#include "harness/testHarness.h" +#include "procs.h" #include #include -#include "procs.h" -#include "harness/testHarness.h" #if !defined(_WIN32) #include #endif test_definition test_list[] = { - ADD_TEST( work_group_all ), - ADD_TEST( work_group_any ), - ADD_TEST( work_group_reduce_add ), - ADD_TEST( work_group_reduce_min ), - ADD_TEST( work_group_reduce_max ), - ADD_TEST( work_group_scan_inclusive_add ), - ADD_TEST( work_group_scan_inclusive_min ), - ADD_TEST( work_group_scan_inclusive_max ), - ADD_TEST( work_group_scan_exclusive_add ), - ADD_TEST( work_group_scan_exclusive_min ), - ADD_TEST( work_group_scan_exclusive_max ), - ADD_TEST( work_group_broadcast_1D ), - ADD_TEST( work_group_broadcast_2D ), - ADD_TEST( work_group_broadcast_3D ), + ADD_TEST(work_group_all), + ADD_TEST(work_group_any), + ADD_TEST(work_group_reduce_add), + ADD_TEST(work_group_reduce_min), + ADD_TEST(work_group_reduce_max), + ADD_TEST(work_group_scan_inclusive_add), + ADD_TEST(work_group_scan_inclusive_min), + ADD_TEST(work_group_scan_inclusive_max), + ADD_TEST(work_group_scan_exclusive_add), + ADD_TEST(work_group_scan_exclusive_min), + ADD_TEST(work_group_scan_exclusive_max), + ADD_TEST(work_group_broadcast_1D), + ADD_TEST(work_group_broadcast_2D), + ADD_TEST(work_group_broadcast_3D), }; -const int test_num = ARRAY_SIZE( test_list ); +const int test_num = ARRAY_SIZE(test_list); -int main(int argc, const char *argv[]) -{ - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); +test_status InitCL(cl_device_id device) { +#ifdef CL_EXPERIMENTAL + auto version = get_device_cl_version(device); + + if(version > Version(2,2)) { + int error; + cl_bool isSupported; + error = clGetDeviceInfo(device, + CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT, + sizeof(isSupported), &isSupported, NULL); + if (error != CL_SUCCESS) { + print_error(error, "Unable to query support for collective functions"); + return TEST_FAIL; + } + + if (isSupported == CL_FALSE) { + return TEST_SKIP; + } + } +#endif + return TEST_PASS; +} + +int main(int argc, const char *argv[]) { + return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0, InitCL); }