diff --git a/doc/source/cl/extension.rst b/doc/source/cl/extension.rst index 7296e679d..505bd247d 100644 --- a/doc/source/cl/extension.rst +++ b/doc/source/cl/extension.rst @@ -317,12 +317,12 @@ before the extension can be turned on by default in the oneAPI Construction Kit: * Event profiling is not implemented (see CA-3322). .. _cl_khr_command_buffer: - https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_command_buffer + https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_API.html#cl_khr_command_buffer Command Buffers: Mutable Dispatch - ``cl_khr_command_buffer_mutable_dispatch`` ------------------------------------------------------------------------------ -oneAPI Construction Kit implements version 0.9.0 of the provisional +oneAPI Construction Kit implements version 0.9.2 of the provisional `cl_khr_command_buffer_mutable_dispatch`_ extension. `cl_khr_command_buffer_mutable_dispatch`_ builds upon `cl_khr_command_buffer`_ @@ -330,7 +330,7 @@ to allow users to modify kernel execution commands between enqueues of a command-buffer. .. _cl_khr_command_buffer_mutable_dispatch: - https://www.khronos.org/registry/OpenCL/specs/3.0-unified/html/OpenCL_Ext.html#cl_khr_command_buffer_mutable_dispatch + https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#cl_khr_command_buffer_mutable_dispatch Extended Async Copies - ``cl_khr_extended_async_copies`` --------------------------------------------------------- diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index bb24b8392..13d5e18e3 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -25,8 +25,8 @@ set(CMAKE_CXX_EXTENSIONS ON) # them available here rather here rather than in source/cl/external. FetchContent_Declare( OpenCLHeaders - GIT_REPOSITORY https://github.com/KhronosGroup/OpenCL-Headers.git - GIT_TAG v2024.05.08 + GIT_REPOSITORY git@github.com:EwanC/OpenCL-Headers.git + GIT_TAG array_update ) FetchContent_MakeAvailable(OpenCLHeaders) diff --git a/source/cl/examples/MutableDispatchKHR/source/main.cpp b/source/cl/examples/MutableDispatchKHR/source/main.cpp index 1f6783c6d..9d750245e 100644 --- a/source/cl/examples/MutableDispatchKHR/source/main.cpp +++ b/source/cl/examples/MutableDispatchKHR/source/main.cpp @@ -209,16 +209,11 @@ int main(const int argc, const char **argv) { // If not executing the first frame if (i != 0) { // Configure the mutable configuration to update the kernel arguments - const cl_mutable_dispatch_arg_khr arg_0{0, sizeof(cl_mem), - &input_A_buffer}; - const cl_mutable_dispatch_arg_khr arg_1{1, sizeof(cl_mem), - &input_B_buffer}; - const cl_mutable_dispatch_arg_khr arg_2{2, sizeof(cl_mem), - &output_buffer}; - const cl_mutable_dispatch_arg_khr args[] = {arg_0, arg_1, arg_2}; - const cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, + cl_mutable_dispatch_arg_khr arg_0{0, sizeof(cl_mem), &input_A_buffer}; + cl_mutable_dispatch_arg_khr arg_1{1, sizeof(cl_mem), &input_B_buffer}; + 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{ command_handle, 3 /* num_args */, 0 /* num_svm_arg */, @@ -230,12 +225,14 @@ int main(const int argc, const char **argv) { nullptr /* global_work_offset */, nullptr /* global_work_size */, nullptr /* local_work_size */}; - const 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_command_buffer_update_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/source/extension/include/extension/khr_command_buffer.h b/source/cl/source/extension/include/extension/khr_command_buffer.h index acfc4bd3d..42d66801c 100644 --- a/source/cl/source/extension/include/extension/khr_command_buffer.h +++ b/source/cl/source/extension/include/extension/khr_command_buffer.h @@ -463,7 +463,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 598780020..81fcb9784 100644 --- a/source/cl/source/extension/source/khr_command_buffer.cpp +++ b/source/cl/source/extension/source/khr_command_buffer.cpp @@ -1072,19 +1072,15 @@ cargo::expected createArgumentDescriptor( } // anonymous namespace [[nodiscard]] cl_int _cl_command_buffer_khr::updateCommandBuffer( - const cl_mutable_base_config_khr &mutable_config) { - const std::lock_guard guard(mutex); + cargo::array_view + &mutable_dispatch_configs) { + std::lock_guard guard(mutex); const cl_device_id device = command_queue->device; - const 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); @@ -1100,7 +1096,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; @@ -1110,16 +1106,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 = @@ -1135,9 +1131,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 3feec64fc..8f6e0834b 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,10 +82,11 @@ 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) { - const tracer::TraceGuard guard("clUpdateMutableCommandsKHR"); +CL_API_ENTRY cl_int CL_API_CALL clUpdateMutableCommandsKHR( + cl_command_buffer_khr command_buffer, cl_uint num_configs, + const cl_command_buffer_update_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 +103,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 40f8f5080..10f2c9237 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 @@ -139,24 +139,17 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferOnce) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -207,28 +200,18 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferTwice) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr first_arg{1, sizeof(cl_mem), - &first_updated_dst_buffer}; - const 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}; - const cl_mutable_base_config_khr first_mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &first_dispatch_config}; + cl_mutable_dispatch_arg_khr first_arg{1, sizeof(cl_mem), + &first_updated_dst_buffer}; + cl_mutable_dispatch_config_khr 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_command_buffer_update_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)); @@ -243,27 +226,17 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateOutputBufferTwice) { EXPECT_EQ(input_data, first_updated_output_data); // Enqueue the command buffer again updating the output buffer a second time. - const cl_mutable_dispatch_arg_khr second_arg{1, sizeof(cl_mem), - &second_updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr second_arg{1, sizeof(cl_mem), + &second_updated_dst_buffer}; + cl_mutable_dispatch_config_khr second_dispatch_config{ + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_command_buffer_update_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)); @@ -318,24 +291,16 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferOnce) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the input buffer. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -400,27 +365,17 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferTwice) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the input buffer. - const cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), - &first_updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), + &first_updated_src_buffer}; + cl_mutable_dispatch_config_khr first_dispatch_config{ + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint first_num_configs = 1; + cl_command_buffer_update_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)); @@ -435,27 +390,17 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateInputBufferTwice) { EXPECT_EQ(first_updated_input_data, output_data); // Enqueue the command buffer a second time updating the input bufer again. - const cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), - &second_updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), + &second_updated_src_buffer}; + cl_mutable_dispatch_config_khr second_dispatch_config{ + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_command_buffer_update_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)); @@ -521,23 +466,15 @@ TEST_F(CommandBufferMutableBufferArgTest, const cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_mem), &updated_dst_buffer}; cl_mutable_dispatch_arg_khr args[] = {arg_1, arg_2}; - const 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}; - const 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)); + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -598,43 +535,21 @@ TEST_F(CommandBufferMutableBufferArgTest, // Now try and enqueue the command buffer updating the input and output // buffers. - const cl_mutable_dispatch_arg_khr arg_1{0, sizeof(cl_mem), - &updated_src_buffer}; - const cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_mem), - &updated_dst_buffer}; - const 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}; - const cl_mutable_dispatch_config_khr dispatch_config_2{ + 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{ + 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_command_buffer_update_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}; - const 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)); @@ -693,24 +608,16 @@ TEST_F(CommandBufferMutableBufferArgTest, UpdateToBiggerBufferSize) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -762,24 +669,16 @@ TEST_F(CommandBufferMutableBufferArgTest, CheckUpdatePersists) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -860,24 +759,16 @@ TEST_F(CommandBufferMutableBufferArgTest, FillThenNDRange) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -938,24 +829,16 @@ TEST_F(CommandBufferMutableBufferArgTest, NDRangeThenFill) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1019,24 +902,16 @@ TEST_F(CommandBufferMutableBufferArgTest, FillTwiceThenNDRange) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1099,24 +974,16 @@ TEST_F(CommandBufferMutableBufferArgTest, CopyBufferThenNDRange) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1181,24 +1048,16 @@ TEST_F(CommandBufferMutableBufferArgTest, CopyBufferRectThenNDRange) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1270,24 +1129,16 @@ TEST_F(CommandBufferMutableBufferArgTest, RegularNDRangeThenMutableNDRange) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the output buffer. - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1424,24 +1275,16 @@ TEST_F(CommandBufferMultiMutableBufferArgTest, UpdateSingleDispatch) { // Now try and enqueue the command buffer updating the output buffer of the // first nd range. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1512,46 +1355,33 @@ TEST_F(CommandBufferMultiMutableBufferArgTest, UpdateMultipleDispatches) { // Now try and enqueue the command buffer updating the input buffer of both // nd ranges. - const cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), - &first_updated_src_buffer}; - const 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}; - - const cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), - &second_updated_src_buffer}; - const cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), + &first_updated_src_buffer}; + cl_mutable_dispatch_config_khr first_dispatch_config{ + 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{second_command_handle, + 1, + 0, + 0, + 0, + &second_arg, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 2; + cl_command_buffer_update_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}; - - const 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)); @@ -1669,24 +1499,16 @@ TEST_F(MutableDispatchTest, UpdateConstantBuffer) { EXPECT_EQ(input_data, output_data); // Now try and enqueue the command buffer updating the input buffer. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1784,24 +1606,16 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateOnce) { EXPECT_SUCCESS(clFinish(command_queue)); // Update the local buffer size. - const cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); } @@ -1815,24 +1629,16 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateTwice) { EXPECT_SUCCESS(clFinish(command_queue)); // Update the local buffer size. - const cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, 32, nullptr}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -1840,25 +1646,16 @@ TEST_F(CommandBufferMutableLocalBufferArgTest, UpdateTwice) { EXPECT_SUCCESS(clFinish(command_queue)); // Update the local buffer size a second time. - const cl_mutable_dispatch_arg_khr arg_2{0, 32, nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg_2{0, 32, 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 = 1; + cl_command_buffer_update_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)); } @@ -1988,24 +1785,16 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, EXPECT_EQ(output_data, std::vector(global_size, 0x0)); // Update the input to null and enqueue a second time. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2053,24 +1842,16 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, // Update the input to pointer to null. const cl_int *null = nullptr; - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &null}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &null}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2116,24 +1897,16 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, EXPECT_EQ(output_data, std::vector(global_size, 0x1)); // Update the input to null. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2180,24 +1953,16 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, EXPECT_EQ(output_data, std::vector(global_size, 0x1)); // Update the input to null. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2241,24 +2006,16 @@ TEST_F(DISABLED_CommandBufferMutableNullArgTest, CheckUpdatePersists) { EXPECT_EQ(output_data, std::vector(global_size, 0x0)); // Update the input to null and enqueue a second time. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2383,24 +2140,16 @@ TEST_F(DISABLED_CommandBufferMultiMutableNullArgTest, UpdateSingleDispatch) { EXPECT_EQ(second_output_data, std::vector(global_size, 0x0)); // Update the input of the first nd range to null and enqueue a second time. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), nullptr}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2440,44 +2189,31 @@ TEST_F(DISABLED_CommandBufferMultiMutableNullArgTest, EXPECT_EQ(second_output_data, std::vector(global_size, 0x0)); // Update the input of both nd ranges to null and enqueue a second time. - const cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), nullptr}; - const 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}; - - const cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_mem), nullptr}; - const cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_mem), nullptr}; + cl_mutable_dispatch_config_khr first_dispatch_config{ + 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{second_command_handle, + 1, + 0, + 0, + 0, + &second_arg, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr}; + + cl_uint num_configs = 2; + cl_command_buffer_update_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}; - - const 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)); @@ -2588,26 +2324,17 @@ TEST_F(CommandBufferMutablePODArgTest, InvalidArgSize) { // Now try and enqueue the command buffer updating the input value. const auto updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int4), - &updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int4), &updated_input_value}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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) { @@ -2633,25 +2360,16 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputOnce) { // Now try and enqueue the command buffer updating the input value. const auto updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), - &updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2687,27 +2405,17 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputTwice) { // Now try and enqueue the command buffer updating the input value. const auto first_updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_int), - &first_updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_int), + &first_updated_input_value}; + cl_mutable_dispatch_config_khr first_dispatch_config{ + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint first_num_configs = 1; + cl_command_buffer_update_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)); @@ -2727,27 +2435,17 @@ TEST_F(CommandBufferMutablePODArgTest, UpdateInputTwice) { // time. const auto second_updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), - &second_updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), + &second_updated_input_value}; + cl_mutable_dispatch_config_khr second_dispatch_config{ + command_handle, 1, 0, 0, 0, &second_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint second_num_configs = 1; + cl_command_buffer_update_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)); @@ -2784,25 +2482,16 @@ TEST_F(CommandBufferMutablePODArgTest, CheckUpdatePersists) { // Now try and enqueue the command buffer updating the input value. const auto updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), - &updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2926,25 +2615,16 @@ TEST_F(CommandBufferMultiMutablePODArgTest, UpdateSingleDispatch) { // first nd range only. const auto updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), - &updated_input_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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)); @@ -2997,47 +2677,36 @@ TEST_F(CommandBufferMultiMutablePODArgTest, UpdateMultipleDispatches) { // ranges. const auto first_updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr first_arg{0, sizeof(cl_int), - &first_updated_input_value}; - const 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_dispatch_arg_khr first_arg{0, sizeof(cl_int), + &first_updated_input_value}; + cl_mutable_dispatch_config_khr first_dispatch_config{ + command_handle, 1, 0, 0, 0, &first_arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; const auto second_updated_input_value = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), - &second_updated_input_value}; - const cl_mutable_dispatch_config_khr second_dispatch_config{ + cl_mutable_dispatch_arg_khr second_arg{0, sizeof(cl_int), + &second_updated_input_value}; + 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_command_buffer_update_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}; - const 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)); @@ -3185,23 +2854,15 @@ TEST_F(CommandBufferMutablePODMultiArgTest, const 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}; - const 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}; - const 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)); + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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. @@ -3240,43 +2901,21 @@ TEST_F(CommandBufferMutablePODMultiArgTest, cl_int updated_input_y_data = ucl::Environment::instance->GetInputGenerator().GenerateInt(); - const cl_mutable_dispatch_arg_khr arg_1{0, sizeof(cl_int), - &updated_input_x_data}; - const cl_mutable_dispatch_arg_khr arg_2{1, sizeof(cl_int), - &updated_input_y_data}; - const 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}; - const cl_mutable_dispatch_config_khr dispatch_config_2{ + 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{ + 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_command_buffer_update_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}; - const 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. @@ -3379,24 +3018,16 @@ TEST_F(CommandBufferMutableStructArgTest, UpdateInputOnce) { // Now try and enqueue the command buffer updating the output buffer. const test_struct second_value{99, 42.0f, 'j'}; - const cl_mutable_dispatch_arg_khr arg{0, sizeof(test_struct), &second_value}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{0, sizeof(test_struct), &second_value}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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 039c02b13..3d8b85678 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) { - const 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) { - const 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)); - const 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}; - const 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)); - const 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}; - const 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)); - const 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)); - - const 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; - const 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)); - - const 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)); - const 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}; - const 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_command_buffer_update_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 @@ -329,10 +204,8 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidHandle) { &global_size, nullptr, 0, nullptr, nullptr, &new_command_handle)); EXPECT_SUCCESS(clFinalizeCommandBufferKHR(new_command_buffer)); - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; - const cl_mutable_dispatch_config_khr dispatch_config{ - CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ new_command_handle /* command */, 1, 0, @@ -344,12 +217,15 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidHandle) { nullptr, nullptr, nullptr}; - const 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_command_buffer_update_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)); - - const 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}; - const 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] = { @@ -451,26 +294,18 @@ TEST_F(CommandBufferUpdateNDKernel, ImmutablePropertyBit) { &global_size, nullptr, 0, nullptr, nullptr, &command_handle)); ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; - const 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}; - - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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}; - const 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)); - - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &dst_buffer}; - dispatch_config = {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, + 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_command_buffer_update_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 = {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 @@ -535,27 +370,20 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgIndex) { &global_size, nullptr, 0, nullptr, nullptr, &command_handle)); ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg = {3 /* arg_index */, sizeof(cl_mem), - &src_buffer}; - const 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_dispatch_arg_khr arg = {3 /* arg_index */, sizeof(cl_mem), + &src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_config}; - const 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 @@ -602,27 +430,19 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgValue) { &global_size, nullptr, 0, nullptr, nullptr, &command_handle)); EXPECT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg = {0, sizeof(cl_mem), - &image /* arg_value */}; - const 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_dispatch_arg_khr arg = {0, sizeof(cl_mem), &image /* arg_value */}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; - const 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_command_buffer_update_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)); } @@ -638,26 +458,19 @@ TEST_F(CommandBufferUpdateNDKernel, InvalidArgSize) { &global_size, nullptr, 0, nullptr, nullptr, &command_handle)); ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg = {0, 2 /* arg_size */, &src_buffer}; - const 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_dispatch_arg_khr arg = {0, 2 /* arg_size */, &src_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; - const 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)); + cl_uint num_configs = 1; + cl_command_buffer_update_type_khr config_types[1] = { + CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR}; + const void *configs[1] = {&dispatch_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,28 +521,23 @@ TEST_F(CommandBufferUpdateNDKernel, IterativeArgumentUpdate) { // Update both the input and output buffer, reusing the same // cl_mutable_dispatch_arg_khr struct cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_mem), &updated_src_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_command_buffer_update_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,28 +606,22 @@ TEST_F(CommandBufferUpdateNDKernel, OverwriteArgumentUpdate) { // Update both the input and output buffer, reusing the same // cl_mutable_dispatch_arg_khr struct cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &unused_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + cl_uint num_configs = 1; + cl_command_buffer_update_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, @@ -873,24 +675,18 @@ TEST_F(CommandBufferUpdateNDKernel, NoMutablePropertiesSet) { EXPECT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); // Update the output buffer - const cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; - const 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}; - const 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)); + cl_mutable_dispatch_arg_khr arg{1, sizeof(cl_mem), &updated_dst_buffer}; + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 1, 0, 0, 0, &arg, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_command_buffer_update_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,24 +798,17 @@ TEST_F(CommandBufferSimultaneousUpdate, UpdatePending) { cl_mutable_dispatch_arg_khr args[2] = { {0, sizeof(cl_mem), &updated_src_buffer}, {1, sizeof(cl_mem), &updated_dst_buffer}}; - const 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}; - const 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)); + cl_mutable_dispatch_config_khr dispatch_config{ + command_handle, 2, 0, 0, 0, args, + nullptr, nullptr, nullptr, nullptr, nullptr}; + + cl_uint num_configs = 1; + cl_command_buffer_update_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( @@ -1060,30 +849,23 @@ TEST_F(CommandBufferSimultaneousUpdate, ConsecutiveUpdate) { const 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}; - const 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_command_buffer_update_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 const 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( @@ -1144,15 +926,19 @@ TEST_F(CommandBufferSimultaneousUpdate, MultipleCommands) { const 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}}; - const 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_command_buffer_update_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 2bffe0756..7034e0d5c 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 @@ -107,27 +107,18 @@ TEST_F(MutableDispatchThreadSafetyTest, UpdateInParallel) { auto update_input_value_and_enqueue = [&](size_t id) { const cl_int updated_input_value = id; // Create a mutable config. - const cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), - &updated_input_value}; - const 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}; - const cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, - &dispatch_config}; + cl_mutable_dispatch_arg_khr arg{0, sizeof(cl_int), &updated_input_value}; + cl_mutable_dispatch_config_khr 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_command_buffer_update_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 66426c968..041bc2d29 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 @@ -138,30 +138,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}; - const 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)); - - const cl_mutable_dispatch_arg_khr arg{0, 0, device_ptrs[1]}; - dispatch_config = {CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, - nullptr, - command_handle, + 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_command_buffer_update_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 = {command_handle, 0, 0 /* num_svm_args */, 0, @@ -173,8 +171,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 @@ -191,26 +190,26 @@ TEST_F(MutableDispatchUSMTest, InvalidArgIndex) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg{2 /* arg index */, 0, device_ptrs[1]}; - const 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}; - const 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_arg_khr arg{2 /* arg index */, 0, device_ptrs[1]}; + 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_command_buffer_update_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) { @@ -225,29 +224,30 @@ TEST_F(MutableDispatchUSMTest, InvalidArgValue) { ASSERT_SUCCESS(clFinalizeCommandBufferKHR(command_buffer)); - const cl_mutable_dispatch_arg_khr arg{0, 0, &out_buffer}; - const 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}; - const cl_mutable_base_config_khr mutable_config{ - CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config}; + cl_mutable_dispatch_arg_khr arg{0, 0, &out_buffer}; + 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_command_buffer_update_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 @@ -319,24 +319,24 @@ TEST_P(MutableDispatchUpdateUSMArgs, NoOffset) { ASSERT_EQ(inputA, output); // Update both the input and argument to second device USM allocation - const cl_mutable_dispatch_arg_khr arg{0, 0, ptrB}; - const 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}; - const 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_arg_khr arg{0, 0, ptrB}; + 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_command_buffer_update_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, @@ -409,24 +409,24 @@ TEST_P(MutableDispatchUpdateUSMArgs, Offset) { ASSERT_EQ(inputA, output); // Update both the input and argument to second device USM allocation - const cl_mutable_dispatch_arg_khr arg{0, 0, offset_ptrB}; - const 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}; - const 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_arg_khr arg{0, 0, offset_ptrB}; + 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_command_buffer_update_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, @@ -534,24 +534,24 @@ TEST_F(MutableDispatchUSMTest, DISABLED_UpdateBlockingFree) { ASSERT_EQ(inputA, output); // Update both the input and argument to second device USM allocation - const cl_mutable_dispatch_arg_khr arg{0, 0, usm_ptrB}; - const 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}; - const 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_arg_khr arg{0, 0, usm_ptrB}; + 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_command_buffer_update_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,