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/errorHelpers.h"
17 #include "harness/kernelHelpers.h"
18 #include "harness/typeWrappers.h"
19 #include "harness/clImageHelper.h"
20 #include "harness/imageHelpers.h"
21 extern float    calculate_ulperror(float a, float b);
22 
23 extern int        test_load_single_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
24 extern int        test_load_two_kernels(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
25 extern int        test_load_two_kernels_in_one(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
26 extern int        test_load_two_kernels_manually(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
27 extern int      test_get_program_info_kernel_names( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
28 extern int        test_create_kernels_in_program(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
29 extern int        test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
30 extern int      test_repeated_setup_cleanup(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
31 
32 extern int        test_bool_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
33 extern int        test_platform_extensions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
34 extern int        test_get_platform_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
35 extern int        test_get_sampler_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
36 extern int        test_get_sampler_info_compatibility(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
37 extern int        test_get_command_queue_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
38 extern int        test_get_command_queue_info_compatibility(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
39 extern int        test_get_context_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
40 extern int        test_get_device_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
41 extern int        test_kernel_required_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
42 
43 extern int        test_binary_get(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
44 extern int        test_binary_create(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
45 
46 extern int        test_release_kernel_order(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
47 extern int        test_release_during_execute(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
48 
49 extern int        test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
50 extern int test_kernel_private_memory_size(cl_device_id deviceID,
51                                            cl_context context,
52                                            cl_command_queue queue,
53                                            int num_elements);
54 extern int        test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
55 extern int        test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
56 extern int        test_set_kernel_arg_struct(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
57 extern int        test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
58 extern int        test_set_kernel_arg_struct_array(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
59 extern int        test_kernel_global_constant(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
60 
61 extern int        test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
62 extern int        test_min_max_work_items_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
63 extern int        test_min_max_work_group_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
64 extern int        test_min_max_read_image_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
65 extern int        test_min_max_write_image_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
66 extern int        test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
67 extern int        test_min_max_image_2d_width(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
68 extern int        test_min_max_image_2d_height(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
69 extern int        test_min_max_image_3d_width(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
70 extern int        test_min_max_image_3d_height(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
71 extern int        test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
72 extern int      test_min_max_image_array_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
73 extern int      test_min_max_image_buffer_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
74 extern int        test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
75 extern int        test_min_max_samplers(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
76 extern int        test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
77 extern int        test_min_max_constant_args(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
78 extern int        test_min_max_compute_units(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
79 extern int        test_min_max_address_bits(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
80 extern int        test_min_max_single_fp_config(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
81 extern int      test_min_max_double_fp_config(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
82 extern int        test_min_max_local_mem_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
83 extern int        test_min_max_kernel_preferred_work_group_size_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
84 extern int        test_min_max_execution_capabilities(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
85 extern int        test_min_max_queue_properties(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
86 extern int        test_min_max_device_version(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
87 extern int        test_min_max_language_version(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
88 
89 extern int        test_native_kernel(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems );
90 
91 extern int      test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
92 
93 extern int      test_get_platform_ids(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
94 
95 extern int        test_kernel_arg_changes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
96 extern int        test_kernel_arg_multi_setup_random(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
97 
98 extern int        test_retain_queue_single(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
99 extern int        test_retain_queue_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
100 extern int        test_retain_mem_object_single(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
101 extern int        test_retain_mem_object_multiple(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
102 extern int        test_retain_mem_object_set_kernel_arg(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
103 extern int      test_min_data_type_align_size_alignment(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems );
104 
105 extern int test_context_destructor_callback(cl_device_id deviceID,
106                                             cl_context context,
107                                             cl_command_queue queue,
108                                             int num_elements);
109 extern int test_mem_object_destructor_callback(cl_device_id deviceID,
110                                                cl_context context,
111                                                cl_command_queue queue,
112                                                int num_elements);
113 
114 extern int      test_null_buffer_arg( cl_device_id device_id, cl_context context, cl_command_queue queue, int num_elements );
115 extern int      test_get_buffer_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
116 extern int      test_get_image2d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
117 extern int      test_get_image3d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
118 extern int      test_get_image1d_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
119 extern int      test_get_image1d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
120 extern int      test_get_image2d_array_info( cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements );
121 extern int      test_get_kernel_arg_info( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );
122 extern int      test_queue_hint(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
123 extern int      test_sub_group_dispatch(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
124 extern int      test_clone_kernel(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
125 extern int      test_zero_sized_enqueue(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements);
126 extern int      test_queue_properties( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements );
127 extern int test_queue_flush_on_release(cl_device_id deviceID,
128                                        cl_context context,
129                                        cl_command_queue queue,
130                                        int num_elements);
131 extern int test_buffer_properties_queries(cl_device_id deviceID,
132                                           cl_context context,
133                                           cl_command_queue queue,
134                                           int num_elements);
135 extern int test_image_properties_queries(cl_device_id deviceID,
136                                          cl_context context,
137                                          cl_command_queue queue,
138                                          int num_elements);
139 extern int test_queue_properties_queries(cl_device_id deviceID,
140                                          cl_context context,
141                                          cl_command_queue queue,
142                                          int num_elements);
143 int test_pipe_properties_queries(cl_device_id deviceID, cl_context context,
144                                  cl_command_queue queue, int num_elements);
145 
146 extern int test_consistency_svm(cl_device_id deviceID, cl_context context,
147                                 cl_command_queue queue, int num_elements);
148 extern int test_consistency_memory_model(cl_device_id deviceID,
149                                          cl_context context,
150                                          cl_command_queue queue,
151                                          int num_elements);
152 extern int test_consistency_device_enqueue(cl_device_id deviceID,
153                                            cl_context context,
154                                            cl_command_queue queue,
155                                            int num_elements);
156 extern int test_consistency_pipes(cl_device_id deviceID, cl_context context,
157                                   cl_command_queue queue, int num_elements);
158 extern int test_consistency_progvar(cl_device_id deviceID, cl_context context,
159                                     cl_command_queue queue, int num_elements);
160 extern int test_consistency_non_uniform_work_group(cl_device_id deviceID,
161                                                    cl_context context,
162                                                    cl_command_queue queue,
163                                                    int num_elements);
164 extern int test_consistency_read_write_images(cl_device_id deviceID,
165                                               cl_context context,
166                                               cl_command_queue queue,
167                                               int num_elements);
168 extern int test_consistency_2d_image_from_buffer(cl_device_id deviceID,
169                                                  cl_context context,
170                                                  cl_command_queue queue,
171                                                  int num_elements);
172 extern int test_consistency_depth_images(cl_device_id deviceID,
173                                          cl_context context,
174                                          cl_command_queue queue,
175                                          int num_elements);
176 extern int test_consistency_device_and_host_timer(cl_device_id deviceID,
177                                                   cl_context context,
178                                                   cl_command_queue queue,
179                                                   int num_elements);
180 extern int test_consistency_il_programs(cl_device_id deviceID,
181                                         cl_context context,
182                                         cl_command_queue queue,
183                                         int num_elements);
184 extern int test_consistency_subgroups(cl_device_id deviceID, cl_context context,
185                                       cl_command_queue queue, int num_elements);
186 extern int test_consistency_prog_ctor_dtor(cl_device_id deviceID,
187                                            cl_context context,
188                                            cl_command_queue queue,
189                                            int num_elements);
190 extern int test_consistency_3d_image_writes(cl_device_id deviceID,
191                                             cl_context context,
192                                             cl_command_queue queue,
193                                             int num_elements);
194 
195 extern int test_min_image_formats(cl_device_id deviceID, cl_context context,
196                                   cl_command_queue queue, int num_elements);
197 extern int test_negative_get_platform_info(cl_device_id deviceID,
198                                            cl_context context,
199                                            cl_command_queue queue,
200                                            int num_elements);
201 extern int test_negative_get_platform_ids(cl_device_id deviceID,
202                                           cl_context context,
203                                           cl_command_queue queue,
204                                           int num_elements);
205 extern int test_kernel_attributes(cl_device_id deviceID, cl_context context,
206                                   cl_command_queue queue, int num_elements);
207