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 "testBase.h"
17 #include "harness/testHarness.h"
18 
19 const char *write_kernels[] = {
20     "__kernel void write_up(__global int *dst, int length)\n"
21     "{\n"
22     "\n"
23     " dst[get_global_id(0)] *= 2;\n"
24     "\n"
25     "}\n"
26     "__kernel void write_down(__global int *dst, int length)\n"
27     "{\n"
28     "\n"
29     " dst[get_global_id(0)]--;\n"
30     "\n"
31     "}\n"
32 };
33 
34 #define TEST_SIZE 10000
35 #define TEST_COUNT 100
36 #define RANDOMIZE 1
37 #define DEBUG_OUT 0
38 
39 /*
40  Tests event dependencies by running two kernels that use the same buffer.
41  If two_queues is set they are run in separate queues.
42  If test_enqueue_wait_for_events is set then clEnqueueWaitForEvent is called between them.
43  If test_barrier is set then clEnqueueBarrier is called between them (only for single queue).
44  If neither are set, nothing is done to prevent them from executing in the wrong order. This can be used for verification.
45  */
test_event_enqueue_wait_for_events_run_test(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements,int two_queues,int two_devices,int test_enqueue_wait_for_events,int test_barrier,int use_waitlist,int use_marker)46 int test_event_enqueue_wait_for_events_run_test( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements, int two_queues, int two_devices,
47                                                 int test_enqueue_wait_for_events, int test_barrier, int use_waitlist, int use_marker)
48 {
49     cl_int error = CL_SUCCESS;
50     size_t threads[3] = {TEST_SIZE,0,0};
51     int i, loop_count, event_count, expected_value, failed;
52     int expected_if_only_queue[2];
53     int max_count = TEST_SIZE;
54 
55     cl_platform_id platform;
56     cl_command_queue queues[2];    // Not a wrapper so we don't autorelease if they are the same
57     clCommandQueueWrapper queueWrappers[2];    // If they are different, we use the wrapper so it will auto release
58     clContextWrapper context_to_use;
59     clMemWrapper data;
60     clProgramWrapper program;
61     clKernelWrapper kernel1[TEST_COUNT], kernel2[TEST_COUNT];
62     clEventWrapper event[TEST_COUNT*4+2]; // If we usemarkers we get 2 more events per iteration
63 
64     if (test_enqueue_wait_for_events)
65         log_info("\tTesting with clEnqueueBarrierWithWaitList as barrier function.\n");
66     if (test_barrier)
67         log_info("\tTesting with clEnqueueBarrierWithWaitList as barrier function.\n");
68     if (use_waitlist)
69         log_info("\tTesting with waitlist-based depenednecies between kernels.\n");
70     if (use_marker)
71         log_info("\tTesting with clEnqueueMarker as a barrier function.\n");
72     if (test_barrier && (two_queues || two_devices)) {
73         log_error("\tTest requested with clEnqueueBarrier across two queues. This is not a valid combination.\n");
74         return -1;
75     }
76 
77     error = clGetPlatformIDs(1, &platform, NULL);
78     test_error(error, "clGetPlatformIDs failed.");
79 
80     // If we are to use two devices, then get them and create a context with both.
81     cl_device_id *two_device_ids;
82     if (two_devices) {
83         two_device_ids = (cl_device_id*)malloc(sizeof(cl_device_id)*2);
84         cl_uint number_returned;
85         error = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 2, two_device_ids, &number_returned);
86         test_error( error, "clGetDeviceIDs for CL_DEVICE_TYPE_ALL failed.");
87         if (number_returned != 2) {
88             log_info("Failed to obtain two devices. Test can not run.\n");
89             free(two_device_ids);
90             return 0;
91         }
92 
93         for (i=0; i<2; i++) {
94             cl_device_type type;
95             error = clGetDeviceInfo(two_device_ids[i], CL_DEVICE_TYPE, sizeof(cl_device_type), &type, NULL);
96             test_error( error, "clGetDeviceInfo failed.");
97             if (type & CL_DEVICE_TYPE_CPU)
98                 log_info("\tDevice %d is CL_DEVICE_TYPE_CPU.\n", i);
99             if (type & CL_DEVICE_TYPE_GPU)
100                 log_info("\tDevice %d is CL_DEVICE_TYPE_GPU.\n", i);
101             if (type & CL_DEVICE_TYPE_ACCELERATOR)
102                 log_info("\tDevice %d is CL_DEVICE_TYPE_ACCELERATOR.\n", i);
103             if (type & CL_DEVICE_TYPE_DEFAULT)
104                 log_info("\tDevice %d is CL_DEVICE_TYPE_DEFAULT.\n", i);
105         }
106 
107         context_to_use = clCreateContext(NULL, 2, two_device_ids, notify_callback, NULL, &error);
108         test_error(error, "clCreateContext failed for two devices.");
109 
110         log_info("\tTesting with two devices.\n");
111     } else {
112         context_to_use = clCreateContext(NULL, 1, &deviceID, NULL, NULL, &error);
113         test_error(error, "clCreateContext failed for one device.");
114 
115         log_info("\tTesting with one device.\n");
116     }
117 
118     // If we are using two queues then create them
119     cl_command_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
120     if (two_queues) {
121         // Get a second queue
122         if (two_devices)
123         {
124             if( !checkDeviceForQueueSupport( two_device_ids[ 0 ], props ) ||
125                !checkDeviceForQueueSupport( two_device_ids[ 1 ], props ) )
126             {
127                 log_info( "WARNING: One or more device for multi-device test does not support out-of-order exec mode; skipping test.\n" );
128                 return -1942;
129             }
130 
131             queueWrappers[0] = clCreateCommandQueue(context_to_use, two_device_ids[0], props, &error);
132             test_error(error, "clCreateCommandQueue for first queue on first device failed.");
133             queueWrappers[1] = clCreateCommandQueue(context_to_use, two_device_ids[1], props, &error);
134             test_error(error, "clCreateCommandQueue for second queue on second device failed.");
135 
136         }
137         else
138         {
139             // Single device has already been checked for out-of-order exec support
140             queueWrappers[0] = clCreateCommandQueue(context_to_use, deviceID, props, &error);
141             test_error(error, "clCreateCommandQueue for first queue failed.");
142             queueWrappers[1] = clCreateCommandQueue(context_to_use, deviceID, props, &error);
143             test_error(error, "clCreateCommandQueue for second queue failed.");
144         }
145         // Ugly hack to make sure we only have the wrapper auto-release if they are different queues
146         queues[0] = queueWrappers[0];
147         queues[1] = queueWrappers[1];
148         log_info("\tTesting with two queues.\n");
149     }
150     else
151     {
152         // (Note: single device has already been checked for out-of-order exec support)
153         // Otherwise create one queue and have the second one be the same
154         queueWrappers[0] = clCreateCommandQueue(context_to_use, deviceID, props, &error);
155         test_error(error, "clCreateCommandQueue for first queue failed.");
156         queues[0] = queueWrappers[0];
157         queues[1] = (cl_command_queue)queues[0];
158         log_info("\tTesting with one queue.\n");
159     }
160 
161 
162     // Setup - create a buffer and the two kernels
163     data = clCreateBuffer(context_to_use, CL_MEM_READ_WRITE, TEST_SIZE*sizeof(cl_int), NULL, &error);
164     test_error( error, "clCreateBuffer failed");
165 
166 
167     // Initialize the values to zero
168     cl_int *values = (cl_int*)malloc(TEST_SIZE*sizeof(cl_int));
169     for (i=0; i<(int)TEST_SIZE; i++)
170         values[i] = 0;
171     error = clEnqueueWriteBuffer(queues[0], data, CL_TRUE, 0, TEST_SIZE*sizeof(cl_int), values, 0, NULL, NULL);
172     test_error( error, "clEnqueueWriteBuffer failed");
173     expected_value = 0;
174 
175     // Build the kernels
176     if (create_single_kernel_helper( context_to_use, &program, &kernel1[0], 1, write_kernels, "write_up" ))
177         return -1;
178 
179     error = clSetKernelArg(kernel1[0], 0, sizeof(data), &data);
180     error |= clSetKernelArg(kernel1[0], 1, sizeof(max_count), &max_count);
181     test_error( error, "clSetKernelArg 1 failed");
182 
183     for (i=1; i<TEST_COUNT; i++) {
184         kernel1[i] = clCreateKernel(program, "write_up", &error);
185         test_error( error, "clCreateKernel 1 failed");
186 
187         error = clSetKernelArg(kernel1[i], 0, sizeof(data), &data);
188         error |= clSetKernelArg(kernel1[i], 1, sizeof(max_count), &max_count);
189         test_error( error, "clSetKernelArg 1 failed");
190     }
191 
192     for (i=0; i<TEST_COUNT; i++) {
193         kernel2[i] = clCreateKernel(program, "write_down", &error);
194         test_error( error, "clCreateKernel 2 failed");
195 
196         error = clSetKernelArg(kernel2[i], 0, sizeof(data), &data);
197         error |= clSetKernelArg(kernel2[i], 1, sizeof(max_count), &max_count);
198         test_error( error, "clSetKernelArg 2 failed");
199     }
200 
201     // Execution - run the first kernel, then enqueue the wait on the events, then the second kernel
202     // If clEnqueueBarrierWithWaitList works, the buffer will be filled with 1s, then multiplied by 4s,
203     // then incremented to 5s, repeatedly. Otherwise the values may be 2s (if the first one doesn't work) or 8s
204     // (if the second one doesn't work).
205     if (RANDOMIZE)
206         log_info("Queues chosen randomly for each kernel execution.\n");
207     else
208         log_info("Queues chosen alternatily for each kernel execution.\n");
209 
210     event_count = 0;
211     for (i=0; i<(int)TEST_SIZE; i++)
212         values[i] = 1;
213     error = clEnqueueWriteBuffer(queues[0], data, CL_FALSE, 0, TEST_SIZE*sizeof(cl_int), values, 0, NULL, &event[event_count]);
214     test_error( error, "clEnqueueWriteBuffer 2 failed");
215     expected_value = 1;
216     expected_if_only_queue[0] = 1;
217     expected_if_only_queue[1] = 1;
218 
219     int queue_to_use = 1;
220     if (test_enqueue_wait_for_events) {
221         error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1, &event[event_count], NULL );
222         test_error( error, "Unable to queue wait for events" );
223     } else if (test_barrier) {
224         error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL, NULL);
225         test_error( error, "Unable to queue barrier" );
226     }
227 
228     for (loop_count=0; loop_count<TEST_COUNT; loop_count++) {
229         // Execute kernel 1
230         event_count++;
231         if (use_waitlist | use_marker) {
232             if (DEBUG_OUT) log_info("clEnqueueNDRangeKernel(queues[%d], kernel1[%d], 1, NULL, threads, NULL, 1, &event[%d], &event[%d])\n", queue_to_use, loop_count, event_count-1, event_count);
233             error = clEnqueueNDRangeKernel(queues[queue_to_use], kernel1[loop_count], 1, NULL, threads, NULL, 1, &event[event_count-1], &event[event_count]);
234         } else {
235             if (DEBUG_OUT) log_info("clEnqueueNDRangeKernel(queues[%d], kernel1[%d], 1, NULL, threads, NULL, 0, NULL, &event[%d])\n", queue_to_use, loop_count, event_count);
236             error = clEnqueueNDRangeKernel(queues[queue_to_use], kernel1[loop_count], 1, NULL, threads, NULL, 0, NULL, &event[event_count]);
237         }
238         if (error) {
239             log_info("\tLoop count %d\n", loop_count);
240             print_error( error, "clEnqueueNDRangeKernel for kernel 1 failed");
241             return error;
242         }
243         expected_value *= 2;
244         expected_if_only_queue[queue_to_use] *= 2;
245 
246         // If we are using a marker, it needs to go in the same queue
247         if (use_marker) {
248             event_count++;
249             if (DEBUG_OUT) log_info("clEnqueueMarker(queues[%d], event[%d])\n", queue_to_use, event_count);
250 
251             #ifdef CL_VERSION_1_2
252                 error = clEnqueueMarkerWithWaitList(queues[queue_to_use], 0, NULL, &event[event_count]);
253             #else
254                 error = clEnqueueMarker(queues[queue_to_use], &event[event_count]);
255             #endif
256 
257         }
258 
259         // Pick the next queue to run
260         if (RANDOMIZE)
261             queue_to_use = rand()%2;
262         else
263             queue_to_use = (queue_to_use + 1)%2;
264 
265         // Put in a barrier if requested
266         if (test_enqueue_wait_for_events) {
267             if (DEBUG_OUT) log_info("clEnqueueBarrierWithWaitList(queues[%d], 1, &event[%d], NULL)\n", queue_to_use, event_count);
268             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1, &event[event_count], NULL);
269             test_error( error, "Unable to queue wait for events" );
270         } else if (test_barrier) {
271             if (DEBUG_OUT) log_info("clEnqueueBarrierWithWaitList(queues[%d])\n", queue_to_use);
272             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL, NULL);
273             test_error( error, "Unable to queue barrier" );
274         }
275 
276         // Execute Kernel 2
277         event_count++;
278         if (use_waitlist | use_marker) {
279             if (DEBUG_OUT) log_info("clEnqueueNDRangeKernel(queues[%d], kernel2[%d], 1, NULL, threads, NULL, 1, &event[%d], &event[%d])\n", queue_to_use, loop_count, event_count-1, event_count);
280             error = clEnqueueNDRangeKernel(queues[queue_to_use], kernel2[loop_count], 1, NULL, threads, NULL, 1, &event[event_count-1], &event[event_count]);
281         } else {
282             if (DEBUG_OUT) log_info("clEnqueueNDRangeKernel(queues[%d], kernel2[%d], 1, NULL, threads, NULL, 0, NULL, &event[%d])\n", queue_to_use, loop_count, event_count);
283             error = clEnqueueNDRangeKernel(queues[queue_to_use], kernel2[loop_count], 1, NULL, threads, NULL, 0, NULL, &event[event_count]);
284         }
285         if (error) {
286             log_info("\tLoop count %d\n", loop_count);
287             print_error( error, "clEnqueueNDRangeKernel for kernel 2 failed");
288             return error;
289         }
290         expected_value--;
291         expected_if_only_queue[queue_to_use]--;
292 
293         // If we are using a marker, it needs to go in the same queue
294         if (use_marker) {
295             event_count++;
296             if (DEBUG_OUT) log_info("clEnqueueMarker(queues[%d], event[%d])\n", queue_to_use, event_count);
297 
298         #ifdef CL_VERSION_1_2
299             error = clEnqueueMarkerWithWaitList(queues[queue_to_use], 0, NULL, &event[event_count]);
300         #else
301             error = clEnqueueMarker(queues[queue_to_use], &event[event_count]);
302         #endif
303         }
304 
305         // Pick the next queue to run
306         if (RANDOMIZE)
307             queue_to_use = rand()%2;
308         else
309             queue_to_use = (queue_to_use + 1)%2;
310 
311         // Put in a barrier if requested
312         if (test_enqueue_wait_for_events) {
313             if (DEBUG_OUT) log_info("clEnqueueBarrierWithWaitList(queues[%d], 1, &event[%d], NULL)\n", queue_to_use, event_count);
314             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1, &event[event_count], NULL );
315             test_error( error, "Unable to queue wait for events" );
316         } else if (test_barrier) {
317             if (DEBUG_OUT) log_info("clEnqueueBarrierWithWaitList(queues[%d])\n", queue_to_use);
318             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL, NULL);
319             test_error( error, "Unable to queue barrier" );
320         }
321     }
322 
323     // Now finish up everything
324     if (two_queues) {
325         error = clFlush(queues[1]);
326         test_error( error, "clFlush[1] failed");
327     }
328 
329     error = clEnqueueReadBuffer(queues[0], data, CL_TRUE, 0, TEST_SIZE*sizeof(cl_int), values, 1, &event[event_count], NULL);
330 
331     test_error(error, "clEnqueueReadBuffer failed");
332 
333     failed = 0;
334     for (i=0; i<(int)TEST_SIZE; i++)
335         if (values[i] != expected_value) {
336             failed = 1;
337             log_info("\tvalues[%d] = %d, expected %d (If only queue 1 accessed memory: %d only queue 2 accessed memory: %d)\n",
338                      i, values[i], expected_value, expected_if_only_queue[0], expected_if_only_queue[1]);
339             break;
340         }
341 
342     free(values);
343     if (two_devices)
344         free(two_device_ids);
345 
346     return failed;
347 }
348 
test(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements,int two_queues,int two_devices,int test_enqueue_wait_for_events,int test_barrier,int use_waitlists,int use_marker)349 int test( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements,
350          int two_queues, int two_devices,
351          int test_enqueue_wait_for_events, int test_barrier, int use_waitlists, int use_marker)
352 {
353     if( !checkDeviceForQueueSupport( deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE ) )
354     {
355         log_info( "WARNING: Device does not support out-of-order exec mode; skipping test.\n" );
356         return 0;
357     }
358 
359     log_info("Running test for baseline results to determine if out-of-order execution can be detected...\n");
360     int baseline_results = test_event_enqueue_wait_for_events_run_test(deviceID, context, queue, num_elements, two_queues, two_devices, 0, 0, 0, 0);
361     if (baseline_results == 0) {
362         if (test_enqueue_wait_for_events)
363             log_info("WARNING: could not detect any out-of-order execution without using clEnqueueBarrierWithWaitList, so this test is not a valid test of out-of-order event dependencies.\n");
364         if (test_barrier)
365             log_info("WARNING: could not detect any out-of-order execution without using clEnqueueBarrierWithWaitList, so this test is not a valid test of out-of-order event dependencies.\n");
366         if (use_waitlists)
367             log_info("WARNING: could not detect any out-of-order execution without using waitlists, so this test is not a valid test of out-of-order event dependencies.\n");
368         if (use_marker)
369             log_info("WARNING: could not detect any out-of-order execution without using clEnqueueMarker, so this test is not a valid test of out-of-order event dependencies.\n");
370     } else if (baseline_results == 1) {
371         if (test_enqueue_wait_for_events)
372             log_info("Detected incorrect execution (possibly out-of-order) without clEnqueueBarrierWithWaitList. Test can be a valid test of out-of-order event dependencies.\n");
373         if (test_barrier)
374             log_info("Detected incorrect execution (possibly out-of-order) without clEnqueueBarrierWithWaitList. Test can be a valid test of out-of-order event dependencies.\n");
375         if (use_waitlists)
376             log_info("Detected incorrect execution (possibly out-of-order) without waitlists. Test can be a valid test of out-of-order event dependencies.\n");
377         if (use_marker)
378             log_info("Detected incorrect execution (possibly out-of-order) without clEnqueueMarker. Test can be a valid test of out-of-order event dependencies.\n");
379     } else if( baseline_results == -1942 ) {
380         // Just ignore and return (out-of-order exec mode not supported)
381         return 0;
382     } else {
383         print_error(baseline_results, "Baseline run failed");
384         return baseline_results;
385     }
386     log_info("Running test for actual results...\n");
387     return test_event_enqueue_wait_for_events_run_test(deviceID, context, queue, num_elements, two_queues, two_devices,
388                                                        test_enqueue_wait_for_events, test_barrier,  use_waitlists, use_marker);
389 }
390 
391 
test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)392 int test_out_of_order_event_waitlist_single_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
393 {
394     int two_queues = 0;
395     int two_devices = 0;
396     int test_enqueue_wait_for_events = 0;
397     int test_barrier = 0;
398     int use_waitlists = 1;
399     int use_marker = 0;
400     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
401 }
402 
test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)403 int test_out_of_order_event_waitlist_multi_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
404 {
405     int two_queues = 1;
406     int two_devices = 0;
407     int test_enqueue_wait_for_events = 0;
408     int test_barrier = 0;
409     int use_waitlists = 1;
410     int use_marker = 0;
411     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
412 }
413 
test_out_of_order_event_waitlist_multi_queue_multi_device(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)414 int test_out_of_order_event_waitlist_multi_queue_multi_device( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
415 {
416     int two_queues = 1;
417     int two_devices = 1;
418     int test_enqueue_wait_for_events = 0;
419     int test_barrier = 0;
420     int use_waitlists = 1;
421     int use_marker = 0;
422     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
423 }
424 
425 
test_out_of_order_event_enqueue_wait_for_events_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)426 int test_out_of_order_event_enqueue_wait_for_events_single_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
427 {
428     int two_queues = 0;
429     int two_devices = 0;
430     int test_enqueue_wait_for_events = 1;
431     int test_barrier = 0;
432     int use_waitlists = 0;
433     int use_marker = 0;
434     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
435 }
436 
test_out_of_order_event_enqueue_wait_for_events_multi_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)437 int test_out_of_order_event_enqueue_wait_for_events_multi_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
438 {
439     int two_queues = 1;
440     int two_devices = 0;
441     int test_enqueue_wait_for_events = 1;
442     int test_barrier = 0;
443     int use_waitlists = 0;
444     int use_marker = 0;
445     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
446 }
447 
448 
test_out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)449 int test_out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
450 {
451     int two_queues = 1;
452     int two_devices = 1;
453     int test_enqueue_wait_for_events = 1;
454     int test_barrier = 0;
455     int use_waitlists = 0;
456     int use_marker = 0;
457     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
458 }
459 
460 
461 
462 
test_out_of_order_event_enqueue_barrier_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)463 int test_out_of_order_event_enqueue_barrier_single_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
464 {
465     int two_queues = 0;
466     int two_devices = 0;
467     int test_enqueue_wait_for_events = 0;
468     int test_barrier = 1;
469     int use_waitlists = 0;
470     int use_marker = 0;
471     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
472 }
473 
474 
test_out_of_order_event_enqueue_marker_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)475 int test_out_of_order_event_enqueue_marker_single_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
476 {
477     int two_queues = 0;
478     int two_devices = 0;
479     int test_enqueue_wait_for_events = 0;
480     int test_barrier = 0;
481     int use_waitlists = 0;
482     int use_marker = 1;
483     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
484 }
485 
test_out_of_order_event_enqueue_marker_multi_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)486 int test_out_of_order_event_enqueue_marker_multi_queue( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
487 {
488     int two_queues = 1;
489     int two_devices = 0;
490     int test_enqueue_wait_for_events = 0;
491     int test_barrier = 0;
492     int use_waitlists = 0;
493     int use_marker = 1;
494     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
495 }
496 
497 
test_out_of_order_event_enqueue_marker_multi_queue_multi_device(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)498 int test_out_of_order_event_enqueue_marker_multi_queue_multi_device( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements)
499 {
500     int two_queues = 1;
501     int two_devices = 1;
502     int test_enqueue_wait_for_events = 0;
503     int test_barrier = 0;
504     int use_waitlists = 0;
505     int use_marker = 1;
506     return test(deviceID, context, queue, num_elements, two_queues, two_devices, test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
507 }
508 
509 
510