diff --git a/test_conformance/subgroups/main.cpp b/test_conformance/subgroups/main.cpp index a3ae910d..36c86d1b 100644 --- a/test_conformance/subgroups/main.cpp +++ b/test_conformance/subgroups/main.cpp @@ -14,39 +14,15 @@ // limitations under the License. // #include "harness/compat.h" - -#include -#include -#include "procs.h" #include "harness/testHarness.h" -#include "CL/cl_half.h" +#include "harness/kernelHelpers.h" +#include "harness/mt19937.cpp" + +#include MTdata gMTdata; cl_half_rounding_mode g_rounding_mode; -test_definition test_list[] = { - ADD_TEST_VERSION(sub_group_info_ext, Version(2, 0)), - ADD_TEST_VERSION(sub_group_info_core, Version(2, 1)), - ADD_TEST_VERSION(work_item_functions_ext, Version(2, 0)), - ADD_TEST_VERSION(work_item_functions_core, Version(2, 1)), - ADD_TEST_VERSION(subgroup_functions_ext, Version(2, 0)), - ADD_TEST_VERSION(subgroup_functions_core, Version(2, 1)), - ADD_TEST_VERSION(barrier_functions_ext, Version(2, 0)), - ADD_TEST_VERSION(barrier_functions_core, Version(2, 1)), - ADD_TEST_VERSION(ifp_ext, Version(2, 0)), - ADD_TEST_VERSION(ifp_core, Version(2, 1)), - ADD_TEST(subgroup_functions_extended_types), - ADD_TEST(subgroup_functions_non_uniform_vote), - ADD_TEST(subgroup_functions_non_uniform_arithmetic), - ADD_TEST(subgroup_functions_ballot), - ADD_TEST(subgroup_functions_clustered_reduce), - ADD_TEST(subgroup_functions_shuffle), - ADD_TEST(subgroup_functions_shuffle_relative), - ADD_TEST(subgroup_functions_rotate), -}; - -const int test_num = ARRAY_SIZE(test_list); - static test_status InitCL(cl_device_id device) { auto version = get_device_cl_version(device); @@ -91,6 +67,7 @@ static test_status InitCL(cl_device_id device) int main(int argc, const char *argv[]) { gMTdata = init_genrand(0); - return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0, - InitCL); + return runTestHarnessWithCheck( + argc, argv, test_registry::getInstance().num_tests(), + test_registry::getInstance().definitions(), false, 0, InitCL); } diff --git a/test_conformance/subgroups/procs.h b/test_conformance/subgroups/procs.h deleted file mode 100644 index ba40a9f9..00000000 --- a/test_conformance/subgroups/procs.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// 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 -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#ifndef _procs_h -#define _procs_h - -#include "harness/testHarness.h" -#include "harness/kernelHelpers.h" -#include "harness/errorHelpers.h" -#include "harness/conversions.h" -#include "harness/typeWrappers.h" - -int test_sub_group_info_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_sub_group_info_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_work_item_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_work_item_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_subgroup_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_subgroup_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_barrier_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_barrier_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_ifp_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_ifp_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_subgroup_functions_extended_types(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements); -int test_subgroup_functions_non_uniform_vote(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements); -int test_subgroup_functions_non_uniform_arithmetic(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements); -int test_subgroup_functions_ballot(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_subgroup_functions_clustered_reduce(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements); -int test_subgroup_functions_shuffle(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -int test_subgroup_functions_shuffle_relative(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements); -int test_subgroup_functions_rotate(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements); -#endif /*_procs_h*/ diff --git a/test_conformance/subgroups/test_barrier.cpp b/test_conformance/subgroups/test_barrier.cpp index f97e2a33..608514de 100644 --- a/test_conformance/subgroups/test_barrier.cpp +++ b/test_conformance/subgroups/test_barrier.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "harness/conversions.h" #include "harness/typeWrappers.h" @@ -174,14 +173,12 @@ int test_barrier_functions(cl_device_id device, cl_context context, return error; } -int test_barrier_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(barrier_functions_core, Version(2, 1)) { return test_barrier_functions(device, context, queue, num_elements, true); } -int test_barrier_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(barrier_functions_ext, Version(2, 0)) { bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); diff --git a/test_conformance/subgroups/test_ifp.cpp b/test_conformance/subgroups/test_ifp.cpp index 61c65673..26403ef8 100644 --- a/test_conformance/subgroups/test_ifp.cpp +++ b/test_conformance/subgroups/test_ifp.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "harness/conversions.h" #include "harness/typeWrappers.h" @@ -332,8 +331,7 @@ static test_status checkIFPSupport(cl_device_id device, bool &ifpSupport) return TEST_PASS; } -int test_ifp_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(ifp_core, Version(2, 1)) { bool ifpSupport = true; test_status error; @@ -351,8 +349,7 @@ int test_ifp_core(cl_device_id device, cl_context context, return test_ifp(device, context, queue, num_elements, true); } -int test_ifp_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(ifp_ext, Version(2, 0)) { bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool ifpSupport = true; diff --git a/test_conformance/subgroups/test_queries.cpp b/test_conformance/subgroups/test_queries.cpp index 6b940935..e9e6ca5f 100644 --- a/test_conformance/subgroups/test_queries.cpp +++ b/test_conformance/subgroups/test_queries.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" typedef struct @@ -190,14 +189,12 @@ int test_sub_group_info(cl_device_id device, cl_context context, return 0; } -int test_sub_group_info_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(sub_group_info_core, Version(2, 1)) { return test_sub_group_info(device, context, queue, num_elements, true); } -int test_sub_group_info_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(sub_group_info_ext, Version(2, 0)) { bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); diff --git a/test_conformance/subgroups/test_subgroup.cpp b/test_conformance/subgroups/test_subgroup.cpp index 3b72913e..e88848b9 100644 --- a/test_conformance/subgroups/test_subgroup.cpp +++ b/test_conformance/subgroups/test_subgroup.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_kernels.h" #include "subgroup_common_templates.h" @@ -188,14 +187,12 @@ int test_subgroup_functions(cl_device_id device, cl_context context, return error; } -int test_subgroup_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(subgroup_functions_core, Version(2, 1)) { return test_subgroup_functions(device, context, queue, num_elements, true); } -int test_subgroup_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(subgroup_functions_ext, Version(2, 0)) { bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); diff --git a/test_conformance/subgroups/test_subgroup_ballot.cpp b/test_conformance/subgroups/test_subgroup_ballot.cpp index 0eb0c499..69976c50 100644 --- a/test_conformance/subgroups/test_subgroup_ballot.cpp +++ b/test_conformance/subgroups/test_subgroup_ballot.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_templates.h" #include "harness/typeWrappers.h" @@ -888,8 +887,7 @@ template int run_non_uniform_broadcast_for_type(RunTestForType rft) } -int test_subgroup_functions_ballot(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(subgroup_functions_ballot) { if (!is_extension_available(device, "cl_khr_subgroup_ballot")) { diff --git a/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp b/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp index fddcce4e..c21880f9 100644 --- a/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp +++ b/test_conformance/subgroups/test_subgroup_clustered_reduce.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_templates.h" #include "harness/typeWrappers.h" @@ -181,10 +180,7 @@ int run_cluster_logical_and_or_xor_for_type(RunTestForType rft) } } -int test_subgroup_functions_clustered_reduce(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(subgroup_functions_clustered_reduce) { if (!is_extension_available(device, "cl_khr_subgroup_clustered_reduce")) { diff --git a/test_conformance/subgroups/test_subgroup_extended_types.cpp b/test_conformance/subgroups/test_subgroup_extended_types.cpp index c9e6bb61..250577de 100644 --- a/test_conformance/subgroups/test_subgroup_extended_types.cpp +++ b/test_conformance/subgroups/test_subgroup_extended_types.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_kernels.h" #include "subgroup_common_templates.h" @@ -54,10 +53,7 @@ template int run_scan_reduction_for_type(RunTestForType rft) } -int test_subgroup_functions_extended_types(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(subgroup_functions_extended_types) { if (!is_extension_available(device, "cl_khr_subgroup_extended_types")) { diff --git a/test_conformance/subgroups/test_subgroup_non_uniform_arithmetic.cpp b/test_conformance/subgroups/test_subgroup_non_uniform_arithmetic.cpp index 02fc507b..9894f428 100644 --- a/test_conformance/subgroups/test_subgroup_non_uniform_arithmetic.cpp +++ b/test_conformance/subgroups/test_subgroup_non_uniform_arithmetic.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "harness/typeWrappers.h" #include "subgroup_common_templates.h" @@ -121,10 +120,7 @@ int run_functions_logical_and_or_xor_for_type(RunTestForType rft) } -int test_subgroup_functions_non_uniform_arithmetic(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(subgroup_functions_non_uniform_arithmetic) { if (!is_extension_available(device, "cl_khr_subgroup_non_uniform_arithmetic")) diff --git a/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp b/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp index 3be1ba30..74e9144e 100644 --- a/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp +++ b/test_conformance/subgroups/test_subgroup_non_uniform_vote.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "harness/typeWrappers.h" #include @@ -253,10 +252,7 @@ template int run_vote_all_equal_for_type(RunTestForType rft) } } -int test_subgroup_functions_non_uniform_vote(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(subgroup_functions_non_uniform_vote) { if (!is_extension_available(device, "cl_khr_subgroup_non_uniform_vote")) { diff --git a/test_conformance/subgroups/test_subgroup_rotate.cpp b/test_conformance/subgroups/test_subgroup_rotate.cpp index db0f48eb..ae828677 100644 --- a/test_conformance/subgroups/test_subgroup_rotate.cpp +++ b/test_conformance/subgroups/test_subgroup_rotate.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_kernels.h" #include "subgroup_common_templates.h" @@ -59,8 +58,7 @@ template int run_clustered_rotate_for_type(RunTestForType rft) } -int test_subgroup_functions_rotate(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(subgroup_functions_rotate) { if (!is_extension_available(device, "cl_khr_subgroup_rotate")) { diff --git a/test_conformance/subgroups/test_subgroup_shuffle.cpp b/test_conformance/subgroups/test_subgroup_shuffle.cpp index 56231cbf..5332884f 100644 --- a/test_conformance/subgroups/test_subgroup_shuffle.cpp +++ b/test_conformance/subgroups/test_subgroup_shuffle.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_kernels.h" #include "subgroup_common_templates.h" @@ -33,8 +32,7 @@ template int run_shuffle_for_type(RunTestForType rft) } -int test_subgroup_functions_shuffle(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(subgroup_functions_shuffle) { if (!is_extension_available(device, "cl_khr_subgroup_shuffle")) { diff --git a/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp b/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp index caa1dccc..eb0e0958 100644 --- a/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp +++ b/test_conformance/subgroups/test_subgroup_shuffle_relative.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "subhelpers.h" #include "subgroup_common_kernels.h" #include "subgroup_common_templates.h" @@ -33,10 +32,7 @@ template int run_shuffle_relative_for_type(RunTestForType rft) } -int test_subgroup_functions_shuffle_relative(cl_device_id device, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(subgroup_functions_shuffle_relative) { if (!is_extension_available(device, "cl_khr_subgroup_shuffle_relative")) { diff --git a/test_conformance/subgroups/test_workitem.cpp b/test_conformance/subgroups/test_workitem.cpp index 5b2a5eb8..b4bbad74 100644 --- a/test_conformance/subgroups/test_workitem.cpp +++ b/test_conformance/subgroups/test_workitem.cpp @@ -13,7 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "procs.h" #include "harness/conversions.h" #include "harness/typeWrappers.h" #include @@ -321,14 +320,12 @@ int test_work_item_functions(cl_device_id device, cl_context context, return 0; } -int test_work_item_functions_core(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(work_item_functions_core, Version(2, 1)) { return test_work_item_functions(device, context, queue, num_elements, true); } -int test_work_item_functions_ext(cl_device_id device, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST_VERSION(work_item_functions_ext, Version(2, 0)) { bool hasExtension = is_extension_available(device, "cl_khr_subgroups");