mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Refactor clCopyImage and clFillImage tests (#2283)
This change mainly extends `clFillImage` and `clCopyImage` test function to include memory flags to be used during creating the image instead of hard-coding these values. The memory flags are also different parameters for source and destination images in `clCopyImage` tests. --------- Signed-off-by: Michael Rizkalla <michael.rizkalla@arm.com>
This commit is contained in:
@@ -58,7 +58,9 @@ int test_fill_image_size_1D( cl_context context, cl_command_queue queue, image_d
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_1D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_image_format *format,
|
||||
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -71,6 +73,7 @@ int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
|
||||
@@ -60,7 +60,11 @@ int test_fill_image_size_1D_array( cl_context context, cl_command_queue queue, i
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_1D_array(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth, maxArraySize;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -73,6 +77,7 @@ int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
|
||||
@@ -71,6 +71,7 @@ int test_fill_image_size_1D_buffer(cl_context context, cl_command_queue queue,
|
||||
int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth;
|
||||
@@ -84,6 +85,7 @@ int test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_BUFFER;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size(imageInfo.format);
|
||||
|
||||
int error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_MAX_BUFFER_SIZE,
|
||||
|
||||
@@ -60,7 +60,9 @@ int test_fill_image_size_2D( cl_context context, cl_command_queue queue, image_d
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_2D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_image_format *format,
|
||||
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth, maxHeight;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -73,6 +75,7 @@ int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
|
||||
@@ -62,7 +62,11 @@ static int test_fill_image_2D_array( cl_context context, cl_command_queue queue,
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_2D_array(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth, maxHeight, maxArraySize;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -76,6 +80,7 @@ int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D_ARRAY;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE2D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
|
||||
@@ -62,7 +62,9 @@ int test_fill_image_3D( cl_context context, cl_command_queue queue, image_descri
|
||||
}
|
||||
|
||||
|
||||
int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType )
|
||||
int test_fill_image_set_3D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_image_format *format,
|
||||
cl_mem_flags mem_flags, ExplicitType outputType)
|
||||
{
|
||||
size_t maxWidth, maxHeight, maxDepth;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
@@ -76,6 +78,7 @@ int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
||||
memset(&imageInfo, 0x0, sizeof(image_descriptor));
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE3D;
|
||||
imageInfo.format = format;
|
||||
imageInfo.mem_flags = mem_flags;
|
||||
pixelSize = get_pixel_size( imageInfo.format );
|
||||
|
||||
int error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof( maxWidth ), &maxWidth, NULL );
|
||||
|
||||
@@ -18,19 +18,38 @@
|
||||
|
||||
extern int gTypesToTest;
|
||||
|
||||
extern int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
||||
extern int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
||||
extern int test_fill_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
||||
extern int test_fill_image_set_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
||||
extern int test_fill_image_set_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType );
|
||||
extern int test_fill_image_set_1D_buffer(cl_device_id device,
|
||||
cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
ExplicitType outputType);
|
||||
extern int test_fill_image_set_1D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType);
|
||||
extern int test_fill_image_set_2D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType);
|
||||
extern int test_fill_image_set_3D(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType);
|
||||
extern int test_fill_image_set_1D_array(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType);
|
||||
extern int test_fill_image_set_2D_array(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue,
|
||||
cl_image_format *format,
|
||||
cl_mem_flags mem_flags,
|
||||
ExplicitType outputType);
|
||||
extern int
|
||||
test_fill_image_set_1D_buffer(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_image_format *format,
|
||||
cl_mem_flags mem_flags, ExplicitType outputType);
|
||||
typedef int (*test_func)(cl_device_id device, cl_context context,
|
||||
cl_command_queue queue, cl_image_format *format,
|
||||
ExplicitType outputType);
|
||||
cl_mem_flags mem_flags, ExplicitType outputType);
|
||||
|
||||
int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod, cl_mem_flags flags )
|
||||
{
|
||||
@@ -105,7 +124,7 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
||||
gTestCount++;
|
||||
|
||||
int test_return =
|
||||
test_fn(device, context, queue, &formatList[i],
|
||||
test_fn(device, context, queue, &formatList[i], flags,
|
||||
test.explicitType);
|
||||
if (test_return)
|
||||
{
|
||||
@@ -128,8 +147,12 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q
|
||||
int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod )
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
ret += test_image_type( device, context, queue, testMethod, CL_MEM_READ_ONLY );
|
||||
cl_mem_flags flags = CL_MEM_READ_ONLY;
|
||||
if (gEnablePitch && testMethod != k1DBuffer)
|
||||
{
|
||||
flags |= CL_MEM_USE_HOST_PTR;
|
||||
}
|
||||
ret += test_image_type(device, context, queue, testMethod, flags);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user