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:
@@ -39,15 +39,20 @@ int test_get_image_info_1D( cl_device_id device, cl_context context, cl_image_fo
|
||||
imageInfo.format = format;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, 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 );
|
||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE2D_MAX_WIDTH,
|
||||
sizeof(maxWidth), &maxWidth, NULL);
|
||||
test_error( error, "Unable to get max image 1D 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 )
|
||||
{
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
@@ -301,15 +301,20 @@ int test_get_image_info_2D( cl_device_id device, cl_context context, cl_image_fo
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
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_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_IMAGE2D_MAX_HEIGHT,
|
||||
sizeof(maxHeight), &maxHeight, NULL);
|
||||
test_error( error, "Unable to get max image 2D width or max image 3D height or max memory allocation size or global memory 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 )
|
||||
{
|
||||
|
||||
@@ -40,15 +40,20 @@ int test_get_image_info_3D( cl_device_id device, cl_context context, cl_image_fo
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof( maxHeight ), &maxHeight, NULL );
|
||||
error |= clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof( maxDepth ), &maxDepth, 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_IMAGE3D_MAX_DEPTH,
|
||||
sizeof(maxDepth), &maxDepth, NULL);
|
||||
test_error( error, "Unable to get max image 3D 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