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:
@@ -188,27 +188,15 @@ int allocate_size(cl_context context, cl_command_queue *queue,
|
||||
// one we don't end up returning a garbage value
|
||||
*number_of_mems = 0;
|
||||
|
||||
error = clGetDeviceInfo(device_id, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
|
||||
sizeof(max_individual_allocation_size),
|
||||
&max_individual_allocation_size, NULL);
|
||||
test_error_abort(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_MAX_MEM_ALLOC_SIZE");
|
||||
error = clGetDeviceInfo(device_id, CL_DEVICE_GLOBAL_MEM_SIZE,
|
||||
sizeof(global_mem_size), &global_mem_size, NULL);
|
||||
test_error_abort(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_GLOBAL_MEM_SIZE");
|
||||
max_individual_allocation_size =
|
||||
get_device_info_max_mem_alloc_size(device_id);
|
||||
global_mem_size = get_device_info_global_mem_size(device_id);
|
||||
|
||||
if (global_mem_size > (cl_ulong)SIZE_MAX)
|
||||
{
|
||||
global_mem_size = (cl_ulong)SIZE_MAX;
|
||||
}
|
||||
|
||||
// log_info("Device reports CL_DEVICE_MAX_MEM_ALLOC_SIZE=%llu bytes (%gMB),
|
||||
// CL_DEVICE_GLOBAL_MEM_SIZE=%llu bytes (%gMB).\n",
|
||||
// max_individual_allocation_size,
|
||||
// toMB(max_individual_allocation_size), global_mem_size,
|
||||
// toMB(global_mem_size));
|
||||
|
||||
if (size_to_allocate > global_mem_size)
|
||||
{
|
||||
log_error("Can not allocate more than the global memory size.\n");
|
||||
|
||||
@@ -24,8 +24,10 @@
|
||||
|
||||
typedef long long unsigned llu;
|
||||
|
||||
#define REDUCTION_PERCENTAGE_DEFAULT 50
|
||||
|
||||
int g_repetition_count = 1;
|
||||
int g_reduction_percentage = 100;
|
||||
int g_reduction_percentage = REDUCTION_PERCENTAGE_DEFAULT;
|
||||
int g_write_allocations = 1;
|
||||
int g_multiple_allocations = 0;
|
||||
int g_execute_kernel = 1;
|
||||
@@ -44,24 +46,9 @@ test_status init_cl(cl_device_id device)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = clGetDeviceInfo(device, CL_DEVICE_MAX_MEM_ALLOC_SIZE,
|
||||
sizeof(g_max_individual_allocation_size),
|
||||
&g_max_individual_allocation_size, NULL);
|
||||
if (error)
|
||||
{
|
||||
print_error(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_MAX_MEM_ALLOC_SIZE");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
error =
|
||||
clGetDeviceInfo(device, CL_DEVICE_GLOBAL_MEM_SIZE,
|
||||
sizeof(g_global_mem_size), &g_global_mem_size, NULL);
|
||||
if (error)
|
||||
{
|
||||
print_error(error,
|
||||
"clGetDeviceInfo failed for CL_DEVICE_GLOBAL_MEM_SIZE");
|
||||
return TEST_FAIL;
|
||||
}
|
||||
g_max_individual_allocation_size =
|
||||
get_device_info_max_mem_alloc_size(device);
|
||||
g_global_mem_size = get_device_info_global_mem_size(device);
|
||||
|
||||
log_info("Device reports CL_DEVICE_MAX_MEM_ALLOC_SIZE=%llu bytes (%gMB), "
|
||||
"CL_DEVICE_GLOBAL_MEM_SIZE=%llu bytes (%gMB).\n",
|
||||
|
||||
Reference in New Issue
Block a user