Khronos Bug 15347 fixed code review issues + fix for a similar issue in basic constant test (#75)

This commit is contained in:
Grzegorz Wawiorko
2019-03-18 11:03:57 +01:00
committed by Kévin Petit
parent bb5b65e014
commit d631cc1858

View File

@@ -100,7 +100,7 @@ test_constant(cl_device_id device, cl_context context, cl_command_queue queue, i
size_t global_threads[3];
int err;
unsigned int i;
cl_ulong maxSize;
cl_ulong maxSize, maxGlobalSize, maxAllocSize;
size_t num_floats, num_ints, constant_values;
MTdata d;
RoundingMode oldRoundMode;
@@ -111,6 +111,14 @@ test_constant(cl_device_id device, cl_context context, cl_command_queue queue, i
test_error( err, "Unable to get max constant buffer size" );
log_info("Device reports CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE %llu bytes.\n", maxSize);
err = clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(maxGlobalSize), &maxGlobalSize, 0);
test_error(err, "Unable to get CL_DEVICE_GLOBAL_MEM_SIZE");
if (maxSize > maxGlobalSize / 4)
maxSize = maxGlobalSize / 4;
err = clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE , sizeof(maxAllocSize), &maxAllocSize, 0);
test_error(err, "Unable to get CL_DEVICE_MAX_MEM_ALLOC_SIZE ");
if (maxSize > maxAllocSize)
maxSize = maxAllocSize;
maxSize/=4;
num_ints = (size_t)maxSize/sizeof(cl_int);
num_floats = (size_t)maxSize/sizeof(cl_float);