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 "harness/testHarness.h"
19 #include "procs.h"
20 #include <stdio.h>
21 #include <string.h>
22
InitCL(cl_device_id device)23 test_status InitCL(cl_device_id device) {
24 auto version = get_device_cl_version(device);
25 auto expected_min_version = Version(2, 0);
26 if (version < expected_min_version)
27 {
28 version_expected_info("Test", "OpenCL",
29 expected_min_version.to_string().c_str(),
30 version.to_string().c_str());
31 return TEST_SKIP;
32 }
33
34 int error;
35 cl_uint max_packet_size;
36 error = clGetDeviceInfo(device, CL_DEVICE_PIPE_MAX_PACKET_SIZE,
37 sizeof(max_packet_size), &max_packet_size, NULL);
38 if (error != CL_SUCCESS) {
39 print_error(error, "Unable to get pipe max packet size");
40 return TEST_FAIL;
41 }
42
43 if ((max_packet_size == 0) && (version >= Version(3, 0)))
44 {
45 return TEST_SKIP;
46 }
47
48 return TEST_PASS;
49 }
50
51 test_definition test_list[] = {
52 ADD_TEST(pipe_readwrite_int),
53 ADD_TEST(pipe_readwrite_uint),
54 ADD_TEST(pipe_readwrite_long),
55 ADD_TEST(pipe_readwrite_ulong),
56 ADD_TEST(pipe_readwrite_short),
57 ADD_TEST(pipe_readwrite_ushort),
58 ADD_TEST(pipe_readwrite_float),
59 ADD_TEST(pipe_readwrite_half),
60 ADD_TEST(pipe_readwrite_char),
61 ADD_TEST(pipe_readwrite_uchar),
62 ADD_TEST(pipe_readwrite_double),
63 ADD_TEST(pipe_readwrite_struct),
64 ADD_TEST(pipe_workgroup_readwrite_int),
65 ADD_TEST(pipe_workgroup_readwrite_uint),
66 ADD_TEST(pipe_workgroup_readwrite_long),
67 ADD_TEST(pipe_workgroup_readwrite_ulong),
68 ADD_TEST(pipe_workgroup_readwrite_short),
69 ADD_TEST(pipe_workgroup_readwrite_ushort),
70 ADD_TEST(pipe_workgroup_readwrite_float),
71 ADD_TEST(pipe_workgroup_readwrite_half),
72 ADD_TEST(pipe_workgroup_readwrite_char),
73 ADD_TEST(pipe_workgroup_readwrite_uchar),
74 ADD_TEST(pipe_workgroup_readwrite_double),
75 ADD_TEST(pipe_workgroup_readwrite_struct),
76 ADD_TEST(pipe_subgroup_readwrite_int),
77 ADD_TEST(pipe_subgroup_readwrite_uint),
78 ADD_TEST(pipe_subgroup_readwrite_long),
79 ADD_TEST(pipe_subgroup_readwrite_ulong),
80 ADD_TEST(pipe_subgroup_readwrite_short),
81 ADD_TEST(pipe_subgroup_readwrite_ushort),
82 ADD_TEST(pipe_subgroup_readwrite_float),
83 ADD_TEST(pipe_subgroup_readwrite_half),
84 ADD_TEST(pipe_subgroup_readwrite_char),
85 ADD_TEST(pipe_subgroup_readwrite_uchar),
86 ADD_TEST(pipe_subgroup_readwrite_double),
87 ADD_TEST(pipe_subgroup_readwrite_struct),
88 ADD_TEST(pipe_convenience_readwrite_int),
89 ADD_TEST(pipe_convenience_readwrite_uint),
90 ADD_TEST(pipe_convenience_readwrite_long),
91 ADD_TEST(pipe_convenience_readwrite_ulong),
92 ADD_TEST(pipe_convenience_readwrite_short),
93 ADD_TEST(pipe_convenience_readwrite_ushort),
94 ADD_TEST(pipe_convenience_readwrite_float),
95 ADD_TEST(pipe_convenience_readwrite_half),
96 ADD_TEST(pipe_convenience_readwrite_char),
97 ADD_TEST(pipe_convenience_readwrite_uchar),
98 ADD_TEST(pipe_convenience_readwrite_double),
99 ADD_TEST(pipe_convenience_readwrite_struct),
100 ADD_TEST(pipe_info),
101 ADD_TEST(pipe_max_args),
102 ADD_TEST(pipe_max_packet_size),
103 ADD_TEST(pipe_max_active_reservations),
104 ADD_TEST(pipe_query_functions),
105 ADD_TEST(pipe_readwrite_errors),
106 ADD_TEST(pipe_subgroups_divergence),
107 };
108
109 const int test_num = ARRAY_SIZE(test_list);
110
main(int argc,const char * argv[])111 int main(int argc, const char *argv[]) {
112 return runTestHarnessWithCheck(argc, argv, test_num, test_list, false,
113 0, InitCL);
114 }
115