Check max work group size in test basic (#414)

The test enqueued_local_size in test_basic used a
local work group size larger than the minimum max
supported work group size supported by some platforms.

This change checks the max and clamps to it if
requested size would be larger than supported.

Signed-off-by: Sam Laynton <sam.laynton@arm.com>
This commit is contained in:
Sam Laynton
2019-08-05 11:26:17 +01:00
committed by Kévin Petit
parent da313500a5
commit 12bc0c1f3f

View File

@@ -91,8 +91,14 @@ test_enqueued_local_size(cl_device_id device, cl_context context, cl_command_que
globalsize[0] = (size_t)num_elements;
globalsize[1] = (size_t)num_elements;
localsize[0] = 16;
localsize[1] = 11;
size_t max_wgs;
err = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof(max_wgs), &max_wgs, NULL);
test_error( err, "clGetDeviceInfo failed.");
localsize[0] = MIN(16, max_wgs);
localsize[1] = MIN(11, max_wgs / localsize[0]);
err = clEnqueueNDRangeKernel(queue, kernel[1], 2, NULL, globalsize, localsize, 0, NULL, NULL);
test_error( err, "clEnqueueNDRangeKernel failed.");