From c4fa48db05645cd0723de9455d66ea46541de5a9 Mon Sep 17 00:00:00 2001 From: Ahmed Hesham <117350656+ahesham-arm@users.noreply.github.com> Date: Tue, 11 Mar 2025 21:57:59 +0000 Subject: [PATCH] Migrate events suite to the new test registration framework (#2324) Contributes to #2181. Signed-off-by: Ahmed Hesham --- test_conformance/events/main.cpp | 51 +------ test_conformance/events/procs.h | 126 ------------------ test_conformance/events/testBase.h | 9 +- test_conformance/events/test_callbacks.cpp | 33 ++--- .../events/test_event_dependencies.cpp | 116 +++++++--------- test_conformance/events/test_events.cpp | 43 ++---- test_conformance/events/test_userevents.cpp | 3 +- .../events/test_userevents_multithreaded.cpp | 5 +- test_conformance/events/test_waitlists.cpp | 28 ++-- 9 files changed, 95 insertions(+), 319 deletions(-) delete mode 100644 test_conformance/events/procs.h diff --git a/test_conformance/events/main.cpp b/test_conformance/events/main.cpp index ab91f0e3..20a62f26 100644 --- a/test_conformance/events/main.cpp +++ b/test_conformance/events/main.cpp @@ -13,57 +13,10 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "harness/compat.h" - -#include -#include -#include "procs.h" #include "harness/testHarness.h" -#if !defined(_WIN32) -#include -#endif - -test_definition test_list[] = { - ADD_TEST(event_get_execute_status), - ADD_TEST(event_get_write_array_status), - ADD_TEST(event_get_read_array_status), - ADD_TEST(event_get_info), - ADD_TEST(event_wait_for_execute), - ADD_TEST(event_wait_for_array), - ADD_TEST(event_flush), - ADD_TEST(event_finish_execute), - ADD_TEST(event_finish_array), - ADD_TEST(event_release_before_done), - ADD_TEST(event_enqueue_marker), -#ifdef CL_VERSION_1_2 - ADD_TEST(event_enqueue_marker_with_event_list), - ADD_TEST(event_enqueue_barrier_with_event_list), -#endif - - ADD_TEST(out_of_order_event_waitlist_single_queue), - ADD_TEST(out_of_order_event_waitlist_multi_queue), - ADD_TEST(out_of_order_event_waitlist_multi_queue_multi_device), - ADD_TEST(out_of_order_event_enqueue_wait_for_events_single_queue), - ADD_TEST(out_of_order_event_enqueue_wait_for_events_multi_queue), - ADD_TEST( - out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device), - ADD_TEST(out_of_order_event_enqueue_marker_single_queue), - ADD_TEST(out_of_order_event_enqueue_marker_multi_queue), - ADD_TEST(out_of_order_event_enqueue_marker_multi_queue_multi_device), - ADD_TEST(out_of_order_event_enqueue_barrier_single_queue), - - ADD_TEST(waitlists), - ADD_TEST(userevents), - ADD_TEST(callbacks), - ADD_TEST(callbacks_simultaneous), - ADD_TEST(userevents_multithreaded), - ADD_TEST(callback_on_error_simple), - ADD_TEST(callback_on_error_enqueue_command) -}; - -const int test_num = ARRAY_SIZE(test_list); int main(int argc, const char *argv[]) { - return runTestHarness(argc, argv, test_num, test_list, false, 0); + return runTestHarness(argc, argv, test_registry::getInstance().num_tests(), + test_registry::getInstance().definitions(), false, 0); } diff --git a/test_conformance/events/procs.h b/test_conformance/events/procs.h deleted file mode 100644 index d840714e..00000000 --- a/test_conformance/events/procs.h +++ /dev/null @@ -1,126 +0,0 @@ -// -// Copyright (c) 2017 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#include "harness/errorHelpers.h" -#include "harness/kernelHelpers.h" -#include "harness/typeWrappers.h" -#include "harness/clImageHelper.h" - -extern float random_float(float low, float high); -extern float calculate_ulperror(float a, float b); - - -extern int test_event_get_execute_status(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_get_write_array_status(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_get_read_array_status(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_get_info(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_event_wait_for_execute(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_wait_for_array(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_event_flush(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_event_finish_execute(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_event_finish_array(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_event_release_before_done(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_enqueue_marker(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -#ifdef CL_VERSION_1_2 -extern int test_event_enqueue_marker_with_event_list(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_event_enqueue_barrier_with_event_list(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -#endif - -extern int test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern 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); - -extern 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); -extern 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); -extern 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); - -extern int test_out_of_order_event_enqueue_barrier_single_queue( - cl_device_id deviceID, cl_context context, cl_command_queue queue, - int num_elements); - -extern int test_out_of_order_event_enqueue_marker_single_queue( - cl_device_id deviceID, cl_context context, cl_command_queue queue, - int num_elements); -extern int test_out_of_order_event_enqueue_marker_multi_queue( - cl_device_id deviceID, cl_context context, cl_command_queue queue, - int num_elements); -extern 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); - -extern int test_waitlists(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_userevents(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_callbacks(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements); -extern int test_callbacks_simultaneous(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_userevents_multithreaded(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_callback_on_error_simple(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); -extern int test_callback_on_error_enqueue_command(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements); diff --git a/test_conformance/events/testBase.h b/test_conformance/events/testBase.h index 63086d7e..8936329d 100644 --- a/test_conformance/events/testBase.h +++ b/test_conformance/events/testBase.h @@ -17,12 +17,7 @@ #define _testBase_h #include "harness/compat.h" - -#include -#include -#include -#include - -#include "procs.h" +#include "harness/testHarness.h" +#include "harness/typeWrappers.h" #endif // _testBase_h diff --git a/test_conformance/events/test_callbacks.cpp b/test_conformance/events/test_callbacks.cpp index 78a2ae4a..74643b74 100644 --- a/test_conformance/events/test_callbacks.cpp +++ b/test_conformance/events/test_callbacks.cpp @@ -82,8 +82,9 @@ void CL_CALLBACK combuf_event_callback_function(cl_event event, *pdata = true; } -int test_callback_event_single(cl_device_id device, cl_context context, - cl_command_queue queue, Action *actionToTest) +static int test_callback_event_single(cl_device_id device, cl_context context, + cl_command_queue queue, + Action *actionToTest) { // Note: we don't use the waiting feature here. We just want to verify that // we get a callback called when the given event finishes @@ -163,15 +164,14 @@ int test_callback_event_single(cl_device_id device, cl_context context, { \ name##Action action; \ log_info("-- Testing " #name "...\n"); \ - if ((error = test_callback_event_single(deviceID, context, queue, \ - &action)) \ + if ((error = \ + test_callback_event_single(device, context, queue, &action)) \ != CL_SUCCESS) \ retVal++; \ clFinish(queue); \ } -int test_callbacks(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(callbacks) { cl_int error; int retVal = 0; @@ -185,7 +185,7 @@ int test_callbacks(cl_device_id deviceID, cl_context context, TEST_ACTION(MapBuffer) TEST_ACTION(UnmapBuffer) - if (checkForImageSupport(deviceID) == CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkForImageSupport(device) == CL_IMAGE_FORMAT_NOT_SUPPORTED) { log_info("\nNote: device does not support images. Skipping remainder " "of callback tests...\n"); @@ -199,7 +199,7 @@ int test_callbacks(cl_device_id deviceID, cl_context context, TEST_ACTION(CopyBufferTo2DImage) TEST_ACTION(MapImage) - if (checkFor3DImageSupport(deviceID) == CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkFor3DImageSupport(device) == CL_IMAGE_FORMAT_NOT_SUPPORTED) log_info("\nNote: device does not support 3D images. Skipping " "remainder of waitlist tests...\n"); else @@ -237,8 +237,7 @@ void CL_CALLBACK simultaneous_event_callback_function(cl_event event, ThreadPool_AtomicAdd(&sSimultaneousCount, 1); } -int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(callbacks_simultaneous) { cl_int error; @@ -255,7 +254,7 @@ int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context, actions[index++] = new MapBufferAction(); actions[index++] = new UnmapBufferAction(); - if (checkForImageSupport(deviceID) != CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkForImageSupport(device) != CL_IMAGE_FORMAT_NOT_SUPPORTED) { actions[index++] = new ReadImage2DAction(); actions[index++] = new WriteImage2DAction(); @@ -264,7 +263,7 @@ int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context, actions[index++] = new CopyBufferTo2DImageAction(); actions[index++] = new MapImageAction(); - if (checkFor3DImageSupport(deviceID) != CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkFor3DImageSupport(device) != CL_IMAGE_FORMAT_NOT_SUPPORTED) { actions[index++] = new ReadImage3DAction(); actions[index++] = new WriteImage3DAction(); @@ -282,7 +281,7 @@ int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context, log_info("\tSetting up test events...\n"); for (index = 0; actions[index] != NULL; index++) { - error = actions[index]->Setup(deviceID, context, queue); + error = actions[index]->Setup(device, context, queue); test_error(error, "Unable to set up test action"); sSimultaneousFlags[index] = false; } @@ -384,8 +383,7 @@ int test_callbacks_simultaneous(cl_device_id deviceID, cl_context context, return -1; } -int test_callback_on_error_simple(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(callback_on_error_simple) { cl_int error = CL_SUCCESS; clEventWrapper user_event = clCreateUserEvent(context, &error); @@ -412,10 +410,7 @@ int test_callback_on_error_simple(cl_device_id deviceID, cl_context context, return CL_SUCCESS; } -int test_callback_on_error_enqueue_command(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(callback_on_error_enqueue_command) { cl_int error = CL_SUCCESS; bool confirmation = false; diff --git a/test_conformance/events/test_event_dependencies.cpp b/test_conformance/events/test_event_dependencies.cpp index 72e0f8e4..e193ec5f 100644 --- a/test_conformance/events/test_event_dependencies.cpp +++ b/test_conformance/events/test_event_dependencies.cpp @@ -44,7 +44,7 @@ const char *write_kernels[] = { them (only for single queue). If neither are set, nothing is done to prevent them from executing in the wrong order. This can be used for verification. */ -int test_event_enqueue_wait_for_events_run_test( +static 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, int test_enqueue_wait_for_events, int test_barrier, int use_waitlist, @@ -473,10 +473,10 @@ int test_event_enqueue_wait_for_events_run_test( return failed; } -int 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) +static int 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_waitlists, int use_marker) { if (!checkDeviceForQueueSupport(deviceID, CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)) @@ -548,10 +548,7 @@ int test(cl_device_id deviceID, cl_context context, cl_command_queue queue, } -int test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(out_of_order_event_waitlist_single_queue) { int two_queues = 0; int two_devices = 0; @@ -559,15 +556,12 @@ int test_out_of_order_event_waitlist_single_queue(cl_device_id deviceID, int test_barrier = 0; int use_waitlists = 1; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -int test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(out_of_order_event_waitlist_multi_queue) { int two_queues = 1; int two_devices = 0; @@ -575,14 +569,12 @@ int test_out_of_order_event_waitlist_multi_queue(cl_device_id deviceID, int test_barrier = 0; int use_waitlists = 1; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -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) +REGISTER_TEST(out_of_order_event_waitlist_multi_queue_multi_device) { int two_queues = 1; int two_devices = 1; @@ -590,15 +582,13 @@ int test_out_of_order_event_waitlist_multi_queue_multi_device( int test_barrier = 0; int use_waitlists = 1; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -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) +REGISTER_TEST(out_of_order_event_enqueue_wait_for_events_single_queue) { int two_queues = 0; int two_devices = 0; @@ -606,14 +596,12 @@ int test_out_of_order_event_enqueue_wait_for_events_single_queue( int test_barrier = 0; int use_waitlists = 0; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -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) +REGISTER_TEST(out_of_order_event_enqueue_wait_for_events_multi_queue) { int two_queues = 1; int two_devices = 0; @@ -621,15 +609,14 @@ int test_out_of_order_event_enqueue_wait_for_events_multi_queue( int test_barrier = 0; int use_waitlists = 0; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -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) +REGISTER_TEST( + out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device) { int two_queues = 1; int two_devices = 1; @@ -637,16 +624,13 @@ int test_out_of_order_event_enqueue_wait_for_events_multi_queue_multi_device( int test_barrier = 0; int use_waitlists = 0; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -int test_out_of_order_event_enqueue_barrier_single_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(out_of_order_event_enqueue_barrier_single_queue) { int two_queues = 0; int two_devices = 0; @@ -654,16 +638,13 @@ int test_out_of_order_event_enqueue_barrier_single_queue(cl_device_id deviceID, int test_barrier = 1; int use_waitlists = 0; int use_marker = 0; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -int test_out_of_order_event_enqueue_marker_single_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(out_of_order_event_enqueue_marker_single_queue) { int two_queues = 0; int two_devices = 0; @@ -671,15 +652,12 @@ int test_out_of_order_event_enqueue_marker_single_queue(cl_device_id deviceID, int test_barrier = 0; int use_waitlists = 0; int use_marker = 1; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -int test_out_of_order_event_enqueue_marker_multi_queue(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(out_of_order_event_enqueue_marker_multi_queue) { int two_queues = 1; int two_devices = 0; @@ -687,15 +665,13 @@ int test_out_of_order_event_enqueue_marker_multi_queue(cl_device_id deviceID, int test_barrier = 0; int use_waitlists = 0; int use_marker = 1; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } -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) +REGISTER_TEST(out_of_order_event_enqueue_marker_multi_queue_multi_device) { int two_queues = 1; int two_devices = 1; @@ -703,7 +679,7 @@ int test_out_of_order_event_enqueue_marker_multi_queue_multi_device( int test_barrier = 0; int use_waitlists = 0; int use_marker = 1; - return test(deviceID, context, queue, num_elements, two_queues, two_devices, - test_enqueue_wait_for_events, test_barrier, use_waitlists, - use_marker); + return run_test(device, context, queue, num_elements, two_queues, + two_devices, test_enqueue_wait_for_events, test_barrier, + use_waitlists, use_marker); } diff --git a/test_conformance/events/test_events.cpp b/test_conformance/events/test_events.cpp index c1321f91..96377b0c 100644 --- a/test_conformance/events/test_events.cpp +++ b/test_conformance/events/test_events.cpp @@ -102,8 +102,7 @@ const char *IGetStatusString(cl_int status) } /* Note: tests clGetEventStatus and clReleaseEvent (implicitly) */ -int test_event_get_execute_status(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_get_execute_status) { cl_int status; SETUP_EVENT(context, queue); @@ -128,8 +127,7 @@ int test_event_get_execute_status(cl_device_id deviceID, cl_context context, return 0; } -int test_event_get_info(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_get_info) { SETUP_EVENT(context, queue); @@ -204,8 +202,7 @@ int test_event_get_info(cl_device_id deviceID, cl_context context, return 0; } -int test_event_get_write_array_status(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_get_write_array_status) { cl_mem stream; cl_float testArray[1024 * 32]; @@ -246,8 +243,7 @@ int test_event_get_write_array_status(cl_device_id deviceID, cl_context context, return 0; } -int test_event_get_read_array_status(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_get_read_array_status) { cl_mem stream; cl_float testArray[1024 * 32]; @@ -305,8 +301,7 @@ int test_event_get_read_array_status(cl_device_id deviceID, cl_context context, /* clGetEventStatus not implemented yet */ -int test_event_wait_for_execute(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_wait_for_execute) { cl_int status; SETUP_EVENT(context, queue); @@ -331,8 +326,7 @@ int test_event_wait_for_execute(cl_device_id deviceID, cl_context context, return 0; } -int test_event_wait_for_array(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_wait_for_array) { cl_mem streams[2]; cl_float readArray[1024 * 32]; @@ -419,8 +413,7 @@ int test_event_wait_for_array(cl_device_id deviceID, cl_context context, return 0; } -int test_event_flush(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_flush) { cl_int status; SETUP_EVENT(context, queue); @@ -472,8 +465,7 @@ int test_event_flush(cl_device_id deviceID, cl_context context, } -int test_event_finish_execute(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_finish_execute) { cl_int status; SETUP_EVENT(context, queue); @@ -498,8 +490,7 @@ int test_event_finish_execute(cl_device_id deviceID, cl_context context, return 0; } -int test_event_finish_array(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_finish_array) { cl_mem streams[2]; cl_float readArray[1024 * 32]; @@ -589,8 +580,7 @@ int test_event_finish_array(cl_device_id deviceID, cl_context context, #define NUM_EVENT_RUNS 100 -int test_event_release_before_done(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_release_before_done) { // Create a kernel to run clProgramWrapper program; @@ -680,8 +670,7 @@ int test_event_release_before_done(cl_device_id deviceID, cl_context context, return 0; } -int test_event_enqueue_marker(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(event_enqueue_marker) { cl_int status; SETUP_EVENT(context, queue); @@ -718,10 +707,7 @@ int test_event_enqueue_marker(cl_device_id deviceID, cl_context context, } #ifdef CL_VERSION_1_2 -int test_event_enqueue_marker_with_event_list(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(event_enqueue_marker_with_event_list) { SETUP_EVENT(context, queue); cl_event event_list[3] = { NULL, NULL, NULL }; @@ -771,10 +757,7 @@ int test_event_enqueue_marker_with_event_list(cl_device_id deviceID, return 0; } -int test_event_enqueue_barrier_with_event_list(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - int num_elements) +REGISTER_TEST(event_enqueue_barrier_with_event_list) { SETUP_EVENT(context, queue); cl_event event_list[3] = { NULL, NULL, NULL }; diff --git a/test_conformance/events/test_userevents.cpp b/test_conformance/events/test_userevents.cpp index b716b5c7..0369c567 100644 --- a/test_conformance/events/test_userevents.cpp +++ b/test_conformance/events/test_userevents.cpp @@ -78,8 +78,7 @@ enum MaxDevices = 8 }; -int test_userevents(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(userevents) { cl_int err; diff --git a/test_conformance/events/test_userevents_multithreaded.cpp b/test_conformance/events/test_userevents_multithreaded.cpp index a7845bf1..ce1d2f12 100644 --- a/test_conformance/events/test_userevents_multithreaded.cpp +++ b/test_conformance/events/test_userevents_multithreaded.cpp @@ -30,8 +30,7 @@ void trigger_user_event(cl_event *event) clSetUserEventStatus(*event, CL_COMPLETE); } -int test_userevents_multithreaded(cl_device_id deviceID, cl_context context, - cl_command_queue queue, int num_elements) +REGISTER_TEST(userevents_multithreaded) { cl_int error; @@ -50,7 +49,7 @@ int test_userevents_multithreaded(cl_device_id deviceID, cl_context context, for (int i = 0; actions[i] != NULL; i++) { - error = actions[i]->Setup(deviceID, context, queue); + error = actions[i]->Setup(device, context, queue); test_error(error, "Unable to set up test action"); error = actions[i]->Execute(queue, 1, &gateEvent, &actionEvents[i]); diff --git a/test_conformance/events/test_waitlists.cpp b/test_conformance/events/test_waitlists.cpp index 6036451f..0b93d3ff 100644 --- a/test_conformance/events/test_waitlists.cpp +++ b/test_conformance/events/test_waitlists.cpp @@ -21,8 +21,9 @@ extern const char *IGetStatusString(cl_int status); #define PRINT_OPS 0 -int test_waitlist(cl_device_id device, cl_context context, - cl_command_queue queue, Action *actionToTest, bool multiple) +static int test_waitlist(cl_device_id device, cl_context context, + cl_command_queue queue, Action *actionToTest, + bool multiple) { NDRangeKernelAction actions[2]; clEventWrapper events[3]; @@ -314,38 +315,39 @@ int test_waitlist(cl_device_id device, cl_context context, { \ name##Action action; \ log_info("-- Testing " #name " (waiting on 1 event)...\n"); \ - if ((error = test_waitlist(deviceID, context, queue, &action, false)) \ + if ((error = \ + test_waitlist(device, context, test_queue, &action, false)) \ != CL_SUCCESS) \ retVal++; \ - clFinish(queue); \ + clFinish(test_queue); \ } \ if (error \ == CL_SUCCESS) /* Only run multiples test if single test passed */ \ { \ name##Action action; \ log_info("-- Testing " #name " (waiting on 2 events)...\n"); \ - if ((error = test_waitlist(deviceID, context, queue, &action, true)) \ + if ((error = \ + test_waitlist(device, context, test_queue, &action, true)) \ != CL_SUCCESS) \ retVal++; \ - clFinish(queue); \ + clFinish(test_queue); \ } -int test_waitlists(cl_device_id deviceID, cl_context context, - cl_command_queue oldQueue, int num_elements) +REGISTER_TEST(waitlists) { cl_int error; int retVal = 0; cl_command_queue_properties props = CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE; - if (!checkDeviceForQueueSupport(deviceID, props)) + if (!checkDeviceForQueueSupport(device, props)) { log_info("WARNING: Device does not support out-of-order exec mode; " "skipping test.\n"); return 0; } - clCommandQueueWrapper queue = - clCreateCommandQueue(context, deviceID, props, &error); + clCommandQueueWrapper test_queue = + clCreateCommandQueue(context, device, props, &error); test_error(error, "Unable to create out-of-order queue"); log_info("\n"); @@ -357,7 +359,7 @@ int test_waitlists(cl_device_id deviceID, cl_context context, TEST_ACTION(MapBuffer) TEST_ACTION(UnmapBuffer) - if (checkForImageSupport(deviceID) == CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkForImageSupport(device) == CL_IMAGE_FORMAT_NOT_SUPPORTED) { log_info("\nNote: device does not support images. Skipping remainder " "of waitlist tests...\n"); @@ -371,7 +373,7 @@ int test_waitlists(cl_device_id deviceID, cl_context context, TEST_ACTION(CopyBufferTo2DImage) TEST_ACTION(MapImage) - if (checkFor3DImageSupport(deviceID) == CL_IMAGE_FORMAT_NOT_SUPPORTED) + if (checkFor3DImageSupport(device) == CL_IMAGE_FORMAT_NOT_SUPPORTED) log_info("Device does not support 3D images. Skipping remainder of " "waitlist tests...\n"); else