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 753cc3be0..e037a5afd 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 @@ -100,22 +100,18 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest if ((available_caps & CL_MUTABLE_DISPATCH_EXEC_INFO_KHR) == 0) { - error = create_single_kernel_helper_create_program( - context, &program, 1, &kernel_str_no_svm); + error = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_str_no_svm, + "full_dispatch"); } else { - error = create_single_kernel_helper_create_program( - context, &program, 1, &kernel_str_svm); + error = + create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_str_svm, "full_dispatch"); } test_error(error, "Failed to create program with source"); - error = clBuildProgram(program, 1, &device, nullptr, nullptr, nullptr); - test_error(error, "Failed to build program"); - - kernel = clCreateKernel(program, "full_dispatch", &error); - test_error(error, "Failed to create copy kernel"); - return CL_SUCCESS; } @@ -300,6 +296,11 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest }; size_t work_offset = 0; + /* Round the global work size up to nearest multiple of the local work + * size to ensure work group uniformity. */ + num_elements = + ((num_elements + group_size - 1) / group_size) * group_size; + cl_int error = clCommandNDRangeKernelKHR( command_buffer, nullptr, props, kernel, 1, &work_offset, &num_elements, &group_size, 0, nullptr, nullptr, &command); @@ -381,18 +382,23 @@ struct MutableCommandFullDispatch : InfoMutableCommandBufferTest dispatch_config.global_work_offset = &work_offset; } - if ((available_caps & CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR) != 0) - { - num_elements /= 2; - dispatch_config.global_work_size = &num_elements; - } - if ((available_caps & CL_MUTABLE_DISPATCH_LOCAL_SIZE_KHR) != 0) { group_size /= 2; dispatch_config.local_work_size = &group_size; } + if ((available_caps & CL_MUTABLE_DISPATCH_GLOBAL_SIZE_KHR) != 0) + { + num_elements /= 2; + /* Round the global work size up to nearest multiple of the local + * work size to ensure work group uniformity. */ + num_elements = + ((num_elements + group_size - 1) / group_size) * group_size; + + dispatch_config.global_work_size = &num_elements; + } + cl_uint num_configs = 1; cl_command_buffer_update_type_khr config_types[1] = { CL_STRUCTURE_TYPE_MUTABLE_DISPATCH_CONFIG_KHR