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