mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Limit buffers sizes to leave some memory for the platform (#1172)
Some conformance tests use directly the size returned by the runtime for max memory size to allocate buffers. This doesn't leave enough memory for the system to run the tests.
This commit is contained in:
@@ -37,15 +37,20 @@ int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_im
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, sizeof( maxArraySize ), &maxArraySize, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( memSize ), &memSize, NULL );
|
||||
error |= clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE,
|
||||
sizeof(maxArraySize), &maxArraySize, NULL);
|
||||
test_error( error, "Unable to get max image 1D array size from device" );
|
||||
|
||||
if (memSize > (cl_ulong)SIZE_MAX) {
|
||||
memSize = (cl_ulong)SIZE_MAX;
|
||||
maxAllocSize = (cl_ulong)SIZE_MAX;
|
||||
}
|
||||
/* Reduce the size used by the test by half */
|
||||
maxAllocSize = get_device_info_max_mem_alloc_size(
|
||||
device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
|
||||
memSize =
|
||||
get_device_info_global_mem_size(device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
|
||||
|
||||
if (memSize > (cl_ulong)SIZE_MAX)
|
||||
{
|
||||
memSize = (cl_ulong)SIZE_MAX;
|
||||
}
|
||||
|
||||
if( gTestSmallImages )
|
||||
{
|
||||
@@ -162,15 +167,20 @@ int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_im
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE, sizeof( maxArraySize ), &maxArraySize, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_MAX_MEM_ALLOC_SIZE, sizeof( maxAllocSize ), &maxAllocSize, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_GLOBAL_MEM_SIZE, sizeof( memSize ), &memSize, NULL );
|
||||
error |= clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_ARRAY_SIZE,
|
||||
sizeof(maxArraySize), &maxArraySize, NULL);
|
||||
test_error( error, "Unable to get max image 1D array size from device" );
|
||||
|
||||
if (memSize > (cl_ulong)SIZE_MAX) {
|
||||
memSize = (cl_ulong)SIZE_MAX;
|
||||
maxAllocSize = (cl_ulong)SIZE_MAX;
|
||||
}
|
||||
/* Reduce the size used by the test by half */
|
||||
maxAllocSize = get_device_info_max_mem_alloc_size(
|
||||
device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
|
||||
memSize =
|
||||
get_device_info_global_mem_size(device, MAX_DEVICE_MEMORY_SIZE_DIVISOR);
|
||||
|
||||
if (memSize > (cl_ulong)SIZE_MAX)
|
||||
{
|
||||
memSize = (cl_ulong)SIZE_MAX;
|
||||
}
|
||||
|
||||
if( gTestSmallImages )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user