xref: /aosp_15_r20/external/OpenCL-CTS/test_conformance/events/test_event_dependencies.cpp (revision 6467f958c7de8070b317fc65bcb0f6472e388d82)
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
43  between them. If test_barrier is set then clEnqueueBarrier is called between
44  them (only for single queue). If neither are set, nothing is done to prevent
45  them from executing in the wrong order. This can be used for verification.
46  */
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)47 int test_event_enqueue_wait_for_events_run_test(
48     cl_device_id deviceID, cl_context context, cl_command_queue queue,
49     int num_elements, int two_queues, int two_devices,
50     int test_enqueue_wait_for_events, int test_barrier, int use_waitlist,
51     int use_marker)
52 {
53     cl_int error = CL_SUCCESS;
54     size_t threads[3] = { TEST_SIZE, 0, 0 };
55     int i, loop_count, expected_value, failed;
56     int expected_if_only_queue[2];
57     int max_count = TEST_SIZE;
58 
59     cl_platform_id platform;
60     cl_command_queue
61         queues[2]; // Not a wrapper so we don't autorelease if they are the same
62     clCommandQueueWrapper queueWrappers[2]; // If they are different, we use the
63                                             // wrapper so it will auto release
64     clContextWrapper context_to_use;
65     clMemWrapper data;
66     clProgramWrapper program;
67     clKernelWrapper kernel1[TEST_COUNT], kernel2[TEST_COUNT];
68 
69     if (test_enqueue_wait_for_events)
70         log_info("\tTesting with clEnqueueBarrierWithWaitList as barrier "
71                  "function.\n");
72     if (test_barrier)
73         log_info("\tTesting with clEnqueueBarrierWithWaitList as barrier "
74                  "function.\n");
75     if (use_waitlist)
76         log_info(
77             "\tTesting with waitlist-based depenednecies between kernels.\n");
78     if (use_marker)
79         log_info("\tTesting with clEnqueueMarker as a barrier function.\n");
80     if (test_barrier && (two_queues || two_devices))
81     {
82         log_error("\tTest requested with clEnqueueBarrier across two queues. "
83                   "This is not a valid combination.\n");
84         return -1;
85     }
86 
87     error = clGetPlatformIDs(1, &platform, NULL);
88     test_error(error, "clGetPlatformIDs failed.");
89 
90     // If we are to use two devices, then get them and create a context with
91     // both.
92     cl_device_id *two_device_ids;
93     if (two_devices)
94     {
95         two_device_ids = (cl_device_id *)malloc(sizeof(cl_device_id) * 2);
96         cl_uint number_returned;
97         error = clGetDeviceIDs(platform, CL_DEVICE_TYPE_ALL, 2, two_device_ids,
98                                &number_returned);
99         test_error(error, "clGetDeviceIDs for CL_DEVICE_TYPE_ALL failed.");
100         if (number_returned != 2)
101         {
102             log_info("Failed to obtain two devices. Test can not run.\n");
103             free(two_device_ids);
104             return 0;
105         }
106 
107         for (i = 0; i < 2; i++)
108         {
109             cl_device_type type;
110             error = clGetDeviceInfo(two_device_ids[i], CL_DEVICE_TYPE,
111                                     sizeof(cl_device_type), &type, NULL);
112             test_error(error, "clGetDeviceInfo failed.");
113             if (type & CL_DEVICE_TYPE_CPU)
114                 log_info("\tDevice %d is CL_DEVICE_TYPE_CPU.\n", i);
115             if (type & CL_DEVICE_TYPE_GPU)
116                 log_info("\tDevice %d is CL_DEVICE_TYPE_GPU.\n", i);
117             if (type & CL_DEVICE_TYPE_ACCELERATOR)
118                 log_info("\tDevice %d is CL_DEVICE_TYPE_ACCELERATOR.\n", i);
119             if (type & CL_DEVICE_TYPE_DEFAULT)
120                 log_info("\tDevice %d is CL_DEVICE_TYPE_DEFAULT.\n", i);
121         }
122 
123         context_to_use = clCreateContext(NULL, 2, two_device_ids,
124                                          notify_callback, NULL, &error);
125         test_error(error, "clCreateContext failed for two devices.");
126 
127         log_info("\tTesting with two devices.\n");
128     }
129     else
130     {
131         context_to_use =
132             clCreateContext(NULL, 1, &deviceID, NULL, NULL, &error);
133         test_error(error, "clCreateContext failed for one device.");
134 
135         log_info("\tTesting with one device.\n");
136     }
137 
138     // If we are using two queues then create them
139     cl_command_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
140     if (two_queues)
141     {
142         // Get a second queue
143         if (two_devices)
144         {
145             if (!checkDeviceForQueueSupport(two_device_ids[0], props)
146                 || !checkDeviceForQueueSupport(two_device_ids[1], props))
147             {
148                 log_info(
149                     "WARNING: One or more device for multi-device test does "
150                     "not support out-of-order exec mode; skipping test.\n");
151                 return -1942;
152             }
153 
154             queueWrappers[0] = clCreateCommandQueue(
155                 context_to_use, two_device_ids[0], props, &error);
156             test_error(
157                 error,
158                 "clCreateCommandQueue for first queue on first device failed.");
159             queueWrappers[1] = clCreateCommandQueue(
160                 context_to_use, two_device_ids[1], props, &error);
161             test_error(error,
162                        "clCreateCommandQueue for second queue on second device "
163                        "failed.");
164         }
165         else
166         {
167             // Single device has already been checked for out-of-order exec
168             // support
169             queueWrappers[0] =
170                 clCreateCommandQueue(context_to_use, deviceID, props, &error);
171             test_error(error, "clCreateCommandQueue for first queue failed.");
172             queueWrappers[1] =
173                 clCreateCommandQueue(context_to_use, deviceID, props, &error);
174             test_error(error, "clCreateCommandQueue for second queue failed.");
175         }
176         // Ugly hack to make sure we only have the wrapper auto-release if they
177         // are different queues
178         queues[0] = queueWrappers[0];
179         queues[1] = queueWrappers[1];
180         log_info("\tTesting with two queues.\n");
181     }
182     else
183     {
184         // (Note: single device has already been checked for out-of-order exec
185         // support) Otherwise create one queue and have the second one be the
186         // same
187         queueWrappers[0] =
188             clCreateCommandQueue(context_to_use, deviceID, props, &error);
189         test_error(error, "clCreateCommandQueue for first queue failed.");
190         queues[0] = queueWrappers[0];
191         queues[1] = (cl_command_queue)queues[0];
192         log_info("\tTesting with one queue.\n");
193     }
194 
195 
196     // Setup - create a buffer and the two kernels
197     data = clCreateBuffer(context_to_use, CL_MEM_READ_WRITE,
198                           TEST_SIZE * sizeof(cl_int), NULL, &error);
199     test_error(error, "clCreateBuffer failed");
200 
201 
202     // Initialize the values to zero
203     cl_int *values = (cl_int *)malloc(TEST_SIZE * sizeof(cl_int));
204     for (i = 0; i < (int)TEST_SIZE; i++) values[i] = 0;
205     error =
206         clEnqueueWriteBuffer(queues[0], data, CL_TRUE, 0,
207                              TEST_SIZE * sizeof(cl_int), values, 0, NULL, NULL);
208     test_error(error, "clEnqueueWriteBuffer failed");
209     expected_value = 0;
210 
211     // Build the kernels
212     if (create_single_kernel_helper(context_to_use, &program, &kernel1[0], 1,
213                                     write_kernels, "write_up"))
214         return -1;
215 
216     error = clSetKernelArg(kernel1[0], 0, sizeof(data), &data);
217     error |= clSetKernelArg(kernel1[0], 1, sizeof(max_count), &max_count);
218     test_error(error, "clSetKernelArg 1 failed");
219 
220     for (i = 1; i < TEST_COUNT; i++)
221     {
222         kernel1[i] = clCreateKernel(program, "write_up", &error);
223         test_error(error, "clCreateKernel 1 failed");
224 
225         error = clSetKernelArg(kernel1[i], 0, sizeof(data), &data);
226         error |= clSetKernelArg(kernel1[i], 1, sizeof(max_count), &max_count);
227         test_error(error, "clSetKernelArg 1 failed");
228     }
229 
230     for (i = 0; i < TEST_COUNT; i++)
231     {
232         kernel2[i] = clCreateKernel(program, "write_down", &error);
233         test_error(error, "clCreateKernel 2 failed");
234 
235         error = clSetKernelArg(kernel2[i], 0, sizeof(data), &data);
236         error |= clSetKernelArg(kernel2[i], 1, sizeof(max_count), &max_count);
237         test_error(error, "clSetKernelArg 2 failed");
238     }
239 
240     // Execution - run the first kernel, then enqueue the wait on the events,
241     // then the second kernel If clEnqueueBarrierWithWaitList works, the buffer
242     // will be filled with 1s, then multiplied by 4s, then incremented to 5s,
243     // repeatedly. Otherwise the values may be 2s (if the first one doesn't
244     // work) or 8s (if the second one doesn't work).
245     if (RANDOMIZE)
246         log_info("Queues chosen randomly for each kernel execution.\n");
247     else
248         log_info("Queues chosen alternatily for each kernel execution.\n");
249 
250     clEventWrapper pre_loop_event;
251     clEventWrapper last_loop_event;
252 
253     for (i = 0; i < (int)TEST_SIZE; i++) values[i] = 1;
254     error = clEnqueueWriteBuffer(queues[0], data, CL_FALSE, 0,
255                                  TEST_SIZE * sizeof(cl_int), values, 0, NULL,
256                                  &pre_loop_event);
257     test_error(error, "clEnqueueWriteBuffer 2 failed");
258     expected_value = 1;
259     expected_if_only_queue[0] = 1;
260     expected_if_only_queue[1] = 1;
261 
262     int queue_to_use = 1;
263     if (test_enqueue_wait_for_events)
264     {
265         error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1,
266                                              &pre_loop_event, NULL);
267         test_error(error, "Unable to queue wait for events");
268     }
269     else if (test_barrier)
270     {
271         error =
272             clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL, NULL);
273         test_error(error, "Unable to queue barrier");
274     }
275 
276     for (loop_count = 0; loop_count < TEST_COUNT; loop_count++)
277     {
278         int event_count = 0;
279         clEventWrapper first_dependency =
280             (loop_count == 0) ? pre_loop_event : last_loop_event;
281         clEventWrapper
282             event[5]; // A maximum of 5 events are created in the loop
283         event[event_count] = first_dependency;
284 
285         // Execute kernel 1
286         event_count++;
287         if (use_waitlist | use_marker)
288         {
289             if (DEBUG_OUT)
290                 log_info("clEnqueueNDRangeKernel(queues[%d], kernel1[%d], 1, "
291                          "NULL, threads, NULL, 1, &event[%d], &event[%d])\n",
292                          queue_to_use, loop_count, event_count - 1,
293                          event_count);
294             error = clEnqueueNDRangeKernel(
295                 queues[queue_to_use], kernel1[loop_count], 1, NULL, threads,
296                 NULL, 1, &event[event_count - 1], &event[event_count]);
297         }
298         else
299         {
300             if (DEBUG_OUT)
301                 log_info("clEnqueueNDRangeKernel(queues[%d], kernel1[%d], 1, "
302                          "NULL, threads, NULL, 0, NULL, &event[%d])\n",
303                          queue_to_use, loop_count, event_count);
304             error = clEnqueueNDRangeKernel(
305                 queues[queue_to_use], kernel1[loop_count], 1, NULL, threads,
306                 NULL, 0, NULL, &event[event_count]);
307         }
308         if (error)
309         {
310             log_info("\tLoop count %d\n", loop_count);
311             print_error(error, "clEnqueueNDRangeKernel for kernel 1 failed");
312             return error;
313         }
314         expected_value *= 2;
315         expected_if_only_queue[queue_to_use] *= 2;
316 
317         // If we are using a marker, it needs to go in the same queue
318         if (use_marker)
319         {
320             event_count++;
321             if (DEBUG_OUT)
322                 log_info("clEnqueueMarker(queues[%d], event[%d])\n",
323                          queue_to_use, event_count);
324 
325 #ifdef CL_VERSION_1_2
326             error = clEnqueueMarkerWithWaitList(queues[queue_to_use], 0, NULL,
327                                                 &event[event_count]);
328 #else
329             error = clEnqueueMarker(queues[queue_to_use], &event[event_count]);
330 #endif
331         }
332 
333         // Pick the next queue to run
334         if (RANDOMIZE)
335             queue_to_use = rand() % 2;
336         else
337             queue_to_use = (queue_to_use + 1) % 2;
338 
339         // Put in a barrier if requested
340         if (test_enqueue_wait_for_events)
341         {
342             if (DEBUG_OUT)
343                 log_info("clEnqueueBarrierWithWaitList(queues[%d], 1, "
344                          "&event[%d], NULL)\n",
345                          queue_to_use, event_count);
346             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1,
347                                                  &event[event_count], NULL);
348             test_error(error, "Unable to queue wait for events");
349         }
350         else if (test_barrier)
351         {
352             if (DEBUG_OUT)
353                 log_info("clEnqueueBarrierWithWaitList(queues[%d])\n",
354                          queue_to_use);
355             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL,
356                                                  NULL);
357             test_error(error, "Unable to queue barrier");
358         }
359 
360         // Execute Kernel 2
361         event_count++;
362         if (use_waitlist | use_marker)
363         {
364             if (DEBUG_OUT)
365                 log_info("clEnqueueNDRangeKernel(queues[%d], kernel2[%d], 1, "
366                          "NULL, threads, NULL, 1, &event[%d], &event[%d])\n",
367                          queue_to_use, loop_count, event_count - 1,
368                          event_count);
369             error = clEnqueueNDRangeKernel(
370                 queues[queue_to_use], kernel2[loop_count], 1, NULL, threads,
371                 NULL, 1, &event[event_count - 1], &event[event_count]);
372         }
373         else
374         {
375             if (DEBUG_OUT)
376                 log_info("clEnqueueNDRangeKernel(queues[%d], kernel2[%d], 1, "
377                          "NULL, threads, NULL, 0, NULL, &event[%d])\n",
378                          queue_to_use, loop_count, event_count);
379             error = clEnqueueNDRangeKernel(
380                 queues[queue_to_use], kernel2[loop_count], 1, NULL, threads,
381                 NULL, 0, NULL, &event[event_count]);
382         }
383         if (error)
384         {
385             log_info("\tLoop count %d\n", loop_count);
386             print_error(error, "clEnqueueNDRangeKernel for kernel 2 failed");
387             return error;
388         }
389         expected_value--;
390         expected_if_only_queue[queue_to_use]--;
391 
392         // If we are using a marker, it needs to go in the same queue
393         if (use_marker)
394         {
395             event_count++;
396             if (DEBUG_OUT)
397                 log_info("clEnqueueMarker(queues[%d], event[%d])\n",
398                          queue_to_use, event_count);
399 
400 #ifdef CL_VERSION_1_2
401             error = clEnqueueMarkerWithWaitList(queues[queue_to_use], 0, NULL,
402                                                 &event[event_count]);
403 #else
404             error = clEnqueueMarker(queues[queue_to_use], &event[event_count]);
405 #endif
406         }
407 
408         // Pick the next queue to run
409         if (RANDOMIZE)
410             queue_to_use = rand() % 2;
411         else
412             queue_to_use = (queue_to_use + 1) % 2;
413 
414         // Put in a barrier if requested
415         if (test_enqueue_wait_for_events)
416         {
417             if (DEBUG_OUT)
418                 log_info("clEnqueueBarrierWithWaitList(queues[%d], 1, "
419                          "&event[%d], NULL)\n",
420                          queue_to_use, event_count);
421             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 1,
422                                                  &event[event_count], NULL);
423             test_error(error, "Unable to queue wait for events");
424         }
425         else if (test_barrier)
426         {
427             if (DEBUG_OUT)
428                 log_info("clEnqueueBarrierWithWaitList(queues[%d])\n",
429                          queue_to_use);
430             error = clEnqueueBarrierWithWaitList(queues[queue_to_use], 0, NULL,
431                                                  NULL);
432             test_error(error, "Unable to queue barrier");
433         }
434         last_loop_event = event[event_count];
435     }
436 
437     // Now finish up everything
438     if (two_queues)
439     {
440         error = clFlush(queues[1]);
441         test_error(error, "clFlush[1] failed");
442     }
443 
444     error = clEnqueueReadBuffer(queues[0], data, CL_TRUE, 0,
445                                 TEST_SIZE * sizeof(cl_int), values, 1,
446                                 &last_loop_event, NULL);
447 
448     test_error(error, "clEnqueueReadBuffer failed");
449 
450     failed = 0;
451     for (i = 0; i < (int)TEST_SIZE; i++)
452         if (values[i] != expected_value)
453         {
454             failed = 1;
455             log_info("\tvalues[%d] = %d, expected %d (If only queue 1 accessed "
456                      "memory: %d only queue 2 accessed memory: %d)\n",
457                      i, values[i], expected_value, expected_if_only_queue[0],
458                      expected_if_only_queue[1]);
459             break;
460         }
461 
462     free(values);
463     if (two_devices) free(two_device_ids);
464 
465     return failed;
466 }
467 
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)468 int test(cl_device_id deviceID, cl_context context, cl_command_queue queue,
469          int num_elements, int two_queues, int two_devices,
470          int test_enqueue_wait_for_events, int test_barrier, int use_waitlists,
471          int use_marker)
472 {
473     if (!checkDeviceForQueueSupport(deviceID,
474                                     CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE))
475     {
476         log_info("WARNING: Device does not support out-of-order exec mode; "
477                  "skipping test.\n");
478         return 0;
479     }
480 
481     log_info("Running test for baseline results to determine if out-of-order "
482              "execution can be detected...\n");
483     int baseline_results = test_event_enqueue_wait_for_events_run_test(
484         deviceID, context, queue, num_elements, two_queues, two_devices, 0, 0,
485         0, 0);
486     if (baseline_results == 0)
487     {
488         if (test_enqueue_wait_for_events)
489             log_info(
490                 "WARNING: could not detect any out-of-order execution without "
491                 "using clEnqueueBarrierWithWaitList, so this test is not a "
492                 "valid test of out-of-order event dependencies.\n");
493         if (test_barrier)
494             log_info(
495                 "WARNING: could not detect any out-of-order execution without "
496                 "using clEnqueueBarrierWithWaitList, so this test is not a "
497                 "valid test of out-of-order event dependencies.\n");
498         if (use_waitlists)
499             log_info("WARNING: could not detect any out-of-order execution "
500                      "without using waitlists, so this test is not a valid "
501                      "test of out-of-order event dependencies.\n");
502         if (use_marker)
503             log_info("WARNING: could not detect any out-of-order execution "
504                      "without using clEnqueueMarker, so this test is not a "
505                      "valid test of out-of-order event dependencies.\n");
506     }
507     else if (baseline_results == 1)
508     {
509         if (test_enqueue_wait_for_events)
510             log_info("Detected incorrect execution (possibly out-of-order) "
511                      "without clEnqueueBarrierWithWaitList. Test can be a "
512                      "valid test of out-of-order event dependencies.\n");
513         if (test_barrier)
514             log_info("Detected incorrect execution (possibly out-of-order) "
515                      "without clEnqueueBarrierWithWaitList. Test can be a "
516                      "valid test of out-of-order event dependencies.\n");
517         if (use_waitlists)
518             log_info("Detected incorrect execution (possibly out-of-order) "
519                      "without waitlists. Test can be a valid test of "
520                      "out-of-order event dependencies.\n");
521         if (use_marker)
522             log_info("Detected incorrect execution (possibly out-of-order) "
523                      "without clEnqueueMarker. Test can be a valid test of "
524                      "out-of-order event dependencies.\n");
525     }
526     else if (baseline_results == -1942)
527     {
528         // Just ignore and return (out-of-order exec mode not supported)
529         return 0;
530     }
531     else
532     {
533         print_error(baseline_results, "Baseline run failed");
534         return baseline_results;
535     }
536     log_info("Running test for actual results...\n");
537     return test_event_enqueue_wait_for_events_run_test(
538         deviceID, context, queue, num_elements, two_queues, two_devices,
539         test_enqueue_wait_for_events, test_barrier, use_waitlists, use_marker);
540 }
541 
542 
test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)543 int test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID,
544                                                   cl_context context,
545                                                   cl_command_queue queue,
546                                                   int num_elements)
547 {
548     int two_queues = 0;
549     int two_devices = 0;
550     int test_enqueue_wait_for_events = 0;
551     int test_barrier = 0;
552     int use_waitlists = 1;
553     int use_marker = 0;
554     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
555                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
556                 use_marker);
557 }
558 
test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)559 int test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID,
560                                                  cl_context context,
561                                                  cl_command_queue queue,
562                                                  int num_elements)
563 {
564     int two_queues = 1;
565     int two_devices = 0;
566     int test_enqueue_wait_for_events = 0;
567     int test_barrier = 0;
568     int use_waitlists = 1;
569     int use_marker = 0;
570     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
571                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
572                 use_marker);
573 }
574 
test_out_of_order_event_waitlist_multi_queue_multi_device(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)575 int test_out_of_order_event_waitlist_multi_queue_multi_device(
576     cl_device_id deviceID, cl_context context, cl_command_queue queue,
577     int num_elements)
578 {
579     int two_queues = 1;
580     int two_devices = 1;
581     int test_enqueue_wait_for_events = 0;
582     int test_barrier = 0;
583     int use_waitlists = 1;
584     int use_marker = 0;
585     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
586                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
587                 use_marker);
588 }
589 
590 
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)591 int test_out_of_order_event_enqueue_wait_for_events_single_queue(
592     cl_device_id deviceID, cl_context context, cl_command_queue queue,
593     int num_elements)
594 {
595     int two_queues = 0;
596     int two_devices = 0;
597     int test_enqueue_wait_for_events = 1;
598     int test_barrier = 0;
599     int use_waitlists = 0;
600     int use_marker = 0;
601     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
602                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
603                 use_marker);
604 }
605 
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)606 int test_out_of_order_event_enqueue_wait_for_events_multi_queue(
607     cl_device_id deviceID, cl_context context, cl_command_queue queue,
608     int num_elements)
609 {
610     int two_queues = 1;
611     int two_devices = 0;
612     int test_enqueue_wait_for_events = 1;
613     int test_barrier = 0;
614     int use_waitlists = 0;
615     int use_marker = 0;
616     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
617                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
618                 use_marker);
619 }
620 
621 
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)622 int test_out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device(
623     cl_device_id deviceID, cl_context context, cl_command_queue queue,
624     int num_elements)
625 {
626     int two_queues = 1;
627     int two_devices = 1;
628     int test_enqueue_wait_for_events = 1;
629     int test_barrier = 0;
630     int use_waitlists = 0;
631     int use_marker = 0;
632     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
633                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
634                 use_marker);
635 }
636 
637 
test_out_of_order_event_enqueue_barrier_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)638 int test_out_of_order_event_enqueue_barrier_single_queue(cl_device_id deviceID,
639                                                          cl_context context,
640                                                          cl_command_queue queue,
641                                                          int num_elements)
642 {
643     int two_queues = 0;
644     int two_devices = 0;
645     int test_enqueue_wait_for_events = 0;
646     int test_barrier = 1;
647     int use_waitlists = 0;
648     int use_marker = 0;
649     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
650                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
651                 use_marker);
652 }
653 
654 
test_out_of_order_event_enqueue_marker_single_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)655 int test_out_of_order_event_enqueue_marker_single_queue(cl_device_id deviceID,
656                                                         cl_context context,
657                                                         cl_command_queue queue,
658                                                         int num_elements)
659 {
660     int two_queues = 0;
661     int two_devices = 0;
662     int test_enqueue_wait_for_events = 0;
663     int test_barrier = 0;
664     int use_waitlists = 0;
665     int use_marker = 1;
666     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
667                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
668                 use_marker);
669 }
670 
test_out_of_order_event_enqueue_marker_multi_queue(cl_device_id deviceID,cl_context context,cl_command_queue queue,int num_elements)671 int test_out_of_order_event_enqueue_marker_multi_queue(cl_device_id deviceID,
672                                                        cl_context context,
673                                                        cl_command_queue queue,
674                                                        int num_elements)
675 {
676     int two_queues = 1;
677     int two_devices = 0;
678     int test_enqueue_wait_for_events = 0;
679     int test_barrier = 0;
680     int use_waitlists = 0;
681     int use_marker = 1;
682     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
683                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
684                 use_marker);
685 }
686 
687 
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)688 int test_out_of_order_event_enqueue_marker_multi_queue_multi_device(
689     cl_device_id deviceID, cl_context context, cl_command_queue queue,
690     int num_elements)
691 {
692     int two_queues = 1;
693     int two_devices = 1;
694     int test_enqueue_wait_for_events = 0;
695     int test_barrier = 0;
696     int use_waitlists = 0;
697     int use_marker = 1;
698     return test(deviceID, context, queue, num_elements, two_queues, two_devices,
699                 test_enqueue_wait_for_events, test_barrier, use_waitlists,
700                 use_marker);
701 }
702