1 //
2 // Copyright (c) 2017 The Khronos Group Inc.
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16 #include "harness/compat.h"
17
18 #include <stdio.h>
19 #include <string.h>
20 #include "procs.h"
21 #include "harness/testHarness.h"
22
23 MTdata gMTdata;
24
25 test_definition test_list[] = {
26 ADD_TEST_VERSION(sub_group_info_ext, Version(2, 0)),
27 ADD_TEST_VERSION(sub_group_info_core, Version(2, 1)),
28 ADD_TEST_VERSION(work_item_functions_ext, Version(2, 0)),
29 ADD_TEST_VERSION(work_item_functions_core, Version(2, 1)),
30 ADD_TEST_VERSION(work_group_functions_ext, Version(2, 0)),
31 ADD_TEST_VERSION(work_group_functions_core, Version(2, 1)),
32 ADD_TEST_VERSION(barrier_functions_ext, Version(2, 0)),
33 ADD_TEST_VERSION(barrier_functions_core, Version(2, 1)),
34 ADD_TEST_VERSION(ifp_ext, Version(2, 0)),
35 ADD_TEST_VERSION(ifp_core, Version(2, 1))
36 };
37
38 const int test_num = ARRAY_SIZE(test_list);
39
InitCL(cl_device_id device)40 static test_status InitCL(cl_device_id device)
41 {
42 auto version = get_device_cl_version(device);
43 test_status ret = TEST_PASS;
44 if (version >= Version(3, 0))
45 {
46 cl_uint max_sub_groups;
47 int error;
48
49 error = clGetDeviceInfo(device, CL_DEVICE_MAX_NUM_SUB_GROUPS,
50 sizeof(max_sub_groups), &max_sub_groups, NULL);
51 if (error != CL_SUCCESS)
52 {
53 print_error(error, "Unable to get max number of subgroups");
54 return TEST_FAIL;
55 }
56
57 if (max_sub_groups == 0)
58 {
59 ret = TEST_SKIP;
60 }
61 }
62 return ret;
63 }
64
main(int argc,const char * argv[])65 int main(int argc, const char *argv[])
66 {
67 gMTdata = init_genrand(0);
68 return runTestHarnessWithCheck(argc, argv, test_num, test_list, false, 0,
69 InitCL);
70 }
71