Migrate subgroups suite to the new test registration framework (#2313)

Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2025-03-09 09:53:47 +00:00
committed by GitHub
parent aed6c3a214
commit 3f7774b089
15 changed files with 25 additions and 160 deletions

View File

@@ -14,39 +14,15 @@
// limitations under the License. // limitations under the License.
// //
#include "harness/compat.h" #include "harness/compat.h"
#include <stdio.h>
#include <string.h>
#include "procs.h"
#include "harness/testHarness.h" #include "harness/testHarness.h"
#include "CL/cl_half.h" #include "harness/kernelHelpers.h"
#include "harness/mt19937.cpp"
#include <CL/cl_half.h>
MTdata gMTdata; MTdata gMTdata;
cl_half_rounding_mode g_rounding_mode; 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) static test_status InitCL(cl_device_id device)
{ {
auto version = get_device_cl_version(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[]) int main(int argc, const char *argv[])
{ {
gMTdata = init_genrand(0); gMTdata = init_genrand(0);
return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0, return runTestHarnessWithCheck(
InitCL); argc, argv, test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), false, 0, InitCL);
} }

View File

@@ -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*/

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
@@ -174,14 +173,12 @@ int test_barrier_functions(cl_device_id device, cl_context context,
return error; return error;
} }
int test_barrier_functions_core(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(barrier_functions_core, Version(2, 1))
cl_command_queue queue, int num_elements)
{ {
return test_barrier_functions(device, context, queue, num_elements, true); return test_barrier_functions(device, context, queue, num_elements, true);
} }
int test_barrier_functions_ext(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(barrier_functions_ext, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool hasExtension = is_extension_available(device, "cl_khr_subgroups");

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
@@ -332,8 +331,7 @@ static test_status checkIFPSupport(cl_device_id device, bool &ifpSupport)
return TEST_PASS; return TEST_PASS;
} }
int test_ifp_core(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(ifp_core, Version(2, 1))
cl_command_queue queue, int num_elements)
{ {
bool ifpSupport = true; bool ifpSupport = true;
test_status error; 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); return test_ifp(device, context, queue, num_elements, true);
} }
int test_ifp_ext(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(ifp_ext, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool hasExtension = is_extension_available(device, "cl_khr_subgroups");
bool ifpSupport = true; bool ifpSupport = true;

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
typedef struct typedef struct
@@ -190,14 +189,12 @@ int test_sub_group_info(cl_device_id device, cl_context context,
return 0; return 0;
} }
int test_sub_group_info_core(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(sub_group_info_core, Version(2, 1))
cl_command_queue queue, int num_elements)
{ {
return test_sub_group_info(device, context, queue, num_elements, true); return test_sub_group_info(device, context, queue, num_elements, true);
} }
int test_sub_group_info_ext(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(sub_group_info_ext, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool hasExtension = is_extension_available(device, "cl_khr_subgroups");

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_kernels.h" #include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
@@ -188,14 +187,12 @@ int test_subgroup_functions(cl_device_id device, cl_context context,
return error; return error;
} }
int test_subgroup_functions_core(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(subgroup_functions_core, Version(2, 1))
cl_command_queue queue, int num_elements)
{ {
return test_subgroup_functions(device, context, queue, num_elements, true); return test_subgroup_functions(device, context, queue, num_elements, true);
} }
int test_subgroup_functions_ext(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(subgroup_functions_ext, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool hasExtension = is_extension_available(device, "cl_khr_subgroups");

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
@@ -888,8 +887,7 @@ template <typename T> int run_non_uniform_broadcast_for_type(RunTestForType rft)
} }
int test_subgroup_functions_ballot(cl_device_id device, cl_context context, REGISTER_TEST(subgroup_functions_ballot)
cl_command_queue queue, int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_ballot")) if (!is_extension_available(device, "cl_khr_subgroup_ballot"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
#include "harness/typeWrappers.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, REGISTER_TEST(subgroup_functions_clustered_reduce)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_clustered_reduce")) if (!is_extension_available(device, "cl_khr_subgroup_clustered_reduce"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_kernels.h" #include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
@@ -54,10 +53,7 @@ template <typename T> int run_scan_reduction_for_type(RunTestForType rft)
} }
int test_subgroup_functions_extended_types(cl_device_id device, REGISTER_TEST(subgroup_functions_extended_types)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_extended_types")) if (!is_extension_available(device, "cl_khr_subgroup_extended_types"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include "subgroup_common_templates.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, REGISTER_TEST(subgroup_functions_non_uniform_arithmetic)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(device, if (!is_extension_available(device,
"cl_khr_subgroup_non_uniform_arithmetic")) "cl_khr_subgroup_non_uniform_arithmetic"))

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include <set> #include <set>
@@ -253,10 +252,7 @@ template <typename T> int run_vote_all_equal_for_type(RunTestForType rft)
} }
} }
int test_subgroup_functions_non_uniform_vote(cl_device_id device, REGISTER_TEST(subgroup_functions_non_uniform_vote)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_non_uniform_vote")) if (!is_extension_available(device, "cl_khr_subgroup_non_uniform_vote"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_kernels.h" #include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
@@ -59,8 +58,7 @@ template <typename T> int run_clustered_rotate_for_type(RunTestForType rft)
} }
int test_subgroup_functions_rotate(cl_device_id device, cl_context context, REGISTER_TEST(subgroup_functions_rotate)
cl_command_queue queue, int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_rotate")) if (!is_extension_available(device, "cl_khr_subgroup_rotate"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_kernels.h" #include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
@@ -33,8 +32,7 @@ template <typename T> int run_shuffle_for_type(RunTestForType rft)
} }
int test_subgroup_functions_shuffle(cl_device_id device, cl_context context, REGISTER_TEST(subgroup_functions_shuffle)
cl_command_queue queue, int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_shuffle")) if (!is_extension_available(device, "cl_khr_subgroup_shuffle"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "subhelpers.h" #include "subhelpers.h"
#include "subgroup_common_kernels.h" #include "subgroup_common_kernels.h"
#include "subgroup_common_templates.h" #include "subgroup_common_templates.h"
@@ -33,10 +32,7 @@ template <typename T> int run_shuffle_relative_for_type(RunTestForType rft)
} }
int test_subgroup_functions_shuffle_relative(cl_device_id device, REGISTER_TEST(subgroup_functions_shuffle_relative)
cl_context context,
cl_command_queue queue,
int num_elements)
{ {
if (!is_extension_available(device, "cl_khr_subgroup_shuffle_relative")) if (!is_extension_available(device, "cl_khr_subgroup_shuffle_relative"))
{ {

View File

@@ -13,7 +13,6 @@
// See the License for the specific language governing permissions and // See the License for the specific language governing permissions and
// limitations under the License. // limitations under the License.
// //
#include "procs.h"
#include "harness/conversions.h" #include "harness/conversions.h"
#include "harness/typeWrappers.h" #include "harness/typeWrappers.h"
#include <CL/cl.h> #include <CL/cl.h>
@@ -321,14 +320,12 @@ int test_work_item_functions(cl_device_id device, cl_context context,
return 0; return 0;
} }
int test_work_item_functions_core(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(work_item_functions_core, Version(2, 1))
cl_command_queue queue, int num_elements)
{ {
return test_work_item_functions(device, context, queue, num_elements, true); return test_work_item_functions(device, context, queue, num_elements, true);
} }
int test_work_item_functions_ext(cl_device_id device, cl_context context, REGISTER_TEST_VERSION(work_item_functions_ext, Version(2, 0))
cl_command_queue queue, int num_elements)
{ {
bool hasExtension = is_extension_available(device, "cl_khr_subgroups"); bool hasExtension = is_extension_available(device, "cl_khr_subgroups");