Allocations fixes (#1245)

* allocations: Run buffer non-blocking even without images

Testing buffer non-blocking should not be dependent on whether images
are supported by a device or not.

* allocations: Fix typos
This commit is contained in:
Pierre Moreau
2021-05-18 19:12:55 +02:00
committed by GitHub
parent 6c8045911a
commit de49d59c8d
3 changed files with 10 additions and 6 deletions

View File

@@ -200,8 +200,10 @@ int fill_image_with_data(cl_context context, cl_device_id device_id, cl_command_
result = clFinish(*queue);
if (result != SUCCEEDED)
{
print_error(error, "clFinish failed after successful enquing filling buffer with data.");
return result;
print_error(error,
"clFinish failed after successful enqueuing filling "
"buffer with data.");
return result;
}
} else {
error = clEnqueueWriteImage(*queue, mem, CL_FALSE, origin, region, 0, 0, data, 0, NULL, &event);

View File

@@ -37,8 +37,8 @@ int find_good_image_size(cl_device_id device_id, size_t size_to_allocate, size_t
}
if (size_to_allocate == 0) {
log_error("Trying to allcoate a zero sized image.\n");
return FAILED_ABORT;
log_error("Trying to allocate a zero sized image.\n");
return FAILED_ABORT;
}
error = clGetDeviceInfo( device_id, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( max_width ), &max_width, NULL );

View File

@@ -112,6 +112,8 @@ int doTest( cl_device_id device, cl_context context, cl_command_queue queue, All
int number_of_mems_used;
cl_ulong max_individual_allocation_size = g_max_individual_allocation_size;
cl_ulong global_mem_size = g_global_mem_size ;
const bool allocate_image =
(alloc_type != BUFFER) && (alloc_type != BUFFER_NON_BLOCKING);
static const char* alloc_description[] = {
"buffer(s)",
@@ -123,7 +125,7 @@ int doTest( cl_device_id device, cl_context context, cl_command_queue queue, All
};
// Skip image tests if we don't support images on the device
if( alloc_type > BUFFER && checkForImageSupport( device ) )
if (allocate_image && checkForImageSupport(device))
{
log_info( "Can not test image allocation because device does not support images.\n" );
return 0;
@@ -132,7 +134,7 @@ int doTest( cl_device_id device, cl_context context, cl_command_queue queue, All
// This section was added in order to fix a bug in the test
// If CL_DEVICE_MAX_MEM_ALLOC_SIZE is much grater than CL_DEVICE_IMAGE2D_MAX_WIDTH * CL_DEVICE_IMAGE2D_MAX_HEIGHT
// The test will fail in image allocations as the size requested for the allocation will be much grater than the maximum size allowed for image
if( ( alloc_type != BUFFER ) && ( alloc_type != BUFFER_NON_BLOCKING ) )
if (allocate_image)
{
size_t max_width, max_height;