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:
arm-wk
2024-08-06 17:32:08 +01:00
committed by GitHub
parent 995e46590e
commit f47354680f
10 changed files with 186 additions and 170 deletions

View File

@@ -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 )
{