Khronos Bug 15347 fix for the same issue in the compatibility tests (#81)

This commit is contained in:
Grzegorz Wawiorko
2019-03-18 11:00:15 +01:00
committed by Kévin Petit
parent a0ef00101f
commit db29c68146
2 changed files with 29 additions and 9 deletions

View File

@@ -493,29 +493,33 @@ int test_min_max_mem_alloc_size(cl_device_id deviceID, cl_context context, cl_co
error = clGetDeviceInfo( deviceID, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( memSize ), &memSize, NULL );
test_error( error, "Unable to get global memory size from device" );
if (memSize > (cl_ulong)SIZE_MAX) {
memSize = (cl_ulong)SIZE_MAX;
}
if( maxAllocSize < requiredAllocSize)
{
log_error( "ERROR: Reported max allocation size is less than required %lldMB! (%llu or %lluMB, from a total mem size of %lldMB)\n", (requiredAllocSize / 1024) / 1024, maxAllocSize, (maxAllocSize / 1024)/1024, (memSize / 1024)/1024 );
return -1;
}
if( maxAllocSize < memSize / 4 )
requiredAllocSize = ((memSize / 4) > (1024 * 1024 * 1024)) ? 1024 * 1024 * 1024 : memSize / 4;
if (gIsEmbedded)
requiredAllocSize = (requiredAllocSize < 1 * 1024 * 1024) ? 1 * 1024 * 1024 : requiredAllocSize;
else
requiredAllocSize = (requiredAllocSize < 128 * 1024 * 1024) ? 128 * 1024 * 1024 : requiredAllocSize;
if( maxAllocSize < requiredAllocSize )
{
log_error( "ERROR: Reported max allocation size is less than required 1/4 of total memory! (%llu or %lluMB, from a total mem size of %lluMB)\n", maxAllocSize, (maxAllocSize / 1024)/1024, (memSize / 1024)/1024 );
log_error( "ERROR: Reported max allocation size is less than required of total memory! (%llu or %lluMB, from a total mem size of %lluMB)\n", maxAllocSize, (maxAllocSize / 1024)/1024, (requiredAllocSize / 1024)/1024 );
return -1;
}
log_info("Reported max allocation size of %lld bytes (%gMB) and global mem size of %lld bytes (%gMB).\n",
maxAllocSize, maxAllocSize/(1024.0*1024.0), memSize, memSize/(1024.0*1024.0));
maxAllocSize, maxAllocSize/(1024.0*1024.0), requiredAllocSize, requiredAllocSize/(1024.0*1024.0));
if ( memSize < maxAllocSize ) {
log_info("Global memory size is less than max allocation size, using that.\n");
maxAllocSize = memSize;
}
if ( maxAllocSize > (cl_ulong)4 * 1024 * 1024 * 1024) {
log_info("Limiting max allocation size to 4GB for test.\n");
maxAllocSize = (cl_ulong)4 * 1024 * 1024 * 1024;
}
minSizeToTry = maxAllocSize/16;
@@ -1298,7 +1302,7 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context,
clMemWrapper streams[3];
size_t threads[1], localThreads[1];
cl_int *constantData, *resultData;
cl_ulong maxSize, stepSize, currentSize;
cl_ulong maxSize, stepSize, currentSize, maxGlobalSize, maxAllocSize;
int i;
cl_event event;
cl_int event_status;
@@ -1316,6 +1320,14 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context,
log_info("Reported max constant buffer size of %lld bytes.\n", maxSize);
error = clGetDeviceInfo(deviceID, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof(maxGlobalSize), &maxGlobalSize, 0);
test_error(error, "Unable to get CL_DEVICE_GLOBAL_MEM_SIZE");
if (maxSize > maxGlobalSize / 8)
maxSize = maxGlobalSize / 8;
error = clGetDeviceInfo(deviceID, CL_DEVICE_MAX_MEM_ALLOC_SIZE , sizeof(maxAllocSize), &maxAllocSize, 0);
test_error(error, "Unable to get CL_DEVICE_MAX_MEM_ALLOC_SIZE ");
if (maxSize > maxAllocSize)
maxSize = maxAllocSize;
/* Create a kernel to test with */
if( create_single_kernel_helper( context, &program, &kernel, 1, sample_const_arg_kernel, "sample_test" ) != 0 )
{

View File

@@ -99,7 +99,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;
@@ -110,6 +110,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);