mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Fix bug in mutable_command_full_dispatch (#2082)
This test did not pass the `-cl-std=` flag when building the program. As a result, for an OpenCL 3.0 device, the program will be "compiled using the highest OpenCL C 1.x language version supported" by the device. However this will force uniform work-group sizes which leads to a `CL_INVALID_WORK_GROUP_SIZE` error. To fix this, use the `create_single_kernel_helper()` helper function which will automatically get the device version and pass that to `-cl-std=` when building the program. --------- Signed-off-by: Gorazd Sumkovski <gorazd.sumkovski@arm.com>
This commit is contained in:
committed by
GitHub
parent
1a17853e75
commit
6a2c0b1cff
@@ -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;
|
||||
}
|
||||
|
||||
@@ -303,6 +299,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);
|
||||
@@ -384,18 +385,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
|
||||
|
||||
Reference in New Issue
Block a user