diff --git a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp index c60de77af8..f10175651b 100644 --- a/test/conformance/enqueue/urEnqueueKernelLaunch.cpp +++ b/test/conformance/enqueue/urEnqueueKernelLaunch.cpp @@ -77,56 +77,105 @@ TEST_P(urEnqueueKernelLaunchTest, InvalidWorkDimension) { UR_RESULT_ERROR_INVALID_WORK_DIMENSION); } -struct urEnqueueKernelLaunch2DTest : uur::urKernelExecutionTest { - void SetUp() override { - program_name = "fill_2d"; - UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); +#define ENQUEUE_KERNEL_LAUNCH_TEST_1D_SIZES(SIZE) \ + struct urEnqueueKernelLaunchTestSizes##SIZE : uur::urKernelExecutionTest { \ + void SetUp() override { \ + program_name = "fill"; \ + UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); \ + } \ + \ + uint32_t val = 42; \ + size_t global_size = SIZE; \ + size_t global_offset = 0; \ + size_t n_dimensions = 1; \ + }; \ + UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunchTestSizes##SIZE); \ + \ + TEST_P(urEnqueueKernelLaunchTestSizes##SIZE, Success) { \ + ur_mem_handle_t buffer = nullptr; \ + AddBuffer1DArg(sizeof(val) * global_size, &buffer); \ + AddPodArg(val); \ + ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, n_dimensions, \ + &global_offset, &global_size, \ + nullptr, 0, nullptr, nullptr)); \ + ASSERT_SUCCESS(urQueueFinish(queue)); \ + ValidateBuffer(buffer, sizeof(val) * global_size, val); \ } - - uint32_t val = 42; - size_t global_size[2] = {8, 8}; - size_t global_offset[2] = {0, 0}; - size_t buffer_size = sizeof(val) * global_size[0] * global_size[1]; - size_t n_dimensions = 2; -}; -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunch2DTest); - -TEST_P(urEnqueueKernelLaunch2DTest, Success) { - ur_mem_handle_t buffer = nullptr; - AddBuffer1DArg(buffer_size, &buffer); - AddPodArg(val); - ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, n_dimensions, - global_offset, global_size, nullptr, 0, - nullptr, nullptr)); - ASSERT_SUCCESS(urQueueFinish(queue)); - ValidateBuffer(buffer, buffer_size, val); -} - -struct urEnqueueKernelLaunch3DTest : uur::urKernelExecutionTest { - void SetUp() override { - program_name = "fill_3d"; - UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); +ENQUEUE_KERNEL_LAUNCH_TEST_1D_SIZES(1) +ENQUEUE_KERNEL_LAUNCH_TEST_1D_SIZES(53) +ENQUEUE_KERNEL_LAUNCH_TEST_1D_SIZES(100) +ENQUEUE_KERNEL_LAUNCH_TEST_1D_SIZES(1342) + +#define ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(SIZE1, SIZE2) \ + struct urEnqueueKernelLaunch2DTestSizes##SIZE1##_##SIZE2 \ + : uur::urKernelExecutionTest { \ + void SetUp() override { \ + program_name = "fill_2d"; \ + UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); \ + } \ + \ + uint32_t val = 42; \ + size_t global_size[2] = {SIZE1, SIZE2}; \ + size_t global_offset[2] = {0, 0}; \ + size_t buffer_size = sizeof(val) * global_size[0] * global_size[1]; \ + size_t n_dimensions = 2; \ + }; \ + UUR_INSTANTIATE_DEVICE_TEST_SUITE_P( \ + urEnqueueKernelLaunch2DTestSizes##SIZE1##_##SIZE2); \ + \ + TEST_P(urEnqueueKernelLaunch2DTestSizes##SIZE1##_##SIZE2, Success) { \ + ur_mem_handle_t buffer = nullptr; \ + AddBuffer1DArg(buffer_size, &buffer); \ + AddPodArg(val); \ + ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, n_dimensions, \ + global_offset, global_size, \ + nullptr, 0, nullptr, nullptr)); \ + ASSERT_SUCCESS(urQueueFinish(queue)); \ + ValidateBuffer(buffer, buffer_size, val); \ } - - uint32_t val = 42; - size_t global_size[3] = {4, 4, 4}; - size_t global_offset[3] = {0, 0, 0}; - size_t buffer_size = - sizeof(val) * global_size[0] * global_size[1] * global_size[2]; - size_t n_dimensions = 3; -}; -UUR_INSTANTIATE_DEVICE_TEST_SUITE_P(urEnqueueKernelLaunch3DTest); - -TEST_P(urEnqueueKernelLaunch3DTest, Success) { - ur_mem_handle_t buffer = nullptr; - AddBuffer1DArg(buffer_size, &buffer); - AddPodArg(val); - ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, n_dimensions, - global_offset, global_size, nullptr, 0, - nullptr, nullptr)); - ASSERT_SUCCESS(urQueueFinish(queue)); - ValidateBuffer(buffer, buffer_size, val); -} +ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(8, 8) +ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(1, 1) +ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(53, 100) +ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(1, 79) +ENQUEUE_KERNEL_LAUNCH_TEST_2D_SIZES(1342, 1) + +#define ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(SIZE1, SIZE2, SIZE3) \ + struct urEnqueueKernelLaunch3DTestSizes##SIZE1##_##SIZE2##_##SIZE3 \ + : uur::urKernelExecutionTest { \ + void SetUp() override { \ + program_name = "fill_3d"; \ + UUR_RETURN_ON_FATAL_FAILURE(urKernelExecutionTest::SetUp()); \ + } \ + \ + uint32_t val = 42; \ + size_t global_size[3] = {SIZE1, SIZE2, SIZE3}; \ + size_t global_offset[3] = {0, 0, 0}; \ + size_t buffer_size = \ + sizeof(val) * global_size[0] * global_size[1] * global_size[2]; \ + size_t n_dimensions = 3; \ + }; \ + UUR_INSTANTIATE_DEVICE_TEST_SUITE_P( \ + urEnqueueKernelLaunch3DTestSizes##SIZE1##_##SIZE2##_##SIZE3); \ + \ + TEST_P(urEnqueueKernelLaunch3DTestSizes##SIZE1##_##SIZE2##_##SIZE3, \ + Success) { \ + ur_mem_handle_t buffer = nullptr; \ + AddBuffer1DArg(buffer_size, &buffer); \ + AddPodArg(val); \ + ASSERT_SUCCESS(urEnqueueKernelLaunch(queue, kernel, n_dimensions, \ + global_offset, global_size, \ + nullptr, 0, nullptr, nullptr)); \ + ASSERT_SUCCESS(urQueueFinish(queue)); \ + ValidateBuffer(buffer, buffer_size, val); \ + } +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(1, 1, 1) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(37, 1, 1) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(1, 78, 1) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(1, 1, 1025) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(37, 19, 1) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(1, 78, 91) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(18, 1, 1025) +ENQUEUE_KERNEL_LAUNCH_TEST_3D_SIZES(18, 79, 1025) struct urEnqueueKernelLaunchWithVirtualMemory : uur::urKernelExecutionTest {