From ff915375662d4ff750e348320812c6205ed7a3c1 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Wed, 19 Jun 2024 13:42:39 +0100 Subject: [PATCH] Use array based clUpdateMutableCommandsKHR CTS change to reflect proposed change from https://github.com/KhronosGroup/OpenCL-Docs/issues/1041 Taking advantage of the extension version macros to avoid breaking existing implementations immediately. This reflects PRs: * https://github.com/KhronosGroup/OpenCL-Docs/pull/1045 * https://github.com/KhronosGroup/OpenCL-Headers/pull/245 --- .../mutable_command_arguments.cpp | 141 +++++++++++++++++- .../mutable_command_full_dispatch.cpp | 31 ++++ .../mutable_command_global_offset.cpp | 28 ++++ .../mutable_command_global_size.cpp | 29 ++++ .../mutable_command_image_arguments.cpp | 55 +++++++ .../mutable_command_iterative_arg_update.cpp | 34 +++++ .../mutable_command_local_size.cpp | 27 ++++ .../mutable_command_multiple_dispatches.cpp | 21 +++ .../mutable_command_overwrite_update.cpp | 35 +++++ .../mutable_command_simultaneous.cpp | 82 ++++++++++ 10 files changed, 477 insertions(+), 6 deletions(-) diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp index b438751b05..7963ebdfb1 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_arguments.cpp @@ -164,6 +164,8 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest cl_mutable_dispatch_arg_khr arg{ 1, sizeof(dst_buf_1), &dst_buf_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -187,6 +189,31 @@ struct MutableDispatchGlobalArguments : public MutableDispatchArgumentsTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + &arg /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); @@ -288,9 +315,14 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest nullptr, nullptr); test_error(error, "clEnqueueCommandBufferKHR failed"); + error = clFinish(queue); + test_error(error, "clFinish failed."); + cl_mutable_dispatch_arg_khr arg_1{ 1, sizeof(cl_mem), nullptr }; cl_mutable_dispatch_arg_khr args[] = { arg_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -311,11 +343,33 @@ struct MutableDispatchLocalArguments : public MutableDispatchArgumentsTest &dispatch_config }; - error = clFinish(queue); - test_error(error, "clFinish failed."); - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueReadBuffer(queue, streams[1], CL_TRUE, 0, size_to_allocate, @@ -421,10 +475,15 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest nullptr, nullptr); test_error(error, "clEnqueueCommandBufferKHR failed"); + error = clFinish(queue); + test_error(error, "clFinish failed."); + int_arg = 20; cl_mutable_dispatch_arg_khr arg_1{ 1, sizeof(cl_int), &int_arg }; cl_mutable_dispatch_arg_khr args[] = { arg_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -445,11 +504,33 @@ struct MutableDispatchPODArguments : public MutableDispatchArgumentsTest &dispatch_config }; - error = clFinish(queue); - test_error(error, "clFinish failed."); - error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueReadBuffer(queue, stream, CL_TRUE, 0, size_to_allocate, result_data.data(), 0, nullptr, nullptr); @@ -571,6 +652,9 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest // Modify and execute the command buffer cl_mutable_dispatch_arg_khr arg{ 0, sizeof(cl_mem), nullptr }; + +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -594,6 +678,31 @@ struct MutableDispatchNullArguments : public MutableDispatchArgumentsTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + &arg /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); @@ -772,6 +881,9 @@ struct MutableDispatchSVMArguments : public MutableDispatchArgumentsTest exec_info.param_value_size = sizeof(new_buffer); exec_info.param_value = &new_buffer; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) + cl_mutable_dispatch_config_khr dispatch_config{}; dispatch_config.type = CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR; dispatch_config.command = command; @@ -787,6 +899,23 @@ struct MutableDispatchSVMArguments : public MutableDispatchArgumentsTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{}; + dispatch_config.num_svm_args = 1; + dispatch_config.arg_svm_list = &arg_svm; + dispatch_config.num_exec_infos = 1; + dispatch_config.exec_info_list = &exec_info; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp index 80865e524d..80eee76fc8 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_full_dispatch.cpp @@ -334,6 +334,8 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest test_error(error, "clEnqueueFillBuffer failed"); } +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) // Modify and execute the command buffer cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, @@ -350,6 +352,22 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest nullptr /* global_work_size */, nullptr /* local_work_size */ }; +#else + // Modify and execute the command buffer + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 0 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + nullptr /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION cl_mutable_dispatch_arg_khr arg0{ 0 }; cl_mutable_dispatch_arg_khr arg1{ 0 }; @@ -395,6 +413,8 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest dispatch_config.local_work_size = &group_size; } +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_base_config_khr mutable_config{ CL_STRUCTURE_TYPE_MUTABLE_BASE_CONFIG_KHR, nullptr, 1, &dispatch_config @@ -402,6 +422,17 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp index 80bc015a33..371ef8b6de 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_offset.cpp @@ -87,6 +87,8 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest error = clFinish(queue); test_error(error, "clFinish failed."); +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -109,6 +111,32 @@ struct MutableDispatchGlobalOffset : InfoMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 0 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + nullptr /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + &update_global_offset /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION + error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp index 091f0c8d30..0be903532c 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_global_size.cpp @@ -86,6 +86,8 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest error = clFinish(queue); test_error(error, "clFinish failed."); +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -108,6 +110,33 @@ struct MutableDispatchGlobalSize : public InfoMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 0 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + nullptr /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + &update_global_size /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION + error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp index d8036e17dd..3915ccd89c 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_image_arguments.cpp @@ -161,6 +161,8 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr arg_2{ 2, sizeof(cl_mem), &new_image }; cl_mutable_dispatch_arg_khr args[] = { arg_2 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -182,6 +184,31 @@ struct MutableDispatchImage1DArguments : public BasicMutableCommandBufferTest }; error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); @@ -359,6 +386,8 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest cl_mutable_dispatch_arg_khr arg_2{ 2, sizeof(cl_mem), &new_image }; cl_mutable_dispatch_arg_khr args[] = { arg_2 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -380,6 +409,32 @@ struct MutableDispatchImage2DArguments : public BasicMutableCommandBufferTest }; error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION + error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp index dd6bf4c1f8..af0e6bcfdb 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_iterative_arg_update.cpp @@ -151,6 +151,8 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest // apply dispatch for mutable arguments cl_mutable_dispatch_arg_khr args = { 0, sizeof(cl_int), &pattern_sec }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -174,6 +176,31 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + &args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION // update parameter of previous mutable dispatch by using the same // arguments list variable but this time modify other kernel argument @@ -181,8 +208,15 @@ struct IterativeArgUpdateDispatch : BasicMutableCommandBufferTest args.arg_size = sizeof(new_out_mem); args.arg_value = &new_out_mem; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueFillBuffer(queue, new_out_mem, &pattern_pri, sizeof(cl_int), 0, data_size(), 0, nullptr, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp index 22a9da6d5c..985a6ac881 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_local_size.cpp @@ -89,6 +89,8 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest error = clFinish(queue); test_error(error, "clFinish failed."); +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -111,6 +113,31 @@ struct MutableDispatchLocalSize : public InfoMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 0 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + nullptr /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + &update_global_size /* global_work_size */, + &update_local_size /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, nullptr, nullptr); diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp index 0911472003..796c4c8114 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_multiple_dispatches.cpp @@ -162,6 +162,8 @@ struct MultipleCommandsDispatch : BasicMutableCommandBufferTest &new_out_mem }; cl_mutable_dispatch_arg_khr args_sec[] = { arg_sec }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) // modify two mutable parameters, each one with separate handle cl_mutable_dispatch_config_khr dispatch_config[] = { { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -179,6 +181,25 @@ struct MultipleCommandsDispatch : BasicMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + // modify two mutable parameters, each one with separate handle + cl_mutable_dispatch_config_khr dispatch_config[] = { + { command_pri, 1, 0, 0, 0, args_pri, nullptr, nullptr, nullptr, + nullptr, nullptr }, + { command_sec, 1, 0, 0, 0, args_sec, 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 }; + + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION // repeat execution of modified command buffer error = clEnqueueCommandBufferKHR(0, nullptr, command_buffer, 0, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp index 74b0c9f2ad..1d3e45f8d2 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_overwrite_update.cpp @@ -156,6 +156,8 @@ struct OverwriteUpdateDispatch : BasicMutableCommandBufferTest { 1, sizeof(unused_mem), &unused_mem } }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -179,13 +181,46 @@ struct OverwriteUpdateDispatch : BasicMutableCommandBufferTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 2 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION + // overwrite previous update of mutable arguments args[0].arg_value = &pattern_sec; args[1].arg_value = &new_out_mem; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + error = clUpdateMutableCommandsKHR(command_buffer, num_configs, + config_types, configs); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueFillBuffer(queue, new_out_mem, &pattern_pri, sizeof(cl_int), 0, data_size(), 0, nullptr, diff --git a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp index 42dd90c74a..e31aa6ba94 100644 --- a/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp +++ b/test_conformance/extensions/cl_khr_command_buffer/cl_khr_command_buffer_mutable_dispatch/mutable_command_simultaneous.cpp @@ -223,6 +223,8 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest &new_out_mem }; cl_mutable_dispatch_arg_khr args[] = { arg_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -246,6 +248,31 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest error = clUpdateMutableCommandsKHR(work_command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION error = clEnqueueCommandBufferKHR(0, nullptr, work_command_buffer, 0, nullptr, &single_event); @@ -342,6 +369,8 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest &new_out_mem }; cl_mutable_dispatch_arg_khr args[] = { arg_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -365,6 +394,31 @@ struct SimultaneousMutableDispatchTest : public BasicMutableCommandBufferTest error = clUpdateMutableCommandsKHR(work_command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 1 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION // command buffer execution must wait for two wait-events error = @@ -551,6 +605,8 @@ struct CrossQueueSimultaneousMutableDispatchTest &new_out_mem }; cl_mutable_dispatch_arg_khr args[] = { arg_0, arg_1 }; +#if CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION \ + < CL_MAKE_VERSION(0, 9, 2) cl_mutable_dispatch_config_khr dispatch_config{ CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR, nullptr, @@ -573,6 +629,32 @@ struct CrossQueueSimultaneousMutableDispatchTest error = clUpdateMutableCommandsKHR(command_buffer, &mutable_config); test_error(error, "clUpdateMutableCommandsKHR failed"); +#else + cl_mutable_dispatch_config_khr dispatch_config{ + command, + 2 /* num_args */, + 0 /* num_svm_arg */, + 0 /* num_exec_infos */, + 0 /* work_dim - 0 means no change to dimensions */, + args /* arg_list */, + nullptr /* arg_svm_list - nullptr means no change*/, + nullptr /* exec_info_list */, + nullptr /* global_work_offset */, + nullptr /* global_work_size */, + nullptr /* local_work_size */ + }; + + 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); + test_error(error, "clUpdateMutableCommandsKHR failed"); +#endif // CL_KHR_COMMAND_BUFFER_MUTABLE_DISPATCH_EXTENSION_VERSION + // enqueue command buffer to non-default queue error = clEnqueueCommandBufferKHR(1, &queue_sec, command_buffer, 0,