mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Add check for Read-Write images support (#965)
* Fix enqueue_flags test to use correct barrier type. Currently, enqueue_flags test uses CLK_LOCAL_MEM_FENCE. Use CLK_GLOBAL_MEM_FENCE instead as all threads across work-groups need to wait here. * Add check for support for Read-Wrie images Read-Write images have required OpenCL 2.x. Read-Write image tests are already being skipped for 1.x devices. With OpenCL 3.0, read-write images being optional, the tests should be run or skipped depending on the implementation support. Add a check to decide if Read-Write images are supported or required to be supported depending on OpenCL version and decide if the tests should be run on skipped. Fixes issue #894 * Fix formatting in case of Read-Write image checks. Fix formatting in case of Read-write image checks. Also, combine two ifs into one in case of kerne_read_write tests * Fix some more formatting for RW-image checks Remove unnecessary spaces at various places. Also, fix lengthy lines.
This commit is contained in:
@@ -1467,6 +1467,43 @@ int checkFor3DImageSupport( cl_device_id device )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int checkForReadWriteImageSupport(cl_device_id device)
|
||||
{
|
||||
if (checkForImageSupport(device))
|
||||
{
|
||||
return CL_IMAGE_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
auto device_cl_version = get_device_cl_version(device);
|
||||
if (device_cl_version >= Version(3, 0))
|
||||
{
|
||||
// In OpenCL 3.0, Read-Write images are optional.
|
||||
// Check if they are supported.
|
||||
cl_uint are_rw_images_supported{};
|
||||
test_error(
|
||||
clGetDeviceInfo(device, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS,
|
||||
sizeof(are_rw_images_supported),
|
||||
&are_rw_images_supported, nullptr),
|
||||
"clGetDeviceInfo failed for CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS\n");
|
||||
if (0 == are_rw_images_supported)
|
||||
{
|
||||
log_info("READ_WRITE_IMAGE tests skipped, not supported.\n");
|
||||
return CL_IMAGE_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
}
|
||||
// READ_WRITE images are not supported on 1.X devices.
|
||||
else if (device_cl_version < Version(2, 0))
|
||||
{
|
||||
log_info("READ_WRITE_IMAGE tests skipped, Opencl 2.0+ is requried.");
|
||||
return CL_IMAGE_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
// Support for read-write image arguments is required
|
||||
// for an 2.X device if the device supports images.
|
||||
|
||||
/* So our support is good */
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t get_min_alignment(cl_context context)
|
||||
{
|
||||
static cl_uint align_size = 0;
|
||||
|
||||
@@ -141,6 +141,7 @@ extern test_status verifyImageSupport( cl_device_id device );
|
||||
/* Checks that the given device supports images. Same as verify, but doesn't print an error */
|
||||
extern int checkForImageSupport( cl_device_id device );
|
||||
extern int checkFor3DImageSupport( cl_device_id device );
|
||||
extern int checkForReadWriteImageSupport(cl_device_id device);
|
||||
|
||||
/* Checks that a given queue property is supported on the specified device. Returns 1 if supported, 0 if not or an error. */
|
||||
extern int checkDeviceForQueueSupport( cl_device_id device, cl_command_queue_properties prop );
|
||||
|
||||
@@ -177,11 +177,10 @@ static int doTest( cl_device_id device, cl_context context, cl_command_queue que
|
||||
}
|
||||
}
|
||||
|
||||
if (testTypesToRun & kReadWriteTests) {
|
||||
if (gDeviceLt20) {
|
||||
log_info("TEST skipped, Opencl 2.0 + requried for this test");
|
||||
return ret;
|
||||
}
|
||||
if ((testTypesToRun & kReadWriteTests)
|
||||
&& checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
if( ( testTypesToRun & kReadWriteTests ) && !gTestMipmaps )
|
||||
|
||||
@@ -201,6 +201,11 @@ int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_
|
||||
image_descriptor imageInfo = { 0 };
|
||||
size_t pixelSize;
|
||||
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
imageInfo.format = format;
|
||||
imageInfo.depth = imageInfo.arraySize = imageInfo.slicePitch = 0;
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE2D;
|
||||
|
||||
@@ -109,9 +109,9 @@ int test_image_set( cl_device_id device, cl_context context, cl_command_queue qu
|
||||
gDeviceLt20 = true;
|
||||
}
|
||||
|
||||
if (gDeviceLt20 && gTestReadWrite) {
|
||||
log_info("TEST skipped, Opencl 2.0 + requried for this test");
|
||||
return ret;
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
// This flag is only for querying the list of supported formats
|
||||
|
||||
@@ -196,6 +196,11 @@ int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_
|
||||
RandomSeed seed( gRandomSeed );
|
||||
int error;
|
||||
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
// Get our operating params
|
||||
size_t maxWidth;
|
||||
cl_ulong maxAllocSize, memSize;
|
||||
|
||||
@@ -198,6 +198,11 @@ int test_read_image_set_1D_array( cl_device_id device, cl_context context, cl_co
|
||||
image_descriptor imageInfo = { 0 };
|
||||
size_t pixelSize;
|
||||
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
imageInfo.format = format;
|
||||
imageInfo.height = imageInfo.depth = 0;
|
||||
imageInfo.type = CL_MEM_OBJECT_IMAGE1D_ARRAY;
|
||||
|
||||
@@ -176,6 +176,11 @@ int test_read_image_set_2D_array( cl_device_id device, cl_context context, cl_co
|
||||
|
||||
int error;
|
||||
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
clProgramWrapper program;
|
||||
clKernelWrapper kernel;
|
||||
|
||||
|
||||
@@ -179,6 +179,11 @@ int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_
|
||||
|
||||
int error;
|
||||
|
||||
if (gTestReadWrite && checkForReadWriteImageSupport(device))
|
||||
{
|
||||
return TEST_SKIPPED_ITSELF;
|
||||
}
|
||||
|
||||
clProgramWrapper program;
|
||||
clKernelWrapper kernel;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user