From 6610facd98c5d54bb7c391fce597823bdb9ed4c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Fri, 13 Dec 2019 13:25:03 +0000 Subject: [PATCH] Remove duplicate imagearraycopy3d test from the compatibility basic suite (#520) The only diffs are: - The non-compatibility version relies on the queue being in-order to remove one explicit dependency. This isn't directly related to the functionality under test. - A memory leak was fixed in the non-compatibility suite Signed-off-by: Kevin Petit --- .../test_conformance/basic/CMakeLists.txt | 1 - .../test_conformance/basic/main.c | 1 - .../basic/test_imagearraycopy3d.c | 144 ------------------ 3 files changed, 146 deletions(-) delete mode 100644 test_conformance/compatibility/test_conformance/basic/test_imagearraycopy3d.c diff --git a/test_conformance/compatibility/test_conformance/basic/CMakeLists.txt b/test_conformance/compatibility/test_conformance/basic/CMakeLists.txt index 37d48b4a..9b17bab2 100644 --- a/test_conformance/compatibility/test_conformance/basic/CMakeLists.txt +++ b/test_conformance/compatibility/test_conformance/basic/CMakeLists.txt @@ -4,7 +4,6 @@ set(${MODULE_NAME}_SOURCES main.c test_readimage.c test_writeimage.c - test_imagearraycopy3d.c test_async_copy.cpp test_sizeof.c test_bufferreadwriterect.c diff --git a/test_conformance/compatibility/test_conformance/basic/main.c b/test_conformance/compatibility/test_conformance/basic/main.c index 385ab65f..43847fd7 100644 --- a/test_conformance/compatibility/test_conformance/basic/main.c +++ b/test_conformance/compatibility/test_conformance/basic/main.c @@ -36,7 +36,6 @@ test_definition test_list[] = { ADD_TEST( writeimage ), ADD_TEST( bufferreadwriterect ), - ADD_TEST( imagearraycopy3d ), ADD_TEST( async_copy_global_to_local ), ADD_TEST( async_copy_local_to_global ), diff --git a/test_conformance/compatibility/test_conformance/basic/test_imagearraycopy3d.c b/test_conformance/compatibility/test_conformance/basic/test_imagearraycopy3d.c deleted file mode 100644 index a413644c..00000000 --- a/test_conformance/compatibility/test_conformance/basic/test_imagearraycopy3d.c +++ /dev/null @@ -1,144 +0,0 @@ -// -// Copyright (c) 2017 The Khronos Group Inc. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -#include "harness/compat.h" - -#include -#include -#include -#include - -#include "procs.h" - -int test_imagearraycopy3d_single_format(cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format) -{ - cl_uchar *imgptr, *bufptr; - clMemWrapper image, buffer; - int img_width = 128; - int img_height = 128; - int img_depth = 32; - size_t elem_size; - size_t buffer_size; - int i; - cl_int err; - MTdata d; - cl_event copyevent; - - log_info("Testing %s %s\n", GetChannelOrderName(format->image_channel_order), GetChannelTypeName(format->image_channel_data_type)); - - image = create_image_3d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), format, img_width, img_height, img_depth, 0, 0, NULL, &err); - test_error(err, "create_image_3d failed"); - - err = clGetImageInfo(image, CL_IMAGE_ELEMENT_SIZE, sizeof(size_t), &elem_size, NULL); - test_error(err, "clGetImageInfo failed"); - - buffer_size = sizeof(cl_uchar) * elem_size * img_width * img_height * img_depth; - - buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), buffer_size, NULL, &err); - test_error(err, "clCreateBuffer failed"); - - imgptr = (cl_uchar*)malloc(buffer_size); - - d = init_genrand( gRandomSeed ); - imgptr = (cl_uchar*)malloc(buffer_size); - for (i=0; i<(int)buffer_size; i++) { - imgptr[i] = (cl_uchar)genrand_int32(d); - } - free_mtdata(d); d = NULL; - - size_t origin[3]={0,0,0}, region[3]={img_width,img_height,img_depth}; - err = clEnqueueWriteImage( queue, image, CL_TRUE, origin, region, 0, 0, imgptr, 0, NULL, NULL ); - test_error(err, "clEnqueueWriteBuffer failed"); - - err = clEnqueueCopyImageToBuffer( queue, image, buffer, origin, region, 0, 0, NULL, ©event ); - test_error(err, "clEnqueueCopyImageToBuffer failed"); - - bufptr = (cl_uchar*)malloc(buffer_size); - - err = clEnqueueReadBuffer( queue, buffer, CL_TRUE, 0, buffer_size, bufptr, 1, ©event, NULL); - test_error(err, "clEnqueueReadBuffer failed"); - - if (memcmp(imgptr, bufptr, buffer_size) != 0) { - log_error( "ERROR: Results did not validate!\n" ); - unsigned char * inchar = (unsigned char*)imgptr; - unsigned char * outchar = (unsigned char*)bufptr; - int failuresPrinted = 0; - int i; - for (i=0; i< (int)buffer_size; i+=(int)elem_size) { - int failed = 0; - int j; - for (j=0; j<(int)elem_size; j++) - if (inchar[i+j] != outchar[i+j]) - failed = 1; - char values[4096]; - values[0] = 0; - if (failed) { - sprintf(values + strlen(values), "%d(0x%x) -> actual [", i, i); - int j; - for (j=0; j<(int)elem_size; j++) - sprintf(values + strlen( values), "0x%02x ", inchar[i+j]); - sprintf(values + strlen(values), "] != expected ["); - for (j=0; j<(int)elem_size; j++) - sprintf(values + strlen( values), "0x%02x ", outchar[i+j]); - sprintf(values + strlen(values), "]"); - log_error("%s\n", values); - failuresPrinted++; - } - if (failuresPrinted > 5) { - log_error("Not printing further failures...\n"); - break; - } - } - err = -1; - } - - free(imgptr); - free(bufptr); - - if (err) - log_error("IMAGE3D to ARRAY copy test failed for image_channel_order=0x%lx and image_channel_data_type=0x%lx\n", - (unsigned long)format->image_channel_order, (unsigned long)format->image_channel_data_type); - - return err; -} - -int test_imagearraycopy3d(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) -{ - cl_int err; - cl_image_format *formats; - cl_uint num_formats; - cl_uint i; - - PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( device ) - - err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE3D, 0, NULL, &num_formats); - test_error(err, "clGetSupportedImageFormats failed"); - - formats = (cl_image_format *)malloc(num_formats * sizeof(cl_image_format)); - - err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE3D, num_formats, formats, NULL); - test_error(err, "clGetSupportedImageFormats failed"); - - for (i = 0; i < num_formats; i++) { - err |= test_imagearraycopy3d_single_format(device, context, queue, &formats[i]); - } - - if (err) - log_error("IMAGE3D to ARRAY copy test failed\n"); - else - log_info("IMAGE3D to ARRAY copy test passed\n"); - - return err; -}