From 21514f0826a07af2a1b4d85dbe8bd87164859201 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Wed, 17 Jan 2024 12:24:22 +0000 Subject: [PATCH] Use array for clUpdateMutableCommandsKHR Implementation change to prototype specification changes proposed in https://github.com/KhronosGroup/OpenCL-Docs/issues/1041 Uses OpenCL-Docs and OpenCL-Header changes from * https://github.com/KhronosGroup/OpenCL-Docs/pull/1045 * https://github.com/KhronosGroup/OpenCL-Headers/pull/245 --- .../MutableDispatchKHR/source/main.cpp | 12 +- source/cl/external/OpenCL-Headers/CL/cl_ext.h | 26 +- .../include/extension/khr_command_buffer.h | 4 +- .../extension/source/khr_command_buffer.cpp | 30 +- .../khr_command_buffer_mutable_dispatch.cpp | 32 +- .../clEnqueueCommandBufferKHRMutability.cpp | 1071 ++++++----------- .../clUpdateMutableCommandsKHR.cpp | 553 +++------ .../thread_safety.cpp | 26 +- .../usm_arg_update.cpp | 222 ++-- 9 files changed, 693 insertions(+), 1283 deletions(-) diff --git a/source/cl/examples/MutableDispatchKHR/source/main.cpp b/source/cl/examples/MutableDispatchKHR/source/main.cpp index 173d40e72..ea3d5db31 100644 --- a/source/cl/examples/MutableDispatchKHR/source/main.cpp +++ b/source/cl/examples/MutableDispatchKHR/source/main.cpp @@ -214,8 +214,6 @@ int main(const int argc, const char **argv) { cl_mutable_dispatch_arg_khr arg_2{2, sizeof(cl_mem), &output_buffer}; cl_mutable_dispatch_arg_khr args[] = {arg_0, arg_1, arg_2}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, command_handle, 3 /* num_args */, 0 /* num_svm_arg */, @@ -227,12 +225,14 @@ int main(const int argc, const char **argv) { nullptr /* global_work_offset */, nullptr /* global_work_size */, nullptr /* local_work_size */}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config}; // Update the command buffer with the mutable configuration - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); CL_CHECK(error); } diff --git a/source/cl/external/OpenCL-Headers/CL/cl_ext.h b/source/cl/external/OpenCL-Headers/CL/cl_ext.h index aef9d1e21..e6f53823e 100644 --- a/source/cl/external/OpenCL-Headers/CL/cl_ext.h +++ b/source/cl/external/OpenCL-Headers/CL/cl_ext.h @@ -272,7 +272,7 @@ extern CL_API_ENTRY cl_int CL_API_CALL clGetCommandBufferInfoKHR( #define CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_NAME \ "cl_khr_command_buffer_mutable_dispatch" -typedef cl_uint cl_command_buffer_structure_type_khr; +typedef cl_uint cl_update_config_type_khr; typedef cl_bitfield cl_mutable_dispatch_fields_khr; typedef cl_uint cl_mutable_command_info_khr; typedef struct _cl_mutable_dispatch_arg_khr { @@ -286,8 +286,6 @@ typedef struct _cl_mutable_dispatch_exec_info_khr { const void *param_value; } cl_mutable_dispatch_exec_info_khr; typedef struct _cl_mutable_dispatch_config_khr { - cl_command_buffer_structure_type_khr type; - const void *next; cl_mutable_command_khr command; cl_uint num_args; cl_uint num_svm_args; @@ -300,13 +298,6 @@ typedef struct _cl_mutable_dispatch_config_khr { const size_t *global_work_size; const size_t *local_work_size; } cl_mutable_dispatch_config_khr; -typedef struct _cl_mutable_base_config_khr { - cl_command_buffer_structure_type_khr type; - const void *next; - cl_uint num_mutable_dispatch; - const cl_mutable_dispatch_config_khr *mutable_dispatch_list; -} cl_mutable_base_config_khr; - /* cl_command_buffer_flags_khr - bitfield */ #define CL_COMMAND_BUFFER_MUTABLE_KHR (1 << 1) @@ -337,13 +328,12 @@ typedef struct _cl_mutable_base_config_khr { #define CL_MUTABLE_DISPATCH_GLOBAL_WORK_SIZE_KHR 0x12A6 #define CL_MUTABLE_DISPATCH_LOCAL_WORK_SIZE_KHR 0x12A7 -/* cl_command_buffer_structure_type_khr */ -#define CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR 0 -#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 1 +/* cl_update_config_type_khr */ +#define CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR 0 typedef cl_int(CL_API_CALL *clUpdateMutableCommandsKHR_fn)( - cl_command_buffer_khr command_buffer, - const cl_mutable_base_config_khr *mutable_config); + cl_command_buffer_khr command_buffer, cl_uint num_configs, + const cl_update_config_type_khr *config_types, const void **configs); typedef cl_int(CL_API_CALL *clGetMutableCommandInfoKHR_fn)( cl_mutable_command_khr command, cl_mutable_command_info_khr param_name, @@ -351,9 +341,9 @@ typedef cl_int(CL_API_CALL *clGetMutableCommandInfoKHR_fn)( #ifndef CL_NO_PROTOTYPES -extern CL_API_ENTRY cl_int CL_API_CALL -clUpdateMutableCommandsKHR(cl_command_buffer_khr command_buffer, - const cl_mutable_base_config_khr *mutable_config); +extern CL_API_ENTRY cl_int CL_API_CALL clUpdateMutableCommandsKHR( + cl_command_buffer_khr command_buffer, cl_uint num_configs, + const cl_update_config_type_khr *config_types, const void **configs); extern CL_API_ENTRY cl_int CL_API_CALL clGetMutableCommandInfoKHR( cl_mutable_command_khr command, cl_mutable_command_info_khr param_name, diff --git a/source/cl/source/extension/include/extension/khr_command_buffer.h b/source/cl/source/extension/include/extension/khr_command_buffer.h index cc8c5c57d..5088ed0ee 100644 --- a/source/cl/source/extension/include/extension/khr_command_buffer.h +++ b/source/cl/source/extension/include/extension/khr_command_buffer.h @@ -462,7 +462,9 @@ struct _cl_command_buffer_khr final : public cl::base<_cl_command_buffer_khr> { /// @param[in] mutable_config New configuration for one or more commands /// /// @return CL_SUCCESS or appropriate OpenCL error code. - cl_int updateCommandBuffer(const cl_mutable_base_config_khr &mutable_config); + cl_int updateCommandBuffer( + cargo::array_view + &mutable_configs); /// @brief Verifies whether a queue is compatible with the command-buffer. /// diff --git a/source/cl/source/extension/source/khr_command_buffer.cpp b/source/cl/source/extension/source/khr_command_buffer.cpp index 736f756f6..573814c82 100644 --- a/source/cl/source/extension/source/khr_command_buffer.cpp +++ b/source/cl/source/extension/source/khr_command_buffer.cpp @@ -1071,19 +1071,15 @@ cargo::expected createArgumentDescriptor( } // anonymous namespace [[nodiscard]] cl_int _cl_command_buffer_khr::updateCommandBuffer( - const cl_mutable_base_config_khr &mutable_config) { + cargo::array_view + &mutable_dispatch_configs) { std::lock_guard guard(mutex); const cl_device_id device = command_queue->device; - cargo::array_view - mutable_dispatch_configs(mutable_config.mutable_dispatch_list, - mutable_config.num_mutable_dispatch); - // Verify struct configures kernel arguments and return error if malformed - for (const auto &config : mutable_dispatch_configs) { - OCL_CHECK(config.type != CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - return CL_INVALID_VALUE); - + for (const auto config_ptr : mutable_dispatch_configs) { + OCL_CHECK(config_ptr == nullptr, return CL_INVALID_VALUE); + cl_mutable_dispatch_config_khr config = *config_ptr; OCL_CHECK(!config.command, return CL_INVALID_MUTABLE_COMMAND_KHR); OCL_CHECK(config.command->command_buffer != this, return CL_INVALID_MUTABLE_COMMAND_KHR); @@ -1099,7 +1095,7 @@ cargo::expected createArgumentDescriptor( for (auto config : mutable_dispatch_configs) { unsigned update_index = 0; - const unsigned num_args = config.num_args + config.num_svm_args; + const unsigned num_args = config->num_args + config->num_svm_args; UpdateInfo update_info; if (update_info.descriptors.alloc(num_args)) { return CL_OUT_OF_HOST_MEMORY; @@ -1109,16 +1105,16 @@ cargo::expected createArgumentDescriptor( return CL_OUT_OF_HOST_MEMORY; } - if (update_info.pointers.alloc(config.num_svm_args)) { + if (update_info.pointers.alloc(config->num_svm_args)) { return CL_OUT_OF_HOST_MEMORY; } - const auto mutable_command = config.command; + const auto mutable_command = config->command; update_info.id = mutable_command->id; - cargo::array_view args(config.arg_list, - config.num_args); + cargo::array_view args(config->arg_list, + config->num_args); - for (unsigned i = 0; i < config.num_args; ++i) { + for (unsigned i = 0; i < config->num_args; ++i) { auto arg = args[i]; update_info.indices[update_index] = arg.arg_index; auto descriptor = @@ -1134,9 +1130,9 @@ cargo::expected createArgumentDescriptor( #ifdef OCL_EXTENSION_cl_intel_unified_shared_memory cargo::array_view svm_args( - config.arg_svm_list, config.num_svm_args); + config->arg_svm_list, config->num_svm_args); - for (unsigned i = 0; i < config.num_svm_args; ++i) { + for (unsigned i = 0; i < config->num_svm_args; ++i) { // Unpack the argument. const auto arg = svm_args[i]; const auto arg_index = arg.arg_index; diff --git a/source/cl/source/extension/source/khr_command_buffer_mutable_dispatch.cpp b/source/cl/source/extension/source/khr_command_buffer_mutable_dispatch.cpp index ce4dcd940..b71915920 100644 --- a/source/cl/source/extension/source/khr_command_buffer_mutable_dispatch.cpp +++ b/source/cl/source/extension/source/khr_command_buffer_mutable_dispatch.cpp @@ -82,9 +82,9 @@ cl_int extension::khr_command_buffer_mutable_dispatch::GetDeviceInfo( } #ifdef OCL_EXTENSION_cl_khr_command_buffer_mutable_dispatch -CL_API_ENTRY cl_int CL_API_CALL -clUpdateMutableCommandsKHR(cl_command_buffer_khr command_buffer, - const cl_mutable_base_config_khr *mutable_config) { +CL_API_ENTRY cl_int CL_API_CALL clUpdateMutableCommandsKHR( + cl_command_buffer_khr command_buffer, cl_uint num_configs, + const cl_update_config_type_khr *config_types, const void **configs) { tracer::TraceGuard guard("clUpdateMutableCommandsKHR"); OCL_CHECK(!command_buffer, return CL_INVALID_COMMAND_BUFFER_KHR); OCL_CHECK(!command_buffer->is_finalized, return CL_INVALID_OPERATION); @@ -102,20 +102,24 @@ clUpdateMutableCommandsKHR(cl_command_buffer_khr command_buffer, return CL_INVALID_OPERATION; } - OCL_CHECK(!mutable_config, return CL_INVALID_VALUE); - OCL_CHECK(mutable_config->type != CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, - return CL_INVALID_VALUE); + OCL_CHECK(config_types && 0 == num_configs, return CL_INVALID_VALUE); + OCL_CHECK(!config_types && num_configs, return CL_INVALID_VALUE); - // Values for next would be defined by implementation of mutable mem commands - // layered extension. Later checks assume next is NULL and so the - // mutable_dispatch_list field must be set. - OCL_CHECK(mutable_config->next, return CL_INVALID_VALUE); + OCL_CHECK(configs && 0 == num_configs, return CL_INVALID_VALUE); + OCL_CHECK(!configs && num_configs, return CL_INVALID_VALUE); - OCL_CHECK(!mutable_config->mutable_dispatch_list || - !mutable_config->num_mutable_dispatch, - return CL_INVALID_VALUE); + for (size_t i = 0; i < num_configs; i++) { + if (config_types[i] != CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR) { + return CL_INVALID_VALUE; + } + } + + const cl_mutable_dispatch_config_khr **casted_configs = + reinterpret_cast(configs); + cargo::array_view + mutable_dispatch_configs(casted_configs, num_configs); - return command_buffer->updateCommandBuffer(*mutable_config); + return command_buffer->updateCommandBuffer(mutable_dispatch_configs); } CL_API_ENTRY cl_int CL_API_CALL clGetMutableCommandInfoKHR( diff --git a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clEnqueueCommandBufferKHRMutability.cpp b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clEnqueueCommandBufferKHRMutability.cpp index 27a0d73c3..9aa89819c 100644 --- a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clEnqueueCommandBufferKHRMutability.cpp +++ b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clEnqueueCommandBufferKHRMutability.cpp @@ -141,22 +141,15 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferOnce) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -210,25 +203,15 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferTwice) { cl_mutable_dispatch_arg_khr first_arg{1, sizeof(cl_mem), &first_updated_dst_buffer}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr first_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &first_dispatch_config}; + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &first_mutable_config)); + cl_uint first_num_configs = 1; + cl_update_config_type_khr first_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *first_configs[1] = {&first_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, first_num_configs, + first_config_types, first_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -246,24 +229,14 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferTwice) { cl_mutable_dispatch_arg_khr second_arg{1, sizeof(cl_mem), &second_updated_dst_buffer}; cl_mutable_dispatch_config_khr second_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr second_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &second_dispatch_config}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &second_mutable_config)); + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_update_config_type_khr second_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *second_configs[1] = {&second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR( + command_buffer, second_num_configs, second_config_types, second_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -320,22 +293,14 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferOnce) { // Now try and enqueue the command buffer updating the input buffer. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -403,24 +368,14 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferTwice) { cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), &first_updated_src_buffer}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr first_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &first_dispatch_config}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &first_mutable_config)); + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint first_num_configs = 1; + cl_update_config_type_khr first_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *first_configs[1] = {&first_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, first_num_configs, + first_config_types, first_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -438,24 +393,14 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferTwice) { cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), &second_updated_src_buffer}; cl_mutable_dispatch_config_khr second_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr second_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &second_dispatch_config}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &second_mutable_config)); + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_update_config_type_khr second_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *second_configs[1] = {&second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR( + command_buffer, second_num_configs, second_config_types, second_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -520,22 +465,14 @@ TEST_F(CommandBufferMutableBufferArgTest, cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_arg_khr args[] = {arg_1, arg_2}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 2, - 0, - 0, - 0, - args, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -599,38 +536,18 @@ TEST_F(CommandBufferMutableBufferArgTest, cl_mutable_dispatch_arg_khr arg_1{0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config_1{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg_1, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &arg_1, + nullptr, nullptr, nullptr, nullptr, nullptr}; cl_mutable_dispatch_config_khr dispatch_config_2{ + command_handle, 1, 0, 0, 0, &arg_2, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg_2, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_dispatch_config_khr dispatch_configs[] = {dispatch_config_1, - dispatch_config_2}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, dispatch_configs}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[2] = {&dispatch_config_1, &dispatch_config_2}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -691,22 +608,14 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateToBiggerBufferSize) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -760,22 +669,14 @@ TEST_F(CommandBufferMutableBufferArgTest, CheckUpdatePersists) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -858,22 +759,14 @@ TEST_F(CommandBufferMutableBufferArgTest, FillThenNDRange) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -936,22 +829,14 @@ TEST_F(CommandBufferMutableBufferArgTest, NDRangeThenFill) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1017,22 +902,14 @@ TEST_F(CommandBufferMutableBufferArgTest, FillTwiceThenNDRange) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1097,22 +974,14 @@ TEST_F(CommandBufferMutableBufferArgTest, CopyBufferThenNDRange) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1179,22 +1048,14 @@ TEST_F(CommandBufferMutableBufferArgTest, CopyBufferRectThenNDRange) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1268,22 +1129,14 @@ TEST_F(CommandBufferMutableBufferArgTest, RegularNDRangeThenMutableNDRange) { // Now try and enqueue the command buffer updating the output buffer. cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1422,22 +1275,14 @@ TEST_F(CommandBufferMultiMutableBufferArgTest, UpdateSingleDispatch) { // first nd range. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1511,43 +1356,30 @@ TEST_F(CommandBufferMultiMutableBufferArgTest, UpdateMultipleDispatches) { cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), &first_updated_src_buffer}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), &second_updated_src_buffer}; - cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_config_khr second_dispatch_config{second_command_handle, + 1, + 0, + 0, + 0, + &second_arg, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - second_command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - - cl_mutable_dispatch_config_khr dispatch_configs[]{first_dispatch_config, - second_dispatch_config}; - - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, dispatch_configs}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[2] = {&first_dispatch_config, &second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1667,22 +1499,14 @@ TEST_F(MutableDispatchTest, UpdateConstantBuffer) { // Now try and enqueue the command buffer updating the input buffer. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1782,22 +1606,14 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateOnce) { // Update the local buffer size. cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); } @@ -1813,22 +1629,14 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateTwice) { // Update the local buffer size. cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -1838,23 +1646,14 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateTwice) { // Update the local buffer size a second time. cl_mutable_dispatch_arg_khr arg_2{0, 32, nullptr}; cl_mutable_dispatch_config_khr dispatch_config_2{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg_2, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config_2{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config_2}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config_2)); + command_handle, 1, 0, 0, 0, &arg_2, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs_2 = 1; + cl_update_config_type_khr config_types_2[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs_2[1] = {&dispatch_config_2}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs_2, + config_types_2, configs_2)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); } @@ -1986,22 +1785,14 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, // Update the input to null and enqueue a second time. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2051,22 +1842,14 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, const cl_int *null = nullptr; cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &null}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2114,22 +1897,14 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, // Update the input to null. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2178,22 +1953,14 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, // Update the input to null. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2239,22 +2006,14 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, CheckUpdatePersists) { // Update the input to null and enqueue a second time. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2381,22 +2140,14 @@ TEST_F(DISABLED_CommandBufferMultiMutableNullArgTest, UpdateSingleDispatch) { // Update the input of the first nd range to null and enqueue a second time. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2438,42 +2189,29 @@ TEST_F(DISABLED_CommandBufferMultiMutableNullArgTest, // Update the input of both nd ranges to null and enqueue a second time. cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), nullptr}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), nullptr}; - cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_config_khr second_dispatch_config{second_command_handle, + 1, + 0, + 0, + 0, + &second_arg, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - second_command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - - cl_mutable_dispatch_config_khr dispatch_configs[]{first_dispatch_config, - second_dispatch_config}; - - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, dispatch_configs}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[2] = {&first_dispatch_config, &second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2586,23 +2324,15 @@ TEST_F(CommandBufferMutablePODArgTest, InvalidArgSize) { ucl::Environment::instance->GetInputGenerator().GenerateInt(); cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int4), &updated_input_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_EQ_ERRCODE(CL_INVALID_ARG_SIZE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_EQ_ERRCODE(CL_INVALID_ARG_SIZE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } TEST_F(CommandBufferMutablePODArgTest, UpdateInputOnce) { @@ -2630,22 +2360,14 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputOnce) { ucl::Environment::instance->GetInputGenerator().GenerateInt(); cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2684,24 +2406,14 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputTwice) { cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_int), &first_updated_input_value}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr first_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &first_dispatch_config}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &first_mutable_config)); + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint first_num_configs = 1; + cl_update_config_type_khr first_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *first_configs[1] = {&first_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, first_num_configs, + first_config_types, first_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2724,24 +2436,14 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputTwice) { cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), &second_updated_input_value}; cl_mutable_dispatch_config_khr second_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr second_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &second_dispatch_config}; - EXPECT_SUCCESS( - clUpdateMutableCommandsKHR(command_buffer, &second_mutable_config)); + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_update_config_type_khr second_config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *second_configs[1] = {&second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR( + command_buffer, second_num_configs, second_config_types, second_configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2780,22 +2482,14 @@ TEST_F(CommandBufferMutablePODArgTest, CheckUpdatePersists) { ucl::Environment::instance->GetInputGenerator().GenerateInt(); cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2921,22 +2615,14 @@ TEST_F(CommandBufferMultiMutablePODArgTest, UpdateSingleDispatch) { ucl::Environment::instance->GetInputGenerator().GenerateInt(); cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -2992,44 +2678,33 @@ TEST_F(CommandBufferMultiMutablePODArgTest, UpdateMultipleDispatches) { cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_int), &first_updated_input_value}; cl_mutable_dispatch_config_khr first_dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &first_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; const auto second_updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), &second_updated_input_value}; - cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_config_khr second_dispatch_config{second_command_handle, + 1, + 0, + 0, + 0, + &second_arg, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - second_command_handle, - 1, - 0, - 0, - 0, - &second_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_dispatch_config_khr mutable_configs[]{first_dispatch_config, - second_dispatch_config}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, mutable_configs}; - - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + + const void *configs[2] = {&first_dispatch_config, &second_dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); @@ -3176,22 +2851,14 @@ TEST_F(CommandBufferMutablePODMultiArgTest, cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_int), &updated_input_y_data}; cl_mutable_dispatch_arg_khr args[] = {arg_1, arg_2}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 2, - 0, - 0, - 0, - args, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); // Check the results. @@ -3233,38 +2900,18 @@ TEST_F(CommandBufferMutablePODMultiArgTest, cl_mutable_dispatch_arg_khr arg_1{0, sizeof(cl_int), &updated_input_x_data}; cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_int), &updated_input_y_data}; cl_mutable_dispatch_config_khr dispatch_config_1{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg_1, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &arg_1, + nullptr, nullptr, nullptr, nullptr, nullptr}; cl_mutable_dispatch_config_khr dispatch_config_2{ + command_handle, 1, 0, 0, 0, &arg_2, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg_2, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_dispatch_config_khr dispatch_configs[]{dispatch_config_1, - dispatch_config_2}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, dispatch_configs}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[2] = {&dispatch_config_1, &dispatch_config_2}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); // Check the results. @@ -3369,22 +3016,14 @@ TEST_F(CommandBufferMutableStructArgTest, UpdateInputOnce) { const test_struct second_value{99, 42.0f, 'j'}; cl_mutable_dispatch_arg_khr arg{0, sizeof(test_struct), &second_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); // Check the results. diff --git a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clUpdateMutableCommandsKHR.cpp b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clUpdateMutableCommandsKHR.cpp index 92c4220ce..cc059c7d8 100644 --- a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clUpdateMutableCommandsKHR.cpp +++ b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/clUpdateMutableCommandsKHR.cpp @@ -111,19 +111,16 @@ class CommandBufferUpdateNDKernel : public MutableDispatchTest { // Return CL_INVALID_COMMAND_BUFFER_KHR if command_buffer is not a valid // command-buffer. TEST_F(CommandBufferUpdateNDKernel, NullCommandBuffer) { - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 0, nullptr}; ASSERT_EQ_ERRCODE(CL_INVALID_COMMAND_BUFFER_KHR, - clUpdateMutableCommandsKHR(nullptr /* command_buffer */, - &mutable_config)); + clUpdateMutableCommandsKHR(nullptr /* command_buffer */, 0, + nullptr, nullptr)); } // Return CL_INVALID_OPERATION if command_buffer has not been finalized. TEST_F(CommandBufferUpdateNDKernel, InvalidCommandBuffer) { - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 0, nullptr}; - ASSERT_EQ_ERRCODE(CL_INVALID_OPERATION, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + ASSERT_EQ_ERRCODE( + CL_INVALID_OPERATION, + clUpdateMutableCommandsKHR(command_buffer, 0, nullptr, nullptr)); } // Return CL_INVALID_OPERATION if command_buffer was not created with the @@ -136,25 +133,9 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidMutableFlag) { EXPECT_SUCCESS(clFinalizeCommandBufferKHR(immutable_command_buffer)); - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - nullptr, - 0, - 0, - 0, - 0, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config = { - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 0, &dispatch_config}; - EXPECT_EQ_ERRCODE( - CL_INVALID_OPERATION, - clUpdateMutableCommandsKHR(immutable_command_buffer, &mutable_config)); + EXPECT_EQ_ERRCODE(CL_INVALID_OPERATION, + clUpdateMutableCommandsKHR(immutable_command_buffer, 0, + nullptr, nullptr)); EXPECT_SUCCESS(clReleaseCommandBufferKHR(immutable_command_buffer)); } @@ -169,24 +150,9 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidSimulataneousUse) { EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 1, &user_event, nullptr)); - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - nullptr, - 0, - 0, - 0, - 0, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config = { - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 0, &dispatch_config}; - EXPECT_EQ_ERRCODE(CL_INVALID_OPERATION, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + EXPECT_EQ_ERRCODE( + CL_INVALID_OPERATION, + clUpdateMutableCommandsKHR(command_buffer, 0, nullptr, nullptr)); // We need to complete the user event to avoid any possible hangs. ASSERT_SUCCESS(clSetUserEventStatus(user_event, CL_COMPLETE)); @@ -194,121 +160,30 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidSimulataneousUse) { EXPECT_SUCCESS(clReleaseEvent(user_event)); } -// Return CL_INVALID_VALUE if the type member of mutable_config is not -// CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR. -TEST_F(CommandBufferUpdateNDKernel, InvalidBaseConfigType) { - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - cl_mutable_base_config_khr mutable_config{ - 0xBAD /* type should be CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR */, - nullptr, 0, nullptr}; - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); -} - -// Return CL_INVALID_VALUE if the mutable_dispatch_list member of mutable_config -// is NULL and num_mutable_dispatch > 0, or mutable_dispatch_list is not NULL -// and num_mutable_dispatch is 0. -TEST_F(CommandBufferUpdateNDKernel, InvalidMutableDispatchList) { - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, - 1 /* num_mutable_dispatch */, nullptr /* mutable_dispatch_list */ - }; - - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); - - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - nullptr, - 0, - 0, - 0, - 0, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - - mutable_config = { - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, - 0 /* num_mutable_dispatch */, &dispatch_config /* mutable_dispatch_list*/ - }; - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); -} - -// Return CL_INVALID_VALUE if the next member of mutable_config is not NULL and -// any iteration of the structure pointer chain does not contain valid type and -// next members. -TEST_F(CommandBufferUpdateNDKernel, InvalidNext) { - ASSERT_SUCCESS(clCommandNDRangeKernelKHR( - command_buffer, nullptr, nullptr, kernel, 1, nullptr, &global_size, - nullptr, 0, nullptr, nullptr, nullptr)); - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - - const cl_ulong next = 0xDEADBEEF; - cl_mutable_base_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, &next /* next is invalid */, 0, - nullptr}; - ASSERT_EQ(CL_INVALID_VALUE, - clUpdateMutableCommandsKHR(command_buffer, &dispatch_config)); -} - -// Return CL_INVALID_VALUE if mutable_config is NULL -TEST_F(CommandBufferUpdateNDKernel, NullUpdate) { - ASSERT_SUCCESS(clCommandNDRangeKernelKHR( - command_buffer, nullptr, nullptr, kernel, 1, nullptr, &global_size, - nullptr, 0, nullptr, nullptr, nullptr)); - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - - ASSERT_EQ(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, nullptr /* mutable_config*/)); -} - -// return CL_INVALID_VALUE if ... both next and mutable_dispatch_list members of -// mutable_config are NULL. -TEST_F(CommandBufferUpdateNDKernel, NopUpdate) { - ASSERT_SUCCESS(clCommandNDRangeKernelKHR( - command_buffer, nullptr, nullptr, kernel, 1, nullptr, &global_size, - nullptr, 0, nullptr, nullptr, nullptr)); - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - - cl_mutable_base_config_khr nop_update{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr /* next */, 0, - nullptr /* mutable_dispatch_list */}; - ASSERT_EQ(CL_INVALID_VALUE, - clUpdateMutableCommandsKHR(command_buffer, &nop_update)); -} - // Return CL_INVALID_MUTABLE_COMMAND_KHR if command is not a valid mutable // command object TEST_F(CommandBufferUpdateNDKernel, NullHandle) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - nullptr /* command */, - 0, - 0, - 0, - 0, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - - ASSERT_EQ_ERRCODE( - CL_INVALID_MUTABLE_COMMAND_KHR, - clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{nullptr /* command */, + 0, + 0, + 0, + 0, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + ASSERT_EQ_ERRCODE(CL_INVALID_MUTABLE_COMMAND_KHR, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Return CL_INVALID_MUTABLE_COMMAND_KHR if command is not created from @@ -331,8 +206,6 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidHandle) { cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, new_command_handle /* command */, 1, 0, @@ -344,12 +217,15 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidHandle) { nullptr, nullptr, nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_EQ_ERRCODE( - CL_INVALID_MUTABLE_COMMAND_KHR, - clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_EQ_ERRCODE(CL_INVALID_MUTABLE_COMMAND_KHR, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clReleaseCommandBufferKHR(new_command_buffer)); } @@ -396,39 +272,6 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidPropertyBit) { nullptr, nullptr, &command_handle)); } -// Return CL_INVALID_VALUE if cl_mutable_dispatch_config_khr type is not -// CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR -TEST_F(CommandBufferUpdateNDKernel, InvalidDispatchConfigStuctType) { - cl_ndrange_kernel_command_properties_khr mutable_properties[3] = { - CL_MUTABLE_DISPATCH_UPDATABLE_FIELDS_KHR, - CL_MUTABLE_DISPATCH_ARGUMENTS_KHR, 0}; - ASSERT_SUCCESS(clCommandNDRangeKernelKHR( - command_buffer, nullptr, mutable_properties, kernel, 1, nullptr, - &global_size, nullptr, 0, nullptr, nullptr, &command_handle)); - - ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - - cl_mutable_dispatch_config_khr dispatch_config{ - 0 /* This field should be CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR*/, - nullptr, - command_handle, - 0, - 0, - 0, - 0, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); -} - // Return CL_INVALID_VALUE if a bad property was set TEST_F(CommandBufferUpdateNDKernel, InvalidCommandProperty) { cl_ndrange_kernel_command_properties_khr mutable_properties[3] = { @@ -453,24 +296,16 @@ TEST_F(CommandBufferUpdateNDKernel, ImmutablePropertyBit) { cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_EQ_ERRCODE(CL_INVALID_OPERATION, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + ASSERT_EQ_ERRCODE(CL_INVALID_OPERATION, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Return CL_INVALID_VALUE if arg_list is NULL and num_args > 0, @@ -485,30 +320,29 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgList) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1 /* num_args */, - 0, - 0, - 0, - nullptr /* arg_list */, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 1 /* num_args */, + 0, + 0, + 0, + nullptr /* arg_list */, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; - dispatch_config = {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, + dispatch_config = {command_handle, 0 /* num_args */, 0, 0, @@ -520,8 +354,9 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgList) { nullptr, nullptr}; - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Test clSetKernelArg error code for CL_INVALID_ARG_INDEX if arg_index is not @@ -538,24 +373,17 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgIndex) { cl_mutable_dispatch_arg_khr arg = {3 /* arg_index */, sizeof(cl_mem), &src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_EQ_ERRCODE(CL_INVALID_ARG_INDEX, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + ASSERT_EQ_ERRCODE(CL_INVALID_ARG_INDEX, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Test clSetKernelArg error code for CL_INVALID_ARG_VALUE if arg_value @@ -604,24 +432,17 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgValue) { EXPECT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); cl_mutable_dispatch_arg_khr arg = {0, sizeof(cl_mem), &image /* arg_value */}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_EQ_ERRCODE(CL_INVALID_ARG_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_EQ_ERRCODE(CL_INVALID_ARG_VALUE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clReleaseMemObject(image)); } @@ -639,24 +460,17 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgSize) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); cl_mutable_dispatch_arg_khr arg = {0, 2 /* arg_size */, &src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_EQ_ERRCODE(CL_INVALID_ARG_SIZE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + ASSERT_EQ_ERRCODE(CL_INVALID_ARG_SIZE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Test update being called multiple times on the same command before an @@ -708,27 +522,22 @@ TEST_F(CommandBufferUpdateNDKernel, IterativeArgumentUpdate) { // cl_mutable_dispatch_arg_khr struct cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Reuse argument update struct for output buffer arg.arg_index = 1; arg.arg_value = &updated_dst_buffer; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer again EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -798,27 +607,21 @@ TEST_F(CommandBufferUpdateNDKernel, OverwriteArgumentUpdate) { // cl_mutable_dispatch_arg_khr struct cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &unused_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Reuse argument update struct for output buffer arg.arg_index = 1; arg.arg_value = &updated_dst_buffer; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer again EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -874,22 +677,16 @@ TEST_F(CommandBufferUpdateNDKernel, NoMutablePropertiesSet) { // Update the output buffer cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -1002,23 +799,16 @@ TEST_F(CommandBufferSimultaneousUpdate, UpdatePending) { {0, sizeof(cl_mem), &updated_src_buffer}, {1, sizeof(cl_mem), &updated_dst_buffer}}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 2, - 0, - 0, - 0, - args, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_SUCCESS( - clUpdateMutableCommandsKHR(simultaneous_command_buffer, &mutable_config)); + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + ASSERT_SUCCESS(clUpdateMutableCommandsKHR( + simultaneous_command_buffer, num_configs, config_types, configs)); // Enqueue the command buffer again after update ASSERT_SUCCESS(clEnqueueCommandBufferKHR( @@ -1059,30 +849,23 @@ TEST_F(CommandBufferSimultaneousUpdate, ConsecutiveUpdate) { cl_mutable_dispatch_arg_khr input_arg = {0, sizeof(cl_mem), &updated_src_buffer}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &input_arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_SUCCESS( - clUpdateMutableCommandsKHR(simultaneous_command_buffer, &mutable_config)); + command_handle, 1, 0, 0, 0, &input_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + ASSERT_SUCCESS(clUpdateMutableCommandsKHR( + simultaneous_command_buffer, num_configs, config_types, configs)); // Update the kernel output argument cl_mutable_dispatch_arg_khr output_args = {1, sizeof(cl_mem), &updated_dst_buffer}; dispatch_config.arg_list = &output_args; - ASSERT_SUCCESS( - clUpdateMutableCommandsKHR(simultaneous_command_buffer, &mutable_config)); + ASSERT_SUCCESS(clUpdateMutableCommandsKHR( + simultaneous_command_buffer, num_configs, config_types, configs)); // Enqueue the command buffer again after update ASSERT_SUCCESS(clEnqueueCommandBufferKHR( @@ -1141,15 +924,19 @@ TEST_F(CommandBufferSimultaneousUpdate, MultipleCommands) { cl_mutable_dispatch_arg_khr arg1 = {1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_arg_khr arg2 = {0, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_config_khr dispatch_configs[2] = { - {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, command_handle, - 1, 0, 0, 0, &arg1, nullptr, nullptr, nullptr, nullptr, nullptr}, - {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, command_handle2, - 1, 0, 0, 0, &arg2, nullptr, nullptr, nullptr, nullptr, nullptr}}; + {command_handle, 1, 0, 0, 0, &arg1, nullptr, nullptr, nullptr, nullptr, + nullptr}, + {command_handle2, 1, 0, 0, 0, &arg2, nullptr, nullptr, nullptr, nullptr, + nullptr}}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 2, dispatch_configs}; - ASSERT_SUCCESS( - clUpdateMutableCommandsKHR(simultaneous_command_buffer, &mutable_config)); + cl_uint num_configs = 2; + cl_update_config_type_khr config_types[2] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[2] = {&dispatch_configs[0], &dispatch_configs[1]}; + + ASSERT_SUCCESS(clUpdateMutableCommandsKHR( + simultaneous_command_buffer, num_configs, config_types, configs)); // Enqueue the command buffer again after update std::vector run1_output_data(global_size); diff --git a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/thread_safety.cpp b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/thread_safety.cpp index c426297b8..547dfc450 100644 --- a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/thread_safety.cpp +++ b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/thread_safety.cpp @@ -109,24 +109,16 @@ TEST_F(MutableDispatchThreadSafetyTest, UpdateInParallel) { // Create a mutable config. cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 1, - 0, - 0, - 0, - &arg, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config}; + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; // Update the nd range. - EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + + EXPECT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); EXPECT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr)); }; diff --git a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/usm_arg_update.cpp b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/usm_arg_update.cpp index 86e5bcbaf..63d29b010 100644 --- a/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/usm_arg_update.cpp +++ b/source/cl/test/UnitCL/source/cl_khr_command_buffer_mutable_dispatch/usm_arg_update.cpp @@ -144,30 +144,28 @@ TEST_F(MutableDispatchUSMTest, InvalidArgList) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1 /* num_svm_args */, - 0, - 0, - nullptr, - nullptr /* arg_svm_list */, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1 /* num_svm_args */, + 0, + 0, + nullptr, + nullptr /* arg_svm_list */, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); cl_mutable_dispatch_arg_khr arg{0, 0, device_ptrs[1]}; - dispatch_config = {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, + dispatch_config = {command_handle, 0, 0 /* num_svm_args */, 0, @@ -179,8 +177,9 @@ TEST_F(MutableDispatchUSMTest, InvalidArgList) { nullptr, nullptr}; - ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + ASSERT_EQ_ERRCODE(CL_INVALID_VALUE, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Test clSetKernelMemPointerINTEL error code for CL_INVALID_ARG_INDEX if @@ -198,25 +197,25 @@ TEST_F(MutableDispatchUSMTest, InvalidArgIndex) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); cl_mutable_dispatch_arg_khr arg{2 /* arg index */, 0, device_ptrs[1]}; - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1 /* num_svm_args */, - 0, - 0, - nullptr, - &arg /* arg_svm_list */, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - - ASSERT_EQ_ERRCODE(CL_INVALID_ARG_INDEX, clUpdateMutableCommandsKHR( - command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1 /* num_svm_args */, + 0, + 0, + nullptr, + &arg /* arg_svm_list */, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_EQ_ERRCODE(CL_INVALID_ARG_INDEX, + clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } TEST_F(MutableDispatchUSMTest, InvalidArgValue) { @@ -232,28 +231,29 @@ TEST_F(MutableDispatchUSMTest, InvalidArgValue) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); cl_mutable_dispatch_arg_khr arg{0, 0, &out_buffer}; - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1 /* num_svm_args */, - 0, - 0, - nullptr, - &arg /* arg_svm_list */, - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1 /* num_svm_args */, + 0, + 0, + nullptr, + &arg /* arg_svm_list */, + nullptr, + nullptr, + nullptr, + nullptr}; // The interaction between cl_intel_unified_shared_memory and // cl_khr_command_buffer_mutable_dispatch is not specified but we assume that // if clSetKernelArgMemPointerINTEL would not report invalid values, neither // will clUpdateMutableCommandsKHR. - ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); } // Tests for updating USM arguments to a command-buffer kernel command are @@ -326,23 +326,23 @@ TEST_P(MutableDispatchUpdateUSMArgs, NoOffset) { // Update both the input and argument to second device USM allocation cl_mutable_dispatch_arg_khr arg{0, 0, ptrB}; - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1, /* num_svm_args */ - 0, - 0, - nullptr, - &arg, /* arg_svm_list */ - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1, /* num_svm_args */ + 0, + 0, + nullptr, + &arg, /* arg_svm_list */ + nullptr, + nullptr, + nullptr, + nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer. ASSERT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -416,23 +416,23 @@ TEST_P(MutableDispatchUpdateUSMArgs, Offset) { // Update both the input and argument to second device USM allocation cl_mutable_dispatch_arg_khr arg{0, 0, offset_ptrB}; - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1, /* num_svm_args */ - 0, - 0, - nullptr, - &arg, /* arg_svm_list */ - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1, /* num_svm_args */ + 0, + 0, + nullptr, + &arg, /* arg_svm_list */ + nullptr, + nullptr, + nullptr, + nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer. ASSERT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, @@ -541,23 +541,23 @@ TEST_F(MutableDispatchUSMTest, DISABLED_UpdateBlockingFree) { // Update both the input and argument to second device USM allocation cl_mutable_dispatch_arg_khr arg{0, 0, usm_ptrB}; - cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, - 0, - 1, /* num_svm_args */ - 0, - 0, - nullptr, - &arg, /* arg_svm_list */ - nullptr, - nullptr, - nullptr, - nullptr}; - cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; - ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, &mutable_config)); + cl_mutable_dispatch_config_khr dispatch_config{command_handle, + 0, + 1, /* num_svm_args */ + 0, + 0, + nullptr, + &arg, /* arg_svm_list */ + nullptr, + nullptr, + nullptr, + nullptr}; + cl_uint num_configs = 1; + cl_update_config_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; + ASSERT_SUCCESS(clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs)); // Enqueue the command buffer. ASSERT_SUCCESS(clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0,