From f627a68dd69afada7ee42271dc377579f4f8a9cb Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Thu, 17 Sep 2020 02:36:43 -0600 Subject: [PATCH 01/37] device_execution: Modify the check in profiling subtest (#962) As per the spec CL_PROFILING_COMMAND_COMPLETE is required to be equal to CL_PROFILING_COMMAND_END only on devices that do not support the on-device queue. For other cases it can be >= CL_PROFILING_COMMAND_END --- .../device_execution/enqueue_profiling.cpp | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/test_conformance/device_execution/enqueue_profiling.cpp b/test_conformance/device_execution/enqueue_profiling.cpp index 75aeb4ec..8e5bab76 100644 --- a/test_conformance/device_execution/enqueue_profiling.cpp +++ b/test_conformance/device_execution/enqueue_profiling.cpp @@ -142,23 +142,12 @@ int test_enqueue_profiling(cl_device_id device, cl_context context, sizeof(complete), &complete, NULL); test_error(err_ret, "clGetEventProfilingInfo() failed"); - if (level == 0) + if (end > complete) { - if (end != complete) - { - log_error("Profiling END should be the same as COMPLETE for " - "kernels without children"); - return -1; - } - } - else - { - if (end > complete) - { - log_error("Profiling END should be smaller than COMPLETE for " - "kernels with device side children"); - return -1; - } + log_error( + "Profiling END should be smaller than or equal to COMPLETE for " + "kernels that use the on-device queue"); + return -1; } log_info("Profiling info for '%s' kernel is OK for level %d.\n", From 3db1a9b3aad15d272807c5ff6162a8b31515380c Mon Sep 17 00:00:00 2001 From: David Avedissian Date: Thu, 17 Sep 2020 09:42:58 +0100 Subject: [PATCH 02/37] Ensure that test_preprocessors checks __OPENCL_C_VERSION__ correctly for CL 3.0 contexts. (#938) --- test_common/harness/kernelHelpers.cpp | 125 ++++++++++++------ test_common/harness/kernelHelpers.h | 9 +- test_conformance/basic/test_preprocessors.cpp | 82 +++++------- 3 files changed, 126 insertions(+), 90 deletions(-) diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index bca058c8..f4a50169 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1584,43 +1584,8 @@ int printDeviceHeader( cl_device_id device ) Version get_device_cl_c_version(cl_device_id device) { - // Get the device OpenCL version. auto device_cl_version = get_device_cl_version(device); - // If the device version >= 3.0 it must support the - // CL_DEVICE_OPENCL_C_ALL_VERSIONS query from which we can extract the most - // recent CL C version supported by the device. - if (device_cl_version >= Version{ 3, 0 }) - { - size_t opencl_c_all_versions_size_in_bytes{}; - auto error = - clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, 0, nullptr, - &opencl_c_all_versions_size_in_bytes); - test_error_ret( - error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", - (Version{ -1, 0 })); - std::vector name_versions( - opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version)); - error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, - opencl_c_all_versions_size_in_bytes, - name_versions.data(), nullptr); - test_error_ret( - error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", - (Version{ -1, 0 })); - - Version max_supported_cl_c_version{}; - for (const auto &name_version : name_versions) - { - Version current_version{ CL_VERSION_MAJOR(name_version.version), - CL_VERSION_MINOR(name_version.version) }; - max_supported_cl_c_version = - (current_version > max_supported_cl_c_version) - ? current_version - : max_supported_cl_c_version; - } - return max_supported_cl_c_version; - } - // The second special case is OpenCL-1.0 where CL_DEVICE_OPENCL_C_VERSION // did not exist, but since this is just the first version we can // return 1.0. @@ -1656,6 +1621,47 @@ Version get_device_cl_c_version(cl_device_id device) return Version{ major - '0', minor - '0' }; } +Version get_device_latest_cl_c_version(cl_device_id device) +{ + auto device_cl_version = get_device_cl_version(device); + + // If the device version >= 3.0 it must support the + // CL_DEVICE_OPENCL_C_ALL_VERSIONS query from which we can extract the most + // recent CL C version supported by the device. + if (device_cl_version >= Version{ 3, 0 }) + { + size_t opencl_c_all_versions_size_in_bytes{}; + auto error = + clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, 0, nullptr, + &opencl_c_all_versions_size_in_bytes); + test_error_ret( + error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", + (Version{ -1, 0 })); + std::vector name_versions( + opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version)); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, + opencl_c_all_versions_size_in_bytes, + name_versions.data(), nullptr); + test_error_ret( + error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", + (Version{ -1, 0 })); + + Version max_supported_cl_c_version{}; + for (const auto &name_version : name_versions) + { + Version current_version{ CL_VERSION_MAJOR(name_version.version), + CL_VERSION_MINOR(name_version.version) }; + max_supported_cl_c_version = + (current_version > max_supported_cl_c_version) + ? current_version + : max_supported_cl_c_version; + } + return max_supported_cl_c_version; + } + + return get_device_cl_c_version(device); +} + Version get_max_OpenCL_C_for_context(cl_context context) { // Get all the devices in the context and find the maximum @@ -1669,10 +1675,11 @@ Version get_max_OpenCL_C_for_context(cl_context context) / sizeof(cl_device_id)); error = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size_in_bytes, devices.data(), nullptr); - auto current_version = get_device_cl_c_version(devices[0]); + auto current_version = get_device_latest_cl_c_version(devices[0]); std::for_each(std::next(devices.begin()), devices.end(), [¤t_version](cl_device_id device) { - auto device_version = get_device_cl_c_version(device); + auto device_version = + get_device_latest_cl_c_version(device); // OpenCL 3.0 is not backwards compatible with 2.0. // If we have 3.0 and 2.0 in the same driver we // use 1.2. @@ -1694,6 +1701,50 @@ Version get_max_OpenCL_C_for_context(cl_context context) return current_version; } +bool device_supports_cl_c_version(cl_device_id device, Version version) +{ + auto device_cl_version = get_device_cl_version(device); + + // In general, a device does not support an OpenCL C version if it is <= + // CL_DEVICE_OPENCL_C_VERSION AND it does not appear in the + // CL_DEVICE_OPENCL_C_ALL_VERSIONS query. + + // If the device version >= 3.0 it must support the + // CL_DEVICE_OPENCL_C_ALL_VERSIONS query, and the version of OpenCL C being + // used must appear in the query result if it's <= + // CL_DEVICE_OPENCL_C_VERSION. + if (device_cl_version >= Version{ 3, 0 }) + { + size_t opencl_c_all_versions_size_in_bytes{}; + auto error = + clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, 0, nullptr, + &opencl_c_all_versions_size_in_bytes); + test_error_ret( + error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", + (false)); + std::vector name_versions( + opencl_c_all_versions_size_in_bytes / sizeof(cl_name_version)); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, + opencl_c_all_versions_size_in_bytes, + name_versions.data(), nullptr); + test_error_ret( + error, "clGetDeviceInfo failed for CL_DEVICE_OPENCL_C_ALL_VERSIONS", + (false)); + + for (const auto &name_version : name_versions) + { + Version current_version{ CL_VERSION_MAJOR(name_version.version), + CL_VERSION_MINOR(name_version.version) }; + if (current_version == version) + { + return true; + } + } + } + + return version <= get_device_cl_c_version(device); +} + bool poll_until(unsigned timeout_ms, unsigned interval_ms, std::function fn) { diff --git a/test_common/harness/kernelHelpers.h b/test_common/harness/kernelHelpers.h index 7f972070..c5ff5d0d 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.h @@ -175,14 +175,21 @@ cl_device_fp_config get_default_rounding_mode( cl_device_id device ); /* Prints out the standard device header for all tests given the device to print for */ extern int printDeviceHeader( cl_device_id device ); +// Execute the CL_DEVICE_OPENCL_C_VERSION query and return the OpenCL C version +// is supported by the device. +Version get_device_cl_c_version(cl_device_id device); + // Gets the latest (potentially non-backward compatible) OpenCL C version // supported by the device. -Version get_device_cl_c_version(cl_device_id device); +Version get_device_latest_cl_c_version(cl_device_id device); // Gets the maximum universally supported OpenCL C version in a context, i.e. // the OpenCL C version supported by all devices in a context. Version get_max_OpenCL_C_for_context(cl_context context); +// Checks whether a particular OpenCL C version is supported by the device. +bool device_supports_cl_c_version(cl_device_id device, Version version); + // Poll fn every interval_ms until timeout_ms or it returns true bool poll_until(unsigned timeout_ms, unsigned interval_ms, std::function fn); diff --git a/test_conformance/basic/test_preprocessors.cpp b/test_conformance/basic/test_preprocessors.cpp index 332f99de..73f75fb0 100644 --- a/test_conformance/basic/test_preprocessors.cpp +++ b/test_conformance/basic/test_preprocessors.cpp @@ -213,33 +213,15 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c // The OpenCL version reported by the macro reports the feature level supported by the compiler. Since // this doesn't directly match any property we can query, we just check to see if it's a sane value - char versionBuffer[ 128 ]; - error = clGetDeviceInfo( deviceID, CL_DEVICE_VERSION, sizeof( versionBuffer ), versionBuffer, NULL ); - test_error( error, "Unable to get device's version to validate against" ); - - // We need to parse to get the version number to compare against - char *p1, *p2, *p3; - for( p1 = versionBuffer; ( *p1 != 0 ) && !isdigit( *p1 ); p1++ ) - ; - for( p2 = p1; ( *p2 != 0 ) && ( *p2 != '.' ); p2++ ) - ; - for( p3 = p2; ( *p3 != 0 ) && ( *p3 != ' ' ); p3++ ) - ; - - if( p2 == p3 ) + auto device_cl_version = get_device_cl_version(deviceID); + int device_cl_version_int = device_cl_version.to_int() * 10; + if ((results[2] < 100) || (results[2] > device_cl_version_int)) { - log_error( "ERROR: Unable to verify OpenCL version string (platform string is incorrect format)\n" ); - return -1; - } - *p2 = 0; - *p3 = 0; - int major = atoi( p1 ); - int minor = atoi( p2 + 1 ); - int realVersion = ( major * 100 ) + ( minor * 10 ); - if( ( results[ 2 ] < 100 ) || ( results[ 2 ] > realVersion ) ) - { - log_error( "ERROR: Kernel preprocessor __OPENCL_VERSION__ does not make sense w.r.t. device's version string! " - "(preprocessor states %d, real version is %d (%d.%d))\n", results[ 2 ], realVersion, major, minor ); + log_error("ERROR: Kernel preprocessor __OPENCL_VERSION__ does not make " + "sense w.r.t. device's version string! " + "(preprocessor states %d, CL_DEVICE_VERSION is %d (%s))\n", + results[2], device_cl_version_int, + device_cl_version.to_string().c_str()); return -1; } @@ -250,33 +232,29 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c return -1; } - // The OpenCL C version reported by the macro reports the OpenCL C supported by the compiler for this OpenCL device. - char cVersionBuffer[ 128 ]; - error = clGetDeviceInfo( deviceID, CL_DEVICE_OPENCL_C_VERSION, sizeof( cVersionBuffer ), cVersionBuffer, NULL ); - test_error( error, "Unable to get device's OpenCL C version to validate against" ); - - // We need to parse to get the version number to compare against - for( p1 = cVersionBuffer; ( *p1 != 0 ) && !isdigit( *p1 ); p1++ ) - ; - for( p2 = p1; ( *p2 != 0 ) && ( *p2 != '.' ); p2++ ) - ; - for( p3 = p2; ( *p3 != 0 ) && ( *p3 != ' ' ); p3++ ) - ; - - if( p2 == p3 ) + // The OpenCL C version reported by the macro reports the OpenCL C version + // specified to the compiler. We need to see whether it is supported. + int cl_c_major_version = results[3] / 100; + int cl_c_minor_version = (results[3] / 10) % 10; + if ((results[3] < 100) + || (!device_supports_cl_c_version( + deviceID, Version{ cl_c_major_version, cl_c_minor_version }))) { - log_error( "ERROR: Unable to verify OpenCL C version string (platform string is incorrect format)\n" ); - return -1; - } - *p2 = 0; - *p3 = 0; - major = atoi( p1 ); - minor = atoi( p2 + 1 ); - realVersion = ( major * 100 ) + ( minor * 10 ); - if( ( results[ 3 ] < 100 ) || ( results[ 3 ] > realVersion ) ) - { - log_error( "ERROR: Kernel preprocessor __OPENCL_C_VERSION__ does not make sense w.r.t. device's version string! " - "(preprocessor states %d, real version is %d (%d.%d))\n", results[ 2 ], realVersion, major, minor ); + auto device_version = get_device_cl_c_version(deviceID); + log_error( + "ERROR: Kernel preprocessor __OPENCL_C_VERSION__ does not make " + "sense w.r.t. device's version string! " + "(preprocessor states %d, CL_DEVICE_OPENCL_C_VERSION is %d (%s))\n", + results[3], device_version.to_int() * 10, + device_version.to_string().c_str()); + log_error("This means that CL_DEVICE_OPENCL_C_VERSION < " + "__OPENCL_C_VERSION__"); + if (device_cl_version >= Version{ 3, 0 }) + { + log_error(", and __OPENCL_C_VERSION__ does not appear in " + "CL_DEVICE_OPENCL_C_ALL_VERSIONS"); + } + log_error("\n"); return -1; } From fffd4f24742529c7f83c4d1efdda1b04f9be9056 Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Mon, 21 Sep 2020 10:51:54 -0600 Subject: [PATCH 03/37] compiler: Modify the IL check code to check for an empty string (#964) The called function (get_device_info_string) subtracts 1 from length before returning it. Hence, to check for an empty string (that the spec requires the implementation to return when CL_DEVICE_IL_VERSION is not supported) the check should be modified to check for empty and not length == 1 --- test_conformance/compiler/test_unload_platform_compiler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_conformance/compiler/test_unload_platform_compiler.cpp b/test_conformance/compiler/test_unload_platform_compiler.cpp index e55bd93f..bb3ee95b 100644 --- a/test_conformance/compiler/test_unload_platform_compiler.cpp +++ b/test_conformance/compiler/test_unload_platform_compiler.cpp @@ -265,7 +265,7 @@ public: Version version = get_device_cl_version(device); std::string sILVersion = get_device_il_version_string(device); if ((version >= Version(2, 1) && version < Version(3, 0)) - || (version >= Version(3, 0) && sILVersion.length() != 1)) + || (version >= Version(3, 0) && !sILVersion.empty())) { m_CreateProgramWithIL = clCreateProgramWithIL; m_enabled = true; From aee9131f8708df172be5dda68cd50bbdcb0b33c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Tue, 22 Sep 2020 17:04:02 +0100 Subject: [PATCH 04/37] Print the latest conformance version passed reported by the device (#959) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #798 Signed-off-by: Kévin Petit --- test_common/harness/deviceInfo.cpp | 4 ++-- test_common/harness/deviceInfo.h | 5 +++++ test_common/harness/kernelHelpers.cpp | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/test_common/harness/deviceInfo.cpp b/test_common/harness/deviceInfo.cpp index 96a04f9a..83db2926 100644 --- a/test_common/harness/deviceInfo.cpp +++ b/test_common/harness/deviceInfo.cpp @@ -24,8 +24,8 @@ /* Helper to return a string containing device information for the specified * device info parameter. */ -static std::string get_device_info_string(cl_device_id device, - cl_device_info param_name) +std::string get_device_info_string(cl_device_id device, + cl_device_info param_name) { size_t size = 0; int err; diff --git a/test_common/harness/deviceInfo.h b/test_common/harness/deviceInfo.h index 87afdc60..300c6d38 100644 --- a/test_common/harness/deviceInfo.h +++ b/test_common/harness/deviceInfo.h @@ -23,6 +23,11 @@ #include +/* Helper to return a string containing device information for the specified + * device info parameter. */ +std::string get_device_info_string(cl_device_id device, + cl_device_info param_name); + /* Determines if an extension is supported by a device. */ int is_extension_available(cl_device_id device, const char *extensionName); diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index f4a50169..2139821a 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1579,6 +1579,15 @@ int printDeviceHeader( cl_device_id device ) deviceName, deviceVendor, deviceVersion, ( error == CL_SUCCESS ) ? ", CL C Version = " : "", ( error == CL_SUCCESS ) ? cLangVersion : "" ); + auto version = get_device_cl_version(device); + if (version >= Version(3, 0)) + { + auto ctsVersion = get_device_info_string( + device, CL_DEVICE_LATEST_CONFORMANCE_VERSION_PASSED); + log_info("Device latest conformance version passed: %s\n", + ctsVersion.c_str()); + } + return CL_SUCCESS; } From f7a093687944c9e045602a4ba84c2a348511bcd9 Mon Sep 17 00:00:00 2001 From: Nikhil Joshi Date: Tue, 22 Sep 2020 21:35:58 +0530 Subject: [PATCH 05/37] 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. --- test_common/harness/kernelHelpers.cpp | 37 +++++++++++++++++++ test_common/harness/kernelHelpers.h | 1 + .../images/kernel_read_write/main.cpp | 9 ++--- .../samplerlessReads/test_iterations.cpp | 5 +++ .../images/samplerlessReads/test_loops.cpp | 6 +-- .../images/samplerlessReads/test_read_1D.cpp | 5 +++ .../samplerlessReads/test_read_1D_array.cpp | 5 +++ .../samplerlessReads/test_read_2D_array.cpp | 5 +++ .../images/samplerlessReads/test_read_3D.cpp | 5 +++ 9 files changed, 70 insertions(+), 8 deletions(-) diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 2139821a..3f73638c 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -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; diff --git a/test_common/harness/kernelHelpers.h b/test_common/harness/kernelHelpers.h index c5ff5d0d..d78481e1 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.h @@ -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 ); diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 51d5c071..98506934 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -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 ) diff --git a/test_conformance/images/samplerlessReads/test_iterations.cpp b/test_conformance/images/samplerlessReads/test_iterations.cpp index 857fbc67..c33007f1 100644 --- a/test_conformance/images/samplerlessReads/test_iterations.cpp +++ b/test_conformance/images/samplerlessReads/test_iterations.cpp @@ -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; diff --git a/test_conformance/images/samplerlessReads/test_loops.cpp b/test_conformance/images/samplerlessReads/test_loops.cpp index e50d5d42..639efa80 100644 --- a/test_conformance/images/samplerlessReads/test_loops.cpp +++ b/test_conformance/images/samplerlessReads/test_loops.cpp @@ -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 diff --git a/test_conformance/images/samplerlessReads/test_read_1D.cpp b/test_conformance/images/samplerlessReads/test_read_1D.cpp index 173bc6f7..f38a2e64 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D.cpp @@ -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; diff --git a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp index 503a161d..c86250fc 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp @@ -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; diff --git a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp index 22fcffc3..fe221ee5 100644 --- a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp @@ -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; diff --git a/test_conformance/images/samplerlessReads/test_read_3D.cpp b/test_conformance/images/samplerlessReads/test_read_3D.cpp index 142d7225..e06a347c 100644 --- a/test_conformance/images/samplerlessReads/test_read_3D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_3D.cpp @@ -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; From 9178524d028b632b548383a9e4116b46305c765e Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Tue, 22 Sep 2020 18:08:32 +0200 Subject: [PATCH 06/37] Change Behaviour of C11 Atomic Tests for OpenCL-3.0 (#944) * Change setup code in `KernelCode()` to use `_explicit` builtin variants that are common to both OpenCL-2.X and OpenCL-3.0. * Only test optional supported builtin variants (`_explicit` signature memory_order/scope) for OpenCL-3.0. * Disable program scope global variable and generic address space tests for a OpenCL-3.0 driver which does not optionally support these features. --- test_common/harness/errorHelpers.h | 10 +- test_conformance/c11_atomics/common.cpp | 74 ++++++++++++++ test_conformance/c11_atomics/common.h | 98 +++++++++++-------- test_conformance/c11_atomics/main.cpp | 26 +++++ test_conformance/c11_atomics/test_atomics.cpp | 19 +++- 5 files changed, 179 insertions(+), 48 deletions(-) diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index 3238a956..0b083dd5 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -62,7 +62,15 @@ return TEST_FAIL; \ } #define test_error(errCode,msg) test_error_ret(errCode,msg,errCode) -#define test_error_ret(errCode,msg,retValue) { if( errCode != CL_SUCCESS ) { print_error( errCode, msg ); return retValue ; } } +#define test_error_ret(errCode, msg, retValue) \ + { \ + auto errCodeResult = errCode; \ + if (errCodeResult != CL_SUCCESS) \ + { \ + print_error(errCodeResult, msg); \ + return retValue; \ + } \ + } #define print_error(errCode,msg) log_error( "ERROR: %s! (%s from %s:%d)\n", msg, IGetErrorString( errCode ), __FILE__, __LINE__ ); #define test_missing_feature(errCode, msg) test_missing_feature_ret(errCode, msg, errCode) diff --git a/test_conformance/c11_atomics/common.cpp b/test_conformance/c11_atomics/common.cpp index bebad895..c0cd265a 100644 --- a/test_conformance/c11_atomics/common.cpp +++ b/test_conformance/c11_atomics/common.cpp @@ -206,3 +206,77 @@ template<> cl_long AtomicTypeExtendedInfo::MaxValue() {return CL_LONG_M template<> cl_ulong AtomicTypeExtendedInfo::MaxValue() {return CL_ULONG_MAX;} template<> cl_float AtomicTypeExtendedInfo::MaxValue() {return CL_FLT_MAX;} template<> cl_double AtomicTypeExtendedInfo::MaxValue() {return CL_DBL_MAX;} + +cl_int getSupportedMemoryOrdersAndScopes( + cl_device_id device, std::vector &memoryOrders, + std::vector &memoryScopes) +{ + // The CL_DEVICE_ATOMIC_MEMORY_CAPABILITES is missing before 3.0, but since + // all orderings and scopes are required for 2.X devices and this test is + // skipped before 2.0 we can safely return all orderings and scopes if the + // device is 2.X. Query device for the supported orders. + if (get_device_cl_version(device) < Version{ 3, 0 }) + { + memoryOrders.push_back(MEMORY_ORDER_EMPTY); + memoryOrders.push_back(MEMORY_ORDER_RELAXED); + memoryOrders.push_back(MEMORY_ORDER_ACQUIRE); + memoryOrders.push_back(MEMORY_ORDER_RELEASE); + memoryOrders.push_back(MEMORY_ORDER_ACQ_REL); + memoryOrders.push_back(MEMORY_ORDER_SEQ_CST); + memoryScopes.push_back(MEMORY_SCOPE_EMPTY); + memoryScopes.push_back(MEMORY_SCOPE_WORK_GROUP); + memoryScopes.push_back(MEMORY_SCOPE_DEVICE); + memoryScopes.push_back(MEMORY_SCOPE_ALL_SVM_DEVICES); + return CL_SUCCESS; + } + + // For a 3.0 device we can query the supported orderings and scopes + // directly. + cl_device_atomic_capabilities atomic_capabilities{}; + test_error( + clGetDeviceInfo(device, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, + sizeof(atomic_capabilities), &atomic_capabilities, + nullptr), + "clGetDeviceInfo failed for CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES\n"); + + // Provided we succeeded, we can start filling the vectors. + if (atomic_capabilities & CL_DEVICE_ATOMIC_ORDER_RELAXED) + { + memoryOrders.push_back(MEMORY_ORDER_RELAXED); + } + + if (atomic_capabilities & CL_DEVICE_ATOMIC_ORDER_ACQ_REL) + { + memoryOrders.push_back(MEMORY_ORDER_ACQUIRE); + memoryOrders.push_back(MEMORY_ORDER_RELEASE); + memoryOrders.push_back(MEMORY_ORDER_ACQ_REL); + } + + if (atomic_capabilities & CL_DEVICE_ATOMIC_ORDER_SEQ_CST) + { + // The functions not ending in explicit have the same semantics as the + // corresponding explicit function with memory_order_seq_cst for the + // memory_order argument. + memoryOrders.push_back(MEMORY_ORDER_EMPTY); + memoryOrders.push_back(MEMORY_ORDER_SEQ_CST); + } + + if (atomic_capabilities & CL_DEVICE_ATOMIC_SCOPE_WORK_GROUP) + { + memoryScopes.push_back(MEMORY_SCOPE_WORK_GROUP); + } + + if (atomic_capabilities & CL_DEVICE_ATOMIC_SCOPE_DEVICE) + { + // The functions that do not have memory_scope argument have the same + // semantics as the corresponding functions with the memory_scope + // argument set to memory_scope_device. + memoryScopes.push_back(MEMORY_SCOPE_EMPTY); + memoryScopes.push_back(MEMORY_SCOPE_DEVICE); + } + if (atomic_capabilities & CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES) + { + memoryScopes.push_back(MEMORY_SCOPE_ALL_SVM_DEVICES); + } + return CL_SUCCESS; +} diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index a69feb06..360ab45e 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -71,6 +71,10 @@ extern cl_device_atomic_capabilities gAtomicMemCap, extern const char *get_memory_order_type_name(TExplicitMemoryOrderType orderType); extern const char *get_memory_scope_type_name(TExplicitMemoryScopeType scopeType); +extern cl_int getSupportedMemoryOrdersAndScopes( + cl_device_id device, std::vector &memoryOrders, + std::vector &memoryScopes); + class AtomicTypeInfo { public: @@ -487,16 +491,11 @@ public: std::vector memoryScope; int error = 0; - memoryOrder.push_back(MEMORY_ORDER_EMPTY); - memoryOrder.push_back(MEMORY_ORDER_RELAXED); - memoryOrder.push_back(MEMORY_ORDER_ACQUIRE); - memoryOrder.push_back(MEMORY_ORDER_RELEASE); - memoryOrder.push_back(MEMORY_ORDER_ACQ_REL); - memoryOrder.push_back(MEMORY_ORDER_SEQ_CST); - memoryScope.push_back(MEMORY_SCOPE_EMPTY); - memoryScope.push_back(MEMORY_SCOPE_WORK_GROUP); - memoryScope.push_back(MEMORY_SCOPE_DEVICE); - memoryScope.push_back(MEMORY_SCOPE_ALL_SVM_DEVICES); + // For OpenCL-3.0 and later some orderings and scopes are optional, so here + // we query for the supported ones. + test_error_ret( + getSupportedMemoryOrdersAndScopes(deviceID, memoryOrder, memoryScope), + "getSupportedMemoryOrdersAndScopes failed\n", TEST_FAIL); for(unsigned oi = 0; oi < memoryOrder.size(); oi++) { @@ -582,16 +581,11 @@ public: std::vector memoryScope; int error = 0; - memoryOrder.push_back(MEMORY_ORDER_EMPTY); - memoryOrder.push_back(MEMORY_ORDER_RELAXED); - memoryOrder.push_back(MEMORY_ORDER_ACQUIRE); - memoryOrder.push_back(MEMORY_ORDER_RELEASE); - memoryOrder.push_back(MEMORY_ORDER_ACQ_REL); - memoryOrder.push_back(MEMORY_ORDER_SEQ_CST); - memoryScope.push_back(MEMORY_SCOPE_EMPTY); - memoryScope.push_back(MEMORY_SCOPE_WORK_GROUP); - memoryScope.push_back(MEMORY_SCOPE_DEVICE); - memoryScope.push_back(MEMORY_SCOPE_ALL_SVM_DEVICES); + // For OpenCL-3.0 and later some orderings and scopes are optional, so here + // we query for the supported ones. + test_error_ret( + getSupportedMemoryOrdersAndScopes(deviceID, memoryOrder, memoryScope), + "getSupportedMemoryOrdersAndScopes failed\n", TEST_FAIL); for(unsigned oi = 0; oi < memoryOrder.size(); oi++) { @@ -800,23 +794,35 @@ std::string CBasicTest::KernelCode(cl_uint maxNumD "\n"; if(LocalMemory()) { - code += - " // initialize atomics not reachable from host (first thread is doing this, other threads are waiting on barrier)\n" - " if(get_local_id(0) == 0)\n" - " for(uint dstItemIdx = 0; dstItemIdx < numDestItems; dstItemIdx++)\n" - " {\n"; - if(aTypeName == "atomic_flag") - { - code += - " if(finalDest[dstItemIdx])\n" - " atomic_flag_test_and_set(destMemory+dstItemIdx);\n" - " else\n" - " atomic_flag_clear(destMemory+dstItemIdx);\n"; - } + // memory_order_relaxed is sufficient for these initialization operations + // as the barrier below will act as a fence, providing an order to the + // operations. memory_scope_work_group is sufficient as local memory is + // only visible within the work-group. + code += R"( + // initialize atomics not reachable from host (first thread + // is doing this, other threads are waiting on barrier) + if(get_local_id(0) == 0) + for(uint dstItemIdx = 0; dstItemIdx < numDestItems; dstItemIdx++) + {)"; + if (aTypeName == "atomic_flag") + { + code += R"( + if(finalDest[dstItemIdx]) + atomic_flag_test_and_set_explicit(destMemory+dstItemIdx, + memory_order_relaxed, + memory_scope_work_group); + else + atomic_flag_clear_explicit(destMemory+dstItemIdx, + memory_order_relaxed, + memory_scope_work_group);)"; + } else { - code += - " atomic_store(destMemory+dstItemIdx, finalDest[dstItemIdx]);\n"; + code += R"( + atomic_store_explicit(destMemory+dstItemIdx, + finalDest[dstItemIdx], + memory_order_relaxed, + memory_scope_work_group);)"; } code += " }\n" @@ -873,20 +879,28 @@ std::string CBasicTest::KernelCode(cl_uint maxNumD " if(get_local_id(0) == 0) // first thread in workgroup\n"; else // global atomics declared in program scope - code += - " if(atomic_fetch_add(&finishedThreads, 1) == get_global_size(0)-1)\n" - " // last finished thread\n"; + code += R"( + if(atomic_fetch_add_explicit(&finishedThreads, 1, + memory_order_relaxed, + memory_scope_work_group) + == get_global_size(0)-1) // last finished thread)"; code += " for(uint dstItemIdx = 0; dstItemIdx < numDestItems; dstItemIdx++)\n"; if(aTypeName == "atomic_flag") { - code += - " finalDest[dstItemIdx] = atomic_flag_test_and_set(destMemory+dstItemIdx);\n"; + code += R"( + finalDest[dstItemIdx] = + atomic_flag_test_and_set_explicit(destMemory+dstItemIdx, + memory_order_relaxed, + memory_scope_work_group);)"; } else { - code += - " finalDest[dstItemIdx] = atomic_load(destMemory+dstItemIdx);\n"; + code += R"( + finalDest[dstItemIdx] = + atomic_load_explicit(destMemory+dstItemIdx, + memory_order_relaxed, + memory_scope_work_group);)"; } } code += "}\n" diff --git a/test_conformance/c11_atomics/main.cpp b/test_conformance/c11_atomics/main.cpp index 41b253a0..3132c40d 100644 --- a/test_conformance/c11_atomics/main.cpp +++ b/test_conformance/c11_atomics/main.cpp @@ -159,6 +159,32 @@ test_status InitCL(cl_device_id device) { "Minimum atomic memory capabilities unsupported by device\n"); return TEST_FAIL; } + + // Disable program scope global variable testing in the case that it is + // not supported on an OpenCL-3.0 driver. + size_t max_global_variable_size{}; + test_error_ret(clGetDeviceInfo(device, + CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE, + sizeof(max_global_variable_size), + &max_global_variable_size, nullptr), + "Unable to get max global variable size\n", TEST_FAIL); + if (0 == max_global_variable_size) + { + gNoGlobalVariables = true; + } + + // Disable generic address space testing in the case that it is not + // supported on an OpenCL-3.0 driver. + cl_bool generic_address_space_support{}; + test_error_ret( + clGetDeviceInfo(device, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT, + sizeof(generic_address_space_support), + &generic_address_space_support, nullptr), + "Unable to get generic address space support\n", TEST_FAIL); + if (CL_FALSE == generic_address_space_support) + { + gNoGenericAddressSpace = true; + } } else { diff --git a/test_conformance/c11_atomics/test_atomics.cpp b/test_conformance/c11_atomics/test_atomics.cpp index c1e153be..6aff4214 100644 --- a/test_conformance/c11_atomics/test_atomics.cpp +++ b/test_conformance/c11_atomics/test_atomics.cpp @@ -206,6 +206,7 @@ public: using CBasicTestMemOrderScope::MemoryOrder; using CBasicTestMemOrderScope::MemoryScope; using CBasicTestMemOrderScope::MemoryOrderScopeStr; + using CBasicTestMemOrderScope::MemoryScopeStr; using CBasicTest::CheckCapabilities; CBasicTestLoad(TExplicitAtomicType dataType, bool useSVM) : CBasicTestMemOrderScope(dataType, useSVM) { @@ -228,11 +229,19 @@ public: } virtual std::string ProgramCore() { - std::string memoryOrderScope = MemoryOrderScopeStr(); - std::string postfix(memoryOrderScope.empty() ? "" : "_explicit"); - return - " atomic_store(&destMemory[tid], tid);\n" - " oldValues[tid] = atomic_load"+postfix+"(&destMemory[tid]"+memoryOrderScope+");\n"; + // In the case this test is run with MEMORY_ORDER_ACQUIRE, the store + // should be MEMORY_ORDER_RELEASE + std::string memoryOrderScopeLoad = MemoryOrderScopeStr(); + std::string memoryOrderScopeStore = + (MemoryOrder() == MEMORY_ORDER_ACQUIRE) + ? (", memory_order_release" + MemoryScopeStr()) + : memoryOrderScopeLoad; + std::string postfix(memoryOrderScopeLoad.empty() ? "" : "_explicit"); + return " atomic_store" + postfix + "(&destMemory[tid], tid" + + memoryOrderScopeStore + + ");\n" + " oldValues[tid] = atomic_load" + + postfix + "(&destMemory[tid]" + memoryOrderScopeLoad + ");\n"; } virtual void HostFunction(cl_uint tid, cl_uint threadCount, volatile HostAtomicType *destMemory, HostDataType *oldValues) { From 60b731ce15f1fa806bb694fcf45d7a73af640e75 Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Tue, 22 Sep 2020 10:15:09 -0600 Subject: [PATCH 07/37] c11_atomics: Fix to iteratively reduce workgroup size (#939) (#941) The generator function for atomic_fence uses the current workgroup size to determine the number of non atomic variables per thread in the kernel. The kernel should hence be regenerated when the workgroup size changes. However regenerating the kernel can itself change the workgroup size. This change introduces an iterative loop that reduces the workgroup sizes by 2 each time re-generating the kernel until we find one that works (or exit at groupsize == 1) Change-Id: Ic32fe967e32de6643e01c6775f4bddbcad0a299a --- test_conformance/c11_atomics/common.h | 91 +++++++++++++++++---------- 1 file changed, 58 insertions(+), 33 deletions(-) diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index 360ab45e..887ca97b 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -962,51 +962,76 @@ int CBasicTest::ExecuteSingleTest(cl_device_id dev if(deviceThreadCount > 0) { - cl_ulong usedLocalMemory; - cl_ulong totalLocalMemory; - cl_uint maxWorkGroupSize; + // This loop iteratively reduces the workgroup size by 2 and then + // re-generates the kernel with the reduced + // workgroup size until we find a size which is admissible for the kernel + // being run or reduce the wg size + // to the trivial case of 1 (which was separately verified to be accurate + // for the kernel being run) - // Set up the kernel code - programSource = PragmaHeader(deviceID)+ProgramHeader(numDestItems)+FunctionCode()+KernelCode(numDestItems); - programLine = programSource.c_str(); - if (create_single_kernel_helper_with_build_options( - context, &program, &kernel, 1, &programLine, "test_atomic_kernel", - gOldAPI ? "" : nullptr)) - { - return -1; - } - if(gDebug) - { - log_info("Program source:\n"); - log_info("%s\n", programLine); - } - // tune up work sizes based on kernel info - error = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_WORK_GROUP_SIZE, sizeof(groupSize), &groupSize, NULL); - test_error(error, "Unable to obtain max work group size for device and kernel combo"); + while ((CurrentGroupSize() > 1)) + { + // Re-generate the kernel code with the current group size + if (kernel) clReleaseKernel(kernel); + if (program) clReleaseProgram(program); + programSource = PragmaHeader(deviceID) + ProgramHeader(numDestItems) + + FunctionCode() + KernelCode(numDestItems); + programLine = programSource.c_str(); + if (create_single_kernel_helper_with_build_options( + context, &program, &kernel, 1, &programLine, + "test_atomic_kernel", gOldAPI ? "" : nullptr)) + { + return -1; + } + // Get work group size for the new kernel + error = clGetKernelWorkGroupInfo(kernel, deviceID, + CL_KERNEL_WORK_GROUP_SIZE, + sizeof(groupSize), &groupSize, NULL); + test_error(error, + "Unable to obtain max work group size for device and " + "kernel combo"); - if(LocalMemory()) - { - error = clGetKernelWorkGroupInfo (kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, sizeof(usedLocalMemory), &usedLocalMemory, NULL); - test_error(error, "clGetKernelWorkGroupInfo failed"); + if (LocalMemory()) + { + cl_ulong usedLocalMemory; + cl_ulong totalLocalMemory; + cl_uint maxWorkGroupSize; - error = clGetDeviceInfo(deviceID, CL_DEVICE_LOCAL_MEM_SIZE, sizeof(totalLocalMemory), &totalLocalMemory, NULL); - test_error(error, "clGetDeviceInfo failed"); + error = clGetKernelWorkGroupInfo( + kernel, deviceID, CL_KERNEL_LOCAL_MEM_SIZE, + sizeof(usedLocalMemory), &usedLocalMemory, NULL); + test_error(error, "clGetKernelWorkGroupInfo failed"); - // We know that each work-group is going to use typeSize * deviceThreadCount bytes of local memory - // so pick the maximum value for deviceThreadCount that uses all the local memory. - maxWorkGroupSize = ((totalLocalMemory - usedLocalMemory) / typeSize); + error = clGetDeviceInfo(deviceID, CL_DEVICE_LOCAL_MEM_SIZE, + sizeof(totalLocalMemory), + &totalLocalMemory, NULL); + test_error(error, "clGetDeviceInfo failed"); - if(maxWorkGroupSize < groupSize) - groupSize = maxWorkGroupSize; - } + // We know that each work-group is going to use typeSize * + // deviceThreadCount bytes of local memory + // so pick the maximum value for deviceThreadCount that uses all + // the local memory. + maxWorkGroupSize = + ((totalLocalMemory - usedLocalMemory) / typeSize); - CurrentGroupSize((cl_uint)groupSize); + if (maxWorkGroupSize < groupSize) groupSize = maxWorkGroupSize; + } + if (CurrentGroupSize() <= groupSize) + break; + else + CurrentGroupSize(CurrentGroupSize() / 2); + } if(CurrentGroupSize() > deviceThreadCount) CurrentGroupSize(deviceThreadCount); if(CurrentGroupNum(deviceThreadCount) == 1 || gOldAPI) deviceThreadCount = CurrentGroupSize()*CurrentGroupNum(deviceThreadCount); threadCount = deviceThreadCount+hostThreadCount; } + if (gDebug) + { + log_info("Program source:\n"); + log_info("%s\n", programLine); + } if(deviceThreadCount > 0) log_info("\t\t(thread count %u, group size %u)\n", deviceThreadCount, CurrentGroupSize()); if(hostThreadCount > 0) From 61cfb505ae0ffd7aabe88bcaf4e94619e09fdc07 Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Tue, 22 Sep 2020 18:26:05 +0200 Subject: [PATCH 08/37] Skip atomic_flag Test on for OpenCL-3.0 not Supporting Device Scope (#954) * The `atomic_flag` test assumes support for the `atomic_scope_device` scope in the global scope test case. Since `atomic_scope_device` is optional on an OpenCL-3.0 driver, this test should check for support and skip otherwise. --- test_conformance/c11_atomics/test_atomics.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test_conformance/c11_atomics/test_atomics.cpp b/test_conformance/c11_atomics/test_atomics.cpp index 6aff4214..6d8ffc9f 100644 --- a/test_conformance/c11_atomics/test_atomics.cpp +++ b/test_conformance/c11_atomics/test_atomics.cpp @@ -1624,6 +1624,30 @@ public: orderStr = std::string(", ") + get_memory_order_type_name(MemoryOrderForClear()); return orderStr + MemoryScopeStr(); } + + virtual int ExecuteSingleTest(cl_device_id deviceID, cl_context context, + cl_command_queue queue) + { + // This test assumes support for the memory_scope_device scope in the case + // that LocalMemory() == false. Therefore we should skip this test in that + // configuration on a 3.0 driver since supporting the memory_scope_device + // scope is optionaly. + if (get_device_cl_version(deviceID) >= Version{ 3, 0 }) + { + if (!LocalMemory() + && !(gAtomicFenceCap & CL_DEVICE_ATOMIC_SCOPE_DEVICE)) + { + log_info( + "Skipping atomic_flag test due to use of atomic_scope_device " + "which is optionally not supported on this device\n"); + return 0; // skip test - not applicable + } + } + return CBasicTestMemOrderScope::ExecuteSingleTest(deviceID, + context, + queue); + } virtual std::string ProgramCore() { std::string memoryOrderScope = MemoryOrderScopeStr(); From 1a3e19c37e5655f1692376f16f3df442afaa8b49 Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Tue, 22 Sep 2020 21:49:13 +0100 Subject: [PATCH 09/37] Use Version type for cl_khr_spir extension version checks (#953) * Use Version type for cl_khr_spir extension version checks The current method of using `std::find(versions, 1.2f)` is unreliable due to performing a floating point comparison. I.e. on some compiles it will spuriously report that the required version is missing and skip the tests. * Address clang-format failure. * Correct typo. --- test_conformance/spir/main.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/test_conformance/spir/main.cpp b/test_conformance/spir/main.cpp index 5634d5b6..3a18988c 100644 --- a/test_conformance/spir/main.cpp +++ b/test_conformance/spir/main.cpp @@ -141,7 +141,8 @@ static bool is_dir_exits(const char* path) return false; } -static void get_spir_version(cl_device_id device, std::vector& versions) +static void get_spir_version(cl_device_id device, + std::vector &versions) { char version[64] = {0}; cl_int err; @@ -162,11 +163,11 @@ static void get_spir_version(cl_device_id device, std::vector& versions) std::copy(std::istream_iterator(versionStream), std::istream_iterator(), std::back_inserter(versionVector)); - for(std::list::const_iterator it = versionVector.begin(), - e = versionVector.end(); it != e; - it++) + for (auto &v : versionVector) { - versions.push_back(atof(it->c_str())); + auto major = v[v.find('.') - 1]; + auto minor = v[v.find('.') + 1]; + versions.push_back(Version{ major - '0', minor - '0' }); } } @@ -6929,10 +6930,12 @@ int main (int argc, const char* argv[]) cl_device_id device = get_platform_device(device_type, choosen_device_index, choosen_platform_index); printDeviceHeader(device); - std::vector versions; + std::vector versions; get_spir_version(device, versions); - if (!is_extension_available( device, "cl_khr_spir") || - std::find(versions.begin(), versions.end(), 1.2f) == versions.end()) + + if (!is_extension_available(device, "cl_khr_spir") + || (std::find(versions.begin(), versions.end(), Version{ 1, 2 }) + == versions.end())) { log_info("Spir extension version 1.2 is not supported by the device\n"); return 0; From 10a30afeb2dfababfd396d78c5c71da7fe3f5e82 Mon Sep 17 00:00:00 2001 From: Jeremy Kemp Date: Wed, 23 Sep 2020 17:16:26 +0100 Subject: [PATCH 10/37] Fix kernel compilation issue in c11 atomics. (#973) --- test_conformance/c11_atomics/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index 887ca97b..80f8b872 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -883,7 +883,8 @@ std::string CBasicTest::KernelCode(cl_uint maxNumD if(atomic_fetch_add_explicit(&finishedThreads, 1, memory_order_relaxed, memory_scope_work_group) - == get_global_size(0)-1) // last finished thread)"; + == get_global_size(0)-1) // last finished thread + )"; code += " for(uint dstItemIdx = 0; dstItemIdx < numDestItems; dstItemIdx++)\n"; if(aTypeName == "atomic_flag") From 20b507a386781914b2936882a1c0f3549ac8919b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Thu, 24 Sep 2020 13:18:46 +0100 Subject: [PATCH 11/37] A first set of updates to the submission template (#969) Signed-off-by: Kevin Petit --- .../submission_details_template.txt | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/test_conformance/submission_details_template.txt b/test_conformance/submission_details_template.txt index 20554c83..aff18864 100644 --- a/test_conformance/submission_details_template.txt +++ b/test_conformance/submission_details_template.txt @@ -1,5 +1,5 @@ ############################################################################## -# OpenCL 2.0 submission details template +# OpenCL submission details template # $Id $ # $URL $ ############################################################################## @@ -27,7 +27,7 @@ Contact Telephone: # Version of OpenCL specification being tested # -OpenCL Version: 2.0 +OpenCL Version: Major.Minor # Statement of conformance listing each conformant product (at a specific # version) that is covered by this implementation. List each conformant product @@ -79,14 +79,9 @@ Platform Version: # ############################################################################## -# Date of tests used, 8 digit string as given in filename. +# git tag of the tests used from GitHub (ex: vYYYY-MM-DD-XX) # -Tests date: - - -# SHA-1 git identifier of the tests used from Gitlab (ex: 0a7770f98664a092c70d0a7d9a48d229b5fd8039) -# -Test ID: +Tests version: # Date of "Khronos Conformance Process" that this submission # adheres to (as shown in the change history at the start of the document). @@ -99,15 +94,6 @@ Conformance Process Document date: # OpenCL Conformance Process Attachment date: -# List of Khronos Bugzilla bugs filed for test bugs that have been fixed -# by modifying the tests used in this submission. Separate bug numbers with -# commas; if none, specify "none". It is OK to use an existing bug describing -# the same problem. In any case, after filing this conformance submission, -# add a comment to the bug referencing the submission tracking number -# giving justification for the test change. -# -Test Bugs: - ############################################################################## # # Tested device configuration @@ -117,9 +103,6 @@ Test Bugs: # Max compute units (CL_DEVICE_MAX_COMPUTE_UNITS) CL_DEVICE_MAX_COMPUTE_UNITS: -# Max clock frequency (CL_DEVICE_MAX_CLOCK_FREQUENCY) -CL_DEVICE_MAX_CLOCK_FREQUENCY: - # Max memory allocation size (CL_DEVICE_MAX_MEM_ALLOC_SIZE) CL_DEVICE_MAX_MEM_ALLOC_SIZE: From eb1bb88a192eb4dea85f290c2066f50d97c1917e Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Thu, 24 Sep 2020 08:40:18 -0700 Subject: [PATCH 12/37] add a test case for subbuffer property queries (#961) --- .../test_mem_object_properties_queries.cpp | 275 ++++++++++++------ 1 file changed, 181 insertions(+), 94 deletions(-) diff --git a/test_conformance/api/test_mem_object_properties_queries.cpp b/test_conformance/api/test_mem_object_properties_queries.cpp index a6ed7ad1..2360d83e 100644 --- a/test_conformance/api/test_mem_object_properties_queries.cpp +++ b/test_conformance/api/test_mem_object_properties_queries.cpp @@ -22,16 +22,18 @@ typedef enum { image, - buffer -} mem_obj_type; + image_with_properties, + buffer, + buffer_with_properties, + subbuffer, +} test_type; struct test_data { - mem_obj_type obj_t; + test_type type; std::vector properties; std::string description; - std::string src; - std::string kernel_name; + cl_kernel kernel; }; static int create_object_and_check_properties(cl_context context, @@ -43,47 +45,94 @@ static int create_object_and_check_properties(cl_context context, { cl_int error = CL_SUCCESS; - if (test_case.obj_t == image) + switch (test_case.type) { - cl_image_format format; - format.image_channel_order = CL_RGBA; - format.image_channel_data_type = CL_UNSIGNED_INT32; - cl_image_desc desc; - memset(&desc, 0x0, sizeof(cl_image_desc)); - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = size_x; - desc.image_height = size_y; + case image: { + cl_image_format format = { 0 }; + format.image_channel_order = CL_RGBA; + format.image_channel_data_type = CL_UNSIGNED_INT32; + test_object = clCreateImage2D(context, flags, &format, size_x, + size_y, 0, local_data.data(), &error); + test_error(error, "clCreateImage2D failed"); + } + break; + case image_with_properties: { + cl_image_format format = { 0 }; + format.image_channel_order = CL_RGBA; + format.image_channel_data_type = CL_UNSIGNED_INT32; + cl_image_desc desc = { 0 }; + desc.image_type = CL_MEM_OBJECT_IMAGE2D; + desc.image_width = size_x; + desc.image_height = size_y; - if (test_case.properties.size() == 0) - { - test_object = - clCreateImageWithProperties(context, NULL, flags, &format, - &desc, local_data.data(), &error); + if (test_case.properties.size() == 0) + { + test_object = clCreateImageWithProperties( + context, NULL, flags, &format, &desc, local_data.data(), + &error); + } + else + { + test_object = clCreateImageWithProperties( + context, test_case.properties.data(), flags, &format, &desc, + local_data.data(), &error); + } + test_error(error, "clCreateImageWithProperties failed"); } - else - { - test_object = clCreateImageWithProperties( - context, test_case.properties.data(), flags, &format, &desc, - local_data.data(), &error); + break; + case buffer: { + test_object = clCreateBuffer(context, flags, + local_data.size() * sizeof(cl_uint), + local_data.data(), &error); + test_error(error, "clCreateBuffer failed"); } - test_error(error, "clCreateImageWithProperties failed"); - } - if (test_case.obj_t == buffer) - { - if (test_case.properties.size() == 0) - { - test_object = clCreateBufferWithProperties( - context, NULL, flags, local_data.size() * sizeof(cl_uint), - local_data.data(), &error); - } - else - { - test_object = clCreateBufferWithProperties( - context, test_case.properties.data(), flags, - local_data.size() * sizeof(cl_uint), local_data.data(), &error); + case buffer_with_properties: { + if (test_case.properties.size() == 0) + { + test_object = clCreateBufferWithProperties( + context, NULL, flags, local_data.size() * sizeof(cl_uint), + local_data.data(), &error); + } + else + { + test_object = clCreateBufferWithProperties( + context, test_case.properties.data(), flags, + local_data.size() * sizeof(cl_uint), local_data.data(), + &error); + } + test_error(error, "clCreateBufferWithProperties failed."); } + break; + case subbuffer: { + clMemWrapper parent_object; + if (test_case.properties.size() == 0) + { + parent_object = clCreateBufferWithProperties( + context, NULL, flags, local_data.size() * sizeof(cl_uint), + local_data.data(), &error); + } + else + { + parent_object = clCreateBufferWithProperties( + context, test_case.properties.data(), flags, + local_data.size() * sizeof(cl_uint), local_data.data(), + &error); + } + test_error(error, "clCreateBufferWithProperties failed."); - test_error(error, "clCreateBufferWithProperties failed."); + cl_mem_flags subbuffer_flags = flags + & (CL_MEM_READ_WRITE | CL_MEM_READ_ONLY | CL_MEM_WRITE_ONLY); + + cl_buffer_region region = { 0 }; + region.origin = 0; + region.size = local_data.size() * sizeof(cl_uint); + test_object = clCreateSubBuffer(parent_object, subbuffer_flags, + CL_BUFFER_CREATE_TYPE_REGION, + ®ion, &error); + test_error(error, "clCreateSubBuffer failed."); + } + break; + default: log_error("Unknown test type!"); return TEST_FAIL; } std::vector check_properties; @@ -94,6 +143,22 @@ static int create_object_and_check_properties(cl_context context, test_error(error, "clGetMemObjectInfo failed asking for CL_MEM_PROPERTIES size."); + // Buffers, subbuffers, and images must return no properties. + if (test_case.type == buffer || test_case.type == subbuffer + || test_case.type == image) + { + if (set_size == 0) + { + return TEST_PASS; + } + else + { + log_error("Queried properties must have size equal to zero for " + "buffers, subbuffers, and images."); + return TEST_FAIL; + } + } + if (set_size == 0 && test_case.properties.size() == 0) { return TEST_PASS; @@ -123,8 +188,6 @@ static int run_test_query_properties(cl_context context, cl_command_queue queue, int error = CL_SUCCESS; log_info("\nTC description: %s\n", test_case.description.c_str()); - clProgramWrapper program; - clKernelWrapper kernel; clMemWrapper obj_src; clMemWrapper obj_dst; clEventWrapper event; @@ -144,12 +207,6 @@ static int run_test_query_properties(cl_context context, cl_command_queue queue, generate_random_data(kUInt, size, init_generator, dst_data.data()); free_mtdata(init_generator); init_generator = NULL; - const char* kernel_src = test_case.src.c_str(); - error = - create_single_kernel_helper(context, &program, &kernel, 1, &kernel_src, - test_case.kernel_name.c_str()); - - test_error(error, "create_single_kernel_helper failed"); flags = (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR); error = create_object_and_check_properties(context, obj_src, test_case, @@ -161,37 +218,44 @@ static int run_test_query_properties(cl_context context, cl_command_queue queue, flags, dst_data, size_x, size_y); test_error(error, "create_object_and_check_properties obj_dst failed."); - error = clSetKernelArg(kernel, 0, sizeof(obj_src), &obj_src); + error = clSetKernelArg(test_case.kernel, 0, sizeof(obj_src), &obj_src); test_error(error, "clSetKernelArg 0 failed."); - error = clSetKernelArg(kernel, 1, sizeof(obj_dst), &obj_dst); + error = clSetKernelArg(test_case.kernel, 1, sizeof(obj_dst), &obj_dst); test_error(error, "clSetKernelArg 1 failed."); - if (test_case.obj_t == image) + switch (test_case.type) { - error = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, global_dim, NULL, - 0, NULL, &event); - test_error(error, "clEnqueueNDRangeKernel failed."); + case image: + case image_with_properties: { + error = clEnqueueNDRangeKernel(queue, test_case.kernel, 2, NULL, + global_dim, NULL, 0, NULL, &event); + test_error(error, "clEnqueueNDRangeKernel failed."); - error = clWaitForEvents(1, &event); - test_error(error, "clWaitForEvents failed."); + error = clWaitForEvents(1, &event); + test_error(error, "clWaitForEvents failed."); - error = clEnqueueReadImage(queue, obj_dst, CL_TRUE, origin, region, 0, - 0, dst_data.data(), 0, NULL, NULL); - test_error(error, "clEnqueueReadImage failed."); - } - if (test_case.obj_t == buffer) - { - error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, &size, NULL, 0, - NULL, &event); - test_error(error, "clEnqueueNDRangeKernel failed."); + error = clEnqueueReadImage(queue, obj_dst, CL_TRUE, origin, region, + 0, 0, dst_data.data(), 0, NULL, NULL); + test_error(error, "clEnqueueReadImage failed."); + } + break; + case buffer: + case buffer_with_properties: + case subbuffer: { + error = clEnqueueNDRangeKernel(queue, test_case.kernel, 1, NULL, + &size, NULL, 0, NULL, &event); + test_error(error, "clEnqueueNDRangeKernel failed."); - error = clWaitForEvents(1, &event); - test_error(error, "clWaitForEvents failed."); + error = clWaitForEvents(1, &event); + test_error(error, "clWaitForEvents failed."); - error = clEnqueueReadBuffer(queue, obj_dst, CL_TRUE, 0, - dst_data.size() * sizeof(cl_uint), - dst_data.data(), 0, NULL, NULL); - test_error(error, "clEnqueueReadBuffer failed."); + error = clEnqueueReadBuffer(queue, obj_dst, CL_TRUE, 0, + dst_data.size() * sizeof(cl_uint), + dst_data.data(), 0, NULL, NULL); + test_error(error, "clEnqueueReadBuffer failed."); + } + break; + default: log_error("Unknown test type!"); return TEST_FAIL; } for (size_t i = 0; i < size; ++i) @@ -223,21 +287,31 @@ int test_image_properties_queries(cl_device_id deviceID, cl_context context, return TEST_SKIPPED_ITSELF; } + clProgramWrapper program; + clKernelWrapper kernel; + + const char* kernel_src = R"CLC( + __kernel void data_copy(read_only image2d_t src, write_only image2d_t dst) + { + int tid_x = get_global_id(0); + int tid_y = get_global_id(1); + int2 coords = (int2)(tid_x, tid_y); + uint4 val = read_imageui(src, coords); + write_imageui(dst, coords, val); + + } + )CLC"; + + error = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_src, "data_copy"); + test_error(error, "create_single_kernel_helper failed"); + std::vector test_cases; - std::string test_kernel = { "__kernel void data_copy(read_only image2d_t " - "src, write_only image2d_t dst)\n" - "{\n" - " int tid_x = get_global_id(0);\n" - " int tid_y = get_global_id(1);\n" - " int2 coords = (int2)(tid_x, tid_y);\n" - " uint4 val = read_imageui(src, coords);\n" - " write_imageui(dst, coords, val);\n" - "\n" - "}\n" }; + test_cases.push_back({ image, {}, "regular image", kernel }); test_cases.push_back( - { image, { 0 }, "image, 0 properties", test_kernel, "data_copy" }); + { image_with_properties, { 0 }, "image, 0 properties", kernel }); test_cases.push_back( - { image, {}, "image, NULL properties", test_kernel, "data_copy" }); + { image_with_properties, {}, "image, NULL properties", kernel }); for (auto test_case : test_cases) { @@ -251,20 +325,33 @@ int test_buffer_properties_queries(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { int error = CL_SUCCESS; + + clProgramWrapper program; + clKernelWrapper kernel; + + const char* kernel_src = R"CLC( + __kernel void data_copy(__global int *src, __global int *dst) + { + int tid = get_global_id(0); + + dst[tid] = src[tid]; + + } + )CLC"; + error = create_single_kernel_helper(context, &program, &kernel, 1, + &kernel_src, "data_copy"); + test_error(error, "create_single_kernel_helper failed"); + std::vector test_cases; - std::string test_kernel = { - "__kernel void data_copy(__global int *src, __global int *dst)\n" - "{\n" - " int tid = get_global_id(0);\n" - "\n" - " dst[tid] = src[tid];\n" - "\n" - "}\n" - }; + test_cases.push_back({ buffer, {}, "regular buffer", kernel }); test_cases.push_back( - { buffer, { 0 }, "buffer, 0 properties", test_kernel, "data_copy" }); + { buffer_with_properties, { 0 }, "buffer with 0 properties", kernel }); test_cases.push_back( - { buffer, {}, "buffer, NULL properties", test_kernel, "data_copy" }); + { buffer_with_properties, {}, "buffer with NULL properties", kernel }); + test_cases.push_back( + { subbuffer, { 0 }, "subbuffer with 0 properties", kernel }); + test_cases.push_back( + { subbuffer, {}, "subbuffer with NULL properties", kernel }); for (auto test_case : test_cases) { From e1cf741f1c800db5e27d1be4cf7647429d8d74ea Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Thu, 24 Sep 2020 21:34:56 +0200 Subject: [PATCH 13/37] Test feature macro OpenCL 3.0 (#762) * Test feature macro OpenCL 3.0 * Test feature macro OpenCL 3.0 - refactor to template function * Use test_error and format fix issues * Fix returned value type for CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE * Code format fix * Feature macro test - refactor code to have one test case * add consistency checking comparing supported features to CL_DEVICE_OPENCL_C_FEATURES * fix minor issues * Feature macro test - fix test version * Feature macro test - add -cl-std=CL3.0 build option * Feature macro test - compilation errors * Feature macro test - compilation errors OSX * Feature macro test - fix adding build options * Feature macro test - share function OutputBuildLogs * Feature macro test - back removed cases * Feature macro test - review fixes * Feature macro test - split check image formats * Feature macro test - fixed version --- test_common/harness/errorHelpers.h | 35 +- test_conformance/compiler/CMakeLists.txt | 1 + test_conformance/compiler/main.cpp | 2 + test_conformance/compiler/procs.h | 3 +- .../compiler/test_feature_macro.cpp | 750 ++++++++++++++++++ 5 files changed, 774 insertions(+), 17 deletions(-) create mode 100644 test_conformance/compiler/test_feature_macro.cpp diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index 0b083dd5..ba9e6474 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -1,6 +1,6 @@ // // 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 @@ -37,19 +37,19 @@ #define vlog_perf(_number, _higherBetter, _numType, _format, ...) printf("Performance Number " _format " (in %s, %s): %g\n",##__VA_ARGS__, _numType, \ _higherBetter?"higher is better":"lower is better" , _number) #ifdef _WIN32 - #ifdef __MINGW32__ - // Use __mingw_printf since it supports "%a" format specifier - #define vlog __mingw_printf - #define vlog_error __mingw_printf - #else - // Use home-baked function that treats "%a" as "%f" - static int vlog_win32(const char *format, ...); - #define vlog vlog_win32 - #define vlog_error vlog_win32 - #endif +#ifdef __MINGW32__ +// Use __mingw_printf since it supports "%a" format specifier +#define vlog __mingw_printf +#define vlog_error __mingw_printf #else - #define vlog_error printf - #define vlog printf +// Use home-baked function that treats "%a" as "%f" +static int vlog_win32(const char *format, ...); +#define vlog vlog_win32 +#define vlog_error vlog_win32 +#endif +#else +#define vlog_error printf +#define vlog printf #endif #define ct_assert(b) ct_assert_i(b, __LINE__) @@ -74,12 +74,14 @@ #define print_error(errCode,msg) log_error( "ERROR: %s! (%s from %s:%d)\n", msg, IGetErrorString( errCode ), __FILE__, __LINE__ ); #define test_missing_feature(errCode, msg) test_missing_feature_ret(errCode, msg, errCode) -// this macro should always return CL_SUCCESS, but print the missing feature message +// this macro should always return CL_SUCCESS, but print the missing feature +// message #define test_missing_feature_ret(errCode,msg,retValue) { if( errCode != CL_SUCCESS ) { print_missing_feature( errCode, msg ); return CL_SUCCESS ; } } #define print_missing_feature(errCode, msg) log_missing_feature("ERROR: Subtest %s tests a feature not supported by the device version! (from %s:%d)\n", msg, __FILE__, __LINE__ ); #define test_missing_support_offline_cmpiler(errCode, msg) test_missing_support_offline_cmpiler_ret(errCode, msg, errCode) -// this macro should always return CL_SUCCESS, but print the skip message on test not supported with offline compiler +// this macro should always return CL_SUCCESS, but print the skip message on +// test not supported with offline compiler #define test_missing_support_offline_cmpiler_ret(errCode,msg,retValue) { if( errCode != CL_SUCCESS ) { log_info( "INFO: Subtest %s tests is not supported in offline compiler execution path! (from %s:%d)\n", msg, __FILE__, __LINE__ ); return TEST_SKIP ; } } // expected error code vs. what we got @@ -133,7 +135,8 @@ extern const char *GetQueuePropertyName(cl_command_queue_properties properties); extern const char *GetDeviceTypeName( cl_device_type type ); int check_functions_for_offline_compiler(const char *subtestname, cl_device_id device); - +cl_int OutputBuildLogs(cl_program program, cl_uint num_devices, + cl_device_id *device_list); // NON-REENTRANT UNLESS YOU PROVIDE A BUFFER PTR (pass null to use static storage, but it's not reentrant then!) extern const char *GetDataVectorString( void *dataBuffer, size_t typeSize, size_t vecSize, char *buffer ); diff --git a/test_conformance/compiler/CMakeLists.txt b/test_conformance/compiler/CMakeLists.txt index 1090db38..058213a2 100644 --- a/test_conformance/compiler/CMakeLists.txt +++ b/test_conformance/compiler/CMakeLists.txt @@ -11,6 +11,7 @@ set(${MODULE_NAME}_SOURCES test_compiler_defines_for_extensions.cpp test_pragma_unroll.cpp test_unload_platform_compiler.cpp + test_feature_macro.cpp ) include(../CMakeCommon.txt) diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index 45b7496d..cbf15e5a 100644 --- a/test_conformance/compiler/main.cpp +++ b/test_conformance/compiler/main.cpp @@ -89,6 +89,7 @@ test_definition test_list[] = { ADD_TEST_VERSION(pragma_unroll, Version(2, 0)), + ADD_TEST_VERSION(features_macro, Version(3, 0)), ADD_TEST(unload_valid), ADD_TEST(unload_invalid), ADD_TEST(unload_repeated), @@ -98,6 +99,7 @@ test_definition test_list[] = { ADD_TEST(unload_build_threaded), ADD_TEST(unload_build_info), ADD_TEST(unload_program_binaries), + }; const int test_num = ARRAY_SIZE(test_list); diff --git a/test_conformance/compiler/procs.h b/test_conformance/compiler/procs.h index 05d8bd5b..88212017 100644 --- a/test_conformance/compiler/procs.h +++ b/test_conformance/compiler/procs.h @@ -212,7 +212,8 @@ extern int test_compile_and_link_status_options_log(cl_device_id deviceID, extern int test_pragma_unroll(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); - +extern int test_features_macro(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); extern int test_unload_valid(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_unload_invalid(cl_device_id deviceID, cl_context context, diff --git a/test_conformance/compiler/test_feature_macro.cpp b/test_conformance/compiler/test_feature_macro.cpp new file mode 100644 index 00000000..656ee99a --- /dev/null +++ b/test_conformance/compiler/test_feature_macro.cpp @@ -0,0 +1,750 @@ +// +// Copyright (c) 2020 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 "testBase.h" +#include +#include +#include "errorHelpers.h" + +const char* macro_supported_source = R"(kernel void enabled(global int * buf) { + int n = get_global_id(0); + buf[n] = 0; + #ifndef %s + ERROR; + #endif +})"; + +const char* macro_not_supported_source = + R"(kernel void not_enabled(global int * buf) { + int n = get_global_id(0); + buf[n] = 0; + #ifdef %s + ERROR; + #endif +})"; + +template +cl_int check_api_feature_info_capabilities(cl_device_id deviceID, + cl_context context, cl_bool& status, + cl_device_info check_property, + cl_bitfield check_cap) +{ + cl_int error = CL_SUCCESS; + T response; + error = clGetDeviceInfo(deviceID, check_property, sizeof(response), + &response, NULL); + test_error(error, "clGetDeviceInfo failed.\n"); + + if ((response & check_cap) == check_cap) + { + status = CL_TRUE; + } + else + { + status = CL_FALSE; + } + return error; +} + +cl_int check_api_feature_info_support(cl_device_id deviceID, cl_context context, + cl_bool& status, + cl_device_info check_property) +{ + cl_int error = CL_SUCCESS; + cl_bool response; + error = clGetDeviceInfo(deviceID, check_property, sizeof(response), + &response, NULL); + test_error(error, "clGetDeviceInfo failed.\n"); + status = response; + return error; +} + +template +cl_int check_api_feature_info_number(cl_device_id deviceID, cl_context context, + cl_bool& status, + cl_device_info check_property) +{ + cl_int error = CL_SUCCESS; + T response; + error = clGetDeviceInfo(deviceID, check_property, sizeof(response), + &response, NULL); + test_error(error, "clGetDeviceInfo failed.\n"); + if (response > 0) + { + status = CL_TRUE; + } + else + { + status = CL_FALSE; + } + return error; +} + +cl_int check_api_feature_info_supported_image_formats(cl_device_id deviceID, + cl_context context, + cl_bool& status) +{ + cl_int error = CL_SUCCESS; + cl_uint response = 0; + cl_uint image_format_count; + error = clGetSupportedImageFormats(context, CL_MEM_WRITE_ONLY, + CL_MEM_OBJECT_IMAGE3D, 0, NULL, + &image_format_count); + test_error(error, "clGetSupportedImageFormats failed"); + response += image_format_count; + error = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE, + CL_MEM_OBJECT_IMAGE3D, 0, NULL, + &image_format_count); + test_error(error, "clGetSupportedImageFormats failed"); + response += image_format_count; + error = clGetSupportedImageFormats(context, CL_MEM_KERNEL_READ_AND_WRITE, + CL_MEM_OBJECT_IMAGE3D, 0, NULL, + &image_format_count); + test_error(error, "clGetSupportedImageFormats failed"); + response += image_format_count; + if (response > 0) + { + status = CL_TRUE; + } + else + { + status = CL_FALSE; + } + return error; +} + +cl_int check_compiler_feature_info(cl_device_id deviceID, cl_context context, + std::string feature_macro, cl_bool& status) +{ + cl_int error = CL_SUCCESS; + clProgramWrapper program_supported; + clProgramWrapper program_not_supported; + char kernel_supported_src[1024]; + char kernel_not_supported_src[1024]; + sprintf(kernel_supported_src, macro_supported_source, + feature_macro.c_str()); + const char* ptr_supported = kernel_supported_src; + const char* build_options = "-cl-std=CL3.0"; + + error = create_single_kernel_helper_create_program( + context, &program_supported, 1, &ptr_supported, build_options); + test_error(error, "create_single_kernel_helper_create_program failed.\n"); + + sprintf(kernel_not_supported_src, macro_not_supported_source, + feature_macro.c_str()); + const char* ptr_not_supported = kernel_not_supported_src; + error = create_single_kernel_helper_create_program( + context, &program_not_supported, 1, &ptr_not_supported, + "-cl-std=CL3.0"); + test_error(error, "create_single_kernel_helper_create_program failed.\n"); + + cl_int status_supported = CL_SUCCESS; + cl_int status_not_supported = CL_SUCCESS; + status_supported = clBuildProgram(program_supported, 1, &deviceID, + build_options, NULL, NULL); + status_not_supported = clBuildProgram(program_not_supported, 1, &deviceID, + build_options, NULL, NULL); + if (status_supported != status_not_supported) + { + if (status_not_supported == CL_SUCCESS) + { + // kernel which verifies not supporting return passed + status = CL_FALSE; + } + else + { + // kernel which verifies supporting return passed + status = CL_TRUE; + } + } + else + { + log_error("Error: The macro feature is defined and undefined " + "in the same time\n"); + error = OutputBuildLogs(program_supported, 1, &deviceID); + test_error(error, "OutputBuildLogs failed.\n"); + error = OutputBuildLogs(program_not_supported, 1, &deviceID); + test_error(error, "OutputBuildLogs failed.\n"); + return TEST_FAIL; + } + return error; +} + +int feature_macro_verify_results(std::string test_macro_name, + cl_bool api_status, cl_bool compiler_status, + cl_bool& supported) +{ + cl_int error = TEST_PASS; + log_info("Feature status: API - %s, compiler - %s\n", + api_status == CL_TRUE ? "supported" : "not supported", + compiler_status == CL_TRUE ? "supported" : "not supported"); + if (api_status != compiler_status) + { + log_info("%s - failed\n", test_macro_name.c_str()); + supported = CL_FALSE; + return TEST_FAIL; + } + else + { + log_info("%s - passed\n", test_macro_name.c_str()); + } + supported = api_status; + return error; +} + +int test_feature_macro_atomic_order_acq_rel(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_capabilities( + deviceID, context, api_status, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, + CL_DEVICE_ATOMIC_ORDER_ACQ_REL); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_atomic_order_seq_cst(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + + error = check_api_feature_info_capabilities( + deviceID, context, api_status, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, + CL_DEVICE_ATOMIC_ORDER_SEQ_CST); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_atomic_scope_device(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_capabilities( + deviceID, context, api_status, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, + CL_DEVICE_ATOMIC_SCOPE_DEVICE); + if (error != CL_SUCCESS) + { + return error; + } + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_atomic_scope_all_devices(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_capabilities( + deviceID, context, api_status, CL_DEVICE_ATOMIC_MEMORY_CAPABILITIES, + CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES); + if (error != CL_SUCCESS) + { + return error; + } + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_3d_image_writes(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_supported_image_formats(deviceID, context, + api_status); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_device_enqueue(cl_device_id deviceID, cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_capabilities< + cl_device_device_enqueue_capabilities>( + deviceID, context, api_status, CL_DEVICE_DEVICE_ENQUEUE_CAPABILITIES, + CL_DEVICE_QUEUE_SUPPORTED); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_generic_address_space(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_support( + deviceID, context, api_status, CL_DEVICE_GENERIC_ADDRESS_SPACE_SUPPORT); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_pipes(cl_device_id deviceID, cl_context context, + std::string test_macro_name, cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_support(deviceID, context, api_status, + CL_DEVICE_PIPE_SUPPORT); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_program_scope_global_variables( + cl_device_id deviceID, cl_context context, std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_number( + deviceID, context, api_status, CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_read_write_images(cl_device_id deviceID, + cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_number( + deviceID, context, api_status, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_subgroups(cl_device_id deviceID, cl_context context, + std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_number( + deviceID, context, api_status, CL_DEVICE_MAX_NUM_SUB_GROUPS); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_work_group_collective_functions( + cl_device_id deviceID, cl_context context, std::string test_macro_name, + cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_support( + deviceID, context, api_status, + CL_DEVICE_WORK_GROUP_COLLECTIVE_FUNCTIONS_SUPPORT); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_images(cl_device_id deviceID, cl_context context, + std::string test_macro_name, cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_support(deviceID, context, api_status, + CL_DEVICE_IMAGE_SUPPORT); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_fp64(cl_device_id deviceID, cl_context context, + std::string test_macro_name, cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + log_info("\n%s ...\n", test_macro_name.c_str()); + error = check_api_feature_info_capabilities( + deviceID, context, api_status, CL_DEVICE_DOUBLE_FP_CONFIG, + CL_FP_FMA | CL_FP_ROUND_TO_NEAREST | CL_FP_INF_NAN | CL_FP_DENORM); + if (error != CL_SUCCESS) + { + return error; + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_feature_macro_int64(cl_device_id deviceID, cl_context context, + std::string test_macro_name, cl_bool& supported) +{ + cl_int error = TEST_FAIL; + cl_bool api_status; + cl_bool compiler_status; + cl_int full_profile = 0; + log_info("\n%s ...\n", test_macro_name.c_str()); + size_t ret_len; + char profile[32] = { 0 }; + error = clGetDeviceInfo(deviceID, CL_DEVICE_PROFILE, sizeof(profile), + profile, &ret_len); + test_error(error, "clGetDeviceInfo(CL_DEVICE_PROFILE) failed"); + if (ret_len < sizeof(profile) && strcmp(profile, "FULL_PROFILE") == 0) + { + full_profile = 1; + } + else if (ret_len < sizeof(profile) + && strcmp(profile, "EMBEDDED_PROFILE") == 0) + { + full_profile = 0; + } + else + { + log_error("Unknown device profile: %s\n", profile); + return TEST_FAIL; + } + + if (full_profile) + { + api_status = CL_TRUE; + } + else + { + if (is_extension_available(deviceID, "cles_khr_int64")) + { + api_status = CL_TRUE; + } + else + { + cl_bool double_supported = CL_FALSE; + error = check_api_feature_info_capabilities( + deviceID, context, double_supported, CL_DEVICE_DOUBLE_FP_CONFIG, + CL_FP_FMA | CL_FP_ROUND_TO_NEAREST | CL_FP_INF_NAN + | CL_FP_DENORM); + test_error(error, "checking CL_DEVICE_DOUBLE_FP_CONFIG failed"); + if (double_supported == CL_FALSE) + { + api_status = CL_FALSE; + } + else + { + log_error("FP double type is supported and cles_khr_int64 " + "extension not supported\n"); + return TEST_FAIL; + } + } + } + + error = check_compiler_feature_info(deviceID, context, test_macro_name, + compiler_status); + if (error != CL_SUCCESS) + { + return error; + } + + return feature_macro_verify_results(test_macro_name, api_status, + compiler_status, supported); +} + +int test_consistency_c_features_list(cl_device_id deviceID, + std::vector vec_to_cmp) +{ + log_info("\nComparison list of features: CL_DEVICE_OPENCL_C_FEATURES vs " + "API/compiler queries.\n"); + cl_int error; + size_t config_size; + std::vector vec_device_feature; + std::vector vec_device_feature_names; + error = clGetDeviceInfo(deviceID, CL_DEVICE_OPENCL_C_FEATURES, 0, NULL, + &config_size); + + test_error( + error, + "clGetDeviceInfo asking for CL_DEVICE_OPENCL_C_FEATURES failed.\n"); + if (config_size == 0) + { + log_info("Empty list of CL_DEVICE_OPENCL_C_FEATURES returned by " + "clGetDeviceInfo on this device.\n"); + } + else + { + int vec_elements = config_size / sizeof(cl_name_version); + vec_device_feature.resize(vec_elements); + error = clGetDeviceInfo(deviceID, CL_DEVICE_OPENCL_C_FEATURES, + config_size, vec_device_feature.data(), 0); + test_error( + error, + "clGetDeviceInfo asking for CL_DEVICE_OPENCL_C_FEATURES failed.\n"); + } + for (auto each_f : vec_device_feature) + { + vec_device_feature_names.push_back(each_f.name); + } + sort(vec_to_cmp.begin(), vec_to_cmp.end()); + sort(vec_device_feature_names.begin(), vec_device_feature_names.end()); + + cl_bool result = + std::equal(vec_device_feature_names.begin(), + vec_device_feature_names.end(), vec_to_cmp.begin()); + if (result) + { + log_info("Comparison list of features - passed\n"); + } + else + { + log_info("Comparison list of features - failed\n"); + error = TEST_FAIL; + } + log_info( + "Supported features based on CL_DEVICE_OPENCL_C_FEATURES API query:\n"); + for (auto each_f : vec_device_feature_names) + { + log_info("%s\n", each_f.c_str()); + } + + log_info("\nSupported features based on queries to API/compiler :\n"); + for (auto each_f : vec_to_cmp) + { + log_info("%s\n", each_f.c_str()); + } + + return error; +} + +#define NEW_FEATURE_MACRO_TEST(feat) \ + test_macro_name = "__opencl_c_" #feat; \ + error |= test_feature_macro_##feat(deviceID, context, test_macro_name, \ + supported); \ + if (supported) supported_features_vec.push_back(test_macro_name); + + +int test_features_macro(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + cl_int error = CL_SUCCESS; + cl_bool supported = CL_FALSE; + std::string test_macro_name = ""; + std::vector supported_features_vec; + NEW_FEATURE_MACRO_TEST(program_scope_global_variables); + NEW_FEATURE_MACRO_TEST(3d_image_writes); + NEW_FEATURE_MACRO_TEST(atomic_order_acq_rel); + NEW_FEATURE_MACRO_TEST(atomic_order_seq_cst); + NEW_FEATURE_MACRO_TEST(atomic_scope_device); + NEW_FEATURE_MACRO_TEST(atomic_scope_all_devices); + NEW_FEATURE_MACRO_TEST(device_enqueue); + NEW_FEATURE_MACRO_TEST(generic_address_space); + NEW_FEATURE_MACRO_TEST(pipes); + NEW_FEATURE_MACRO_TEST(read_write_images); + NEW_FEATURE_MACRO_TEST(subgroups); + NEW_FEATURE_MACRO_TEST(work_group_collective_functions); + NEW_FEATURE_MACRO_TEST(images); + NEW_FEATURE_MACRO_TEST(fp64); + NEW_FEATURE_MACRO_TEST(int64); + + error |= test_consistency_c_features_list(deviceID, supported_features_vec); + + return error; +} From 4d3a3e8b1612af24fe666fff6b0ac6452293652b Mon Sep 17 00:00:00 2001 From: Jeremy Kemp Date: Thu, 24 Sep 2020 20:36:52 +0100 Subject: [PATCH 14/37] Update CTS csv files. (#971) * This removes API specific csv files, as these are no longer required. This also updates opencl_conformance_tests_quick.csv to include >= 2.0 tests. No changes were required for opencl_conformance_tests_full.csv. Addresses #863 * Pass the correct arguments to test_spirv_new. --- ...pencl_conformance_tests_12_conversions.csv | 4 - .../opencl_conformance_tests_12_d3d.csv | 5 - .../opencl_conformance_tests_12_full.csv | 81 -------------- ...e_tests_12_full_no_math_or_conversions.csv | 78 -------------- .../opencl_conformance_tests_12_math.csv | 4 - .../opencl_conformance_tests_12_quick.csv | 81 -------------- .../opencl_conformance_tests_20_full.csv | 101 ------------------ ...e_tests_20_full_no_math_or_conversions.csv | 78 -------------- .../opencl_conformance_tests_20_quick.csv | 81 -------------- ...encl_conformance_tests_21_legacy_wimpy.csv | 99 ----------------- .../opencl_conformance_tests_22.csv | 45 -------- .../opencl_conformance_tests_full.csv | 28 ++--- ...ance_tests_full_no_math_or_conversions.csv | 26 ++--- ...> opencl_conformance_tests_full_spirv.csv} | 0 .../opencl_conformance_tests_math.csv | 2 +- .../opencl_conformance_tests_quick.csv | 52 ++++++--- 16 files changed, 67 insertions(+), 698 deletions(-) delete mode 100644 test_conformance/opencl_conformance_tests_12_conversions.csv delete mode 100644 test_conformance/opencl_conformance_tests_12_d3d.csv delete mode 100644 test_conformance/opencl_conformance_tests_12_full.csv delete mode 100644 test_conformance/opencl_conformance_tests_12_full_no_math_or_conversions.csv delete mode 100644 test_conformance/opencl_conformance_tests_12_math.csv delete mode 100644 test_conformance/opencl_conformance_tests_12_quick.csv delete mode 100644 test_conformance/opencl_conformance_tests_20_full.csv delete mode 100644 test_conformance/opencl_conformance_tests_20_full_no_math_or_conversions.csv delete mode 100644 test_conformance/opencl_conformance_tests_20_quick.csv delete mode 100644 test_conformance/opencl_conformance_tests_21_legacy_wimpy.csv delete mode 100644 test_conformance/opencl_conformance_tests_22.csv rename test_conformance/{opencl_conformance_tests_21_full_spirv.csv => opencl_conformance_tests_full_spirv.csv} (100%) diff --git a/test_conformance/opencl_conformance_tests_12_conversions.csv b/test_conformance/opencl_conformance_tests_12_conversions.csv deleted file mode 100644 index c8e283a6..00000000 --- a/test_conformance/opencl_conformance_tests_12_conversions.csv +++ /dev/null @@ -1,4 +0,0 @@ -# -# OpenCL Conformance Test Suite (conversions only) -# -Conversions,conversions/test_conversions diff --git a/test_conformance/opencl_conformance_tests_12_d3d.csv b/test_conformance/opencl_conformance_tests_12_d3d.csv deleted file mode 100644 index 53466ebc..00000000 --- a/test_conformance/opencl_conformance_tests_12_d3d.csv +++ /dev/null @@ -1,5 +0,0 @@ -# -# OpenCL Conformance Test for DirectX interop -# - -D3D10,D3D10/test_d3d10 diff --git a/test_conformance/opencl_conformance_tests_12_full.csv b/test_conformance/opencl_conformance_tests_12_full.csv deleted file mode 100644 index bb732c40..00000000 --- a/test_conformance/opencl_conformance_tests_12_full.csv +++ /dev/null @@ -1,81 +0,0 @@ -# -# OpenCL Conformance Test Suite (full version) -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions full* -Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Vectors, vectors/test_vectors -Printf,printf/test_printf -Device Partitioning,device_partition/test_device_partition - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -Conversions,conversions/test_conversions -Contractions,contractions/test_contractions -Math,math_brute_force/test_bruteforce -Integer Ops,integer_ops/test_integer_ops -Half Ops,half/test_half diff --git a/test_conformance/opencl_conformance_tests_12_full_no_math_or_conversions.csv b/test_conformance/opencl_conformance_tests_12_full_no_math_or_conversions.csv deleted file mode 100644 index fca9af4b..00000000 --- a/test_conformance/opencl_conformance_tests_12_full_no_math_or_conversions.csv +++ /dev/null @@ -1,78 +0,0 @@ -# -# OpenCL Conformance Test Suite (full version) -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions full* -Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Vectors, vectors/test_vectors - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -Contractions,contractions/test_contractions -Integer Ops,integer_ops/test_integer_ops -Half Ops,half/test_half - diff --git a/test_conformance/opencl_conformance_tests_12_math.csv b/test_conformance/opencl_conformance_tests_12_math.csv deleted file mode 100644 index e033190f..00000000 --- a/test_conformance/opencl_conformance_tests_12_math.csv +++ /dev/null @@ -1,4 +0,0 @@ -# -# OpenCL Conformance Test Suite (math only) -# -Math,math_brute_force/test_bruteforce diff --git a/test_conformance/opencl_conformance_tests_12_quick.csv b/test_conformance/opencl_conformance_tests_12_quick.csv deleted file mode 100644 index af591656..00000000 --- a/test_conformance/opencl_conformance_tests_12_quick.csv +++ /dev/null @@ -1,81 +0,0 @@ -# -# OpenCL Conformance Test Suite (quick version) -# The quick version skips some long-running image tests, runs a shorter math test, -# and does not run the conversion test. -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions quick* -#Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Printf,printf/test_printf -Device Partitioning,device_partition/test_device_partition - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -#Conversions,conversions/test_conversions -Contractions,contractions/test_contractions -Math,math_brute_force/test_bruteforce -w -Integer Ops,integer_ops/test_integer_ops integer_* quick_* -Half Ops,half/test_half -w diff --git a/test_conformance/opencl_conformance_tests_20_full.csv b/test_conformance/opencl_conformance_tests_20_full.csv deleted file mode 100644 index e5320bb4..00000000 --- a/test_conformance/opencl_conformance_tests_20_full.csv +++ /dev/null @@ -1,101 +0,0 @@ -# -# OpenCL Conformance Test Suite (full version) -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions full* -Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Vectors, vectors/test_vectors -Printf,printf/test_printf -Device Partitioning,device_partition/test_device_partition - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -Conversions,conversions/test_conversions -Contractions,contractions/test_contractions -Math,math_brute_force/test_bruteforce -Integer Ops,integer_ops/test_integer_ops -Half Ops,half/test_half - -##################################### -# OpenCL 2.0 tests -##################################### -C11 Atomics,c11_atomics/test_c11_atomics -Execution Model,device_execution/test_device_execution -Generic Address Space,generic_address_space/test_generic_address_space -Non Uniform Work Groups,non_uniform_work_group/test_non_uniform_work_group -Pipes,pipes/test_pipes -SVM,SVM/test_svm -Workgroups,workgroups/test_workgroups - -######################################### -# Extensions -######################################### -SPIR,spir/test_spir -Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST -Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps -Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps -Subgroups,subgroups/test_subgroups diff --git a/test_conformance/opencl_conformance_tests_20_full_no_math_or_conversions.csv b/test_conformance/opencl_conformance_tests_20_full_no_math_or_conversions.csv deleted file mode 100644 index fca9af4b..00000000 --- a/test_conformance/opencl_conformance_tests_20_full_no_math_or_conversions.csv +++ /dev/null @@ -1,78 +0,0 @@ -# -# OpenCL Conformance Test Suite (full version) -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions full* -Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Vectors, vectors/test_vectors - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -Contractions,contractions/test_contractions -Integer Ops,integer_ops/test_integer_ops -Half Ops,half/test_half - diff --git a/test_conformance/opencl_conformance_tests_20_quick.csv b/test_conformance/opencl_conformance_tests_20_quick.csv deleted file mode 100644 index af591656..00000000 --- a/test_conformance/opencl_conformance_tests_20_quick.csv +++ /dev/null @@ -1,81 +0,0 @@ -# -# OpenCL Conformance Test Suite (quick version) -# The quick version skips some long-running image tests, runs a shorter math test, -# and does not run the conversion test. -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions quick* -#Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Printf,printf/test_printf -Device Partitioning,device_partition/test_device_partition - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -#Conversions,conversions/test_conversions -Contractions,contractions/test_contractions -Math,math_brute_force/test_bruteforce -w -Integer Ops,integer_ops/test_integer_ops integer_* quick_* -Half Ops,half/test_half -w diff --git a/test_conformance/opencl_conformance_tests_21_legacy_wimpy.csv b/test_conformance/opencl_conformance_tests_21_legacy_wimpy.csv deleted file mode 100644 index 610a2945..00000000 --- a/test_conformance/opencl_conformance_tests_21_legacy_wimpy.csv +++ /dev/null @@ -1,99 +0,0 @@ -# -# OpenCL Conformance Test Suite (quick version) -# The quick version skips some long-running image tests, runs a shorter math test, -# and does not run the conversion test. -# - -# ######################################### -# Basic Information on the compute device -# ######################################### -Compute Info,computeinfo/test_computeinfo - -# ######################################### -# Basic operation tests -# ######################################### -Basic,basic/test_basic -API,api/test_api -Compiler,compiler/test_compiler - -# ######################################### -# Common mathematical functions -# ######################################### -Common Functions,commonfns/test_commonfns -Geometric Functions,geometrics/test_geometrics -Relationals,relationals/test_relationals - -# ######################################### -# General operation -# ######################################### -Thread Dimensions,thread_dimensions/test_thread_dimensions quick* -Multiple Device/Context,multiple_device_context/test_multiples -Atomics,atomics/test_atomics -Profiling,profiling/test_profiling -Events,events/test_events -Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all -Vectors, vectors/test_vectors -Printf,printf/test_printf -Device Partitioning,device_partition/test_device_partition - -# ######################################### -# Buffers and images -# ######################################### -Buffers,buffers/test_buffers -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods -Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST -Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST -Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images -Mem (Host Flags),mem_host_flags/test_mem_host_flags - -# ######################################### -# CPU is required to pass linear and normalized image filtering -# ######################################### -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR -CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR - -# ######################################### -# OpenGL/CL interaction -# ######################################### -OpenCL-GL Sharing,gl/test_gl - -# ######################################### -# Thorough math and conversions tests -# ######################################### -Select,select/test_select -Conversions,conversions/test_conversions -w -Contractions,contractions/test_contractions -Math,math_brute_force/test_bruteforce -w -Integer Ops,integer_ops/test_integer_ops integer_* quick_* -Half Ops,half/test_half -w - -##################################### -# OpenCL 2.0 tests -##################################### -C11 Atomics,c11_atomics/test_c11_atomics -Execution Model,device_execution/test_device_execution -Generic Address Space,generic_address_space/test_generic_address_space -Non Uniform Work Groups,non_uniform_work_group/test_non_uniform_work_group -Pipes,pipes/test_pipes -SVM,SVM/test_svm -Workgroups,workgroups/test_workgroups - -##################################### -# OpenCL 2.1 tests -##################################### -Device timer,device_timer/test_device_timer -SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin - -######################################### -# Extensions -######################################### -SPIR,spir/test_spir -Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST -Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps -Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps -Subgroups,subgroups/test_subgroups diff --git a/test_conformance/opencl_conformance_tests_22.csv b/test_conformance/opencl_conformance_tests_22.csv deleted file mode 100644 index 2ef864a6..00000000 --- a/test_conformance/opencl_conformance_tests_22.csv +++ /dev/null @@ -1,45 +0,0 @@ -# -# OpenCL Conformance Test Suite (2.2 version) -# - -# ######################################### -# New API features -# ######################################### -API (ctors and dtors of global scope vars) , clcpp/api/test_cpp_api "test_global_scope*" -API (specialization constants) , clcpp/api/test_cpp_api "test_spec_consts*" - -# ######################################### -# New representation of types -# ######################################### -Images and samplers , clcpp/images/test_cpp_images -Pipes and reservations , clcpp/pipes/test_cpp_pipes "test_pipes_pipe" -Device enqueue and events , clcpp/device_queue/test_cpp_device_queue -Address spaces , clcpp/address_spaces/test_cpp_address_spaces - -# ######################################### -# New representation of functions -# ######################################### -Conversions (convert_cast) , clcpp/convert/test_cpp_convert -Reinterpreting (as_type) , clcpp/reinterpret/test_cpp_reinterpret -Atomics , clcpp/atomics/test_cpp_atomics -Work-item functions , clcpp/workitems/test_cpp_workitems -Work-group functions , clcpp/workgroups/test_cpp_workgroups -Sub-group functions , clcpp/subgroups/test_cpp_subgroups -Synchronization functions , clcpp/synchronization/test_cpp_synchronization "test_work_group_barrier*" "test_sub_group_barrier*" -Math functions , clcpp/math_funcs/test_cpp_math_funcs -Integer functions , clcpp/integer_funcs/test_cpp_integer_funcs -Common functions , clcpp/common_funcs/test_cpp_common_funcs -Geometric functions , clcpp/geometric_funcs/test_cpp_geometric_funcs -Relational functions , clcpp/relational_funcs/test_cpp_relational_funcs -vload and vstore functions , clcpp/vload_vstore/test_cpp_vload_vstore_funcs - -# ######################################### -# New in OpenCL C++ -# ######################################### -Specialization constants , clcpp/spec_constants/test_cpp_spec_constants -Named barriers (KHR extension) , clcpp/synchronization/test_cpp_synchronization "test_work_group_named_barrier*" -required_num_sub_groups attribute , clcpp/attributes/test_cpp_attributes "test_required_num_sub_groups*" -ivdep attribute , clcpp/attributes/test_cpp_attributes "test_ivdep*" -max_size attribute , clcpp/attributes/test_cpp_attributes "test_max_size*" -Ctors and dtors of global scope objects , clcpp/program_scope_ctors_dtors/test_cpp_program_scope_ctors_dtors -Pipe storages , clcpp/pipes/test_cpp_pipes "test_pipes_pipe_storage" diff --git a/test_conformance/opencl_conformance_tests_full.csv b/test_conformance/opencl_conformance_tests_full.csv index efd004e6..2b0dc8aa 100644 --- a/test_conformance/opencl_conformance_tests_full.csv +++ b/test_conformance/opencl_conformance_tests_full.csv @@ -30,7 +30,7 @@ Atomics,atomics/test_atomics Profiling,profiling/test_profiling Events,events/test_events Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all +Allocations (total maximum),allocations/test_allocations multiple 5 all Vectors, vectors/test_vectors Printf,printf/test_printf Device Partitioning,device_partition/test_device_partition @@ -39,23 +39,23 @@ Device Partitioning,device_partition/test_device_partition # Buffers and images # ######################################### Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods +Images (API Info),images/clGetInfo/test_cl_get_info +Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST Images (clCopyImage),images/clCopyImage/test_cl_copy_images Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images +Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images +Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images +Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches +Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images +Images (clFillImage),images/clFillImage/test_cl_fill_images +Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches +Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images +Images (Samplerless),images/samplerlessReads/test_samplerless_reads +Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches +Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images Mem (Host Flags),mem_host_flags/test_mem_host_flags # ######################################### @@ -95,7 +95,7 @@ Workgroups,workgroups/test_workgroups # OpenCL 2.1 tests ##################################### Device timer,device_timer/test_device_timer -SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin +SPIRV new,spirv_new/test_spirv_new --spirv-binaries-path spirv_bin ######################################### # Extensions diff --git a/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv b/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv index f14e0991..8c4508b3 100644 --- a/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv +++ b/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv @@ -30,7 +30,7 @@ Atomics,atomics/test_atomics Profiling,profiling/test_profiling Events,events/test_events Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all +Allocations (total maximum),allocations/test_allocations multiple 5 all Vectors, vectors/test_vectors Printf,printf/test_printf Device Partitioning,device_partition/test_device_partition @@ -39,23 +39,23 @@ Device Partitioning,device_partition/test_device_partition # Buffers and images # ######################################### Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods +Images (API Info),images/clGetInfo/test_cl_get_info +Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST Images (clCopyImage),images/clCopyImage/test_cl_copy_images Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images +Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images +Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images +Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches +Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images +Images (clFillImage),images/clFillImage/test_cl_fill_images +Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches +Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images +Images (Samplerless),images/samplerlessReads/test_samplerless_reads +Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches +Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images Mem (Host Flags),mem_host_flags/test_mem_host_flags # ######################################### diff --git a/test_conformance/opencl_conformance_tests_21_full_spirv.csv b/test_conformance/opencl_conformance_tests_full_spirv.csv similarity index 100% rename from test_conformance/opencl_conformance_tests_21_full_spirv.csv rename to test_conformance/opencl_conformance_tests_full_spirv.csv diff --git a/test_conformance/opencl_conformance_tests_math.csv b/test_conformance/opencl_conformance_tests_math.csv index e033190f..03fddea8 100644 --- a/test_conformance/opencl_conformance_tests_math.csv +++ b/test_conformance/opencl_conformance_tests_math.csv @@ -1,4 +1,4 @@ # # OpenCL Conformance Test Suite (math only) # -Math,math_brute_force/test_bruteforce +Math,math_brute_force/test_bruteforce diff --git a/test_conformance/opencl_conformance_tests_quick.csv b/test_conformance/opencl_conformance_tests_quick.csv index af591656..043df821 100644 --- a/test_conformance/opencl_conformance_tests_quick.csv +++ b/test_conformance/opencl_conformance_tests_quick.csv @@ -32,7 +32,7 @@ Atomics,atomics/test_atomics Profiling,profiling/test_profiling Events,events/test_events Allocations (single maximum),allocations/test_allocations single 5 all -Allocations (total maximum),allocations/test_allocations multiple 5 all +Allocations (total maximum),allocations/test_allocations multiple 5 all Printf,printf/test_printf Device Partitioning,device_partition/test_device_partition @@ -40,22 +40,22 @@ Device Partitioning,device_partition/test_device_partition # Buffers and images # ######################################### Buffers,buffers/test_buffers -Images (API Info),images/clGetInfo/test_cl_get_info -Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods +Images (API Info),images/clGetInfo/test_cl_get_info +Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST Images (clCopyImage),images/clCopyImage/test_cl_copy_images -Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images -Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images -Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches -Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images -Images (clFillImage),images/clFillImage/test_cl_fill_images -Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches -Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images -Images (Samplerless),images/samplerlessReads/test_samplerless_reads -Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches -Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images +Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images +Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images +Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches +Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images +Images (clFillImage),images/clFillImage/test_cl_fill_images +Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches +Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images +Images (Samplerless),images/samplerlessReads/test_samplerless_reads +Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches +Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images Mem (Host Flags),mem_host_flags/test_mem_host_flags # ######################################### @@ -79,3 +79,29 @@ Contractions,contractions/test_contractions Math,math_brute_force/test_bruteforce -w Integer Ops,integer_ops/test_integer_ops integer_* quick_* Half Ops,half/test_half -w + +##################################### +# OpenCL 2.0 tests +##################################### +C11 Atomics,c11_atomics/test_c11_atomics +Execution Model,device_execution/test_device_execution +Generic Address Space,generic_address_space/test_generic_address_space +Non Uniform Work Groups,non_uniform_work_group/test_non_uniform_work_group +Pipes,pipes/test_pipes +SVM,SVM/test_svm +Workgroups,workgroups/test_workgroups + +##################################### +# OpenCL 2.1 tests +##################################### +Device timer,device_timer/test_device_timer +SPIRV new,spirv_new/test_spirv_new --spirv-binaries-path spirv_bin + +######################################### +# Extensions +######################################### +SPIR,spir/test_spir +Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST +Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps +Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps +Subgroups,subgroups/test_subgroups From 02fc5809e37025e732faff768a4d8dde83628429 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Thu, 24 Sep 2020 12:41:04 -0700 Subject: [PATCH 15/37] simple vector swizzle test (#960) * initial version, tests vec2 and vec4 * added all types and vector sizes * fix formatting * add checks for long and ulong support * test floats unconditionally, not tied to long support (oops) * fix for vec3 kernel arguments * remove generic address space dependency --- test_conformance/basic/CMakeLists.txt | 1 + test_conformance/basic/main.cpp | 215 +++--- test_conformance/basic/procs.h | 8 +- .../basic/test_vector_swizzle.cpp | 681 ++++++++++++++++++ 4 files changed, 796 insertions(+), 109 deletions(-) create mode 100644 test_conformance/basic/test_vector_swizzle.cpp diff --git a/test_conformance/basic/CMakeLists.txt b/test_conformance/basic/CMakeLists.txt index d73b84a2..27178246 100644 --- a/test_conformance/basic/CMakeLists.txt +++ b/test_conformance/basic/CMakeLists.txt @@ -39,6 +39,7 @@ set(${MODULE_NAME}_SOURCES test_async_copy.cpp test_sizeof.cpp test_vector_creation.cpp + test_vector_swizzle.cpp test_vec_type_hint.cpp test_numeric_constants.cpp test_constant_source.cpp diff --git a/test_conformance/basic/main.cpp b/test_conformance/basic/main.cpp index 11ed2c38..911f5e7b 100644 --- a/test_conformance/basic/main.cpp +++ b/test_conformance/basic/main.cpp @@ -26,130 +26,131 @@ #include "procs.h" test_definition test_list[] = { - ADD_TEST( hostptr ), - ADD_TEST( fpmath_float ), - ADD_TEST( fpmath_float2 ), - ADD_TEST( fpmath_float4 ), - ADD_TEST( intmath_int ), - ADD_TEST( intmath_int2 ), - ADD_TEST( intmath_int4 ), - ADD_TEST( intmath_long ), - ADD_TEST( intmath_long2 ), - ADD_TEST( intmath_long4 ), - ADD_TEST( hiloeo ), - ADD_TEST( if ), - ADD_TEST( sizeof ), - ADD_TEST( loop ), - ADD_TEST( pointer_cast ), - ADD_TEST( local_arg_def ), - ADD_TEST( local_kernel_def ), - ADD_TEST( local_kernel_scope ), - ADD_TEST( constant ), - ADD_TEST( constant_source ), - ADD_TEST( readimage ), - ADD_TEST( readimage_int16 ), - ADD_TEST( readimage_fp32 ), - ADD_TEST( writeimage ), - ADD_TEST( writeimage_int16 ), - ADD_TEST( writeimage_fp32 ), - ADD_TEST( mri_one ), + ADD_TEST(hostptr), + ADD_TEST(fpmath_float), + ADD_TEST(fpmath_float2), + ADD_TEST(fpmath_float4), + ADD_TEST(intmath_int), + ADD_TEST(intmath_int2), + ADD_TEST(intmath_int4), + ADD_TEST(intmath_long), + ADD_TEST(intmath_long2), + ADD_TEST(intmath_long4), + ADD_TEST(hiloeo), + ADD_TEST(if), + ADD_TEST(sizeof), + ADD_TEST(loop), + ADD_TEST(pointer_cast), + ADD_TEST(local_arg_def), + ADD_TEST(local_kernel_def), + ADD_TEST(local_kernel_scope), + ADD_TEST(constant), + ADD_TEST(constant_source), + ADD_TEST(readimage), + ADD_TEST(readimage_int16), + ADD_TEST(readimage_fp32), + ADD_TEST(writeimage), + ADD_TEST(writeimage_int16), + ADD_TEST(writeimage_fp32), + ADD_TEST(mri_one), - ADD_TEST( mri_multiple ), - ADD_TEST( image_r8 ), - ADD_TEST( barrier ), - ADD_TEST_VERSION( wg_barrier, Version(2, 0) ), - ADD_TEST( int2float ), - ADD_TEST( float2int ), - ADD_TEST( imagereadwrite ), - ADD_TEST( imagereadwrite3d ), - ADD_TEST( readimage3d ), - ADD_TEST( readimage3d_int16 ), - ADD_TEST( readimage3d_fp32 ), - ADD_TEST( bufferreadwriterect ), - ADD_TEST( arrayreadwrite ), - ADD_TEST( arraycopy ), - ADD_TEST( imagearraycopy ), - ADD_TEST( imagearraycopy3d ), - ADD_TEST( imagecopy ), - ADD_TEST( imagecopy3d ), - ADD_TEST( imagerandomcopy ), - ADD_TEST( arrayimagecopy ), - ADD_TEST( arrayimagecopy3d ), - ADD_TEST( imagenpot ), + ADD_TEST(mri_multiple), + ADD_TEST(image_r8), + ADD_TEST(barrier), + ADD_TEST_VERSION(wg_barrier, Version(2, 0)), + ADD_TEST(int2float), + ADD_TEST(float2int), + ADD_TEST(imagereadwrite), + ADD_TEST(imagereadwrite3d), + ADD_TEST(readimage3d), + ADD_TEST(readimage3d_int16), + ADD_TEST(readimage3d_fp32), + ADD_TEST(bufferreadwriterect), + ADD_TEST(arrayreadwrite), + ADD_TEST(arraycopy), + ADD_TEST(imagearraycopy), + ADD_TEST(imagearraycopy3d), + ADD_TEST(imagecopy), + ADD_TEST(imagecopy3d), + ADD_TEST(imagerandomcopy), + ADD_TEST(arrayimagecopy), + ADD_TEST(arrayimagecopy3d), + ADD_TEST(imagenpot), - ADD_TEST( vload_global ), - ADD_TEST( vload_local ), - ADD_TEST( vload_constant ), - ADD_TEST( vload_private ), - ADD_TEST( vstore_global ), - ADD_TEST( vstore_local ), - ADD_TEST( vstore_private ), + ADD_TEST(vload_global), + ADD_TEST(vload_local), + ADD_TEST(vload_constant), + ADD_TEST(vload_private), + ADD_TEST(vstore_global), + ADD_TEST(vstore_local), + ADD_TEST(vstore_private), - ADD_TEST( createkernelsinprogram ), - ADD_TEST( imagedim_pow2 ), - ADD_TEST( imagedim_non_pow2 ), - ADD_TEST( image_param ), - ADD_TEST( image_multipass_integer_coord ), - ADD_TEST( image_multipass_float_coord ), - ADD_TEST( explicit_s2v_char ), - ADD_TEST( explicit_s2v_uchar ), - ADD_TEST( explicit_s2v_short ), - ADD_TEST( explicit_s2v_ushort ), - ADD_TEST( explicit_s2v_int ), - ADD_TEST( explicit_s2v_uint ), - ADD_TEST( explicit_s2v_long ), - ADD_TEST( explicit_s2v_ulong ), - ADD_TEST( explicit_s2v_float ), - ADD_TEST( explicit_s2v_double ), + ADD_TEST(createkernelsinprogram), + ADD_TEST(imagedim_pow2), + ADD_TEST(imagedim_non_pow2), + ADD_TEST(image_param), + ADD_TEST(image_multipass_integer_coord), + ADD_TEST(image_multipass_float_coord), + ADD_TEST(explicit_s2v_char), + ADD_TEST(explicit_s2v_uchar), + ADD_TEST(explicit_s2v_short), + ADD_TEST(explicit_s2v_ushort), + ADD_TEST(explicit_s2v_int), + ADD_TEST(explicit_s2v_uint), + ADD_TEST(explicit_s2v_long), + ADD_TEST(explicit_s2v_ulong), + ADD_TEST(explicit_s2v_float), + ADD_TEST(explicit_s2v_double), - ADD_TEST( enqueue_map_buffer ), - ADD_TEST( enqueue_map_image ), + ADD_TEST(enqueue_map_buffer), + ADD_TEST(enqueue_map_image), - ADD_TEST( work_item_functions ), + ADD_TEST(work_item_functions), - ADD_TEST( astype ), + ADD_TEST(astype), - ADD_TEST( async_copy_global_to_local ), - ADD_TEST( async_copy_local_to_global ), - ADD_TEST( async_strided_copy_global_to_local ), - ADD_TEST( async_strided_copy_local_to_global ), - ADD_TEST( prefetch ), + ADD_TEST(async_copy_global_to_local), + ADD_TEST(async_copy_local_to_global), + ADD_TEST(async_strided_copy_global_to_local), + ADD_TEST(async_strided_copy_local_to_global), + ADD_TEST(prefetch), - ADD_TEST( kernel_call_kernel_function ), - ADD_TEST( host_numeric_constants ), - ADD_TEST( kernel_numeric_constants ), - ADD_TEST( kernel_limit_constants ), - ADD_TEST( kernel_preprocessor_macros ), + ADD_TEST(kernel_call_kernel_function), + ADD_TEST(host_numeric_constants), + ADD_TEST(kernel_numeric_constants), + ADD_TEST(kernel_limit_constants), + ADD_TEST(kernel_preprocessor_macros), - ADD_TEST( parameter_types ), - ADD_TEST( vector_creation ), - ADD_TEST( vec_type_hint ), - ADD_TEST( kernel_memory_alignment_local ), - ADD_TEST( kernel_memory_alignment_global ), - ADD_TEST( kernel_memory_alignment_constant ), - ADD_TEST( kernel_memory_alignment_private ), + ADD_TEST(parameter_types), + ADD_TEST(vector_creation), + ADD_TEST(vector_swizzle), + ADD_TEST(vec_type_hint), + ADD_TEST(kernel_memory_alignment_local), + ADD_TEST(kernel_memory_alignment_global), + ADD_TEST(kernel_memory_alignment_constant), + ADD_TEST(kernel_memory_alignment_private), - ADD_TEST_VERSION( progvar_prog_scope_misc, Version(2, 0) ), - ADD_TEST_VERSION( progvar_prog_scope_uninit, Version(2, 0) ), - ADD_TEST_VERSION( progvar_prog_scope_init, Version(2, 0) ), - ADD_TEST_VERSION( progvar_func_scope, Version(2, 0) ), + ADD_TEST_VERSION(progvar_prog_scope_misc, Version(2, 0)), + ADD_TEST_VERSION(progvar_prog_scope_uninit, Version(2, 0)), + ADD_TEST_VERSION(progvar_prog_scope_init, Version(2, 0)), + ADD_TEST_VERSION(progvar_func_scope, Version(2, 0)), - ADD_TEST( global_work_offsets ), - ADD_TEST( get_global_offset ), + ADD_TEST(global_work_offsets), + ADD_TEST(get_global_offset), - ADD_TEST_VERSION( global_linear_id, Version(2, 0) ), - ADD_TEST_VERSION( local_linear_id, Version(2, 0) ), - ADD_TEST_VERSION( enqueued_local_size, Version(2, 0) ), + ADD_TEST_VERSION(global_linear_id, Version(2, 0)), + ADD_TEST_VERSION(local_linear_id, Version(2, 0)), + ADD_TEST_VERSION(enqueued_local_size, Version(2, 0)), - ADD_TEST( simple_read_image_pitch ), - ADD_TEST( simple_write_image_pitch ), + ADD_TEST(simple_read_image_pitch), + ADD_TEST(simple_write_image_pitch), #if defined( __APPLE__ ) - ADD_TEST( queue_priority ), + ADD_TEST(queue_priority), #endif - ADD_TEST_VERSION( get_linear_ids, Version(2, 0) ), - ADD_TEST_VERSION( rw_image_access_qualifier, Version(2, 0) ), + ADD_TEST_VERSION(get_linear_ids, Version(2, 0)), + ADD_TEST_VERSION(rw_image_access_qualifier, Version(2, 0)), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/basic/procs.h b/test_conformance/basic/procs.h index 9fe17ef4..bdb7d6a4 100644 --- a/test_conformance/basic/procs.h +++ b/test_conformance/basic/procs.h @@ -126,8 +126,12 @@ extern int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context extern int test_kernel_call_kernel_function(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_parameter_types(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements); -extern int test_vector_creation(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); -extern int test_vec_type_hint(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); +extern int test_vector_creation(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); +extern int test_vector_swizzle(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); +extern int test_vec_type_hint(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); extern int test_kernel_memory_alignment_local(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems ); diff --git a/test_conformance/basic/test_vector_swizzle.cpp b/test_conformance/basic/test_vector_swizzle.cpp new file mode 100644 index 00000000..67bf7537 --- /dev/null +++ b/test_conformance/basic/test_vector_swizzle.cpp @@ -0,0 +1,681 @@ +// +// Copyright (c) 2020 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 +#include +#include +#include + +#include "procs.h" +#include "harness/testHarness.h" + +template struct TestInfo +{ +}; + +template <> struct TestInfo<2> +{ + static const size_t vector_size = 2; + + static constexpr const char* kernel_source_xyzw = R"CLC( +__kernel void test_vector_swizzle_xyzw(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].x = value.x; + dst[index++].y = value.x; + dst[index++].xy = value; + dst[index++].yx = value; + + // rvalue swizzles + dst[index++] = value.x; + dst[index++] = value.y; + dst[index++] = value.xy; + dst[index++] = value.yx; +} +)CLC"; + + static constexpr const char* kernel_source_rgba = R"CLC( +__kernel void test_vector_swizzle_rgba(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].r = value.r; + dst[index++].g = value.r; + dst[index++].rg = value; + dst[index++].gr = value; + + // rvalue swizzles + dst[index++] = value.r; + dst[index++] = value.g; + dst[index++] = value.rg; + dst[index++] = value.gr; +} +)CLC"; + + static constexpr const char* kernel_source_sN = R"CLC( +__kernel void test_vector_swizzle_sN(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].s0 = value.s0; + dst[index++].s1 = value.s0; + dst[index++].s01 = value; + dst[index++].s10 = value; + + // rvalue swizzles + dst[index++] = value.s0; + dst[index++] = value.s1; + dst[index++] = value.s01; + dst[index++] = value.s10; +} +)CLC"; +}; + +template <> struct TestInfo<3> +{ + static const size_t vector_size = 4; // sizeof(vec3) is four elements + + static constexpr const char* kernel_source_xyzw = R"CLC( +__kernel void test_vector_swizzle_xyzw(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].x = value.x; + dst[index++].y = value.x; + dst[index++].z = value.x; + dst[index++].xyz = value; + dst[index++].zyx = value; + + // rvalue swizzles + vstore3(value.x, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.y, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.z, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.xyz, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.zyx, 0, (__global BASETYPE*)(dst + index++)); +} +)CLC"; + + static constexpr const char* kernel_source_rgba = R"CLC( +__kernel void test_vector_swizzle_rgba(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].r = value.r; + dst[index++].g = value.r; + dst[index++].b = value.r; + dst[index++].rgb = value; + dst[index++].bgr = value; + + // rvalue swizzles + vstore3(value.r, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.g, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.b, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.rgb, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.bgr, 0, (__global BASETYPE*)(dst + index++)); +} +)CLC"; + + static constexpr const char* kernel_source_sN = R"CLC( +__kernel void test_vector_swizzle_sN(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].s0 = value.s0; + dst[index++].s1 = value.s0; + dst[index++].s2 = value.s0; + dst[index++].s012 = value; + dst[index++].s210 = value; + + // rvalue swizzles + vstore3(value.s0, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.s1, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.s2, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.s012, 0, (__global BASETYPE*)(dst + index++)); + vstore3(value.s210, 0, (__global BASETYPE*)(dst + index++)); +} +)CLC"; +}; + +template <> struct TestInfo<4> +{ + static const size_t vector_size = 4; + + static constexpr const char* kernel_source_xyzw = R"CLC( +__kernel void test_vector_swizzle_xyzw(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].x = value.x; + dst[index++].y = value.x; + dst[index++].z = value.x; + dst[index++].w = value.x; + dst[index++].xyzw = value; + dst[index++].wzyx = value; + + // rvalue swizzles + dst[index++] = value.x; + dst[index++] = value.y; + dst[index++] = value.z; + dst[index++] = value.w; + dst[index++] = value.xyzw; + dst[index++] = value.wzyx; +} +)CLC"; + + static constexpr const char* kernel_source_rgba = R"CLC( +__kernel void test_vector_swizzle_rgba(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].r = value.r; + dst[index++].g = value.r; + dst[index++].b = value.r; + dst[index++].a = value.r; + dst[index++].rgba = value; + dst[index++].abgr = value; + + // rvalue swizzles + dst[index++] = value.r; + dst[index++] = value.g; + dst[index++] = value.b; + dst[index++] = value.a; + dst[index++] = value.rgba; + dst[index++] = value.abgr; +} +)CLC"; + + static constexpr const char* kernel_source_sN = R"CLC( +__kernel void test_vector_swizzle_sN(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].s0 = value.s0; + dst[index++].s1 = value.s0; + dst[index++].s2 = value.s0; + dst[index++].s3 = value.s0; + dst[index++].s0123 = value; + dst[index++].s3210 = value; + + // rvalue swizzles + dst[index++] = value.s0; + dst[index++] = value.s1; + dst[index++] = value.s2; + dst[index++] = value.s3; + dst[index++] = value.s0123; + dst[index++] = value.s3210; +} +)CLC"; +}; + +template <> struct TestInfo<8> +{ + static const size_t vector_size = 8; + + static constexpr const char* kernel_source_xyzw = R"CLC( +__kernel void test_vector_swizzle_xyzw(TYPE value, __global TYPE* dst) { + int index = 0; + + // xwzw only for first four components! + + // lvalue swizzles + dst[index++].x = value.x; + dst[index++].y = value.x; + dst[index++].z = value.x; + dst[index++].w = value.x; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index].xyzw = value.s0123; + dst[index++].s4567 = value.s4567; + dst[index].s7654 = value.s0123; + dst[index++].wzyx = value.s4567; + + // rvalue swizzles + dst[index++] = value.x; + dst[index++] = value.y; + dst[index++] = value.z; + dst[index++] = value.w; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = (TYPE)(value.xyzw, value.s4567); + dst[index++] = (TYPE)(value.s7654, value.wzyx); +} +)CLC"; + static constexpr const char* kernel_source_rgba = R"CLC( +__kernel void test_vector_swizzle_rgba(TYPE value, __global TYPE* dst) { + int index = 0; + + // rgba only for first four components! + + // lvalue swizzles + dst[index++].r = value.r; + dst[index++].g = value.r; + dst[index++].b = value.r; + dst[index++].a = value.r; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index].rgba = value.s0123; + dst[index++].s4567 = value.s4567; + dst[index].s7654 = value.s0123; + dst[index++].abgr = value.s4567; + + // rvalue swizzles + dst[index++] = value.r; + dst[index++] = value.g; + dst[index++] = value.b; + dst[index++] = value.a; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = (TYPE)(value.rgba, value.s4567); + dst[index++] = (TYPE)(value.s7654, value.abgr); +} +)CLC"; + static constexpr const char* kernel_source_sN = R"CLC( +__kernel void test_vector_swizzle_sN(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].s0 = value.s0; + dst[index++].s1 = value.s0; + dst[index++].s2 = value.s0; + dst[index++].s3 = value.s0; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index++].s01234567 = value; + dst[index++].s76543210 = value; + + // rvalue swizzles + dst[index++] = value.s0; + dst[index++] = value.s1; + dst[index++] = value.s2; + dst[index++] = value.s3; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = value.s01234567; + dst[index++] = value.s76543210; +} +)CLC"; +}; + +template <> struct TestInfo<16> +{ + static const size_t vector_size = 16; + + static constexpr const char* kernel_source_xyzw = R"CLC( +__kernel void test_vector_swizzle_xyzw(TYPE value, __global TYPE* dst) { + int index = 0; + + // xwzw only for first four components! + + // lvalue swizzles + dst[index++].x = value.x; + dst[index++].y = value.x; + dst[index++].z = value.x; + dst[index++].w = value.x; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index++].s8 = value.s0; + dst[index++].s9 = value.s0; + dst[index++].sa = value.s0; + dst[index++].sb = value.s0; + dst[index++].sc = value.s0; + dst[index++].sd = value.s0; + dst[index++].se = value.s0; + dst[index++].sf = value.s0; + dst[index].xyzw = value.s0123; + dst[index].s4567 = value.s4567; + dst[index].s89ab = value.s89ab; + dst[index++].scdef = value.scdef; + dst[index].sfedc = value.s0123; + dst[index].sba98 = value.s4567; + dst[index].s7654 = value.s89ab; + dst[index++].wzyx = value.scdef; + + // rvalue swizzles + dst[index++] = value.x; + dst[index++] = value.y; + dst[index++] = value.z; + dst[index++] = value.w; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = value.s8; + dst[index++] = value.s9; + dst[index++] = value.sa; + dst[index++] = value.sb; + dst[index++] = value.sc; + dst[index++] = value.sd; + dst[index++] = value.se; + dst[index++] = value.sf; + dst[index++] = (TYPE)(value.xyzw, value.s4567, value.s89abcdef); + dst[index++] = (TYPE)(value.sfedcba98, value.s7654, value.wzyx); +} +)CLC"; + static constexpr const char* kernel_source_rgba = R"CLC( +__kernel void test_vector_swizzle_rgba(TYPE value, __global TYPE* dst) { + int index = 0; + + // rgba only for first four components! + + // lvalue swizzles + dst[index++].r = value.r; + dst[index++].g = value.r; + dst[index++].b = value.r; + dst[index++].a = value.r; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index++].s8 = value.s0; + dst[index++].s9 = value.s0; + dst[index++].sa = value.s0; + dst[index++].sb = value.s0; + dst[index++].sc = value.s0; + dst[index++].sd = value.s0; + dst[index++].se = value.s0; + dst[index++].sf = value.s0; + dst[index].rgba = value.s0123; + dst[index].s4567 = value.s4567; + dst[index].s89ab = value.s89ab; + dst[index++].scdef = value.scdef; + dst[index].sfedc = value.s0123; + dst[index].sba98 = value.s4567; + dst[index].s7654 = value.s89ab; + dst[index++].abgr = value.scdef; + + // rvalue swizzles + dst[index++] = value.r; + dst[index++] = value.g; + dst[index++] = value.b; + dst[index++] = value.a; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = value.s8; + dst[index++] = value.s9; + dst[index++] = value.sa; + dst[index++] = value.sb; + dst[index++] = value.sc; + dst[index++] = value.sd; + dst[index++] = value.se; + dst[index++] = value.sf; + dst[index++] = (TYPE)(value.rgba, value.s4567, value.s89abcdef); + dst[index++] = (TYPE)(value.sfedcba98, value.s7654, value.abgr); +} +)CLC"; + static constexpr const char* kernel_source_sN = R"CLC( +__kernel void test_vector_swizzle_sN(TYPE value, __global TYPE* dst) { + int index = 0; + + // lvalue swizzles + dst[index++].s0 = value.s0; + dst[index++].s1 = value.s0; + dst[index++].s2 = value.s0; + dst[index++].s3 = value.s0; + dst[index++].s4 = value.s0; + dst[index++].s5 = value.s0; + dst[index++].s6 = value.s0; + dst[index++].s7 = value.s0; + dst[index++].s8 = value.s0; + dst[index++].s9 = value.s0; + dst[index++].sa = value.s0; + dst[index++].sb = value.s0; + dst[index++].sc = value.s0; + dst[index++].sd = value.s0; + dst[index++].se = value.s0; + dst[index++].sf = value.s0; + dst[index++].s0123456789abcdef = value; // lower-case + dst[index++].sFEDCBA9876543210 = value; // upper-case + + // rvalue swizzles + dst[index++] = value.s0; + dst[index++] = value.s1; + dst[index++] = value.s2; + dst[index++] = value.s3; + dst[index++] = value.s4; + dst[index++] = value.s5; + dst[index++] = value.s6; + dst[index++] = value.s7; + dst[index++] = value.s8; + dst[index++] = value.s9; + dst[index++] = value.sa; + dst[index++] = value.sb; + dst[index++] = value.sc; + dst[index++] = value.sd; + dst[index++] = value.se; + dst[index++] = value.sf; + dst[index++] = value.s0123456789abcdef; // lower-case + dst[index++] = value.sFEDCBA9876543210; // upper-case +} +)CLC"; +}; + +template +static void makeReference(std::vector& ref) +{ + // N single channel lvalue tests + // 2 multi-value lvalue tests + // N single channel rvalue tests + // 2 multi-value rvalue tests + const size_t refSize = (N + 2 + N + 2) * S; + + ref.resize(refSize); + std::fill(ref.begin(), ref.end(), 99); + + size_t dstIndex = 0; + + // single channel lvalue + for (size_t i = 0; i < N; i++) + { + ref[dstIndex * S + i] = 0; + ++dstIndex; + } + + // normal lvalue + for (size_t c = 0; c < N; c++) + { + ref[dstIndex * S + c] = c; + } + ++dstIndex; + + // reverse lvalue + for (size_t c = 0; c < N; c++) + { + ref[dstIndex * S + c] = N - c - 1; + } + ++dstIndex; + + // single channel rvalue + for (size_t i = 0; i < N; i++) + { + for (size_t c = 0; c < N; c++) + { + ref[dstIndex * S + c] = i; + } + ++dstIndex; + } + + // normal rvalue + for (size_t c = 0; c < N; c++) + { + ref[dstIndex * S + c] = c; + } + ++dstIndex; + + // reverse rvalue + for (size_t c = 0; c < N; c++) + { + ref[dstIndex * S + c] = N - c - 1; + } + ++dstIndex; + + assert(dstIndex * S == refSize); +} + +template +static int +test_vectype_case(const std::vector& value, const std::vector& reference, + cl_context context, cl_kernel kernel, cl_command_queue queue) +{ + cl_int error = CL_SUCCESS; + + clMemWrapper mem; + + std::vector buffer(reference.size(), 99); + mem = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + buffer.size() * sizeof(T), buffer.data(), &error); + test_error(error, "Unable to create test buffer"); + + error = clSetKernelArg(kernel, 0, value.size() * sizeof(T), value.data()); + test_error(error, "Unable to set value kernel arg"); + + error = clSetKernelArg(kernel, 1, sizeof(mem), &mem); + test_error(error, "Unable to set destination buffer kernel arg"); + + size_t global_work_size[] = { 1 }; + error = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, global_work_size, + NULL, 0, NULL, NULL); + test_error(error, "Unable to enqueue test kernel"); + + error = clFinish(queue); + test_error(error, "clFinish failed after test kernel"); + + error = + clEnqueueReadBuffer(queue, mem, CL_TRUE, 0, buffer.size() * sizeof(T), + buffer.data(), 0, NULL, NULL); + test_error(error, "Unable to read data after test kernel"); + + if (buffer != reference) + { + log_error("Result buffer did not match reference buffer!\n"); + return TEST_FAIL; + } + + return TEST_PASS; +} + +template +static int test_vectype(const char* type_name, cl_device_id device, + cl_context context, cl_command_queue queue) +{ + log_info(" testing type %s%d\n", type_name, N); + + cl_int error = CL_SUCCESS; + int result = TEST_PASS; + + clProgramWrapper program; + clKernelWrapper kernel; + + std::string buildOptions{ "-DTYPE=" }; + buildOptions += type_name; + buildOptions += std::to_string(N); + buildOptions += " -DBASETYPE="; + buildOptions += type_name; + + constexpr size_t S = TestInfo::vector_size; + + std::vector value(S); + std::iota(value.begin(), value.end(), 0); + + std::vector reference; + makeReference(reference); + + // XYZW swizzles: + + const char* xyzw_source = TestInfo::kernel_source_xyzw; + error = create_single_kernel_helper( + context, &program, &kernel, 1, &xyzw_source, "test_vector_swizzle_xyzw", + buildOptions.c_str()); + test_error(error, "Unable to create xyzw test kernel"); + + result |= test_vectype_case(value, reference, context, kernel, queue); + + // sN swizzles: + const char* sN_source = TestInfo::kernel_source_sN; + error = create_single_kernel_helper(context, &program, &kernel, 1, + &sN_source, "test_vector_swizzle_sN", + buildOptions.c_str()); + test_error(error, "Unable to create sN test kernel"); + + result |= test_vectype_case(value, reference, context, kernel, queue); + + // RGBA swizzles for OpenCL 3.0 and newer: + const Version device_version = get_device_cl_version(device); + if (device_version >= Version(3, 0)) + { + const char* rgba_source = TestInfo::kernel_source_rgba; + error = create_single_kernel_helper( + context, &program, &kernel, 1, &rgba_source, + "test_vector_swizzle_rgba", buildOptions.c_str()); + test_error(error, "Unable to create rgba test kernel"); + + result |= test_vectype_case(value, reference, context, kernel, queue); + } + + return result; +} + +template +static int test_type(const char* type_name, cl_device_id device, + cl_context context, cl_command_queue queue) +{ + return test_vectype(type_name, device, context, queue) + | test_vectype(type_name, device, context, queue) + | test_vectype(type_name, device, context, queue) + | test_vectype(type_name, device, context, queue) + | test_vectype(type_name, device, context, queue); +} + +int test_vector_swizzle(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements) +{ + int hasDouble = is_extension_available(device, "cl_khr_fp64"); + + int result = TEST_PASS; + result |= test_type("char", device, context, queue); + result |= test_type("uchar", device, context, queue); + result |= test_type("short", device, context, queue); + result |= test_type("ushort", device, context, queue); + result |= test_type("int", device, context, queue); + result |= test_type("uint", device, context, queue); + if (gHasLong) + { + result |= test_type("long", device, context, queue); + result |= test_type("ulong", device, context, queue); + } + result |= test_type("float", device, context, queue); + if (hasDouble) + { + result |= test_type("double", device, context, queue); + } + return result; +} From 0bff9b66749b44d5c4dc7815bd9d8480ae7444e2 Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Fri, 25 Sep 2020 14:24:57 +0100 Subject: [PATCH 16/37] Skip feature macro consistency tests if no compiler is available (#983) The test compiles programs to determine compiler support, which isn't possible if the compiler is not available, so skip the test. --- test_conformance/compiler/test_feature_macro.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/test_conformance/compiler/test_feature_macro.cpp b/test_conformance/compiler/test_feature_macro.cpp index 656ee99a..cea85a6e 100644 --- a/test_conformance/compiler/test_feature_macro.cpp +++ b/test_conformance/compiler/test_feature_macro.cpp @@ -724,7 +724,21 @@ int test_consistency_c_features_list(cl_device_id deviceID, int test_features_macro(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { - cl_int error = CL_SUCCESS; + cl_bool compilerAvailable = CL_FALSE; + cl_int error = + clGetDeviceInfo(deviceID, CL_DEVICE_COMPILER_AVAILABLE, + sizeof(compilerAvailable), &compilerAvailable, NULL); + test_error(error, "Unable to query CL_DEVICE_COMPILER_AVAILABLE"); + if (compilerAvailable == CL_FALSE) + { + // Note: Not checking that the feature array is empty because the + // specification says "For devices that do not support compilation from + // OpenCL C source, this query may return an empty array." It "may" + // return an empty array implies that an implementation also "may not". + log_info("Skipping test - no compiler is available.\n"); + return TEST_SKIPPED_ITSELF; + } + cl_bool supported = CL_FALSE; std::string test_macro_name = ""; std::vector supported_features_vec; From 59a57de9bf2cc92279e2a317835599a9df19bd6f Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Fri, 25 Sep 2020 14:25:26 +0100 Subject: [PATCH 17/37] Replace use of -ILPath with --spirv-binaries-path in CSV (#981) --- .../opencl_conformance_tests_full_no_math_or_conversions.csv | 2 +- test_conformance/opencl_conformance_tests_full_spirv.csv | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv b/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv index 8c4508b3..89d44907 100644 --- a/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv +++ b/test_conformance/opencl_conformance_tests_full_no_math_or_conversions.csv @@ -93,7 +93,7 @@ Workgroups,workgroups/test_workgroups # OpenCL 2.1 tests ##################################### Device timer,device_timer/test_device_timer -SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin +SPIRV new,spirv_new/test_spirv_new --spirv-binaries-path spirv_bin ######################################### # Extensions diff --git a/test_conformance/opencl_conformance_tests_full_spirv.csv b/test_conformance/opencl_conformance_tests_full_spirv.csv index 1c2b7499..24b41865 100644 --- a/test_conformance/opencl_conformance_tests_full_spirv.csv +++ b/test_conformance/opencl_conformance_tests_full_spirv.csv @@ -95,7 +95,7 @@ Workgroups,workgroups/test_workgroups --compilation-mode spir-v --compilation-ca # OpenCL 2.1 tests ##################################### Device timer,device_timer/test_device_timer -SPIRV new,spirv_new/test_spirv_new -ILPath spirv_bin +SPIRV new,spirv_new/test_spirv_new --spirv-binaries-path spirv_bin ######################################### # Extensions From bd86e2aa9b13dcdce75a65385d75ac0c25f89d0a Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Fri, 25 Sep 2020 06:25:49 -0700 Subject: [PATCH 18/37] temporarily disable the unload_invalid test case (#978) Different implementations of the OpenCL ICD loader treat a null platform differently, so this case does not reliably return CL_INVALID_PLATFORM. --- test_conformance/compiler/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index cbf15e5a..89499f46 100644 --- a/test_conformance/compiler/main.cpp +++ b/test_conformance/compiler/main.cpp @@ -91,7 +91,7 @@ test_definition test_list[] = { ADD_TEST_VERSION(features_macro, Version(3, 0)), ADD_TEST(unload_valid), - ADD_TEST(unload_invalid), + // ADD_TEST(unload_invalid), // disabling temporarily, see GitHub #977 ADD_TEST(unload_repeated), ADD_TEST(unload_compile_unload_link), ADD_TEST(unload_build_unload_create_kernel), From f732cd5b7e9ce899341444cb7f984326fea23696 Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Fri, 25 Sep 2020 14:57:41 +0100 Subject: [PATCH 19/37] Remove invalid SPIR-V image decoration tests (#22) (#958) The Volatile, Coherent, NonWritable and NonReadable decorations can only be applied to images if they are storage images, which require the Shader capability. Note that in SPIR-V 1.4 and later, the NonWritable decoration can also be applied to objects in the Private and Function storage classes (although Private also requires the Shader capability), but this was not covered by the existing test for the NonWritable decoration. Signed-off-by: Stuart Brady --- .../spirv_asm/decorate_coherent.spvasm32 | 81 --------- .../spirv_asm/decorate_coherent.spvasm64 | 94 ---------- .../spirv_asm/decorate_nonreadable.spvasm32 | 66 ------- .../spirv_asm/decorate_nonreadable.spvasm64 | 79 -------- .../spirv_asm/decorate_nonwritable.spvasm32 | 81 --------- .../spirv_asm/decorate_nonwritable.spvasm64 | 94 ---------- .../spirv_asm/decorate_volatile.spvasm32 | 81 --------- .../spirv_asm/decorate_volatile.spvasm64 | 94 ---------- .../spirv_bin/decorate_coherent.spv32 | Bin 1396 -> 0 bytes .../spirv_bin/decorate_coherent.spv64 | Bin 1608 -> 0 bytes .../spirv_bin/decorate_nonreadable.spv32 | Bin 1128 -> 0 bytes .../spirv_bin/decorate_nonreadable.spv64 | Bin 1340 -> 0 bytes .../spirv_bin/decorate_nonwritable.spv32 | Bin 1400 -> 0 bytes .../spirv_bin/decorate_nonwritable.spv64 | Bin 1612 -> 0 bytes .../spirv_bin/decorate_volatile.spv32 | Bin 1396 -> 0 bytes .../spirv_bin/decorate_volatile.spv64 | Bin 1608 -> 0 bytes test_conformance/spirv_new/test_decorate.cpp | 168 ------------------ 17 files changed, 838 deletions(-) delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm32 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm64 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm32 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm64 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm32 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm64 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm32 delete mode 100644 test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_coherent.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_coherent.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_volatile.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_volatile.spv64 diff --git a/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm32 b/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm32 deleted file mode 100644 index 158d7e43..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm32 +++ /dev/null @@ -1,81 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %2 "decorate_coherent" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %call1 "call1" - OpName %call2 "call2" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit6 "vecinit6" - OpName %TempSampledImage "TempSampledImage" - OpName %call7_old "call7.old" - OpName %arrayidx "arrayidx" - OpDecorate %src Coherent - OpDecorate %19 Constant - %19 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %19 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %uint_16 = OpConstant %uint 16 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3uint = OpTypeVector %uint 3 -%_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %28 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %29 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %28 - %v2uint = OpTypeVector %uint 2 - %31 = OpTypeSampler - %32 = OpTypeSampledImage %28 - %float = OpTypeFloat 32 - %34 = OpConstantSampler %31 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input - %2 = OpFunction %void None %29 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %28 - %entry = OpLabel - %36 = OpUndef %v2uint - %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %uint %37 0 - %38 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %uint %38 1 - %39 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 0 - %call2 = OpCompositeExtract %uint %39 0 - %mul = OpIMul %uint %call2 %call1 - %add = OpIAdd %uint %mul %call - %vecinit = OpCompositeInsert %v2uint %call1 %36 0 - %vecinit6 = OpCompositeInsert %v2uint %call %vecinit 1 -%TempSampledImage = OpSampledImage %32 %src %34 - %call7_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit6 Lod %float_0 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %add - OpStore %arrayidx %call7_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm64 b/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm64 deleted file mode 100644 index 205a21c3..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_coherent.spvasm64 +++ /dev/null @@ -1,94 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability Int64 - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %2 "decorate_coherent" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %conv "conv" - OpName %call1 "call1" - OpName %conv2 "conv2" - OpName %conv3 "conv3" - OpName %call4 "call4" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit10 "vecinit10" - OpName %TempSampledImage "TempSampledImage" - OpName %call11_old "call11.old" - OpName %sext "sext" - OpName %idxprom "idxprom" - OpName %arrayidx "arrayidx" - OpDecorate %src Coherent - OpDecorate %24 Constant - %24 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %24 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %ulong = OpTypeInt 64 0 - %uint_16 = OpConstant %uint 16 - %ulong_32 = OpConstant %ulong 32 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3ulong = OpTypeVector %ulong 3 -%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %35 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %35 - %v2uint = OpTypeVector %uint 2 - %38 = OpTypeSampler - %39 = OpTypeSampledImage %35 - %float = OpTypeFloat 32 - %41 = OpConstantSampler %38 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3ulong Input - %2 = OpFunction %void None %36 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %35 - %entry = OpLabel - %43 = OpUndef %v2uint - %44 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %ulong %44 0 - %conv = OpUConvert %uint %call - %45 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %ulong %45 1 - %conv2 = OpUConvert %uint %call1 - %conv3 = OpSConvert %ulong %conv2 - %46 = OpLoad %v3ulong %__spirv_BuiltInGlobalSize Aligned 0 - %call4 = OpCompositeExtract %ulong %46 0 - %mul = OpIMul %ulong %conv3 %call4 - %add = OpIAdd %ulong %mul %call - %vecinit = OpCompositeInsert %v2uint %conv2 %43 0 - %vecinit10 = OpCompositeInsert %v2uint %conv %vecinit 1 -%TempSampledImage = OpSampledImage %39 %src %41 - %call11_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit10 Lod %float_0 - %sext = OpShiftLeftLogical %ulong %add %ulong_32 - %idxprom = OpShiftRightArithmetic %ulong %sext %ulong_32 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %idxprom - OpStore %arrayidx %call11_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm32 b/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm32 deleted file mode 100644 index 16c89ff5..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm32 +++ /dev/null @@ -1,66 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 31 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability ImageBasic - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %2 "decorate_nonreadable" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpSource OpenCL_C 100000 - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %call1 "call1" - OpName %call2 "call2" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit3 "vecinit3" - OpName %arrayidx "arrayidx" - OpDecorate %dst NonReadable - OpDecorate %16 Constant - %16 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %src FuncParamAttr NoCapture - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpGroupDecorate %16 %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %v3uint = OpTypeVector %uint 3 -%_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid - %21 = OpTypeImage %void 2D 0 0 0 0 Unknown WriteOnly - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %24 = OpTypeFunction %void %21 %_ptr_CrossWorkgroup_v4uint - %v2uint = OpTypeVector %uint 2 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input - %2 = OpFunction %void None %24 - %dst = OpFunctionParameter %21 - %src = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %entry = OpLabel - %26 = OpUndef %v2uint - %27 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %uint %27 0 - %28 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %uint %28 1 - %29 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 0 - %call2 = OpCompositeExtract %uint %29 0 - %mul = OpIMul %uint %call2 %call1 - %add = OpIAdd %uint %mul %call - %vecinit = OpCompositeInsert %v2uint %call1 %26 0 - %vecinit3 = OpCompositeInsert %v2uint %call %vecinit 1 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %src %add - %30 = OpLoad %v4uint %arrayidx Aligned 16 - OpImageWrite %dst %vecinit3 %30 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm64 b/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm64 deleted file mode 100644 index cd5a0065..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_nonreadable.spvasm64 +++ /dev/null @@ -1,79 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 38 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability Int64 - OpCapability ImageBasic - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %2 "decorate_nonreadable" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpSource OpenCL_C 100000 - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %conv "conv" - OpName %call1 "call1" - OpName %conv2 "conv2" - OpName %conv3 "conv3" - OpName %call4 "call4" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit7 "vecinit7" - OpName %sext "sext" - OpName %idxprom "idxprom" - OpName %arrayidx "arrayidx" - OpDecorate %dst NonReadable - OpDecorate %21 Constant - %21 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %src FuncParamAttr NoCapture - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpGroupDecorate %21 %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %ulong = OpTypeInt 64 0 - %uint = OpTypeInt 32 0 - %ulong_32 = OpConstant %ulong 32 - %v3ulong = OpTypeVector %ulong 3 -%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong - %void = OpTypeVoid - %28 = OpTypeImage %void 2D 0 0 0 0 Unknown WriteOnly - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %31 = OpTypeFunction %void %28 %_ptr_CrossWorkgroup_v4uint - %v2uint = OpTypeVector %uint 2 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3ulong Input - %2 = OpFunction %void None %31 - %dst = OpFunctionParameter %28 - %src = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %entry = OpLabel - %33 = OpUndef %v2uint - %34 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %ulong %34 0 - %conv = OpUConvert %uint %call - %35 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %ulong %35 1 - %conv2 = OpUConvert %uint %call1 - %conv3 = OpSConvert %ulong %conv2 - %36 = OpLoad %v3ulong %__spirv_BuiltInGlobalSize Aligned 0 - %call4 = OpCompositeExtract %ulong %36 0 - %mul = OpIMul %ulong %conv3 %call4 - %add = OpIAdd %ulong %mul %call - %vecinit = OpCompositeInsert %v2uint %conv2 %33 0 - %vecinit7 = OpCompositeInsert %v2uint %conv %vecinit 1 - %sext = OpShiftLeftLogical %ulong %add %ulong_32 - %idxprom = OpShiftRightArithmetic %ulong %sext %ulong_32 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %src %idxprom - %37 = OpLoad %v4uint %arrayidx Aligned 16 - OpImageWrite %dst %vecinit7 %37 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm32 b/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm32 deleted file mode 100644 index 64c378de..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm32 +++ /dev/null @@ -1,81 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %2 "decorate_nonwritable" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %call1 "call1" - OpName %call2 "call2" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit6 "vecinit6" - OpName %TempSampledImage "TempSampledImage" - OpName %call7_old "call7.old" - OpName %arrayidx "arrayidx" - OpDecorate %src NonWritable - OpDecorate %19 Constant - %19 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %19 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %uint_16 = OpConstant %uint 16 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3uint = OpTypeVector %uint 3 -%_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %28 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %29 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %28 - %v2uint = OpTypeVector %uint 2 - %31 = OpTypeSampler - %32 = OpTypeSampledImage %28 - %float = OpTypeFloat 32 - %34 = OpConstantSampler %31 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input - %2 = OpFunction %void None %29 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %28 - %entry = OpLabel - %36 = OpUndef %v2uint - %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %uint %37 0 - %38 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %uint %38 1 - %39 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 0 - %call2 = OpCompositeExtract %uint %39 0 - %mul = OpIMul %uint %call2 %call1 - %add = OpIAdd %uint %mul %call - %vecinit = OpCompositeInsert %v2uint %call1 %36 0 - %vecinit6 = OpCompositeInsert %v2uint %call %vecinit 1 -%TempSampledImage = OpSampledImage %32 %src %34 - %call7_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit6 Lod %float_0 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %add - OpStore %arrayidx %call7_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm64 b/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm64 deleted file mode 100644 index 7df1989a..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_nonwritable.spvasm64 +++ /dev/null @@ -1,94 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability Int64 - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %2 "decorate_nonwritable" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %conv "conv" - OpName %call1 "call1" - OpName %conv2 "conv2" - OpName %conv3 "conv3" - OpName %call4 "call4" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit10 "vecinit10" - OpName %TempSampledImage "TempSampledImage" - OpName %call11_old "call11.old" - OpName %sext "sext" - OpName %idxprom "idxprom" - OpName %arrayidx "arrayidx" - OpDecorate %src NonWritable - OpDecorate %24 Constant - %24 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %24 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %ulong = OpTypeInt 64 0 - %uint_16 = OpConstant %uint 16 - %ulong_32 = OpConstant %ulong 32 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3ulong = OpTypeVector %ulong 3 -%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %35 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %35 - %v2uint = OpTypeVector %uint 2 - %38 = OpTypeSampler - %39 = OpTypeSampledImage %35 - %float = OpTypeFloat 32 - %41 = OpConstantSampler %38 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3ulong Input - %2 = OpFunction %void None %36 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %35 - %entry = OpLabel - %43 = OpUndef %v2uint - %44 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %ulong %44 0 - %conv = OpUConvert %uint %call - %45 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %ulong %45 1 - %conv2 = OpUConvert %uint %call1 - %conv3 = OpSConvert %ulong %conv2 - %46 = OpLoad %v3ulong %__spirv_BuiltInGlobalSize Aligned 0 - %call4 = OpCompositeExtract %ulong %46 0 - %mul = OpIMul %ulong %conv3 %call4 - %add = OpIAdd %ulong %mul %call - %vecinit = OpCompositeInsert %v2uint %conv2 %43 0 - %vecinit10 = OpCompositeInsert %v2uint %conv %vecinit 1 -%TempSampledImage = OpSampledImage %39 %src %41 - %call11_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit10 Lod %float_0 - %sext = OpShiftLeftLogical %ulong %add %ulong_32 - %idxprom = OpShiftRightArithmetic %ulong %sext %ulong_32 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %idxprom - OpStore %arrayidx %call11_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm32 b/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm32 deleted file mode 100644 index f6eb3577..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm32 +++ /dev/null @@ -1,81 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 40 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical32 OpenCL - OpEntryPoint Kernel %2 "decorate_volatile" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %call1 "call1" - OpName %call2 "call2" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit6 "vecinit6" - OpName %TempSampledImage "TempSampledImage" - OpName %call7_old "call7.old" - OpName %arrayidx "arrayidx" - OpDecorate %src Volatile - OpDecorate %19 Constant - %19 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %19 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %uint_16 = OpConstant %uint 16 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3uint = OpTypeVector %uint 3 -%_ptr_Input_v3uint = OpTypePointer Input %v3uint - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %28 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %29 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %28 - %v2uint = OpTypeVector %uint 2 - %31 = OpTypeSampler - %32 = OpTypeSampledImage %28 - %float = OpTypeFloat 32 - %34 = OpConstantSampler %31 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3uint Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3uint Input - %2 = OpFunction %void None %29 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %28 - %entry = OpLabel - %36 = OpUndef %v2uint - %37 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %uint %37 0 - %38 = OpLoad %v3uint %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %uint %38 1 - %39 = OpLoad %v3uint %__spirv_BuiltInGlobalSize Aligned 0 - %call2 = OpCompositeExtract %uint %39 0 - %mul = OpIMul %uint %call2 %call1 - %add = OpIAdd %uint %mul %call - %vecinit = OpCompositeInsert %v2uint %call1 %36 0 - %vecinit6 = OpCompositeInsert %v2uint %call %vecinit 1 -%TempSampledImage = OpSampledImage %32 %src %34 - %call7_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit6 Lod %float_0 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %add - OpStore %arrayidx %call7_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm64 b/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm64 deleted file mode 100644 index ef2623b7..00000000 --- a/test_conformance/spirv_new/spirv_asm/decorate_volatile.spvasm64 +++ /dev/null @@ -1,94 +0,0 @@ -; SPIR-V -; Version: 1.0 -; Generator: Khronos SPIR-V Tools Assembler; 0 -; Bound: 47 -; Schema: 0 - OpCapability Addresses - OpCapability Linkage - OpCapability Kernel - OpCapability Int64 - OpCapability ImageBasic - OpCapability LiteralSampler - %1 = OpExtInstImport "OpenCL.std" - OpMemoryModel Physical64 OpenCL - OpEntryPoint Kernel %2 "decorate_volatile" %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - OpName %sampler "sampler" - OpName %__spirv_BuiltInGlobalInvocationId "__spirv_BuiltInGlobalInvocationId" - OpName %__spirv_BuiltInGlobalSize "__spirv_BuiltInGlobalSize" - OpName %dst "dst" - OpName %src "src" - OpName %entry "entry" - OpName %call "call" - OpName %conv "conv" - OpName %call1 "call1" - OpName %conv2 "conv2" - OpName %conv3 "conv3" - OpName %call4 "call4" - OpName %mul "mul" - OpName %add "add" - OpName %vecinit "vecinit" - OpName %vecinit10 "vecinit10" - OpName %TempSampledImage "TempSampledImage" - OpName %call11_old "call11.old" - OpName %sext "sext" - OpName %idxprom "idxprom" - OpName %arrayidx "arrayidx" - OpDecorate %src Volatile - OpDecorate %24 Constant - %24 = OpDecorationGroup - OpDecorate %__spirv_BuiltInGlobalInvocationId BuiltIn GlobalInvocationId - OpDecorate %__spirv_BuiltInGlobalSize BuiltIn GlobalSize - OpDecorate %dst FuncParamAttr NoCapture - OpDecorate %sampler LinkageAttributes "sampler" Export - OpDecorate %__spirv_BuiltInGlobalSize LinkageAttributes "__spirv_BuiltInGlobalSize" Import - OpDecorate %__spirv_BuiltInGlobalInvocationId LinkageAttributes "__spirv_BuiltInGlobalInvocationId" Import - OpDecorate %sampler Alignment 4 - OpGroupDecorate %24 %sampler %__spirv_BuiltInGlobalInvocationId %__spirv_BuiltInGlobalSize - %uint = OpTypeInt 32 0 - %ulong = OpTypeInt 64 0 - %uint_16 = OpConstant %uint 16 - %ulong_32 = OpConstant %ulong 32 -%_ptr_Input_uint = OpTypePointer Input %uint -%_ptr_UniformConstant_uint = OpTypePointer UniformConstant %uint - %v3ulong = OpTypeVector %ulong 3 -%_ptr_Input_v3ulong = OpTypePointer Input %v3ulong - %void = OpTypeVoid - %v4uint = OpTypeVector %uint 4 -%_ptr_CrossWorkgroup_v4uint = OpTypePointer CrossWorkgroup %v4uint - %35 = OpTypeImage %void 2D 0 0 0 0 Unknown ReadOnly - %36 = OpTypeFunction %void %_ptr_CrossWorkgroup_v4uint %35 - %v2uint = OpTypeVector %uint 2 - %38 = OpTypeSampler - %39 = OpTypeSampledImage %35 - %float = OpTypeFloat 32 - %41 = OpConstantSampler %38 None 0 Nearest - %float_0 = OpConstant %float 0 - %sampler = OpVariable %_ptr_UniformConstant_uint UniformConstant %uint_16 -%__spirv_BuiltInGlobalInvocationId = OpVariable %_ptr_Input_v3ulong Input -%__spirv_BuiltInGlobalSize = OpVariable %_ptr_Input_v3ulong Input - %2 = OpFunction %void None %36 - %dst = OpFunctionParameter %_ptr_CrossWorkgroup_v4uint - %src = OpFunctionParameter %35 - %entry = OpLabel - %43 = OpUndef %v2uint - %44 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call = OpCompositeExtract %ulong %44 0 - %conv = OpUConvert %uint %call - %45 = OpLoad %v3ulong %__spirv_BuiltInGlobalInvocationId Aligned 0 - %call1 = OpCompositeExtract %ulong %45 1 - %conv2 = OpUConvert %uint %call1 - %conv3 = OpSConvert %ulong %conv2 - %46 = OpLoad %v3ulong %__spirv_BuiltInGlobalSize Aligned 0 - %call4 = OpCompositeExtract %ulong %46 0 - %mul = OpIMul %ulong %conv3 %call4 - %add = OpIAdd %ulong %mul %call - %vecinit = OpCompositeInsert %v2uint %conv2 %43 0 - %vecinit10 = OpCompositeInsert %v2uint %conv %vecinit 1 -%TempSampledImage = OpSampledImage %39 %src %41 - %call11_old = OpImageSampleExplicitLod %v4uint %TempSampledImage %vecinit10 Lod %float_0 - %sext = OpShiftLeftLogical %ulong %add %ulong_32 - %idxprom = OpShiftRightArithmetic %ulong %sext %ulong_32 - %arrayidx = OpInBoundsPtrAccessChain %_ptr_CrossWorkgroup_v4uint %dst %idxprom - OpStore %arrayidx %call11_old Aligned 16 - OpReturn - OpFunctionEnd diff --git a/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv32 deleted file mode 100644 index fb6a06c37d47da2363968f84dda2211f70c90b0e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1396 zcmaKr+iMe15XL9n#AsuywYIgbm&AHSE$Bll6n#)ILdxtq0D|<$N>eo7pqL+*aGHVPE@+ zr{#3`>M+f!LEg`bFJU&wr$rQ2X^{_fov;^Nj#IG*>5s%=0>>ksRKf?URCkq;^roGc zE;i+n!!?!7EDEzs!ky21`>D4(-hSrnz%ELT4l|dR-h^@N;ufV(lPJwo?rff236I_FBAeCOvMch1Wf>l&@po{2U(1@;mnB!V2kJO_ zU-i*rIA8ZR{l>oKZT`(uzvFt0|9^ev74>bw-FYVV#Q&Sc%>Msl z#l!EdSim1H^&45y32&~e&3feR73uV`E1TNMH^ViJzOb;@bbih2H+@4AEU{;;o+57Q5FGKukej}fo0-_qw=21+DtnS(R;AyT>}o&J z|3GeOA79iC=8kvn=`L!8Ba5Ew2}6C<+BjxY6ZVeKaDxX6uDe3Rl{bM7A78%-Kri?K&=8nFsMKf(Gj#eE#;b`5_IY-Zm)=kxB zcs-2L=dW6$A~a^+c*R$#>S~IMR1F{u)^y&*BJ2h5S98She!L z_=-6xUTE?I>sL`WWBNgoh**0KIZMZ-Odqhfo&A)v-*qzm!T+9<=aJ=q-^!j@5FP9# z7RPDvK^WRPi{i&oKTcyXR?V5ea+~>7g?dT!T{IZ(+CGKdLGX#=S%2nXakX1nqQ-Ex zW$8xIKCQO$ifA0}5A$qbV^$>xc^(`{iBHG%20i>aQDVB9AbdwTnHfE};AG~9yy0Z# zeN~%zcGPv~4efHaVx_O!nW6vR+_;?`GiPfa>wD-vOkyVY>6YTb_fjap50>)IEz5FV zvaiiTUK4$apw)Etb@9xpsc7t++t+6K^0_EV%}K6`xr9Lrc~y4$LL7DR_eJqXzofo4 zMDg1cB?i3sZHa<+qOY0D;_)T+xYba^6&dj(o)~g74|4Mk*Yv$6x-LZ5Me$h?Pk(*w zZOsh(P3?ad{lKT`lsl@$S;5GnPdoDQML8=tOPMnvKah7r6dWwDK9o0Dxi|3O;eGy+ z7jJV)I`A{g$MT|Y+uGD9^Sn`BdOYiFBIb**aAw{w`ZBg9{-{{)Fg9?OvAk{cxpI-8 zw~emMbz3}VJB))jkB#-+VdLEskL{b&aj(#W@2$?pIr$GzgY&XVJ^usFf*p+Sm4o^5 zPoQ7S>w~yWQT_$!i2)lk`{`=(PoOUM_=nT+#?hmDAszGJAHYnoJ&_KXyyPSPw@^IN F{sW2&i^2c^ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv32 deleted file mode 100644 index 62594fa5421ed99c73de14a9815550315f686960..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1128 zcmaKq%Ss$U6o${-yvAG97?Y?Yf{=|611bbJ2GUFjgd`6zl-<2(XuGAS9ipo&#OLra zvl0BiqB;wiSWtcL|M~0m>9qHz&01zQZ9DpMR;+E^AbUYh1-T$OZ#`e}{W2{+e>)h} ziP@rcysxeJk}}9gPtv%oT%8V!vZzv*xbr-fTiND&bflr*-?fA~@ActubeUD-;n`J| z*MlO;%X60xig6jcIxCBT+9`L|*H6s-mEF*!Cp7pcquT3m8db6Mu3l@F7Ik&)^SU-8 z8M{1}@bTGTe+c$mun)c65mU2^tK8$hknWPi*D;@Q8fQgD&z|P;&;BUY`<5hKRk`ad z`He3MJU4^BEcr@zpb4T!;>(Qa`7YS}A8h^^ao)DC%X=e5h`-l;Za)0=$QC^Ie{-MA zotm#ghgb6t*JZEB?(1?kWWSWeM^0b%swB1eSM{zn$xWNHbxCw$lMa6Hmg3%m_U z-im)$+G|O0z#~Qt^Q4A7{3II=@By>2!NWch2KD4}z&lnpc=SOBmpT7c7W>nZj~;Jy zPZi;9Z*}R>;QUZE9M~^noFzUc2?dZ!nZwodEd>Httz(;|vh>vXOGv7_K z^3~h>O`DpXwZ5{=)2brKLr=4$s$H8+%Brk0m%6Pkdcf>-W{Lhp807O#INJ35^A%4QDiG(OHJ)xr$fYwTU_w&Z!a>^nZ{>~h%;?6t7KXXmkXShpq9 z+sQh33-~x+Lv6eV^6`BMHr@qx>ieMHB5~dachE1Vv-3{q1wS?Z3>dr>aM+C>!Nz;R kj_tK<%#=67T=7vq|MZRsJN1K`s2lzRcj5c3o1TjP0R9tpz5oCK diff --git a/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv32 deleted file mode 100644 index 5d1e2ac2b6d5fb5158327653fad3d275c591f172..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1400 zcmaKr+iMd+6vj_3YqYVgwYIgbm&AHSE$Bll6n#)IL%i{0edo+~&dfCGTP?GinYHYZ{;VadThq(H%L`u4dwET=ZGp@DFpje~ z@3$vqWVT=p=c_BeCPwiNb~t8pfFKl#B%fvUkJnv_mg(>5uF(wlZs zdYqNTvBNc0&1@K^sf3HqdHb2S+unZe?1o*I937>uF7pYa$mK0apT@%^OV~5eJpS1` zQsrsc70J)>XuR+Gj{2kUtD6h>CB@*eyPc=AJ_EZdUsx33aT0x(YCZKuFW0@kEV-($ zuc@Q=)E_g3^9^rvw%E75&0Oy5WBxr&3CUfk&O)mEZ8u~5|C=*6sb}+U&vUV-&Tp18 zJO3xjhu=G~fInQSJF=n(_pYOl_1N1h(wSpNHoa4ChHKiIbQboS;>-!1n&8(Z!Q)@n z%r+#!ZAyZJ3pi#67yRosXE!Cml6&6jD&v-d;K(P3+RUBWyo(L}JCd7X)RhFYD*cXR zN8eMO2Xaf_$wlvA?t15*_M%rfvY5%9F!V>SwG%cyVebeHH+Zn%x+^qXxfAH{;eP!V zig!|z5B~S`y%dVMad+6Gs`F8G>5q3rj8$PDNIwh98zTm<3j0txTu;~K?h<4D@_X?H z@l)rg_wg3-!{d{|IJRLA>bs_bNipmoHNt0(Y0~25i=XNyZW+bZPaR>2A-bqwC?GYr)Nd$7Pts+ zdU5vR^=7|}%%*KjQOxZbA@E0z;!a+KW!%p4>`Rf9;cgmBEws6ufxhJIhuvNp7vk&A z)^7KENik?Y-%HZ6l{M3RH%wdEAn$}_l4mWY6n4VJI1;;)d?it!Xw(w*OULW*)-O8Z zYj#q6oR!6a!_^ectP`fGh_g>3=h>i==>_&JZ$IVj_q{Zhoq3!+K1-z)O2So(iDffnwtwfxZp4~*L&p4 zUZ&62w3%m9U5DP(u4XG%`nvN&|G&9$Lz_0`avqC4bRUL3!~1kw{@m$Ts)G8drMh$T zvYeOP&}Jboi9SQnTKD#4@yuym-q<;JLz~qQ=AtM$hp}pQ34<2$qU`hqKk|Zah=NBy zr@pR;f?E~EhkC)SiBj)SKWSIQgT?o_wIYwJGJ?Y&A7V2PV)GW4^t~>+tcq@kf>{tx ze;e8xni=+6+W#*40cPDRx0Q>tQX`8#Z41*7<*d|M$(#xKq0lR$)WM?GM?zC8_XeJN zxP!lh;%$ydNBzw5iBR-yLz^5`oVSWgk0-oM#6GJQ&dmEoU-@o|KgyRojEy=gU*0zQ zLa~U?+eTN#x+9*m9j=2nkB#-+*T%cYAKN#t<6fbszIQqs=j1;?4$jM}^!yJv3wCP! zpcu@Le**ntULVD+it;Z&j}Nsmv!6aE{{-@KkAHX_ZyY_km(np0{te6o+f(U~iAy~E Kf2)ee+J68|8I2JD diff --git a/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv32 deleted file mode 100644 index 78c6b05db247cd97d91b9ee6468b305d3bc4516a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1396 zcmaKr+iTQ76voe9;%e7cYi(;=FT2(&YC#`bq3DBxVMP$Fh;K{W1PNr5C7UkRCm;Ny zeG&YAvlA($bzpLC-#PQ0lbKd?yJOZcvyMH~m$ht7YkL`ZdCtp4FRw~=EpVCdCrSSL z-OjX%&6cd?d`-nK*@BUW9w(!sjH+ZfE3&9cvqZj@Hs=KTa?UgwPqL(x-gU9za5_oL z+3?k2npJ~5%!;p3HppkiNEM2FpyPzS;A)(TJxG6WPM~V=h^Lj))v!&=k@U8mm!9NR zdE{_yRWln!StjA)3*LU}?XI_d=su2gwC zc3JXMGM*f`zT?3-`UYKxUzUW&-cFIt`wZ-gd{J3OM``>WT&TY2W!38|l55%nO&mQ` zf6N%p*S*cWv2S^sx!luc{-LIXFflmxdW zNe*1VF*~^6-_V`DAqke;vsPajHx&d&J~`B8?$qW@Z0g&S+)|f)Nib{DZ%g*HpXh%e zx3!NidIxjIJNI=Ky~2^jO!kGLKYDE(v*`(YS7^Awg9X<;q2bD%K!*?a>$gz6lZJfo zzpMR1DCWl9;f%V@2i2uN-VrfYjlD1ZG%Rn77`$ri1L<%*S(m#@jP=W(#T&#=ouA&v zTf`5KkKzh%-Xs|KvuZzY6C80kd{&LVB=?H`ng17Q{D0mhesbW(KX@ZNbK`w7JI;P7 PA2xV!(18g z4hL~Q>OS9#lcJNhlk8KFbkb4QQ-&<$Kk zB{#HL$g85y5VSVEeN8-b+Eg@l&fU;vHRN+ql$zsQRl9^i3wcF$`a&Fa@o$LYkA6{o zZHnTzE=mk|@!Jpu?^r)$SH$B>>~X89h^sQySgoQKne$kh)E%8Uia)+^jvyA0!qtBI# z{Jd>+Wv)BoIon|zym@S_?;acPo_K8EypDT?9(?a~HqOa^fEt{aRqFX4a2D)f{Gc4n zkADLFVqPD`t&8$6Ku-+VnAuNXlebM>?(q+=OSo diff --git a/test_conformance/spirv_new/test_decorate.cpp b/test_conformance/spirv_new/test_decorate.cpp index 766a6b68..ccd74315 100644 --- a/test_conformance/spirv_new/test_decorate.cpp +++ b/test_conformance/spirv_new/test_decorate.cpp @@ -310,174 +310,6 @@ TEST_SATURATED_CONVERSION(float, uint, ushort) TEST_SATURATED_CONVERSION(double, long, int) TEST_SATURATED_CONVERSION(double, ulong, uint) -int test_image_decorate(cl_device_id deviceID, - cl_context context, - cl_command_queue queue, - const char *name) -{ - const int width = 4096; - const int height = 4096; - - std::vector src(width * height); - RandomSeed seed(gRandomSeed); - - for (auto &val : src) { - val = genrand(seed); - } - - cl_image_format imageFormat; - imageFormat.image_channel_data_type = CL_UNSIGNED_INT32; - imageFormat.image_channel_order = CL_RGBA; - - cl_image_desc desc; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = width; - desc.image_height = height; - desc.image_depth = 0; - desc.image_array_size = 0; - desc.image_row_pitch = 0; // Automatically calculate the pitch - desc.image_slice_pitch = 0; // Not needed for 2D - desc.num_mip_levels = 0; - desc.num_samples = 0; - desc.mem_object = NULL; - - cl_int err = CL_SUCCESS; - - clMemWrapper srcImage = clCreateImage(context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, - &imageFormat, &desc, - &src[0], &err); - SPIRV_CHECK_ERROR(err, "Failed to create image object"); - - size_t bytes = src.size() * sizeof(cl_uint4); - clMemWrapper dstBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, bytes, NULL, &err); - SPIRV_CHECK_ERROR(err, "Failed to create image object"); - - clProgramWrapper prog; - err = get_program_with_il(prog, deviceID, context, name); - SPIRV_CHECK_ERROR(err, "Failed to build program"); - - clKernelWrapper kernel = clCreateKernel(prog, name, &err); - SPIRV_CHECK_ERROR(err, "Failed to create spv kernel"); - - err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &dstBuffer); - SPIRV_CHECK_ERROR(err, "Failed to set arg 2 of the kernel"); - - err = clSetKernelArg(kernel, 1, sizeof(cl_mem), &srcImage); - SPIRV_CHECK_ERROR(err, "Failed to set arg 1 of the kernel"); - - size_t global[] = {width, height}; - err = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, global, NULL, 0, NULL, NULL); - SPIRV_CHECK_ERROR(err, "Failed to enqueue kernel"); - - std::vector dst(src.size()); - err = clEnqueueReadBuffer(queue, dstBuffer, CL_TRUE, 0, bytes, &dst[0], 0, NULL, NULL); - SPIRV_CHECK_ERROR(err, "Failed to copy data back to host"); - - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - int srcIdx = j * width + i; - int dstIdx = i * height + j; - if (dst[dstIdx] != src[srcIdx]) { - log_error("Values do not match at location (%d, %d) of src\n", i, j); - } - } - } - - return 0; -} - -#define TEST_SPIRV_IMAGE_DECORATE(type) \ - TEST_SPIRV_FUNC(decorate_##type) \ - { \ - PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID); \ - return test_image_decorate(deviceID, context, queue, \ - "decorate_" #type); \ - } \ - -TEST_SPIRV_IMAGE_DECORATE(volatile) -TEST_SPIRV_IMAGE_DECORATE(coherent) -TEST_SPIRV_IMAGE_DECORATE(nonwritable) - -TEST_SPIRV_FUNC(decorate_nonreadable) -{ - PASSIVE_REQUIRE_IMAGE_SUPPORT(deviceID); - const char *name = "decorate_nonreadable"; - const int width = 4096; - const int height = 4096; - cl_int err = CL_SUCCESS; - - std::vector src(width * height); - RandomSeed seed(gRandomSeed); - - for (auto &val : src) { - val = genrand(seed); - } - - size_t bytes = src.size() * sizeof(cl_uint4); - clMemWrapper srcBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, bytes, NULL, &err); - SPIRV_CHECK_ERROR(err, "Failed to create image object"); - - err = clEnqueueWriteBuffer(queue, srcBuffer, CL_TRUE, 0, bytes, &src[0], 0, NULL, NULL); - SPIRV_CHECK_ERROR(err, "Failed to copy data back to host"); - - cl_image_format imageFormat; - imageFormat.image_channel_data_type = CL_UNSIGNED_INT32; - imageFormat.image_channel_order = CL_RGBA; - - cl_image_desc desc; - desc.image_type = CL_MEM_OBJECT_IMAGE2D; - desc.image_width = height; - desc.image_height = width; - desc.image_depth = 0; - desc.image_array_size = 0; - desc.image_row_pitch = 0; // Automatically calculate the pitch - desc.image_slice_pitch = 0; // Not needed for 2D - desc.num_mip_levels = 0; - desc.num_samples = 0; - desc.mem_object = NULL; - - - clMemWrapper dstImage = clCreateImage(context, CL_MEM_WRITE_ONLY, - &imageFormat, &desc, - NULL, &err); - SPIRV_CHECK_ERROR(err, "Failed to create image object"); - - clProgramWrapper prog; - err = get_program_with_il(prog, deviceID, context, name); - SPIRV_CHECK_ERROR(err, "Failed to build program"); - - clKernelWrapper kernel = clCreateKernel(prog, name, &err); - SPIRV_CHECK_ERROR(err, "Failed to create spv kernel"); - - err = clSetKernelArg(kernel, 0, sizeof(cl_mem), &dstImage); - SPIRV_CHECK_ERROR(err, "Failed to set arg 2 of the kernel"); - - err = clSetKernelArg(kernel, 1, sizeof(cl_mem), &srcBuffer); - SPIRV_CHECK_ERROR(err, "Failed to set arg 1 of the kernel"); - - size_t global[] = {width, height}; - err = clEnqueueNDRangeKernel(queue, kernel, 2, NULL, global, NULL, 0, NULL, NULL); - SPIRV_CHECK_ERROR(err, "Failed to enqueue kernel"); - - std::vector dst(src.size()); - size_t origin[] = {0, 0, 0}; - size_t region[] = {height, width, 1}; - err = clEnqueueReadImage(queue, dstImage, CL_TRUE, origin, region, 0, 0, &dst[0], 0, NULL, NULL); - - - for (int j = 0; j < height; j++) { - for (int i = 0; i < width; i++) { - int srcIdx = j * width + i; - int dstIdx = i * height + j; - if (dst[dstIdx] != src[srcIdx]) { - log_error("Values do not match at location (%d, %d) of src\n", i, j); - } - } - } - - return 0; -} - template int test_fp_rounding(cl_device_id deviceID, cl_context context, From 951d010eaf137b5191eeb1b06168f5bcdc1cb8a0 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Sun, 27 Sep 2020 16:22:49 -0700 Subject: [PATCH 20/37] add a new test to verify reported image formats (#963) --- test_common/harness/imageHelpers.cpp | 331 +++++++++++------- test_common/harness/imageHelpers.h | 3 + test_conformance/api/CMakeLists.txt | 1 + test_conformance/api/main.cpp | 2 + test_conformance/api/procs.h | 3 + .../api/test_min_image_formats.cpp | 133 +++++++ .../images/clGetInfo/test_loops.cpp | 35 -- test_conformance/images/common.cpp | 14 - test_conformance/images/common.h | 1 - 9 files changed, 339 insertions(+), 184 deletions(-) create mode 100644 test_conformance/api/test_min_image_formats.cpp diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index 807f4338..6a84fde8 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -3462,150 +3462,199 @@ bool find_format( cl_image_format *formatList, unsigned int numFormats, cl_image return false; } -void build_required_image_formats(cl_mem_flags flags, - cl_mem_object_type image_type, - cl_device_id device, - std::vector& formatsToSupport) +void build_required_image_formats( + cl_mem_flags flags, cl_mem_object_type image_type, cl_device_id device, + std::vector &formatsToSupport) { - Version version = get_device_cl_version(device); + formatsToSupport.clear(); - formatsToSupport.clear(); + // Minimum list of supported image formats for reading or writing (embedded + // profile) + static std::vector embeddedProfile_readOrWrite{ + // clang-format off + { CL_RGBA, CL_UNORM_INT8 }, + { CL_RGBA, CL_UNORM_INT16 }, + { CL_RGBA, CL_SIGNED_INT8 }, + { CL_RGBA, CL_SIGNED_INT16 }, + { CL_RGBA, CL_SIGNED_INT32 }, + { CL_RGBA, CL_UNSIGNED_INT8 }, + { CL_RGBA, CL_UNSIGNED_INT16 }, + { CL_RGBA, CL_UNSIGNED_INT32 }, + { CL_RGBA, CL_HALF_FLOAT }, + { CL_RGBA, CL_FLOAT }, + // clang-format on + }; - // Required embedded formats. - static std::vector embeddedProfReadOrWriteFormats - { - { CL_RGBA, CL_UNORM_INT8 }, - { CL_RGBA, CL_UNORM_INT16 }, - { CL_RGBA, CL_SIGNED_INT8 }, - { CL_RGBA, CL_SIGNED_INT16 }, - { CL_RGBA, CL_SIGNED_INT32 }, - { CL_RGBA, CL_UNSIGNED_INT8 }, - { CL_RGBA, CL_UNSIGNED_INT16 }, - { CL_RGBA, CL_UNSIGNED_INT32 }, - { CL_RGBA, CL_HALF_FLOAT }, - { CL_RGBA, CL_FLOAT }, - }; + // Minimum list of required image formats for reading or writing + // num_channels, for all image types. + static std::vector fullProfile_readOrWrite{ + // clang-format off + { CL_RGBA, CL_UNORM_INT8 }, + { CL_RGBA, CL_UNORM_INT16 }, + { CL_RGBA, CL_SIGNED_INT8 }, + { CL_RGBA, CL_SIGNED_INT16 }, + { CL_RGBA, CL_SIGNED_INT32 }, + { CL_RGBA, CL_UNSIGNED_INT8 }, + { CL_RGBA, CL_UNSIGNED_INT16 }, + { CL_RGBA, CL_UNSIGNED_INT32 }, + { CL_RGBA, CL_HALF_FLOAT }, + { CL_RGBA, CL_FLOAT }, + { CL_BGRA, CL_UNORM_INT8 }, + // clang-format on + }; - /* - Required full profile formats. - This array does not contain any full profile - formats that have restrictions on when they - are required. - */ - static std::vector fullProfReadOrWriteFormats - { - { CL_RGBA, CL_UNORM_INT8 }, - { CL_RGBA, CL_UNORM_INT16 }, - { CL_RGBA, CL_SIGNED_INT8 }, - { CL_RGBA, CL_SIGNED_INT16 }, - { CL_RGBA, CL_SIGNED_INT32 }, - { CL_RGBA, CL_UNSIGNED_INT8 }, - { CL_RGBA, CL_UNSIGNED_INT16 }, - { CL_RGBA, CL_UNSIGNED_INT32 }, - { CL_RGBA, CL_HALF_FLOAT }, - { CL_RGBA, CL_FLOAT }, - { CL_BGRA, CL_UNORM_INT8 }, - }; + // Minimum list of supported image formats for reading or writing + // (OpenCL 2.0, 2.1, or 2.2), for all image types. + static std::vector fullProfile_2x_readOrWrite{ + // clang-format off + { CL_R, CL_UNORM_INT8 }, + { CL_R, CL_UNORM_INT16 }, + { CL_R, CL_SNORM_INT8 }, + { CL_R, CL_SNORM_INT16 }, + { CL_R, CL_SIGNED_INT8 }, + { CL_R, CL_SIGNED_INT16 }, + { CL_R, CL_SIGNED_INT32 }, + { CL_R, CL_UNSIGNED_INT8 }, + { CL_R, CL_UNSIGNED_INT16 }, + { CL_R, CL_UNSIGNED_INT32 }, + { CL_R, CL_HALF_FLOAT }, + { CL_R, CL_FLOAT }, + { CL_RG, CL_UNORM_INT8 }, + { CL_RG, CL_UNORM_INT16 }, + { CL_RG, CL_SNORM_INT8 }, + { CL_RG, CL_SNORM_INT16 }, + { CL_RG, CL_SIGNED_INT8 }, + { CL_RG, CL_SIGNED_INT16 }, + { CL_RG, CL_SIGNED_INT32 }, + { CL_RG, CL_UNSIGNED_INT8 }, + { CL_RG, CL_UNSIGNED_INT16 }, + { CL_RG, CL_UNSIGNED_INT32 }, + { CL_RG, CL_HALF_FLOAT }, + { CL_RG, CL_FLOAT }, + { CL_RGBA, CL_UNORM_INT8 }, + { CL_RGBA, CL_UNORM_INT16 }, + { CL_RGBA, CL_SNORM_INT8 }, + { CL_RGBA, CL_SNORM_INT16 }, + { CL_RGBA, CL_SIGNED_INT8 }, + { CL_RGBA, CL_SIGNED_INT16 }, + { CL_RGBA, CL_SIGNED_INT32 }, + { CL_RGBA, CL_UNSIGNED_INT8 }, + { CL_RGBA, CL_UNSIGNED_INT16 }, + { CL_RGBA, CL_UNSIGNED_INT32 }, + { CL_RGBA, CL_HALF_FLOAT }, + { CL_RGBA, CL_FLOAT }, + { CL_BGRA, CL_UNORM_INT8 }, + // clang-format on + }; - /* - Required full profile formats specifically for 2.x. - This array does not contain any full profile - formats that have restrictions on when they - are required. - */ - static std::vector fullProf2XReadOrWriteFormats - { - { CL_R, CL_UNORM_INT8 }, - { CL_R, CL_UNORM_INT16 }, - { CL_R, CL_SNORM_INT8 }, - { CL_R, CL_SNORM_INT16 }, - { CL_R, CL_SIGNED_INT8 }, - { CL_R, CL_SIGNED_INT16 }, - { CL_R, CL_SIGNED_INT32 }, - { CL_R, CL_UNSIGNED_INT8 }, - { CL_R, CL_UNSIGNED_INT16 }, - { CL_R, CL_UNSIGNED_INT32 }, - { CL_R, CL_HALF_FLOAT }, - { CL_R, CL_FLOAT }, - { CL_RG, CL_UNORM_INT8 }, - { CL_RG, CL_UNORM_INT16 }, - { CL_RG, CL_SNORM_INT8 }, - { CL_RG, CL_SNORM_INT16 }, - { CL_RG, CL_SIGNED_INT8 }, - { CL_RG, CL_SIGNED_INT16 }, - { CL_RG, CL_SIGNED_INT32 }, - { CL_RG, CL_UNSIGNED_INT8 }, - { CL_RG, CL_UNSIGNED_INT16 }, - { CL_RG, CL_UNSIGNED_INT32 }, - { CL_RG, CL_HALF_FLOAT }, - { CL_RG, CL_FLOAT }, - { CL_RGBA, CL_SNORM_INT8 }, - { CL_RGBA, CL_SNORM_INT16 }, - }; + // Conditional addition to the 2x readOrWrite table: + // Support for the CL_DEPTH image channel order is required only for 2D + // images and 2D image arrays. + static std::vector fullProfile_2x_readOrWrite_Depth{ + // clang-format off + { CL_DEPTH, CL_UNORM_INT16 }, + { CL_DEPTH, CL_FLOAT }, + // clang-format on + }; - /* - Required full profile formats for CL_DEPTH - (specifically 2.x). - There are cases whereby the format isn't required. - */ - static std::vector fullProf2XReadOrWriteDepthFormats - { - { CL_DEPTH, CL_UNORM_INT16 }, - { CL_DEPTH, CL_FLOAT }, - }; + // Conditional addition to the 2x readOrWrite table: + // Support for reading from the CL_sRGBA image channel order is optional for + // 1D image buffers. Support for writing to the CL_sRGBA image channel order + // is optional for all image types. + static std::vector fullProfile_2x_readOrWrite_srgb{ + { CL_sRGBA, CL_UNORM_INT8 }, + }; - /* - Required full profile formats for CL_sRGB - (specifically 2.x). - There are cases whereby the format isn't required. - */ - static std::vector fullProf2XSRGBFormats - { - { CL_sRGBA, CL_UNORM_INT8 }, - }; + // Minimum list of required image formats for reading and writing. + static std::vector fullProfile_readAndWrite{ + // clang-format off + { CL_R, CL_UNORM_INT8 }, + { CL_R, CL_SIGNED_INT8 }, + { CL_R, CL_SIGNED_INT16 }, + { CL_R, CL_SIGNED_INT32 }, + { CL_R, CL_UNSIGNED_INT8 }, + { CL_R, CL_UNSIGNED_INT16 }, + { CL_R, CL_UNSIGNED_INT32 }, + { CL_R, CL_HALF_FLOAT }, + { CL_R, CL_FLOAT }, + { CL_RGBA, CL_UNORM_INT8 }, + { CL_RGBA, CL_SIGNED_INT8 }, + { CL_RGBA, CL_SIGNED_INT16 }, + { CL_RGBA, CL_SIGNED_INT32 }, + { CL_RGBA, CL_UNSIGNED_INT8 }, + { CL_RGBA, CL_UNSIGNED_INT16 }, + { CL_RGBA, CL_UNSIGNED_INT32 }, + { CL_RGBA, CL_HALF_FLOAT }, + { CL_RGBA, CL_FLOAT }, + // clang-format on + }; - // Embedded profile - if (gIsEmbedded) - { - copy(embeddedProfReadOrWriteFormats.begin(), - embeddedProfReadOrWriteFormats.end(), - back_inserter(formatsToSupport)); - } - // Full profile - else - { - copy(fullProfReadOrWriteFormats.begin(), - fullProfReadOrWriteFormats.end(), - back_inserter(formatsToSupport)); - } + // Embedded profile + if (gIsEmbedded) + { + copy(embeddedProfile_readOrWrite.begin(), + embeddedProfile_readOrWrite.end(), + back_inserter(formatsToSupport)); + } + // Full profile + else + { + Version version = get_device_cl_version(device); + if (version < Version(2, 0) || version >= Version(3, 0)) + { + // Full profile, OpenCL 1.2 or 3.0. + if (flags & CL_MEM_KERNEL_READ_AND_WRITE) + { + // Note: assumes that read-write images are supported! + copy(fullProfile_readAndWrite.begin(), + fullProfile_readAndWrite.end(), + back_inserter(formatsToSupport)); + } + else + { + copy(fullProfile_readOrWrite.begin(), + fullProfile_readOrWrite.end(), + back_inserter(formatsToSupport)); + } + } + else + { + // Full profile, OpenCL 2.0, 2.1, 2.2. + if (flags & CL_MEM_KERNEL_READ_AND_WRITE) + { + copy(fullProfile_readAndWrite.begin(), + fullProfile_readAndWrite.end(), + back_inserter(formatsToSupport)); + } + else + { + copy(fullProfile_2x_readOrWrite.begin(), + fullProfile_2x_readOrWrite.end(), + back_inserter(formatsToSupport)); - // Full profile, OpenCL 2.0, 2.1, 2.2 - if (!gIsEmbedded && version >= Version(2, 0) && version <= Version(2, 2)) - { - copy(fullProf2XReadOrWriteFormats.begin(), - fullProf2XReadOrWriteFormats.end(), - back_inserter(formatsToSupport)); + // Support for the CL_DEPTH image channel order is required only + // for 2D images and 2D image arrays. + if (image_type == CL_MEM_OBJECT_IMAGE2D + || image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY) + { + copy(fullProfile_2x_readOrWrite_Depth.begin(), + fullProfile_2x_readOrWrite_Depth.end(), + back_inserter(formatsToSupport)); + } - // Depth images are only required for 2DArray and 2D images - if (image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY || image_type == CL_MEM_OBJECT_IMAGE2D) - { - copy(fullProf2XReadOrWriteDepthFormats.begin(), - fullProf2XReadOrWriteDepthFormats.end(), - back_inserter(formatsToSupport)); - } - - // sRGB is not required for 1DImage Buffers - if (image_type != CL_MEM_OBJECT_IMAGE1D_BUFFER) - { - // sRGB is only required for reading - if (flags == CL_MEM_READ_ONLY) - { - copy(fullProf2XSRGBFormats.begin(), - fullProf2XSRGBFormats.end(), - back_inserter(formatsToSupport)); - } - } - } + // Support for reading from the CL_sRGBA image channel order is + // optional for 1D image buffers. Support for writing to the + // CL_sRGBA image channel order is optional for all image types. + if (image_type != CL_MEM_OBJECT_IMAGE1D_BUFFER + && flags == CL_MEM_READ_ONLY) + { + copy(fullProfile_2x_readOrWrite_srgb.begin(), + fullProfile_2x_readOrWrite_srgb.end(), + back_inserter(formatsToSupport)); + } + } + } + } } bool is_image_format_required(cl_image_format format, @@ -3734,3 +3783,17 @@ size_t compute_mip_level_offset( image_descriptor * imageInfo , size_t lod) } return retOffset; } + +const char *convert_image_type_to_string(cl_mem_object_type image_type) +{ + switch (image_type) + { + case CL_MEM_OBJECT_IMAGE1D: return "1D"; + case CL_MEM_OBJECT_IMAGE2D: return "2D"; + case CL_MEM_OBJECT_IMAGE3D: return "3D"; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: return "1D array"; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: return "2D array"; + case CL_MEM_OBJECT_IMAGE1D_BUFFER: return "1D image buffer"; + default: return "unrecognized object type"; + } +} diff --git a/test_common/harness/imageHelpers.h b/test_common/harness/imageHelpers.h index a3feb72b..4c527543 100644 --- a/test_common/harness/imageHelpers.h +++ b/test_common/harness/imageHelpers.h @@ -653,4 +653,7 @@ static int inline is_half_zero( cl_ushort half ){ return ( half & 0x7fff ) == 0; extern double sRGBmap(float fc); +extern const char *convert_image_type_to_string(cl_mem_object_type imageType); + + #endif // _imageHelpers_h diff --git a/test_conformance/api/CMakeLists.txt b/test_conformance/api/CMakeLists.txt index 20d69830..d3213ed5 100644 --- a/test_conformance/api/CMakeLists.txt +++ b/test_conformance/api/CMakeLists.txt @@ -23,6 +23,7 @@ set(${MODULE_NAME}_SOURCES test_kernel_arg_info_compatibility.cpp test_null_buffer_arg.cpp test_mem_object_info.cpp + test_min_image_formats.cpp test_queue.cpp test_queue_hint.cpp test_queue_properties.cpp diff --git a/test_conformance/api/main.cpp b/test_conformance/api/main.cpp index 8d8d20ad..9740cba4 100644 --- a/test_conformance/api/main.cpp +++ b/test_conformance/api/main.cpp @@ -142,6 +142,8 @@ test_definition test_list[] = { ADD_TEST_VERSION(consistency_subgroups, Version(3, 0)), ADD_TEST_VERSION(consistency_prog_ctor_dtor, Version(3, 0)), ADD_TEST_VERSION(consistency_3d_image_writes, Version(3, 0)), + + ADD_TEST(min_image_formats), }; const int test_num = ARRAY_SIZE(test_list); diff --git a/test_conformance/api/procs.h b/test_conformance/api/procs.h index 21dca3f2..c550e5cc 100644 --- a/test_conformance/api/procs.h +++ b/test_conformance/api/procs.h @@ -186,3 +186,6 @@ extern int test_consistency_3d_image_writes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); + +extern int test_min_image_formats(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); diff --git a/test_conformance/api/test_min_image_formats.cpp b/test_conformance/api/test_min_image_formats.cpp new file mode 100644 index 00000000..f6a35463 --- /dev/null +++ b/test_conformance/api/test_min_image_formats.cpp @@ -0,0 +1,133 @@ +// +// 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 "testBase.h" + +int test_min_image_formats(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements) +{ + int missingFormats = 0; + + cl_int error = CL_SUCCESS; + + Version version = get_device_cl_version(device); + + cl_bool supports_images = CL_FALSE; + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT, + sizeof(supports_images), &supports_images, NULL); + test_error(error, "clGetDeviceInfo for CL_DEVICE_IMAGE_SUPPORT failed"); + + if (supports_images == CL_FALSE) + { + log_info("No image support on current device - skipped\n"); + return TEST_SKIPPED_ITSELF; + } + + const cl_mem_object_type image_types[] = { + CL_MEM_OBJECT_IMAGE1D, CL_MEM_OBJECT_IMAGE1D_BUFFER, + CL_MEM_OBJECT_IMAGE2D, CL_MEM_OBJECT_IMAGE3D, + CL_MEM_OBJECT_IMAGE1D_ARRAY, CL_MEM_OBJECT_IMAGE2D_ARRAY, + }; + const cl_mem_flags mem_flags[] = { + CL_MEM_READ_ONLY, + CL_MEM_WRITE_ONLY, + CL_MEM_KERNEL_READ_AND_WRITE, + }; + + cl_bool supports_read_write_images = CL_FALSE; + if (version >= Version(3, 0)) + { + cl_uint maxReadWriteImageArgs = 0; + error = clGetDeviceInfo(device, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS, + sizeof(maxReadWriteImageArgs), + &maxReadWriteImageArgs, NULL); + test_error(error, + "Unable to query " + "CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS"); + + // read-write images are supported if MAX_READ_WRITE_IMAGE_ARGS is + // nonzero + supports_read_write_images = + maxReadWriteImageArgs != 0 ? CL_TRUE : CL_FALSE; + } + else if (version >= Version(2, 0)) + { + // read-write images are required for OpenCL 2.x + supports_read_write_images = CL_TRUE; + } + + int supports_3D_image_writes = + is_extension_available(device, "cl_khr_3d_image_writes"); + + for (int t = 0; t < ARRAY_SIZE(image_types); t++) + { + const cl_mem_object_type type = image_types[t]; + log_info(" testing %s...\n", convert_image_type_to_string(type)); + for (int f = 0; f < ARRAY_SIZE(mem_flags); f++) + { + const cl_mem_flags flags = mem_flags[f]; + const char* testTypeString = flags == CL_MEM_READ_ONLY + ? "read-only" + : flags == CL_MEM_WRITE_ONLY + ? "write only" + : flags == CL_MEM_KERNEL_READ_AND_WRITE ? "read and write" + : "unknown???"; + + if (flags == CL_MEM_KERNEL_READ_AND_WRITE + && !supports_read_write_images) + { + continue; + } + + if (type == CL_MEM_OBJECT_IMAGE3D && flags != CL_MEM_READ_ONLY + && !supports_3D_image_writes) + { + continue; + } + + cl_uint numImageFormats = 0; + error = clGetSupportedImageFormats(context, flags, type, 0, NULL, + &numImageFormats); + test_error(error, "Unable to query number of image formats"); + + std::vector supportedFormats(numImageFormats); + if (numImageFormats != 0) + { + error = clGetSupportedImageFormats( + context, flags, type, supportedFormats.size(), + supportedFormats.data(), NULL); + test_error(error, "Unable to query image formats"); + } + + std::vector requiredFormats; + build_required_image_formats(flags, type, device, requiredFormats); + + for (auto& format : requiredFormats) + { + if (!find_format(supportedFormats.data(), + supportedFormats.size(), &format)) + { + log_error( + "Missing required %s format %s + %s.\n", testTypeString, + GetChannelOrderName(format.image_channel_order), + GetChannelTypeName(format.image_channel_data_type)); + ++missingFormats; + } + } + } + } + + return missingFormats == 0 ? TEST_PASS : TEST_FAIL; +} diff --git a/test_conformance/images/clGetInfo/test_loops.cpp b/test_conformance/images/clGetInfo/test_loops.cpp index e64ec3b9..9b0e9243 100644 --- a/test_conformance/images/clGetInfo/test_loops.cpp +++ b/test_conformance/images/clGetInfo/test_loops.cpp @@ -34,30 +34,6 @@ extern int test_get_image_info_3D( cl_device_id device, cl_context context, cl_i extern int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ); extern int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ); -static bool check_minimum_supported(cl_image_format *formatList, - unsigned int numFormats, - cl_mem_flags flags, - cl_mem_object_type image_type, - cl_device_id device) -{ - bool passed = true; - Version version = get_device_cl_version(device); - std::vector formatsToSupport; - build_required_image_formats(flags, image_type, device, formatsToSupport); - - for (auto &format: formatsToSupport) - { - if( !find_format( formatList, numFormats, &format ) ) - { - log_error( "ERROR: Format required by OpenCL %s is not supported: ", version.to_string().c_str() ); - print_header( &format, true ); - passed = false; - } - } - - return passed; -} - int test_image_type( cl_device_id device, cl_context context, cl_mem_object_type image_type, cl_mem_flags flags ) { log_info( "Running %s %s-only tests...\n", convert_image_type_to_string(image_type), flags == CL_MEM_READ_ONLY ? "read" : "write" ); @@ -74,17 +50,6 @@ int test_image_type( cl_device_id device, cl_context context, cl_mem_object_type BufferOwningPtr formatListBuf(formatList); - if ((image_type == CL_MEM_OBJECT_IMAGE3D) && (flags != CL_MEM_READ_ONLY)) { - log_info("No requirement for 3D write in OpenCL 1.2. Not checking formats.\n"); - } else { - log_info("Checking for required OpenCL 1.2 formats.\n"); - if (check_minimum_supported( formatList, numFormats, flags, image_type, device ) == false) { - ret++; - } else { - log_info("All required formats present.\n"); - } - } - filterFlags = new bool[ numFormats ]; BufferOwningPtr filterFlagsBuf(filterFlags); diff --git a/test_conformance/images/common.cpp b/test_conformance/images/common.cpp index 9e542612..a14242ef 100644 --- a/test_conformance/images/common.cpp +++ b/test_conformance/images/common.cpp @@ -58,20 +58,6 @@ std::array imageTestTypes = { { { kTestFloat, kFloat, floatFormats, "float" }, } }; -const char *convert_image_type_to_string(cl_mem_object_type image_type) -{ - switch (image_type) - { - case CL_MEM_OBJECT_IMAGE1D: return "1D"; - case CL_MEM_OBJECT_IMAGE2D: return "2D"; - case CL_MEM_OBJECT_IMAGE3D: return "3D"; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: return "1D array"; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: return "2D array"; - case CL_MEM_OBJECT_IMAGE1D_BUFFER: return "1D image buffer"; - default: return "unrecognized object type"; - } -} - int filter_formats(cl_image_format *formatList, bool *filterFlags, unsigned int formatCount, cl_channel_type *channelDataTypesToFilter, diff --git a/test_conformance/images/common.h b/test_conformance/images/common.h index 114623e4..7ae2f4fa 100644 --- a/test_conformance/images/common.h +++ b/test_conformance/images/common.h @@ -40,7 +40,6 @@ struct ImageTestTypes extern std::array imageTestTypes; -const char *convert_image_type_to_string(cl_mem_object_type imageType); int filter_formats(cl_image_format *formatList, bool *filterFlags, unsigned int formatCount, cl_channel_type *channelDataTypesToFilter, From beaecb71a343945f2b82acb49306b1df705a31aa Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Sun, 27 Sep 2020 16:26:57 -0700 Subject: [PATCH 21/37] add checks for OpenCL C versions (#968) * add test_compiler test for OpenCL C versions * add checks for required OpenCL C versions * bugfix: only OpenCL C 2.0 is required for OpenCL 2.1 and 2.2 * pass reference to feature struct vs. pointer * address review comments regarding C++ identifiers and 3d image writes --- test_common/CMakeLists.txt | 1 + test_common/harness/featureHelpers.cpp | 75 +++++ test_common/harness/featureHelpers.h | 43 +++ test_conformance/compiler/CMakeLists.txt | 1 + test_conformance/compiler/main.cpp | 1 + test_conformance/compiler/procs.h | 2 + .../compiler/test_opencl_c_versions.cpp | 316 ++++++++++++++++++ 7 files changed, 439 insertions(+) create mode 100644 test_common/harness/featureHelpers.cpp create mode 100644 test_common/harness/featureHelpers.h create mode 100644 test_conformance/compiler/test_opencl_c_versions.cpp diff --git a/test_common/CMakeLists.txt b/test_common/CMakeLists.txt index 1dffd379..2d4bc190 100644 --- a/test_common/CMakeLists.txt +++ b/test_common/CMakeLists.txt @@ -8,6 +8,7 @@ set(HARNESS_SOURCES harness/msvc9.c harness/crc32.cpp harness/errorHelpers.cpp + harness/featureHelpers.cpp harness/genericThread.cpp harness/imageHelpers.cpp harness/kernelHelpers.cpp diff --git a/test_common/harness/featureHelpers.cpp b/test_common/harness/featureHelpers.cpp new file mode 100644 index 00000000..07435c3f --- /dev/null +++ b/test_common/harness/featureHelpers.cpp @@ -0,0 +1,75 @@ +// +// Copyright (c) 2020 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 "featureHelpers.h" +#include "errorHelpers.h" + +#include +#include + +#include + +int get_device_cl_c_features(cl_device_id device, OpenCLCFeatures& features) +{ + // Initially, all features are unsupported. + features = { 0 }; + + // The CL_DEVICE_OPENCL_C_FEATURES query does not exist pre-3.0. + const Version version = get_device_cl_version(device); + if (version < Version(3, 0)) + { + return TEST_PASS; + } + + cl_int error = CL_SUCCESS; + + size_t sz = 0; + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_FEATURES, 0, NULL, &sz); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_FEATURES size"); + + std::vector clc_features(sz / sizeof(cl_name_version)); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_FEATURES, sz, + clc_features.data(), NULL); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_FEATURES"); + +#define CHECK_OPENCL_C_FEATURE(_feature) \ + if (strcmp(clc_feature.name, #_feature) == 0) \ + { \ + features.supports##_feature = true; \ + } + + for (const auto& clc_feature : clc_features) + { + CHECK_OPENCL_C_FEATURE(__opencl_c_3d_image_writes); + CHECK_OPENCL_C_FEATURE(__opencl_c_atomic_order_acq_rel); + CHECK_OPENCL_C_FEATURE(__opencl_c_atomic_order_seq_cst); + CHECK_OPENCL_C_FEATURE(__opencl_c_atomic_scope_device); + CHECK_OPENCL_C_FEATURE(__opencl_c_atomic_scope_all_devices); + CHECK_OPENCL_C_FEATURE(__opencl_c_device_enqueue); + CHECK_OPENCL_C_FEATURE(__opencl_c_generic_address_space); + CHECK_OPENCL_C_FEATURE(__opencl_c_fp64); + CHECK_OPENCL_C_FEATURE(__opencl_c_images); + CHECK_OPENCL_C_FEATURE(__opencl_c_int64); + CHECK_OPENCL_C_FEATURE(__opencl_c_pipes); + CHECK_OPENCL_C_FEATURE(__opencl_c_program_scope_global_variables); + CHECK_OPENCL_C_FEATURE(__opencl_c_read_write_images); + CHECK_OPENCL_C_FEATURE(__opencl_c_subgroups); + CHECK_OPENCL_C_FEATURE(__opencl_c_work_group_collective_functions); + } + +#undef CHECK_OPENCL_C_FEATURE + + return TEST_PASS; +} diff --git a/test_common/harness/featureHelpers.h b/test_common/harness/featureHelpers.h new file mode 100644 index 00000000..3f77b76f --- /dev/null +++ b/test_common/harness/featureHelpers.h @@ -0,0 +1,43 @@ +// +// Copyright (c) 2020 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. +// +#ifndef _featureHelpers_h +#define _featureHelpers_h + +#include "compat.h" +#include "testHarness.h" + +struct OpenCLCFeatures +{ + bool supports__opencl_c_3d_image_writes; + bool supports__opencl_c_atomic_order_acq_rel; + bool supports__opencl_c_atomic_order_seq_cst; + bool supports__opencl_c_atomic_scope_device; + bool supports__opencl_c_atomic_scope_all_devices; + bool supports__opencl_c_device_enqueue; + bool supports__opencl_c_generic_address_space; + bool supports__opencl_c_fp64; + bool supports__opencl_c_images; + bool supports__opencl_c_int64; + bool supports__opencl_c_pipes; + bool supports__opencl_c_program_scope_global_variables; + bool supports__opencl_c_read_write_images; + bool supports__opencl_c_subgroups; + bool supports__opencl_c_work_group_collective_functions; +}; + +int get_device_cl_c_features(cl_device_id device, OpenCLCFeatures& features); + +#endif // _featureHelpers_h diff --git a/test_conformance/compiler/CMakeLists.txt b/test_conformance/compiler/CMakeLists.txt index 058213a2..0960b1c0 100644 --- a/test_conformance/compiler/CMakeLists.txt +++ b/test_conformance/compiler/CMakeLists.txt @@ -7,6 +7,7 @@ set(${MODULE_NAME}_SOURCES test_async_build.cpp test_build_options.cpp test_preprocessor.cpp + test_opencl_c_versions.cpp test_image_macro.cpp test_compiler_defines_for_extensions.cpp test_pragma_unroll.cpp diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index 89499f46..19479285 100644 --- a/test_conformance/compiler/main.cpp +++ b/test_conformance/compiler/main.cpp @@ -50,6 +50,7 @@ test_definition test_list[] = { ADD_TEST(preprocessor_line_error), ADD_TEST(preprocessor_pragma), + ADD_TEST(opencl_c_versions), ADD_TEST(compiler_defines_for_extensions), ADD_TEST(image_macro), diff --git a/test_conformance/compiler/procs.h b/test_conformance/compiler/procs.h index 88212017..38188d31 100644 --- a/test_conformance/compiler/procs.h +++ b/test_conformance/compiler/procs.h @@ -88,6 +88,8 @@ extern int test_preprocessor_line_error(cl_device_id deviceID, extern int test_preprocessor_pragma(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); +extern int test_opencl_c_versions(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements); extern int test_compiler_defines_for_extensions(cl_device_id device, cl_context context, cl_command_queue queue, diff --git a/test_conformance/compiler/test_opencl_c_versions.cpp b/test_conformance/compiler/test_opencl_c_versions.cpp new file mode 100644 index 00000000..d3c28c30 --- /dev/null +++ b/test_conformance/compiler/test_opencl_c_versions.cpp @@ -0,0 +1,316 @@ +// +// Copyright (c) 2020 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 "testBase.h" +#include "harness/featureHelpers.h" + +#include + +static const char* test_kernel = R"CLC( +__kernel void test(__global int* dst) { + dst[0] = 0; +} +)CLC"; + +// This sub-test checks that CL_DEVICE_OPENCL_C_VERSION meets any API +// requirements and that programs can be built for the reported OpenCL C version +// and all previous versions. +static int test_CL_DEVICE_OPENCL_C_VERSION(cl_device_id device, + cl_context context) +{ + const Version latest_version = Version(3, 0); + + const Version api_version = get_device_cl_version(device); + const Version clc_version = get_device_cl_c_version(device); + + if (api_version > latest_version) + { + log_info("CL_DEVICE_VERSION is %s, which is bigger than %s.\n" + "Need to update the opencl_c_versions test!\n", + api_version.to_string().c_str(), + latest_version.to_string().c_str()); + } + + if (clc_version > latest_version) + { + log_info("CL_DEVICE_OPENCL_C_VERSION is %s, which is bigger than %s.\n" + "Need to update the opencl_c_versions test!\n", + clc_version.to_string().c_str(), + latest_version.to_string().c_str()); + } + + // For OpenCL 3.0, the minimum required OpenCL C version is OpenCL C 1.2. + // For OpenCL 2.x, the minimum required OpenCL C version is OpenCL C 2.0. + // For other OpenCL versions, the minimum required OpenCL C version is + // the same as the API version. + const Version min_clc_version = api_version == Version(3, 0) + ? Version(1, 2) + : api_version >= Version(2, 0) ? Version(2, 0) : api_version; + if (clc_version < min_clc_version) + { + log_error("The minimum required OpenCL C version for API version %s is " + "%s (got %s)!\n", + api_version.to_string().c_str(), + min_clc_version.to_string().c_str(), + clc_version.to_string().c_str()); + return TEST_FAIL; + } + + log_info(" testing compilation based on CL_DEVICE_OPENCL_C_VERSION\n"); + + struct TestCase + { + Version version; + const char* buildOptions; + }; + + std::vector tests; + tests.push_back({ Version(1, 1), "-cl-std=CL1.1" }); + tests.push_back({ Version(1, 2), "-cl-std=CL1.2" }); + tests.push_back({ Version(2, 0), "-cl-std=CL2.0" }); + tests.push_back({ Version(3, 0), "-cl-std=CL3.0" }); + + for (const auto& testcase : tests) + { + if (clc_version >= testcase.version) + { + clProgramWrapper program; + cl_int error = + create_single_kernel_helper_create_program_for_device( + context, device, &program, 1, &test_kernel, + testcase.buildOptions); + test_error(error, "Unable to build program!"); + + log_info(" successfully built program with build options '%s'\n", + testcase.buildOptions); + } + } + + return TEST_PASS; +} + +// This sub-test checks that CL_DEVICE_OPENCL_C_ALL_VERSIONS includes any +// requirements for the API version, and that programs can be built for all +// reported versions. +static int test_CL_DEVICE_OPENCL_C_ALL_VERSIONS(cl_device_id device, + cl_context context) +{ + // For now, the required OpenCL C version is the same as the API version. + const Version api_version = get_device_cl_version(device); + bool found_api_version = false; + + log_info( + " testing compilation based on CL_DEVICE_OPENCL_C_ALL_VERSIONS\n"); + + cl_int error = CL_SUCCESS; + + size_t sz = 0; + error = + clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, 0, NULL, &sz); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_ALL_VERSIONS size"); + + std::vector clc_versions(sz / sizeof(cl_name_version)); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, sz, + clc_versions.data(), NULL); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_FEATURES"); + + for (const auto& clc_version : clc_versions) + { + const unsigned major = CL_VERSION_MAJOR(clc_version.version); + const unsigned minor = CL_VERSION_MINOR(clc_version.version); + + if (strcmp(clc_version.name, "OpenCL C") == 0) + { + if (api_version == Version(major, minor)) + { + found_api_version = true; + } + + if (major == 1 && minor == 0) + { + log_info( + " skipping OpenCL C 1.0, there is no -cl-std=CL1.0.\n"); + continue; + } + + std::string buildOptions = "-cl-std=CL"; + buildOptions += std::to_string(major); + buildOptions += "."; + buildOptions += std::to_string(minor); + + clProgramWrapper program; + error = create_single_kernel_helper_create_program_for_device( + context, device, &program, 1, &test_kernel, + buildOptions.c_str()); + test_error(error, "Unable to build program!"); + + log_info(" successfully built program with build options '%s'\n", + buildOptions.c_str()); + } + else + { + log_error(" unknown OpenCL C name '%s'.\n", clc_version.name); + return TEST_FAIL; + } + } + + if (!found_api_version) + { + log_error(" didn't find required OpenCL C version '%s'!\n", + api_version.to_string().c_str()); + return TEST_FAIL; + } + + return TEST_PASS; +} + +// This sub-test checks that any required features are present for a specific +// CL_DEVICE_OPENCL_C_VERSION. +static int test_CL_DEVICE_OPENCL_C_VERSION_features(cl_device_id device, + cl_context context) +{ + log_info(" testing for OPENCL_C_VERSION required features\n"); + + OpenCLCFeatures features; + int error = get_device_cl_c_features(device, features); + if (error) + { + log_error("Couldn't query OpenCL C features for the device!\n"); + return TEST_FAIL; + } + + const Version clc_version = get_device_cl_c_version(device); + if (clc_version >= Version(2, 0)) + { + bool has_all_OpenCL_C_20_features = + features.supports__opencl_c_atomic_order_acq_rel + && features.supports__opencl_c_atomic_order_seq_cst + && features.supports__opencl_c_atomic_scope_device + && features.supports__opencl_c_atomic_scope_all_devices + && features.supports__opencl_c_device_enqueue + && features.supports__opencl_c_generic_address_space + && features.supports__opencl_c_pipes + && features.supports__opencl_c_program_scope_global_variables + && features.supports__opencl_c_work_group_collective_functions; + + if (features.supports__opencl_c_images) + { + has_all_OpenCL_C_20_features = has_all_OpenCL_C_20_features + && features.supports__opencl_c_3d_image_writes + && features.supports__opencl_c_read_write_images; + } + + test_assert_error( + has_all_OpenCL_C_20_features, + "At least one required OpenCL C 2.0 feature is missing!"); + } + + return TEST_PASS; +} + +// This sub-test checks that all required OpenCL C versions are present for a +// specific CL_DEVICE_OPENCL_C_VERSION. +static int test_CL_DEVICE_OPENCL_C_VERSION_versions(cl_device_id device, + cl_context context) +{ + log_info(" testing for OPENCL_C_VERSION required versions\n"); + + const Version device_clc_version = get_device_cl_c_version(device); + + std::vector test_clc_versions; + test_clc_versions.push_back(Version(1, 0)); + test_clc_versions.push_back(Version(1, 1)); + test_clc_versions.push_back(Version(1, 2)); + test_clc_versions.push_back(Version(2, 0)); + test_clc_versions.push_back(Version(3, 0)); + + cl_int error = CL_SUCCESS; + + size_t sz = 0; + error = + clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, 0, NULL, &sz); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_ALL_VERSIONS size"); + + std::vector device_clc_versions(sz + / sizeof(cl_name_version)); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_ALL_VERSIONS, sz, + device_clc_versions.data(), NULL); + test_error(error, "Unable to query CL_DEVICE_OPENCL_C_FEATURES"); + + for (const auto& test_clc_version : test_clc_versions) + { + if (device_clc_version >= test_clc_version) + { + bool found = false; + for (const auto& check : device_clc_versions) + { + const unsigned major = CL_VERSION_MAJOR(check.version); + const unsigned minor = CL_VERSION_MINOR(check.version); + + if (strcmp(check.name, "OpenCL C") == 0 + && test_clc_version == Version(major, minor)) + { + found = true; + break; + } + } + + if (found) + { + log_info(" found OpenCL C version '%s'\n", + test_clc_version.to_string().c_str()); + } + else + { + log_error("Didn't find OpenCL C version '%s'!\n", + test_clc_version.to_string().c_str()); + return TEST_FAIL; + } + } + } + + + return TEST_PASS; +} + +int test_opencl_c_versions(cl_device_id device, cl_context context, + cl_command_queue queue, int num_elements) +{ + cl_bool compilerAvailable = CL_FALSE; + cl_int error = + clGetDeviceInfo(device, CL_DEVICE_COMPILER_AVAILABLE, + sizeof(compilerAvailable), &compilerAvailable, NULL); + if (compilerAvailable == CL_FALSE) + { + log_info("Skipping test - no compiler is available.\n"); + return TEST_SKIPPED_ITSELF; + } + + const Version version = get_device_cl_version(device); + + int result = TEST_PASS; + + result |= test_CL_DEVICE_OPENCL_C_VERSION(device, context); + + if (version >= Version(3, 0)) + { + result |= test_CL_DEVICE_OPENCL_C_ALL_VERSIONS(device, context); + result |= test_CL_DEVICE_OPENCL_C_VERSION_features(device, context); + result |= test_CL_DEVICE_OPENCL_C_VERSION_versions(device, context); + } + + return result; +} From 33200355817d42920ed892797405e8022b440d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Tue, 29 Sep 2020 21:51:49 +0100 Subject: [PATCH 22/37] Align with updated conformance process (#989) - Remove the requirement to detail values for device queries and list extensions in the submission template. They are printed by computeinfo. - Require that tests skipped in accordance with the conformance process be listed in the submission template. - Remove support for OPENCL_1_0_DEVICE. This variable doesn't control anything anymore and the updated conformance process no longer refers to it. - Require that implementations running via a loader document the loader that was used. Signed-off-by: Kevin Petit --- test_common/harness/testHarness.cpp | 23 --------- test_common/harness/testHarness.h | 1 - .../submission_details_template.txt | 47 +++++-------------- 3 files changed, 12 insertions(+), 59 deletions(-) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 718983a7..83a575b4 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -54,8 +54,6 @@ cl_uint gReSeed = 0; int gFlushDenormsToZero = 0; int gInfNanSupport = 1; int gIsEmbedded = 0; -int gIsOpenCL_C_1_0_Device = 0; -int gIsOpenCL_1_0_Device = 0; int gHasLong = 1; bool gCoreILProgram = true; @@ -403,27 +401,6 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def gHasLong = 0; } - if( getenv( "OPENCL_1_0_DEVICE" ) ) - { - char c_version[1024]; - gIsOpenCL_1_0_Device = 1; - memset( c_version, 0, sizeof( c_version ) ); - - if( (err = clGetDeviceInfo( device, CL_DEVICE_OPENCL_C_VERSION, sizeof(c_version), c_version, NULL )) ) - { - log_error( "FAILURE: unable to get CL_DEVICE_OPENCL_C_VERSION on 1.0 device. (%d)\n", err ); - return EXIT_FAILURE; - } - - if( 0 == strncmp( c_version, "OpenCL C 1.0 ", strlen( "OpenCL C 1.0 " ) ) ) - { - gIsOpenCL_C_1_0_Device = 1; - log_info( "Device is a OpenCL C 1.0 device\n" ); - } - else - log_info( "Device is a OpenCL 1.0 device, but supports OpenCL C 1.1\n" ); - } - cl_uint device_address_bits = 0; if( (err = clGetDeviceInfo( device, CL_DEVICE_ADDRESS_BITS, sizeof( device_address_bits ), &device_address_bits, NULL ) )) { diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index d01c81ba..afa9ad92 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -147,7 +147,6 @@ extern int gFlushDenormsToZero; // This is set to 1 if the device does n extern int gInfNanSupport; // This is set to 1 if the device supports infinities and NaNs extern int gIsEmbedded; // This is set to 1 if the device is an embedded device extern int gHasLong; // This is set to 1 if the device suppots long and ulong types in OpenCL C. -extern int gIsOpenCL_C_1_0_Device; // This is set to 1 if the device supports only OpenCL C 1.0. extern bool gCoreILProgram; #if ! defined( __APPLE__ ) diff --git a/test_conformance/submission_details_template.txt b/test_conformance/submission_details_template.txt index aff18864..9d276a62 100644 --- a/test_conformance/submission_details_template.txt +++ b/test_conformance/submission_details_template.txt @@ -13,8 +13,7 @@ ############################################################################## # -# Submission information (mostly section 7 and F.5 of Conformance Process -# Document) that needs to be copied onto the web submission form. +# Submission information that needs to be copied onto the web submission form # ############################################################################## @@ -74,15 +73,19 @@ Platform Version: ############################################################################## # -# Further submission information (mostly section 7 of Conformance Process -# Document). +# Further submission information # ############################################################################## -# git tag of the tests used from GitHub (ex: vYYYY-MM-DD-XX) +# git tag of the tests used from GitHub (e.g. vYYYY-MM-DD-XX) # Tests version: +# Implementations that support cl_khr_icd are required to use a loader to run +# the tests and document the loader that was used. +# +Loader used: + # Date of "Khronos Conformance Process" that this submission # adheres to (as shown in the change history at the start of the document). # @@ -94,35 +97,9 @@ Conformance Process Document date: # OpenCL Conformance Process Attachment date: -############################################################################## +# The conformance process document makes allowances for skipping specific tests +# in some situations. A list of tests that were skipped in accordance to these +# rules along with the justification must be documented here. # -# Tested device configuration -# -############################################################################## - -# Max compute units (CL_DEVICE_MAX_COMPUTE_UNITS) -CL_DEVICE_MAX_COMPUTE_UNITS: - -# Max memory allocation size (CL_DEVICE_MAX_MEM_ALLOC_SIZE) -CL_DEVICE_MAX_MEM_ALLOC_SIZE: - -# Image support (CL_DEVICE_IMAGE_SUPPORT), 1/0 -CL_DEVICE_IMAGE_SUPPORT: - -# Global memory size (CL_DEVICE_GLOBAL_MEM_SIZE) -CL_DEVICE_GLOBAL_MEM_SIZE: - -# Max constant buffer size (CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE) -CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE: - -# Local memory size (CL_DEVICE_LOCAL_MEM_SIZE) -CL_DEVICE_LOCAL_MEM_SIZE: - - -############################################################################## -# -# Extension Queries -# -############################################################################## -# Show the list of supported extensions per device tested, each extension string on a separate line. +List of skipped tests in accordance with conformance process: From a41e5a9ee07703ad3d4312e04f9d785450664554 Mon Sep 17 00:00:00 2001 From: Chetan Mistry <70694498+chemis01@users.noreply.github.com> Date: Wed, 30 Sep 2020 09:50:21 +0100 Subject: [PATCH 23/37] samplerlessReads: Release Image to stop Memory Leak (#984) A previously created Image was not being released leading to a memory leak. Change-Id: I9715b5c4193a8e89c6c182b443959009ce1f1129 Signed-off-by: Chetankumar Mistry --- test_conformance/images/samplerlessReads/test_read_1D_array.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp index c86250fc..be0d4900 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp @@ -173,6 +173,8 @@ int test_read_image_1D_array( cl_context context, cl_command_queue queue, cl_ker clReleaseSampler(actualSampler); clReleaseMemObject(results); + clReleaseMemObject(read_only_image); + if(gTestReadWrite) { clReleaseMemObject(read_write_image); From 26cacf056eb26a34d5cf870e6cc1df5d52922721 Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Wed, 30 Sep 2020 11:06:45 +0100 Subject: [PATCH 24/37] Fail feature macro compare if compiler has more features than runtime (#982) * Fail feature macro compare if compiler has more features than runtime Because a C++11 `std::equal` only iterates over the first container, and matches with items in the second, if the second container contains more items the check can still pass even though they're not identical. Just use `==` instead. Fixes #979 * Move an expression to its point of use --- test_conformance/compiler/test_feature_macro.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/test_conformance/compiler/test_feature_macro.cpp b/test_conformance/compiler/test_feature_macro.cpp index cea85a6e..1dd3549b 100644 --- a/test_conformance/compiler/test_feature_macro.cpp +++ b/test_conformance/compiler/test_feature_macro.cpp @@ -22,7 +22,7 @@ const char* macro_supported_source = R"(kernel void enabled(global int * buf) { int n = get_global_id(0); buf[n] = 0; #ifndef %s - ERROR; + #error Feature macro was not defined #endif })"; @@ -31,7 +31,7 @@ const char* macro_not_supported_source = int n = get_global_id(0); buf[n] = 0; #ifdef %s - ERROR; + #error Feature macro was defined #endif })"; @@ -686,10 +686,7 @@ int test_consistency_c_features_list(cl_device_id deviceID, sort(vec_to_cmp.begin(), vec_to_cmp.end()); sort(vec_device_feature_names.begin(), vec_device_feature_names.end()); - cl_bool result = - std::equal(vec_device_feature_names.begin(), - vec_device_feature_names.end(), vec_to_cmp.begin()); - if (result) + if (vec_device_feature_names == vec_to_cmp) { log_info("Comparison list of features - passed\n"); } From a9d06dcd819d25df4733f8fac9a588ea212b757e Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Wed, 30 Sep 2020 07:18:55 -0700 Subject: [PATCH 25/37] add a basic test for CL_PIPE_PROPERTIES (#995) --- test_conformance/api/CMakeLists.txt | 1 + test_conformance/api/main.cpp | 1 + test_conformance/api/procs.h | 2 + .../api/test_pipe_properties_queries.cpp | 100 ++++++++++++++++++ 4 files changed, 104 insertions(+) create mode 100644 test_conformance/api/test_pipe_properties_queries.cpp diff --git a/test_conformance/api/CMakeLists.txt b/test_conformance/api/CMakeLists.txt index d3213ed5..9bd6c6e4 100644 --- a/test_conformance/api/CMakeLists.txt +++ b/test_conformance/api/CMakeLists.txt @@ -33,6 +33,7 @@ set(${MODULE_NAME}_SOURCES test_context_destructor_callback.cpp test_mem_object_properties_queries.cpp test_queue_properties_queries.cpp + test_pipe_properties_queries.cpp ) include(../CMakeCommon.txt) diff --git a/test_conformance/api/main.cpp b/test_conformance/api/main.cpp index 9740cba4..e41249a7 100644 --- a/test_conformance/api/main.cpp +++ b/test_conformance/api/main.cpp @@ -127,6 +127,7 @@ test_definition test_list[] = { ADD_TEST_VERSION(buffer_properties_queries, Version(3, 0)), ADD_TEST_VERSION(image_properties_queries, Version(3, 0)), ADD_TEST_VERSION(queue_properties_queries, Version(3, 0)), + ADD_TEST_VERSION(pipe_properties_queries, Version(3, 0)), ADD_TEST_VERSION(consistency_svm, Version(3, 0)), ADD_TEST_VERSION(consistency_memory_model, Version(3, 0)), diff --git a/test_conformance/api/procs.h b/test_conformance/api/procs.h index c550e5cc..5d91c73f 100644 --- a/test_conformance/api/procs.h +++ b/test_conformance/api/procs.h @@ -137,6 +137,8 @@ extern int test_queue_properties_queries(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); +int test_pipe_properties_queries(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); extern int test_consistency_svm(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); diff --git a/test_conformance/api/test_pipe_properties_queries.cpp b/test_conformance/api/test_pipe_properties_queries.cpp new file mode 100644 index 00000000..db918952 --- /dev/null +++ b/test_conformance/api/test_pipe_properties_queries.cpp @@ -0,0 +1,100 @@ +// +// Copyright (c) 2020 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 "testBase.h" +#include "harness/typeWrappers.h" + +#include + +struct test_query_pipe_properties_data +{ + std::vector properties; + std::string description; +}; + +static int create_pipe_and_check_array_properties( + cl_context context, const test_query_pipe_properties_data& test_case) +{ + log_info("TC description: %s\n", test_case.description.c_str()); + + cl_int error = CL_SUCCESS; + + clMemWrapper test_pipe; + + if (test_case.properties.size() > 0) + { + test_pipe = clCreatePipe(context, CL_MEM_HOST_NO_ACCESS, 4, 4, + test_case.properties.data(), &error); + test_error(error, "clCreatePipe failed"); + } + else + { + test_pipe = + clCreatePipe(context, CL_MEM_HOST_NO_ACCESS, 4, 4, NULL, &error); + test_error(error, "clCreatePipe failed"); + } + + std::vector check_properties; + size_t set_size = 0; + + error = clGetPipeInfo(test_pipe, CL_PIPE_PROPERTIES, 0, NULL, &set_size); + test_error(error, + "clGetPipeInfo failed asking for " + "CL_PIPE_PROPERTIES size."); + + if (set_size == 0 && test_case.properties.size() == 0) + { + return TEST_PASS; + } + if (set_size != test_case.properties.size() * sizeof(cl_pipe_properties)) + { + log_error("ERROR: CL_PIPE_PROPERTIES size is %d, expected %d.\n", + set_size, + test_case.properties.size() * sizeof(cl_pipe_properties)); + return TEST_FAIL; + } + + log_error("Unexpected test case size. This test needs to be updated to " + "compare pipe properties.\n"); + return TEST_FAIL; +} + +int test_pipe_properties_queries(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + cl_int error = CL_SUCCESS; + + cl_bool pipeSupport = CL_FALSE; + error = clGetDeviceInfo(deviceID, CL_DEVICE_PIPE_SUPPORT, + sizeof(pipeSupport), &pipeSupport, NULL); + test_error(error, "Unable to query CL_DEVICE_PIPE_SUPPORT"); + + if (pipeSupport == CL_FALSE) + { + return TEST_SKIPPED_ITSELF; + } + + int result = TEST_PASS; + + std::vector test_cases; + test_cases.push_back({ {}, "NULL properties" }); + + for (auto test_case : test_cases) + { + result |= create_pipe_and_check_array_properties(context, test_case); + } + + return result; +} From 81cea4775e1915365d5447957699e2231d43d205 Mon Sep 17 00:00:00 2001 From: Ben Ashbaugh Date: Wed, 30 Sep 2020 13:47:42 -0700 Subject: [PATCH 26/37] added extended versioning tests for OpenCL 3.0 (#996) * added extended versioning tests for OpenCL 3.0 * address review feedback --- .../computeinfo/extended_versioning.cpp | 49 ++++++++++++++++--- 1 file changed, 43 insertions(+), 6 deletions(-) diff --git a/test_conformance/computeinfo/extended_versioning.cpp b/test_conformance/computeinfo/extended_versioning.cpp index 841526cc..179e9025 100644 --- a/test_conformance/computeinfo/extended_versioning.cpp +++ b/test_conformance/computeinfo/extended_versioning.cpp @@ -243,7 +243,8 @@ static int test_extended_versioning_platform_version(cl_platform_id platform) /* Check that CL_DEVICE{,_OPENCL_C}_NUMERIC_VERSION_KHR return the same versions * as CL_DEVICE{,_OPENCL_C}_VERSION */ -static int test_extended_versioning_device_versions(cl_device_id deviceID) +static int test_extended_versioning_device_versions(bool ext, + cl_device_id deviceID) { log_info("Device versions:\n"); @@ -260,6 +261,15 @@ static int test_extended_versioning_device_versions(cl_device_id deviceID) for (const auto& query : device_version_queries) { + // CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR is only supported by + // cl_khr_extended_versioning: + if (!ext + && query.param_name_numeric + == CL_DEVICE_OPENCL_C_NUMERIC_VERSION_KHR) + { + continue; + } + const std::vector version_string( get_device_string(deviceID, query.param_name_string)); if (version_string.empty()) @@ -688,14 +698,41 @@ static int test_extended_versioning_device_built_in_kernels(cl_device_id device) return 0; } +// Assumes the core enums, structures, and macros exactly match +// the extension enums, structures, and macros: + +static_assert(CL_PLATFORM_NUMERIC_VERSION == CL_PLATFORM_NUMERIC_VERSION_KHR, + "CL_PLATFORM_NUMERIC_VERSION mismatch"); +static_assert(CL_PLATFORM_EXTENSIONS_WITH_VERSION + == CL_PLATFORM_EXTENSIONS_WITH_VERSION_KHR, + "CL_PLATFORM_EXTENSIONS_WITH_VERSION mismatch"); + +static_assert(CL_DEVICE_NUMERIC_VERSION == CL_DEVICE_NUMERIC_VERSION_KHR, + "CL_DEVICE_NUMERIC_VERSION mismatch"); +static_assert(CL_DEVICE_EXTENSIONS_WITH_VERSION + == CL_DEVICE_EXTENSIONS_WITH_VERSION_KHR, + "CL_DEVICE_EXTENSIONS_WITH_VERSION mismatch"); +static_assert(CL_DEVICE_ILS_WITH_VERSION == CL_DEVICE_ILS_WITH_VERSION_KHR, + "CL_DEVICE_ILS_WITH_VERSION mismatch"); +static_assert(CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION + == CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION_KHR, + "CL_DEVICE_BUILT_IN_KERNELS_WITH_VERSION mismatch"); + +static_assert(sizeof(cl_name_version) == sizeof(cl_name_version_khr), + "cl_name_version mismatch"); + +static_assert(CL_MAKE_VERSION(1, 2, 3) == CL_MAKE_VERSION_KHR(1, 2, 3), + "CL_MAKE_VERSION mismatch"); + int test_extended_versioning(cl_device_id deviceID, cl_context context, cl_command_queue ignoreQueue, int num_elements) { - if (!is_extension_available(deviceID, "cl_khr_extended_versioning")) + bool ext = is_extension_available(deviceID, "cl_khr_extended_versioning"); + bool core = get_device_cl_version(deviceID) >= Version(3, 0); + + if (!ext && !core) { - log_info( - "cl_khr_extended_versioning not supported. Skipping test...\n"); - return 0; + return TEST_SKIPPED_ITSELF; } cl_platform_id platform; @@ -706,7 +743,7 @@ int test_extended_versioning(cl_device_id deviceID, cl_context context, int total_errors = 0; total_errors += test_extended_versioning_platform_version(platform); total_errors += test_extended_versioning_platform_extensions(platform); - total_errors += test_extended_versioning_device_versions(deviceID); + total_errors += test_extended_versioning_device_versions(ext, deviceID); total_errors += test_extended_versioning_device_extensions(deviceID); total_errors += test_extended_versioning_device_il(deviceID); total_errors += test_extended_versioning_device_built_in_kernels(deviceID); From 615ab64db5327e49129c4511102c23d9c810cf5e Mon Sep 17 00:00:00 2001 From: julienhascoet Date: Fri, 2 Oct 2020 12:22:35 +0200 Subject: [PATCH 27/37] Fix error handling for test_half (#997) For vLoadHalf test, the error was not properly returned leading to test success whereas it failed. --- test_conformance/half/Test_vLoadHalf.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_conformance/half/Test_vLoadHalf.cpp b/test_conformance/half/Test_vLoadHalf.cpp index 3682d3e6..1c53492a 100644 --- a/test_conformance/half/Test_vLoadHalf.cpp +++ b/test_conformance/half/Test_vLoadHalf.cpp @@ -506,7 +506,7 @@ int Test_vLoadHalf_private( cl_device_id device, bool aligned ) (aligned?"aligned":"unaligned")); gFailCount++; error = -1; - break; // goto exit; + goto exit; } } } From 7a735b74e31a46a8bf50e451c5b0875db73349fc Mon Sep 17 00:00:00 2001 From: Chetan Mistry <70694498+chemis01@users.noreply.github.com> Date: Fri, 2 Oct 2020 16:29:05 +0100 Subject: [PATCH 28/37] Replace cl_ushort with cl_half (#885) (#1000) * test_common: Replace cl_ushort with cl_half (#885) Change-Id: I507eca2084629c3b6f3e7331f062f006edbce434 Signed-off-by: Chetankumar Mistry * buffers, pipes, profiling: Replace cl_ushort with cl_half (#885) Change-Id: Id9799322b636af6aa0eec3d4e846d7af8c7f9602 Signed-off-by: Chetankumar Mistry * images/kernel_read_write: Replace cl_ushort with cl_half (#885) Change-Id: I922ddb593b6e5631d0f4ea1522c7f75f8770be40 Signed-off-by: Chetankumar Mistry * half: Replace cl_ushort with cl_half (#885) Change-Id: I484a5bb2b33a7e87805fc6079953c66e5f8d9239 Signed-off-by: Chetankumar Mistry --- test_common/gl/helpers.cpp | 8 +-- test_common/harness/conversions.cpp | 2 +- test_common/harness/errorHelpers.cpp | 2 +- test_common/harness/errorHelpers.h | 6 +- test_common/harness/imageHelpers.cpp | 52 +++++++------- test_common/harness/imageHelpers.h | 18 ++--- .../buffers/test_buffer_write.cpp | 4 +- test_conformance/half/Test_vStoreHalf.cpp | 72 +++++++++++-------- .../kernel_read_write/test_write_1D.cpp | 14 +++- .../kernel_read_write/test_write_1D_array.cpp | 14 +++- .../kernel_read_write/test_write_2D_array.cpp | 16 ++++- .../kernel_read_write/test_write_3D.cpp | 16 ++++- .../kernel_read_write/test_write_image.cpp | 14 +++- .../pipes/test_pipe_read_write.cpp | 4 +- test_conformance/profiling/writeArray.cpp | 4 +- 15 files changed, 156 insertions(+), 90 deletions(-) diff --git a/test_common/gl/helpers.cpp b/test_common/gl/helpers.cpp index 0d5cba75..def78d75 100644 --- a/test_common/gl/helpers.cpp +++ b/test_common/gl/helpers.cpp @@ -1277,9 +1277,7 @@ void * CreateGLTexture2DMultisample( size_t width, size_t height, size_t samples case kUInt: *((unsigned int*)p) = val*0xffffffff; break; - case kHalf: - *((cl_ushort*)p) = convert_float_to_half(val); - break; + case kHalf: *((cl_half *)p) = convert_float_to_half(val); break; default: log_error("Test error: unexpected type enum 0x%x\n",type); } @@ -1541,9 +1539,7 @@ void * CreateGLTexture2DArrayMultisample(size_t width, size_t height, case kUInt: *((unsigned int*)p) = val*0xffffffff; break; - case kHalf: - *((cl_ushort*)p) = convert_float_to_half(val); - break; + case kHalf: *((cl_half *)p) = convert_float_to_half(val); break; default: log_error("Test error: unexpected type enum 0x%x\n",type); } diff --git a/test_common/harness/conversions.cpp b/test_common/harness/conversions.cpp index 72fd8cb3..3c5ec964 100644 --- a/test_common/harness/conversions.cpp +++ b/test_common/harness/conversions.cpp @@ -880,7 +880,7 @@ void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outD cl_ulong *ulongPtr; cl_float *floatPtr; cl_double *doublePtr; - cl_ushort *halfPtr; + cl_half *halfPtr; size_t i; cl_uint bits = genrand_int32(d); cl_uint bitsLeft = 32; diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index b2586f90..5fee9a2c 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -354,7 +354,7 @@ static float Ulp_Error_Half_Float( float test, double reference ) return (float) scalbn( testVal - reference, ulp_exp ); } -float Ulp_Error_Half( cl_ushort test, float reference ) +float Ulp_Error_Half(cl_half test, float reference) { return Ulp_Error_Half_Float(cl_half_to_float(test), reference); } diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index ba9e6474..36868f8d 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -122,9 +122,9 @@ static int vlog_win32(const char *format, ...); extern const char *IGetErrorString( int clErrorCode ); -extern float Ulp_Error_Half( cl_ushort test, float reference ); -extern float Ulp_Error( float test, double reference ); -extern float Ulp_Error_Double( double test, long double reference ); +extern float Ulp_Error_Half(cl_half test, float reference); +extern float Ulp_Error(float test, double reference); +extern float Ulp_Error_Double(double test, long double reference); extern const char *GetChannelTypeName( cl_channel_type type ); extern int IsChannelTypeSupported( cl_channel_type type ); diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index 6a84fde8..af1aea3d 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -925,7 +925,7 @@ int get_format_min_int( cl_image_format *format ) } } -cl_ushort convert_float_to_half( float f ) +cl_half convert_float_to_half(float f) { switch( gFloatToHalfRoundingMode ) { @@ -1281,10 +1281,9 @@ void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, break; } - case CL_HALF_FLOAT: - { - cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < channelCount; i++ ) + case CL_HALF_FLOAT: { + cl_half *dPtr = (cl_half *)ptr; + for (i = 0; i < channelCount; i++) tempData[i] = cl_half_to_float(dPtr[i]); break; } @@ -2397,9 +2396,8 @@ void pack_image_pixel( float *srcVector, const cl_image_format *imageFormat, voi size_t channelCount = get_format_channel_count( imageFormat ); switch( imageFormat->image_channel_data_type ) { - case CL_HALF_FLOAT: - { - cl_ushort *ptr = (cl_ushort *)outData; + case CL_HALF_FLOAT: { + cl_half *ptr = (cl_half *)outData; switch( gFloatToHalfRoundingMode ) { @@ -2569,9 +2567,8 @@ void pack_image_pixel_error( const float *srcVector, const cl_image_format *imag size_t channelCount = get_format_channel_count( imageFormat ); switch( imageFormat->image_channel_data_type ) { - case CL_HALF_FLOAT: - { - const cl_ushort *ptr = (const cl_ushort *)results; + case CL_HALF_FLOAT: { + const cl_half *ptr = (const cl_half *)results; for( unsigned int i = 0; i < channelCount; i++ ) errors[i] = Ulp_Error_Half( ptr[i], srcVector[i] ); @@ -2838,25 +2835,28 @@ int DetectFloatToHalfRoundingMode( cl_command_queue q ) // Returns CL_SUCCESS return err; } - // read the results - cl_ushort outBuf[count*4]; - memset( outBuf, -1, sizeof( outBuf ) ); - size_t origin[3] = {0,0,0}; - size_t region[3] = {count,1,1}; - err = clEnqueueReadImage( q, outImage, CL_TRUE, origin, region, 0, 0, outBuf, 0, NULL, NULL ); - if( err ) + // read the results + cl_half outBuf[count * 4]; + memset(outBuf, -1, sizeof(outBuf)); + size_t origin[3] = { 0, 0, 0 }; + size_t region[3] = { count, 1, 1 }; + err = clEnqueueReadImage(q, outImage, CL_TRUE, origin, region, 0, 0, + outBuf, 0, NULL, NULL); + if (err) { - log_error( "Error: could not read output image in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseKernel( k ); + log_error("Error: could not read output image in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); + clReleaseKernel(k); return err; } - // Generate our list of reference results - cl_ushort rte_ref[count*4]; - cl_ushort rtz_ref[count*4]; - for( size_t i = 0; i < 4 * count; i++ ) + // Generate our list of reference results + cl_half rte_ref[count * 4]; + cl_half rtz_ref[count * 4]; + for (size_t i = 0; i < 4 * count; i++) { rte_ref[i] = cl_half_from_float(inp[i], CL_HALF_RTE); rtz_ref[i] = cl_half_from_float(inp[i], CL_HALF_RTZ); diff --git a/test_common/harness/imageHelpers.h b/test_common/harness/imageHelpers.h index 4c527543..ca335d7d 100644 --- a/test_common/harness/imageHelpers.h +++ b/test_common/harness/imageHelpers.h @@ -275,10 +275,9 @@ template void read_image_pixel( void *imageData, image_descriptor *ima break; } - case CL_HALF_FLOAT: - { - cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) + case CL_HALF_FLOAT: { + cl_half *dPtr = (cl_half *)ptr; + for (i = 0; i < get_format_channel_count(format); i++) tempData[i] = (T)cl_half_to_float(dPtr[i]); break; } @@ -639,17 +638,18 @@ protected: size_t mVecSize; }; -extern cl_ushort convert_float_to_half(float f); -extern int DetectFloatToHalfRoundingMode( cl_command_queue ); // Returns CL_SUCCESS on success +extern cl_half convert_float_to_half(float f); +extern int DetectFloatToHalfRoundingMode( + cl_command_queue); // Returns CL_SUCCESS on success // sign bit: don't care, exponent: maximum value, significand: non-zero -static int inline is_half_nan( cl_ushort half ){ return ( half & 0x7fff ) > 0x7c00; } +static int inline is_half_nan(cl_half half) { return (half & 0x7fff) > 0x7c00; } // sign bit: don't care, exponent: zero, significand: non-zero -static int inline is_half_denorm( cl_ushort half ){ return IsHalfSubnormal( half ); } +static int inline is_half_denorm(cl_half half) { return IsHalfSubnormal(half); } // sign bit: don't care, exponent: zero, significand: zero -static int inline is_half_zero( cl_ushort half ){ return ( half & 0x7fff ) == 0; } +static int inline is_half_zero(cl_half half) { return (half & 0x7fff) == 0; } extern double sRGBmap(float fc); diff --git a/test_conformance/buffers/test_buffer_write.cpp b/test_conformance/buffers/test_buffer_write.cpp index 0f672807..49340520 100644 --- a/test_conformance/buffers/test_buffer_write.cpp +++ b/test_conformance/buffers/test_buffer_write.cpp @@ -554,8 +554,8 @@ static int verify_write_float( void *ptr1, void *ptr2, int n ) static int verify_write_half( void *ptr1, void *ptr2, int n ) { int i; - cl_ushort *inptr = (cl_ushort *)ptr1; - cl_ushort *outptr = (cl_ushort *)ptr2; + cl_half *inptr = (cl_half *)ptr1; + cl_half *outptr = (cl_half *)ptr2; for ( i = 0; i < n; i++ ){ if ( outptr[i] != inptr[i] ) diff --git a/test_conformance/half/Test_vStoreHalf.cpp b/test_conformance/half/Test_vStoreHalf.cpp index 658694fa..c3a328ad 100644 --- a/test_conformance/half/Test_vStoreHalf.cpp +++ b/test_conformance/half/Test_vStoreHalf.cpp @@ -210,42 +210,42 @@ CheckD(cl_uint jid, cl_uint tid, void *userInfo) return ret; } -static cl_ushort float2half_rte(float f) +static cl_half float2half_rte(float f) { return cl_half_from_float(f, CL_HALF_RTE); } -static cl_ushort float2half_rtz(float f) +static cl_half float2half_rtz(float f) { return cl_half_from_float(f, CL_HALF_RTZ); } -static cl_ushort float2half_rtp(float f) +static cl_half float2half_rtp(float f) { return cl_half_from_float(f, CL_HALF_RTP); } -static cl_ushort float2half_rtn(float f) +static cl_half float2half_rtn(float f) { return cl_half_from_float(f, CL_HALF_RTN); } -static cl_ushort double2half_rte(double f) +static cl_half double2half_rte(double f) { return cl_half_from_double(f, CL_HALF_RTE); } -static cl_ushort double2half_rtz(double f) +static cl_half double2half_rtz(double f) { return cl_half_from_double(f, CL_HALF_RTZ); } -static cl_ushort double2half_rtp(double f) +static cl_half double2half_rtp(double f) { return cl_half_from_double(f, CL_HALF_RTP); } -static cl_ushort double2half_rtn(double f) +static cl_half double2half_rtn(double f) { return cl_half_from_double(f, CL_HALF_RTN); } @@ -696,30 +696,30 @@ int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleR ComputeReferenceInfoF fref; fref.x = (float *)gIn_single; - fref.r = (cl_ushort *)gOut_half_reference; + fref.r = (cl_half *)gOut_half_reference; fref.f = referenceFunc; fref.lim = blockCount; fref.count = (blockCount + threadCount - 1) / threadCount; CheckResultInfoF fchk; fchk.x = (const float *)gIn_single; - fchk.r = (const cl_ushort *)gOut_half_reference; - fchk.s = (const cl_ushort *)gOut_half; + fchk.r = (const cl_half *)gOut_half_reference; + fchk.s = (const cl_half *)gOut_half; fchk.f = referenceFunc; fchk.lim = blockCount; fchk.count = (blockCount + threadCount - 1) / threadCount; ComputeReferenceInfoD dref; dref.x = (double *)gIn_double; - dref.r = (cl_ushort *)gOut_half_reference_double; + dref.r = (cl_half *)gOut_half_reference_double; dref.f = doubleReferenceFunc; dref.lim = blockCount; dref.count = (blockCount + threadCount - 1) / threadCount; CheckResultInfoD dchk; dchk.x = (const double *)gIn_double; - dchk.r = (const cl_ushort *)gOut_half_reference_double; - dchk.s = (const cl_ushort *)gOut_half; + dchk.r = (const cl_half *)gOut_half_reference_double; + dchk.s = (const cl_half *)gOut_half; dchk.f = doubleReferenceFunc; dchk.lim = blockCount; dchk.count = (blockCount + threadCount - 1) / threadCount; @@ -764,7 +764,9 @@ int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleR cl_uint pattern = 0xdeaddead; memset_pattern4( gOut_half, &pattern, BUFFER_SIZE/2); - error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, + 0, count * sizeof(cl_half), + gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clWriteArray\n" ); gFailCount++; @@ -779,7 +781,9 @@ int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleR goto exit; } - error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, + count * sizeof(cl_half), gOut_half, + 0, NULL, NULL); if (error) { vlog_error( "Failure in clReadArray\n" ); gFailCount++; @@ -795,7 +799,9 @@ int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleR if (gTestDouble) { memset_pattern4( gOut_half, &pattern, BUFFER_SIZE/2); - error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueWriteBuffer( + gQueue, gOutBuffer_half, CL_FALSE, 0, + count * sizeof(cl_half), gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clWriteArray\n" ); gFailCount++; @@ -810,7 +816,9 @@ int Test_vStoreHalf_private( cl_device_id device, f2h referenceFunc, d2h doubleR goto exit; } - error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueReadBuffer( + gQueue, gOutBuffer_half, CL_TRUE, 0, + count * sizeof(cl_half), gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clReadArray\n" ); gFailCount++; @@ -1285,30 +1293,30 @@ int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h double ComputeReferenceInfoF fref; fref.x = (float *)gIn_single; - fref.r = (cl_ushort *)gOut_half_reference; + fref.r = (cl_half *)gOut_half_reference; fref.f = referenceFunc; fref.lim = blockCount; fref.count = (blockCount + threadCount - 1) / threadCount; CheckResultInfoF fchk; fchk.x = (const float *)gIn_single; - fchk.r = (const cl_ushort *)gOut_half_reference; - fchk.s = (const cl_ushort *)gOut_half; + fchk.r = (const cl_half *)gOut_half_reference; + fchk.s = (const cl_half *)gOut_half; fchk.f = referenceFunc; fchk.lim = blockCount; fchk.count = (blockCount + threadCount - 1) / threadCount; ComputeReferenceInfoD dref; dref.x = (double *)gIn_double; - dref.r = (cl_ushort *)gOut_half_reference_double; + dref.r = (cl_half *)gOut_half_reference_double; dref.f = doubleReferenceFunc; dref.lim = blockCount; dref.count = (blockCount + threadCount - 1) / threadCount; CheckResultInfoD dchk; dchk.x = (const double *)gIn_double; - dchk.r = (const cl_ushort *)gOut_half_reference_double; - dchk.s = (const cl_ushort *)gOut_half; + dchk.r = (const cl_half *)gOut_half_reference_double; + dchk.s = (const cl_half *)gOut_half; dchk.f = doubleReferenceFunc; dchk.lim = blockCount; dchk.count = (blockCount + threadCount - 1) / threadCount; @@ -1353,7 +1361,9 @@ int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h double cl_uint pattern = 0xdeaddead; memset_pattern4(gOut_half, &pattern, BUFFER_SIZE/2); - error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, + 0, count * sizeof(cl_half), + gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clWriteArray\n" ); gFailCount++; @@ -1368,7 +1378,9 @@ int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h double goto exit; } - error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, + count * sizeof(cl_half), gOut_half, + 0, NULL, NULL); if (error) { vlog_error( "Failure in clReadArray\n" ); gFailCount++; @@ -1384,7 +1396,9 @@ int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h double if (gTestDouble) { memset_pattern4(gOut_half, &pattern, BUFFER_SIZE/2); - error = clEnqueueWriteBuffer(gQueue, gOutBuffer_half, CL_FALSE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueWriteBuffer( + gQueue, gOutBuffer_half, CL_FALSE, 0, + count * sizeof(cl_half), gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clWriteArray\n" ); gFailCount++; @@ -1399,7 +1413,9 @@ int Test_vStoreaHalf_private( cl_device_id device, f2h referenceFunc, d2h double goto exit; } - error = clEnqueueReadBuffer(gQueue, gOutBuffer_half, CL_TRUE, 0, count * sizeof(cl_ushort), gOut_half, 0, NULL, NULL); + error = clEnqueueReadBuffer( + gQueue, gOutBuffer_half, CL_TRUE, 0, + count * sizeof(cl_half), gOut_half, 0, NULL, NULL); if (error) { vlog_error( "Failure in clReadArray\n" ); gFailCount++; diff --git a/test_conformance/images/kernel_read_write/test_write_1D.cpp b/test_conformance/images/kernel_read_write/test_write_1D.cpp index ca022629..845ba830 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D.cpp @@ -472,8 +472,18 @@ int test_write_image_1D( cl_device_id device, cl_context context, cl_command_que log_error( " Error: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_HALF_FLOAT: - log_error( " Expected: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultBuffer)[0], ((cl_ushort*)resultBuffer)[1], ((cl_ushort*)resultBuffer)[2], ((cl_ushort*)resultBuffer)[3] ); - log_error( " Actual: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultPtr)[0], ((cl_ushort*)resultPtr)[1], ((cl_ushort*)resultPtr)[2], ((cl_ushort*)resultPtr)[3] ); + log_error(" Expected: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultBuffer)[0], + ((cl_half *)resultBuffer)[1], + ((cl_half *)resultBuffer)[2], + ((cl_half *)resultBuffer)[3]); + log_error(" Actual: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultPtr)[0], + ((cl_half *)resultPtr)[1], + ((cl_half *)resultPtr)[2], + ((cl_half *)resultPtr)[3]); log_error( " Ulps: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_UNSIGNED_INT32: diff --git a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp index b91bf1cf..5fe928f1 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp @@ -491,8 +491,18 @@ int test_write_image_1D_array( cl_device_id device, cl_context context, cl_comma log_error( " Error: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_HALF_FLOAT: - log_error( " Expected: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultBuffer)[0], ((cl_ushort*)resultBuffer)[1], ((cl_ushort*)resultBuffer)[2], ((cl_ushort*)resultBuffer)[3] ); - log_error( " Actual: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultPtr)[0], ((cl_ushort*)resultPtr)[1], ((cl_ushort*)resultPtr)[2], ((cl_ushort*)resultPtr)[3] ); + log_error(" Expected: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultBuffer)[0], + ((cl_half *)resultBuffer)[1], + ((cl_half *)resultBuffer)[2], + ((cl_half *)resultBuffer)[3]); + log_error(" Actual: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultPtr)[0], + ((cl_half *)resultPtr)[1], + ((cl_half *)resultPtr)[2], + ((cl_half *)resultPtr)[3]); log_error( " Ulps: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_UNSIGNED_INT32: diff --git a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp index 4524c6cd..01050c2c 100644 --- a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp @@ -514,8 +514,20 @@ int test_write_image_2D_array( cl_device_id device, cl_context context, cl_comma log_error( " Error: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_HALF_FLOAT: - log_error( " Expected: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultBuffer)[0], ((cl_ushort*)resultBuffer)[1], ((cl_ushort*)resultBuffer)[2], ((cl_ushort*)resultBuffer)[3] ); - log_error( " Actual: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultPtr)[0], ((cl_ushort*)resultPtr)[1], ((cl_ushort*)resultPtr)[2], ((cl_ushort*)resultPtr)[3] ); + log_error( + " Expected: 0x%4.4x 0x%4.4x " + "0x%4.4x 0x%4.4x\n", + ((cl_half *)resultBuffer)[0], + ((cl_half *)resultBuffer)[1], + ((cl_half *)resultBuffer)[2], + ((cl_half *)resultBuffer)[3]); + log_error( + " Actual: 0x%4.4x 0x%4.4x " + "0x%4.4x 0x%4.4x\n", + ((cl_half *)resultPtr)[0], + ((cl_half *)resultPtr)[1], + ((cl_half *)resultPtr)[2], + ((cl_half *)resultPtr)[3]); log_error( " Ulps: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_UNSIGNED_INT32: diff --git a/test_conformance/images/kernel_read_write/test_write_3D.cpp b/test_conformance/images/kernel_read_write/test_write_3D.cpp index 7440bd6e..b67a7325 100644 --- a/test_conformance/images/kernel_read_write/test_write_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_3D.cpp @@ -521,8 +521,20 @@ int test_write_image_3D( cl_device_id device, cl_context context, cl_command_que log_error( " Error: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_HALF_FLOAT: - log_error( " Expected: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultBuffer)[0], ((cl_ushort*)resultBuffer)[1], ((cl_ushort*)resultBuffer)[2], ((cl_ushort*)resultBuffer)[3] ); - log_error( " Actual: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultPtr)[0], ((cl_ushort*)resultPtr)[1], ((cl_ushort*)resultPtr)[2], ((cl_ushort*)resultPtr)[3] ); + log_error( + " Expected: 0x%4.4x 0x%4.4x " + "0x%4.4x 0x%4.4x\n", + ((cl_half *)resultBuffer)[0], + ((cl_half *)resultBuffer)[1], + ((cl_half *)resultBuffer)[2], + ((cl_half *)resultBuffer)[3]); + log_error( + " Actual: 0x%4.4x 0x%4.4x " + "0x%4.4x 0x%4.4x\n", + ((cl_half *)resultPtr)[0], + ((cl_half *)resultPtr)[1], + ((cl_half *)resultPtr)[2], + ((cl_half *)resultPtr)[3]); log_error( " Ulps: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_UNSIGNED_INT32: diff --git a/test_conformance/images/kernel_read_write/test_write_image.cpp b/test_conformance/images/kernel_read_write/test_write_image.cpp index f6d9235c..37274f3a 100644 --- a/test_conformance/images/kernel_read_write/test_write_image.cpp +++ b/test_conformance/images/kernel_read_write/test_write_image.cpp @@ -538,8 +538,18 @@ int test_write_image( cl_device_id device, cl_context context, cl_command_queue log_error( " Error: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_HALF_FLOAT: - log_error( " Expected: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultBuffer)[0], ((cl_ushort*)resultBuffer)[1], ((cl_ushort*)resultBuffer)[2], ((cl_ushort*)resultBuffer)[3] ); - log_error( " Actual: 0x%4.4x 0x%4.4x 0x%4.4x 0x%4.4x\n", ((cl_ushort*)resultPtr)[0], ((cl_ushort*)resultPtr)[1], ((cl_ushort*)resultPtr)[2], ((cl_ushort*)resultPtr)[3] ); + log_error(" Expected: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultBuffer)[0], + ((cl_half *)resultBuffer)[1], + ((cl_half *)resultBuffer)[2], + ((cl_half *)resultBuffer)[3]); + log_error(" Actual: 0x%4.4x " + "0x%4.4x 0x%4.4x 0x%4.4x\n", + ((cl_half *)resultPtr)[0], + ((cl_half *)resultPtr)[1], + ((cl_half *)resultPtr)[2], + ((cl_half *)resultPtr)[3]); log_error( " Ulps: %f %f %f %f\n", errors[0], errors[1], errors[2], errors[3] ); break; case CL_UNSIGNED_INT32: diff --git a/test_conformance/pipes/test_pipe_read_write.cpp b/test_conformance/pipes/test_pipe_read_write.cpp index 4bb4468e..64ee31b3 100644 --- a/test_conformance/pipes/test_pipe_read_write.cpp +++ b/test_conformance/pipes/test_pipe_read_write.cpp @@ -361,8 +361,8 @@ static int verify_readwrite_half(void *ptr1, void *ptr2, int n) { int i; int sum_input = 0, sum_output = 0; - cl_ushort *inptr = (cl_ushort *)ptr1; - cl_ushort *outptr = (cl_ushort *)ptr2; + cl_half *inptr = (cl_half *)ptr1; + cl_half *outptr = (cl_half *)ptr2; for(i = 0; i < n; i++) { diff --git a/test_conformance/profiling/writeArray.cpp b/test_conformance/profiling/writeArray.cpp index 1455c1e3..c3481e60 100644 --- a/test_conformance/profiling/writeArray.cpp +++ b/test_conformance/profiling/writeArray.cpp @@ -551,8 +551,8 @@ static int verify_write_float( void *ptr1, void *ptr2, int n ) static int verify_write_half( void *ptr1, void *ptr2, int n ) { int i; - cl_ushort *inptr = (cl_ushort *)ptr1; - cl_ushort *outptr = (cl_ushort *)ptr2; + cl_half *inptr = (cl_half *)ptr1; + cl_half *outptr = (cl_half *)ptr2; for( i = 0; i < n; i++ ){ if( outptr[i] != inptr[i] ) From 020eea9e529f25b2896ace6c50d2c57687f03576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Mon, 5 Oct 2020 18:20:51 +0100 Subject: [PATCH 29/37] Don't require support for 3D image writes in tests that don't need it (#1003) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fix PASSIVE_REQUIRE_* macros to report tests as skipped instead of passed. Signed-off-by: Kévin Petit --- test_common/harness/kernelHelpers.h | 33 ++++++++++--------- test_conformance/api/test_api_min_max.cpp | 9 +++-- .../basic/test_arrayimagecopy3d.cpp | 10 ++++-- .../basic/test_imagearraycopy3d.cpp | 10 ++++-- 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/test_common/harness/kernelHelpers.h b/test_common/harness/kernelHelpers.h index d78481e1..4b1462e5 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.h @@ -152,25 +152,28 @@ size_t get_min_alignment(cl_context context); /* Helper to obtain the default rounding mode for single precision computation. (Double is always CL_FP_ROUND_TO_NEAREST.) Returns 0 on error. */ cl_device_fp_config get_default_rounding_mode( cl_device_id device ); -#define PASSIVE_REQUIRE_IMAGE_SUPPORT( device ) \ - if( checkForImageSupport( device ) ) \ - { \ - log_info( "\n\tNote: device does not support images. Skipping test...\n" ); \ - return 0; \ +#define PASSIVE_REQUIRE_IMAGE_SUPPORT(device) \ + if (checkForImageSupport(device)) \ + { \ + log_info( \ + "\n\tNote: device does not support images. Skipping test...\n"); \ + return TEST_SKIPPED_ITSELF; \ } -#define PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( device ) \ - if( checkFor3DImageSupport( device ) ) \ - { \ - log_info( "\n\tNote: device does not support 3D images. Skipping test...\n" ); \ - return 0; \ +#define PASSIVE_REQUIRE_3D_IMAGE_SUPPORT(device) \ + if (checkFor3DImageSupport(device)) \ + { \ + log_info("\n\tNote: device does not support 3D images. Skipping " \ + "test...\n"); \ + return TEST_SKIPPED_ITSELF; \ } -#define PASSIVE_REQUIRE_FP16_SUPPORT(device) \ - if (!is_extension_available(device, "cl_khr_fp16")) \ - { \ - log_info("\n\tNote: device does not support fp16. Skipping test...\n"); \ - return 0; \ +#define PASSIVE_REQUIRE_FP16_SUPPORT(device) \ + if (!is_extension_available(device, "cl_khr_fp16")) \ + { \ + log_info( \ + "\n\tNote: device does not support fp16. Skipping test...\n"); \ + return TEST_SKIPPED_ITSELF; \ } /* Prints out the standard device header for all tests given the device to print for */ diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index 4d902116..5f171438 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -692,7 +692,8 @@ int test_min_max_image_3d_width(cl_device_id deviceID, cl_context context, cl_co PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( deviceID ) /* Just get any ol format to test with */ - error = get_8_bit_image_format( context, CL_MEM_OBJECT_IMAGE3D, CL_MEM_READ_WRITE, 0, &image_format_desc ); + error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, + CL_MEM_READ_ONLY, 0, &image_format_desc); test_error( error, "Unable to obtain suitable image format to test with!" ); /* Get the max 2d image width */ @@ -748,7 +749,8 @@ int test_min_max_image_3d_height(cl_device_id deviceID, cl_context context, cl_c PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( deviceID ) /* Just get any ol format to test with */ - error = get_8_bit_image_format( context, CL_MEM_OBJECT_IMAGE3D, CL_MEM_READ_WRITE, 0, &image_format_desc ); + error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, + CL_MEM_READ_ONLY, 0, &image_format_desc); test_error( error, "Unable to obtain suitable image format to test with!" ); /* Get the max 2d image width */ @@ -805,7 +807,8 @@ int test_min_max_image_3d_depth(cl_device_id deviceID, cl_context context, cl_co PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( deviceID ) /* Just get any ol format to test with */ - error = get_8_bit_image_format( context, CL_MEM_OBJECT_IMAGE3D, CL_MEM_READ_WRITE, 0, &image_format_desc ); + error = get_8_bit_image_format(context, CL_MEM_OBJECT_IMAGE3D, + CL_MEM_READ_ONLY, 0, &image_format_desc); test_error( error, "Unable to obtain suitable image format to test with!" ); /* Get the max 2d image width */ diff --git a/test_conformance/basic/test_arrayimagecopy3d.cpp b/test_conformance/basic/test_arrayimagecopy3d.cpp index d1d36524..0d6a5245 100644 --- a/test_conformance/basic/test_arrayimagecopy3d.cpp +++ b/test_conformance/basic/test_arrayimagecopy3d.cpp @@ -39,7 +39,8 @@ int test_arrayimagecopy3d_single_format(cl_device_id device, cl_context context, 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); + image = create_image_3d(context, CL_MEM_READ_ONLY, 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); @@ -125,12 +126,15 @@ int test_arrayimagecopy3d(cl_device_id device, cl_context context, cl_command_qu PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( device ) - err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE3D, 0, NULL, &num_formats); + err = clGetSupportedImageFormats( + context, CL_MEM_READ_ONLY, 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); + err = clGetSupportedImageFormats(context, CL_MEM_READ_ONLY, + CL_MEM_OBJECT_IMAGE3D, num_formats, formats, + NULL); test_error(err, "clGetSupportedImageFormats failed"); for (i = 0; i < num_formats; i++) { diff --git a/test_conformance/basic/test_imagearraycopy3d.cpp b/test_conformance/basic/test_imagearraycopy3d.cpp index e34aa7d9..91ef1fcc 100644 --- a/test_conformance/basic/test_imagearraycopy3d.cpp +++ b/test_conformance/basic/test_imagearraycopy3d.cpp @@ -38,7 +38,8 @@ int test_imagearraycopy3d_single_format(cl_device_id device, cl_context context, 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); + image = create_image_3d(context, CL_MEM_READ_ONLY, 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); @@ -121,12 +122,15 @@ int test_imagearraycopy3d(cl_device_id device, cl_context context, cl_command_qu PASSIVE_REQUIRE_3D_IMAGE_SUPPORT( device ) - err = clGetSupportedImageFormats(context, CL_MEM_READ_WRITE, CL_MEM_OBJECT_IMAGE3D, 0, NULL, &num_formats); + err = clGetSupportedImageFormats( + context, CL_MEM_READ_ONLY, 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); + err = clGetSupportedImageFormats(context, CL_MEM_READ_ONLY, + CL_MEM_OBJECT_IMAGE3D, num_formats, formats, + NULL); test_error(err, "clGetSupportedImageFormats failed"); for (i = 0; i < num_formats; i++) { From d0e97361ae1ff1802c0f70548f8530fab82d3d7a Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Tue, 13 Oct 2020 09:24:22 +0100 Subject: [PATCH 30/37] Add a binary compile mode CSV (#987) This is identical to the SPIR-V spreadsheet, except spir-v mode is replaced by binary mode. --- .../opencl_conformance_tests_full_binary.csv | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 test_conformance/opencl_conformance_tests_full_binary.csv diff --git a/test_conformance/opencl_conformance_tests_full_binary.csv b/test_conformance/opencl_conformance_tests_full_binary.csv new file mode 100644 index 00000000..348f32eb --- /dev/null +++ b/test_conformance/opencl_conformance_tests_full_binary.csv @@ -0,0 +1,107 @@ +# +# OpenCL Conformance Test Suite (full version) +# + +# ######################################### +# Basic Information on the compute device +# ######################################### +Compute Info,computeinfo/test_computeinfo + +# ######################################### +# Basic operation tests +# ######################################### +Basic,basic/test_basic --compilation-mode binary --compilation-cache-path . +API,api/test_api --compilation-mode binary --compilation-cache-path . +Compiler,compiler/test_compiler --compilation-mode binary --compilation-cache-path . + +# ######################################### +# Common mathematical functions +# ######################################### +Common Functions,commonfns/test_commonfns --compilation-mode binary --compilation-cache-path . +Geometric Functions,geometrics/test_geometrics --compilation-mode binary --compilation-cache-path . +Relationals,relationals/test_relationals --compilation-mode binary --compilation-cache-path . + +# ######################################### +# General operation +# ######################################### +Thread Dimensions,thread_dimensions/test_thread_dimensions full* --compilation-mode binary --compilation-cache-path . +Multiple Device/Context,multiple_device_context/test_multiples --compilation-mode binary --compilation-cache-path . +Atomics,atomics/test_atomics --compilation-mode binary --compilation-cache-path . +Profiling,profiling/test_profiling --compilation-mode binary --compilation-cache-path . +Events,events/test_events --compilation-mode binary --compilation-cache-path . +Allocations (single maximum),allocations/test_allocations single 5 all --compilation-mode binary --compilation-cache-path . +Allocations (total maximum),allocations/test_allocations multiple 5 all --compilation-mode binary --compilation-cache-path . +Vectors, vectors/test_vectors --compilation-mode binary --compilation-cache-path . +Printf,printf/test_printf --compilation-mode binary --compilation-cache-path . +Device Partitioning,device_partition/test_device_partition --compilation-mode binary --compilation-cache-path . + +# ######################################### +# Buffers and images +# ######################################### +Images (API Info),images/clGetInfo/test_cl_get_info +Buffers,buffers/test_buffers --compilation-mode binary --compilation-cache-path . +Images (Kernel Methods),images/kernel_image_methods/test_kernel_image_methods --compilation-mode binary --compilation-cache-path . +Images (Kernel),images/kernel_read_write/test_image_streams CL_FILTER_NEAREST --compilation-mode binary --compilation-cache-path . +Images (Kernel pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_NEAREST --compilation-mode binary --compilation-cache-path . +Images (Kernel max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_NEAREST --compilation-mode binary --compilation-cache-path . +Images (clCopyImage),images/clCopyImage/test_cl_copy_images +Images (clCopyImage small),images/clCopyImage/test_cl_copy_images small_images +Images (clCopyImage max size),images/clCopyImage/test_cl_copy_images max_images +Images (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images +Images (clReadWriteImage pitch),images/clReadWriteImage/test_cl_read_write_images use_pitches +Images (clReadWriteImage max size),images/clReadWriteImage/test_cl_read_write_images max_images +Images (clFillImage),images/clFillImage/test_cl_fill_images +Images (clFillImage pitch),images/clFillImage/test_cl_fill_images use_pitches +Images (clFillImage max size),images/clFillImage/test_cl_fill_images max_images +Images (Samplerless),images/samplerlessReads/test_samplerless_reads --compilation-mode binary --compilation-cache-path . +Images (Samplerless pitch),images/samplerlessReads/test_samplerless_reads use_pitches --compilation-mode binary --compilation-cache-path . +Images (Samplerless max size),images/samplerlessReads/test_samplerless_reads max_images --compilation-mode binary --compilation-cache-path . +Mem (Host Flags),mem_host_flags/test_mem_host_flags + +# ######################################### +# CPU is required to pass linear and normalized image filtering +# ######################################### +CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR),images/kernel_read_write/test_image_streams CL_FILTER_LINEAR --compilation-mode binary --compilation-cache-path . +CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR pitch),images/kernel_read_write/test_image_streams use_pitches CL_FILTER_LINEAR --compilation-mode binary --compilation-cache-path . +CL_DEVICE_TYPE_CPU, Images (Kernel CL_FILTER_LINEAR max size),images/kernel_read_write/test_image_streams max_images CL_FILTER_LINEAR --compilation-mode binary --compilation-cache-path . + +# ######################################### +# OpenGL/CL interaction +# ######################################### +OpenCL-GL Sharing,gl/test_gl --compilation-mode binary --compilation-cache-path . + +# ######################################### +# Thorough math and conversions tests +# ######################################### +Select,select/test_select --compilation-mode binary --compilation-cache-path . +Conversions,conversions/test_conversions --compilation-mode binary --compilation-cache-path . +Contractions,contractions/test_contractions --compilation-mode binary --compilation-cache-path . +Math,math_brute_force/test_bruteforce --compilation-mode binary --compilation-cache-path . +Integer Ops,integer_ops/test_integer_ops --compilation-mode binary --compilation-cache-path . +Half Ops,half/test_half --compilation-mode binary --compilation-cache-path . + +##################################### +# OpenCL 2.0 tests +##################################### +C11 Atomics,c11_atomics/test_c11_atomics --compilation-mode binary --compilation-cache-path . +Execution Model,device_execution/test_device_execution --compilation-mode binary --compilation-cache-path . +Generic Address Space,generic_address_space/test_generic_address_space --compilation-mode binary --compilation-cache-path . +Non Uniform Work Groups,non_uniform_work_group/test_non_uniform_work_group --compilation-mode binary --compilation-cache-path . +Pipes,pipes/test_pipes --compilation-mode binary --compilation-cache-path . +SVM,SVM/test_svm --compilation-mode binary --compilation-cache-path . +Workgroups,workgroups/test_workgroups --compilation-mode binary --compilation-cache-path . + +##################################### +# OpenCL 2.1 tests +##################################### +Device timer,device_timer/test_device_timer +SPIRV new,spirv_new/test_spirv_new --spirv-binaries-path spirv_bin + +######################################### +# Extensions +######################################### +SPIR,spir/test_spir +Mipmaps (Kernel),images/kernel_read_write/test_image_streams test_mipmaps CL_FILTER_NEAREST --compilation-mode binary --compilation-cache-path . +Mipmaps (clCopyImage),images/clCopyImage/test_cl_copy_images test_mipmaps --compilation-mode binary --compilation-cache-path . +Mipmaps (clReadWriteImage),images/clReadWriteImage/test_cl_read_write_images test_mipmaps --compilation-mode binary --compilation-cache-path . +Subgroups,subgroups/test_subgroups --compilation-mode binary --compilation-cache-path . From 8ca1537157f6381fabb9eebb4ad5acfcb57200db Mon Sep 17 00:00:00 2001 From: julienhascoet Date: Tue, 13 Oct 2020 10:27:27 +0200 Subject: [PATCH 31/37] Fix api/test_api_min_max for Embedded profile with cles_khr_int64 support (#994) In embedded profile with cles_khr_int64 support, the test did not consider the size of long. Thus the number of argument computation was not coherent with the returned CL_DEVICE_MAX_PARAMETER_SIZE leaded to test failure. We fix this by taking the size of long when cles_khr_int64 is available in the device extension. --- test_conformance/api/test_api_min_max.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index 5f171438..cf3d26e2 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -994,6 +994,7 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_co size_t decrement; cl_event event; cl_int event_status; + bool embeddedNoLong = gIsEmbedded && !gHasLong; /* Get the max param size */ @@ -1007,8 +1008,9 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_co return -1; } - /* The embedded profile does not require longs, so use ints */ - if(gIsEmbedded) + /* The embedded profile without cles_khr_int64 extension does not require + * longs, so use ints */ + if (embeddedNoLong) numberOfIntParametersToTry = numberExpected = (maxSize-sizeof(cl_mem))/sizeof(cl_int); else numberOfIntParametersToTry = numberExpected = (maxSize-sizeof(cl_mem))/sizeof(cl_long); @@ -1024,7 +1026,7 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_co clMemWrapper mem; clKernelWrapper kernel; - if(gIsEmbedded) + if (embeddedNoLong) { log_info("Trying a kernel with %ld int arguments (%ld bytes) and one cl_mem (%ld bytes) for %ld bytes total.\n", numberOfIntParametersToTry, sizeof(cl_int)*numberOfIntParametersToTry, sizeof(cl_mem), From a6809710ea89b9082ae12a3f2056939435c5d10f Mon Sep 17 00:00:00 2001 From: ellnor01 <51320439+ellnor01@users.noreply.github.com> Date: Mon, 19 Oct 2020 13:56:02 +0100 Subject: [PATCH 32/37] Remove unnecessary cl_mem_flags casts (#1018) * api, atomics: remove unnecessary cl_mem_flags casts Instances in api, atomics, buffers and c11_atomics suites Contributes #759 Signed-off-by: Ellen Norris-Thompson * basic: remove unnecessary cl_mem_flags casts Contributes #759 Signed-off-by: Ellen Norris-Thompson * spir, thread_dimensions: remove unnecessary cl_mem_flags casts Instances in spir, thread_dimensions and workgroups tests Contributes #759 Signed-off-by: Ellen Norris-Thompson * profiling, relationals: remove unnecessary cl_mem_flags casts Includes relationals, profiling, muliple_device_context, integer_ops tests Contributes #759 Signed-off-by: Ellen Norris-Thompson * clcpp: remove unnecessary cl_mem_flags casts Contibutes #759 Signed-off-by: Ellen Norris-Thompson * events, geometrics: remove unnecessary cl_mem_flags casts Includes events, geometrics, gl and images tests Contributes #759 Signed-off-by: Ellen Norris-Thompson * commonfs, compiler: remove unnecessary cl_mem_flags casts Includes cast removal in commonfs, compiler and device_partition tests Fixes #759 Signed-off-by: Ellen Norris-Thompson * Fix up formatting Signed-off-by: Ellen Norris-Thompson --- test_conformance/api/test_api_min_max.cpp | 27 +++++++---- .../api/test_create_context_from_type.cpp | 6 ++- test_conformance/api/test_create_kernels.cpp | 3 +- .../api/test_kernel_arg_changes.cpp | 8 ++-- .../api/test_kernel_arg_multi_setup.cpp | 27 ++++++++--- test_conformance/api/test_kernels.cpp | 22 ++++----- .../test_mem_object_properties_queries.cpp | 4 +- test_conformance/api/test_retain_program.cpp | 6 ++- test_conformance/atomics/test_atomics.cpp | 8 +++- .../atomics/test_indexed_cases.cpp | 23 +++++---- test_conformance/basic/test_arraycopy.cpp | 29 +++++++----- .../basic/test_arrayimagecopy.cpp | 5 +- .../basic/test_arrayimagecopy3d.cpp | 2 +- .../basic/test_arrayreadwrite.cpp | 3 +- test_conformance/basic/test_barrier.cpp | 10 ++-- test_conformance/basic/test_constant.cpp | 9 ++-- .../basic/test_enqueued_local_size.cpp | 3 +- test_conformance/basic/test_explicit_s2v.cpp | 6 ++- test_conformance/basic/test_float2int.cpp | 6 ++- test_conformance/basic/test_fpmath_float.cpp | 8 ++-- test_conformance/basic/test_fpmath_float2.cpp | 8 ++-- test_conformance/basic/test_fpmath_float4.cpp | 8 ++-- .../basic/test_global_linear_id.cpp | 13 ++--- .../basic/test_global_work_offsets.cpp | 8 +++- test_conformance/basic/test_hostptr.cpp | 28 ++++++++--- .../basic/test_image_multipass.cpp | 8 ++-- test_conformance/basic/test_image_r8.cpp | 11 +++-- .../basic/test_imagearraycopy.cpp | 5 +- .../basic/test_imagearraycopy3d.cpp | 2 +- test_conformance/basic/test_imagecopy.cpp | 18 ++++--- test_conformance/basic/test_imagedim.cpp | 16 +++++-- test_conformance/basic/test_imagenpot.cpp | 8 ++-- .../basic/test_imagerandomcopy.cpp | 18 ++++--- .../basic/test_imagereadwrite.cpp | 9 ++-- test_conformance/basic/test_int2float.cpp | 6 ++- .../basic/test_local_linear_id.cpp | 21 +++++---- .../basic/test_multireadimagemultifmt.cpp | 13 +++-- .../basic/test_numeric_constants.cpp | 30 ++++++++---- test_conformance/basic/test_preprocessors.cpp | 9 ++-- .../basic/test_queue_priority.cpp | 16 +++---- .../basic/test_rw_image_access_qualifier.cpp | 3 +- test_conformance/basic/test_wg_barrier.cpp | 10 ++-- test_conformance/buffers/array_info.cpp | 3 +- test_conformance/buffers/test_buffer_mem.cpp | 3 +- test_conformance/buffers/test_buffer_read.cpp | 6 ++- test_conformance/c11_atomics/common.h | 18 +++++-- .../clcpp/address_spaces/common.hpp | 5 +- .../address_spaces/test_pointer_types.hpp | 3 +- test_conformance/clcpp/api/test_ctors.hpp | 12 +++-- test_conformance/clcpp/api/test_dtors.hpp | 12 +++-- .../clcpp/api/test_spec_consts.hpp | 12 +++-- .../clcpp/atomics/atomic_fetch.hpp | 6 ++- .../clcpp/math_funcs/logarithmic_funcs.hpp | 3 +- .../program_scope_ctors_dtors/common.hpp | 5 +- .../clcpp/spec_constants/common.hpp | 5 +- .../clcpp/subgroups/test_sg_all.hpp | 6 ++- .../clcpp/subgroups/test_sg_any.hpp | 6 ++- .../clcpp/subgroups/test_sg_broadcast.hpp | 6 ++- .../clcpp/subgroups/test_sg_reduce.hpp | 7 ++- .../subgroups/test_sg_scan_exclusive.hpp | 7 ++- .../subgroups/test_sg_scan_inclusive.hpp | 7 ++- .../synchronization/named_barrier/common.hpp | 3 +- .../named_barrier/test_named_barrier.hpp | 11 +++-- .../named_barrier/test_spec_example.hpp | 4 +- test_conformance/clcpp/utils_test/binary.hpp | 15 +++--- test_conformance/clcpp/utils_test/ternary.hpp | 20 ++++---- test_conformance/clcpp/utils_test/unary.hpp | 10 ++-- .../clcpp/vload_vstore/vload_funcs.hpp | 6 ++- .../clcpp/vload_vstore/vstore_funcs.hpp | 6 ++- .../clcpp/workgroups/test_wg_all.hpp | 6 ++- .../clcpp/workgroups/test_wg_any.hpp | 6 ++- .../clcpp/workgroups/test_wg_broadcast.hpp | 6 ++- .../clcpp/workgroups/test_wg_reduce.hpp | 7 ++- .../workgroups/test_wg_scan_exclusive.hpp | 7 ++- .../workgroups/test_wg_scan_inclusive.hpp | 7 ++- test_conformance/commonfns/test_binary_fn.cpp | 10 ++-- test_conformance/commonfns/test_clamp.cpp | 10 ++-- test_conformance/commonfns/test_degrees.cpp | 12 +++-- test_conformance/commonfns/test_fmax.cpp | 9 ++-- test_conformance/commonfns/test_fmaxf.cpp | 15 ++++-- test_conformance/commonfns/test_fmin.cpp | 9 ++-- test_conformance/commonfns/test_fminf.cpp | 9 ++-- test_conformance/commonfns/test_mix.cpp | 12 +++-- test_conformance/commonfns/test_radians.cpp | 12 +++-- test_conformance/commonfns/test_sign.cpp | 12 +++-- .../commonfns/test_smoothstep.cpp | 12 +++-- .../commonfns/test_smoothstepf.cpp | 12 +++-- test_conformance/commonfns/test_step.cpp | 18 ++++--- test_conformance/commonfns/test_stepf.cpp | 18 ++++--- .../compiler/test_build_options.cpp | 6 ++- .../test_device_partition.cpp | 3 +- test_conformance/events/action_classes.cpp | 6 ++- test_conformance/events/test_events.cpp | 32 +++++++++---- .../geometrics/test_geometrics.cpp | 38 ++++++++++----- .../geometrics/test_geometrics_double.cpp | 35 ++++++++++---- test_conformance/gl/test_image_methods.cpp | 3 +- .../images/kernel_image_methods/test_1D.cpp | 3 +- .../kernel_image_methods/test_1D_array.cpp | 3 +- .../images/kernel_image_methods/test_2D.cpp | 3 +- .../kernel_image_methods/test_2D_array.cpp | 3 +- .../kernel_read_write/test_iterations.cpp | 15 ++++-- .../images/kernel_read_write/test_read_1D.cpp | 9 +++- .../kernel_read_write/test_read_1D_array.cpp | 18 ++++--- .../kernel_read_write/test_read_2D_array.cpp | 21 +++++++-- .../images/kernel_read_write/test_read_3D.cpp | 27 ++++++++--- .../kernel_read_write/test_write_1D.cpp | 6 ++- .../kernel_read_write/test_write_1D_array.cpp | 6 ++- .../kernel_read_write/test_write_2D_array.cpp | 7 ++- .../kernel_read_write/test_write_3D.cpp | 7 ++- .../kernel_read_write/test_write_image.cpp | 7 ++- .../integer_ops/test_int_basic_ops.cpp | 31 ++++++++---- .../integer_ops/test_integers.cpp | 47 +++++++++++-------- .../integer_ops/test_unary_ops.cpp | 10 ++-- .../integer_ops/test_upsample.cpp | 11 +++-- .../test_multiple_devices.cpp | 2 +- test_conformance/profiling/copy.cpp | 23 +++++---- test_conformance/profiling/execute.cpp | 10 ++-- .../profiling/execute_multipass.cpp | 8 +++- test_conformance/profiling/readArray.cpp | 3 +- test_conformance/profiling/readImage.cpp | 5 +- test_conformance/profiling/writeArray.cpp | 11 +++-- test_conformance/profiling/writeImage.cpp | 5 +- .../relationals/test_comparisons_double.cpp | 8 +++- .../relationals/test_comparisons_float.cpp | 8 +++- .../relationals/test_relationals.cpp | 25 ++++++++-- .../relationals/test_shuffles.cpp | 12 +++-- test_conformance/spir/kernelargs.h | 6 +-- .../test_thread_dimensions.cpp | 3 +- test_conformance/workgroups/test_wg_all.cpp | 7 ++- test_conformance/workgroups/test_wg_any.cpp | 7 ++- .../workgroups/test_wg_broadcast.cpp | 18 ++++--- .../workgroups/test_wg_reduce.cpp | 24 ++++++---- .../workgroups/test_wg_reduce_max.cpp | 24 ++++++---- .../workgroups/test_wg_reduce_min.cpp | 24 ++++++---- .../workgroups/test_wg_scan_exclusive_add.cpp | 24 ++++++---- .../workgroups/test_wg_scan_exclusive_max.cpp | 24 ++++++---- .../workgroups/test_wg_scan_exclusive_min.cpp | 24 ++++++---- .../workgroups/test_wg_scan_inclusive_add.cpp | 24 ++++++---- .../workgroups/test_wg_scan_inclusive_max.cpp | 24 ++++++---- .../workgroups/test_wg_scan_inclusive_min.cpp | 24 ++++++---- 140 files changed, 1077 insertions(+), 556 deletions(-) diff --git a/test_conformance/api/test_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index cf3d26e2..9ac4aae3 100644 --- a/test_conformance/api/test_api_min_max.cpp +++ b/test_conformance/api/test_api_min_max.cpp @@ -136,7 +136,8 @@ int test_min_max_thread_dimensions(cl_device_id deviceID, cl_context context, cl } /* Create some I/O streams */ - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * 100, NULL, &error ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * 100, NULL, &error); if( streams[0] == NULL ) { log_error("ERROR: Creating test array failed!\n"); @@ -321,7 +322,8 @@ int test_min_max_read_image_args(cl_device_id deviceID, cl_context context, cl_c test_error( error, "Failed to create the program and kernel."); free( programSrc ); - result = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float), NULL, &error); + result = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_float), NULL, + &error); test_error( error, "clCreateBufer failed"); /* Create some I/O streams */ @@ -1097,7 +1099,8 @@ int test_min_max_parameter_size(cl_device_id deviceID, cl_context context, cl_co /* Try to set a large argument to the kernel */ retVal = 0; - mem = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long), NULL, &error); + mem = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_long), NULL, + &error); test_error(error, "clCreateBuffer failed"); for (i=0; i<(int)numberOfIntParametersToTry; i++) { @@ -1251,7 +1254,8 @@ int test_min_max_samplers(cl_device_id deviceID, cl_context context, cl_command_ clMemWrapper image = create_image_2d( context, CL_MEM_READ_WRITE, &format, 16, 16, 0, NULL, &error ); test_error( error, "Unable to create a test image" ); - clMemWrapper stream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), 16, NULL, &error ); + clMemWrapper stream = + clCreateBuffer(context, CL_MEM_READ_WRITE, 16, NULL, &error); test_error( error, "Unable to create test buffer" ); error = clSetKernelArg( kernel, 0, sizeof( cl_mem ), &image ); @@ -1352,9 +1356,11 @@ int test_min_max_constant_buffer_size(cl_device_id deviceID, cl_context context, constantData[i] = (int)genrand_int32(d); clMemWrapper streams[3]; - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeToAllocate, constantData, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeToAllocate, constantData, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeToAllocate, NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeToAllocate, + NULL, &error); test_error( error, "Creating test array failed" ); @@ -1518,7 +1524,8 @@ int test_min_max_constant_args(cl_device_id deviceID, cl_context context, cl_com streams = new clMemWrapper[ maxArgs + 1 ]; for( i = 0; i < maxArgs + 1; i++ ) { - streams[i] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), individualBufferSize, NULL, &error); + streams[i] = clCreateBuffer(context, CL_MEM_READ_WRITE, + individualBufferSize, NULL, &error); test_error( error, "Creating test array failed" ); } @@ -1726,9 +1733,11 @@ int test_min_max_local_mem_size(cl_device_id deviceID, cl_context context, cl_co localData[i] = (int)genrand_int32(d); free_mtdata(d); d = NULL; - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeToAllocate, localData, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeToAllocate, + localData, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeToAllocate, NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeToAllocate, + NULL, &error); test_error( error, "Creating test array failed" ); diff --git a/test_conformance/api/test_create_context_from_type.cpp b/test_conformance/api/test_create_context_from_type.cpp index bbc2c866..b67041ff 100644 --- a/test_conformance/api/test_create_context_from_type.cpp +++ b/test_conformance/api/test_create_context_from_type.cpp @@ -80,9 +80,11 @@ int test_create_context_from_type(cl_device_id deviceID, cl_context context, cl_ } /* Create some I/O streams */ - streams[0] = clCreateBuffer(context_to_test, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 10, NULL, &error); + streams[0] = clCreateBuffer(context_to_test, CL_MEM_READ_WRITE, + sizeof(cl_float) * 10, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context_to_test, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * 10, NULL, &error); + streams[1] = clCreateBuffer(context_to_test, CL_MEM_READ_WRITE, + sizeof(cl_int) * 10, NULL, &error); test_error( error, "Creating test array failed" ); /* Write some test data */ diff --git a/test_conformance/api/test_create_kernels.cpp b/test_conformance/api/test_create_kernels.cpp index 59f7f0aa..79e01fdb 100644 --- a/test_conformance/api/test_create_kernels.cpp +++ b/test_conformance/api/test_create_kernels.cpp @@ -456,7 +456,8 @@ int test_enqueue_task(cl_device_id deviceID, cl_context context, cl_command_queu // Create args count = 100; - output = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( cl_int ) * count, NULL, &error ); + output = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * count, + NULL, &error); test_error( error, "Unable to create output buffer" ); error = clSetKernelArg( kernel, 0, sizeof( cl_mem ), &output ); diff --git a/test_conformance/api/test_kernel_arg_changes.cpp b/test_conformance/api/test_kernel_arg_changes.cpp index d85ae99b..eb798a90 100644 --- a/test_conformance/api/test_kernel_arg_changes.cpp +++ b/test_conformance/api/test_kernel_arg_changes.cpp @@ -74,14 +74,16 @@ int test_kernel_arg_changes(cl_device_id device, cl_context context, cl_command_ sizes[ i ][ 0 ] = genrand_int32(seed) % (maxWidth/32) + 1; sizes[ i ][ 1 ] = genrand_int32(seed) % (maxHeight/32) + 1; - images[ i ] = create_image_2d( context, (cl_mem_flags)(CL_MEM_READ_ONLY), - &imageFormat, sizes[ i ][ 0], sizes[ i ][ 1 ], 0, NULL, &error ); + images[i] = create_image_2d(context, CL_MEM_READ_ONLY, &imageFormat, + sizes[i][0], sizes[i][1], 0, NULL, &error); if( images[i] == NULL ) { log_error("Failed to create image %d of size %d x %d (%s).\n", i, (int)sizes[i][0], (int)sizes[i][1], IGetErrorString( error )); return -1; } - results[ i ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( cl_int ) * threads[0] * 2, NULL, &error ); + results[i] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * threads[0] * 2, NULL, &error); if( results[i] == NULL) { log_error("Failed to create array %d of size %d.\n", i, (int)threads[0]*2); diff --git a/test_conformance/api/test_kernel_arg_multi_setup.cpp b/test_conformance/api/test_kernel_arg_multi_setup.cpp index 92c039e1..de3dc15e 100644 --- a/test_conformance/api/test_kernel_arg_multi_setup.cpp +++ b/test_conformance/api/test_kernel_arg_multi_setup.cpp @@ -66,24 +66,39 @@ int test_multi_arg_set(cl_device_id device, cl_context context, cl_command_queue // Create input streams initData[ 0 ] = create_random_data( vec1Type, d, (unsigned int)threads[ 0 ] * vec1Size ); - streams[ 0 ] = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), get_explicit_type_size( vec1Type ) * threads[0] * vec1Size, initData[ 0 ], &error ); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vec1Type) * threads[0] * vec1Size, + initData[0], &error); test_error( error, "Unable to create testing stream" ); initData[ 1 ] = create_random_data( vec2Type, d, (unsigned int)threads[ 0 ] * vec2Size ); - streams[ 1 ] = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), get_explicit_type_size( vec2Type ) * threads[0] * vec2Size, initData[ 1 ], &error ); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vec2Type) * threads[0] * vec2Size, + initData[1], &error); test_error( error, "Unable to create testing stream" ); initData[ 2 ] = create_random_data( vec3Type, d, (unsigned int)threads[ 0 ] * vec3Size ); - streams[ 2 ] = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), get_explicit_type_size( vec3Type ) * threads[0] * vec3Size, initData[ 2 ], &error ); + streams[2] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vec3Type) * threads[0] * vec3Size, + initData[2], &error); test_error( error, "Unable to create testing stream" ); - streams[ 3 ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( vec1Type ) * threads[0] * vec1Size, NULL, &error ); + streams[3] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + get_explicit_type_size(vec1Type) * threads[0] * vec1Size, NULL, &error); test_error( error, "Unable to create testing stream" ); - streams[ 4 ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( vec2Type ) * threads[0] * vec2Size, NULL, &error ); + streams[4] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + get_explicit_type_size(vec2Type) * threads[0] * vec2Size, NULL, &error); test_error( error, "Unable to create testing stream" ); - streams[ 5 ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( vec3Type ) * threads[0] * vec3Size, NULL, &error ); + streams[5] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + get_explicit_type_size(vec3Type) * threads[0] * vec3Size, NULL, &error); test_error( error, "Unable to create testing stream" ); // Set the arguments diff --git a/test_conformance/api/test_kernels.cpp b/test_conformance/api/test_kernels.cpp index 993a72fb..d25410ba 100644 --- a/test_conformance/api/test_kernels.cpp +++ b/test_conformance/api/test_kernels.cpp @@ -192,10 +192,10 @@ int test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, c } /* Create some I/O streams */ - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_float) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); @@ -323,10 +323,10 @@ int test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_c } /* Create some I/O streams */ - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_float) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); @@ -412,15 +412,15 @@ int test_set_kernel_arg_constant(cl_device_id deviceID, cl_context context, cl_c } free_mtdata(d); d = NULL; - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof(cl_int) * num_elements, randomTestDataA.data(), &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof(cl_int) * num_elements, randomTestDataB.data(), &error); test_error( error, "Creating test array failed" ); - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); @@ -496,11 +496,11 @@ int test_set_kernel_arg_struct_array(cl_device_id deviceID, cl_context context, } free_mtdata(d); d = NULL; - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof(image_pair_t) * num_elements, (void *)image_pair.data(), &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); @@ -593,11 +593,11 @@ int test_kernel_global_constant(cl_device_id deviceID, cl_context context, cl_co } free_mtdata(d); d = NULL; - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof(cl_int) * num_elements, randomTestDataA.data(), &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &error); test_error( error, "Creating test array failed" ); diff --git a/test_conformance/api/test_mem_object_properties_queries.cpp b/test_conformance/api/test_mem_object_properties_queries.cpp index 2360d83e..55300a62 100644 --- a/test_conformance/api/test_mem_object_properties_queries.cpp +++ b/test_conformance/api/test_mem_object_properties_queries.cpp @@ -208,12 +208,12 @@ static int run_test_query_properties(cl_context context, cl_command_queue queue, free_mtdata(init_generator); init_generator = NULL; - flags = (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR); + flags = CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR; error = create_object_and_check_properties(context, obj_src, test_case, flags, src_data, size_x, size_y); test_error(error, "create_object_and_check_properties obj_src failed."); - flags = (cl_mem_flags)(CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR); + flags = CL_MEM_WRITE_ONLY | CL_MEM_COPY_HOST_PTR; error = create_object_and_check_properties(context, obj_dst, test_case, flags, dst_data, size_x, size_y); test_error(error, "create_object_and_check_properties obj_dst failed."); diff --git a/test_conformance/api/test_retain_program.cpp b/test_conformance/api/test_retain_program.cpp index a85bc704..aa9c8b36 100644 --- a/test_conformance/api/test_retain_program.cpp +++ b/test_conformance/api/test_retain_program.cpp @@ -68,9 +68,11 @@ int test_release_during_execute( cl_device_id deviceID, cl_context context, cl_c return -1; } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 10, NULL, &error); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 10, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * 10, NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * 10, + NULL, &error); test_error( error, "Creating test array failed" ); /* Set the arguments */ diff --git a/test_conformance/atomics/test_atomics.cpp b/test_conformance/atomics/test_atomics.cpp index 24bf974a..5f4c0943 100644 --- a/test_conformance/atomics/test_atomics.cpp +++ b/test_conformance/atomics/test_atomics.cpp @@ -243,13 +243,17 @@ int test_atomic_function(cl_device_id deviceID, cl_context context, cl_command_q for( size_t i = 0; i < numDestItems; i++ ) memcpy( destItems + i * typeSize, startValue, typeSize ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * numDestItems, destItems, NULL); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + typeSize * numDestItems, destItems, NULL); if (!streams[0]) { log_error("ERROR: Creating output array failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(( startRefValues != NULL ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE )), typeSize * threadSize, startRefValues, NULL); + streams[1] = clCreateBuffer( + context, + ((startRefValues != NULL ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE)), + typeSize * threadSize, startRefValues, NULL); if (!streams[1]) { log_error("ERROR: Creating reference array failed!\n"); diff --git a/test_conformance/atomics/test_indexed_cases.cpp b/test_conformance/atomics/test_indexed_cases.cpp index 9a27d076..b85e3d24 100644 --- a/test_conformance/atomics/test_indexed_cases.cpp +++ b/test_conformance/atomics/test_indexed_cases.cpp @@ -64,12 +64,12 @@ int test_atomic_add_index(cl_device_id deviceID, cl_context context, cl_command_ (int)numGlobalThreads, (int)numLocalThreads); // Create the counter that will keep track of where each thread writes. - counter = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), - sizeof(cl_int) * 1, NULL, NULL); + counter = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * 1, + NULL, NULL); // Create the counters that will hold the results of each thread writing // its ID into a (hopefully) unique location. - counters = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), - sizeof(cl_int) * numGlobalThreads, NULL, NULL); + counters = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * numGlobalThreads, NULL, NULL); // Reset all those locations to -1 to indciate they have not been used. cl_int *values = (cl_int*) malloc(sizeof(cl_int)*numGlobalThreads); @@ -175,12 +175,15 @@ int add_index_bin_test(size_t *global_threads, cl_command_queue queue, cl_contex (int)global_threads[0], (int)local_threads[0]); // Allocate our storage - cl_mem bin_counters = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), - sizeof(cl_int) * number_of_bins, NULL, NULL); - cl_mem bins = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), - sizeof(cl_int) * number_of_bins*max_counts_per_bin, NULL, NULL); - cl_mem bin_assignments = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_ONLY), - sizeof(cl_int) * number_of_items, NULL, NULL); + cl_mem bin_counters = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * number_of_bins, NULL, NULL); + cl_mem bins = clCreateBuffer( + context, CL_MEM_READ_WRITE, + sizeof(cl_int) * number_of_bins * max_counts_per_bin, NULL, NULL); + cl_mem bin_assignments = + clCreateBuffer(context, CL_MEM_READ_ONLY, + sizeof(cl_int) * number_of_items, NULL, NULL); if (bin_counters == NULL) { log_error("add_index_bin_test FAILED to allocate bin_counters.\n"); diff --git a/test_conformance/basic/test_arraycopy.cpp b/test_conformance/basic/test_arraycopy.cpp index e0cb565f..5a352869 100644 --- a/test_conformance/basic/test_arraycopy.cpp +++ b/test_conformance/basic/test_arraycopy.cpp @@ -51,7 +51,8 @@ test_arraycopy(cl_device_id device, cl_context context, cl_command_queue queue, output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); // results - results = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, &err); + results = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, &err); test_error(err, "clCreateBuffer failed"); /*****************************************************************************************************************************************/ @@ -64,7 +65,9 @@ test_arraycopy(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr[i] = (cl_uint)(genrand_int32(d) & 0x7FFFFFFF); // client backing - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_USE_HOST_PTR), sizeof(cl_uint) * num_elements, input_ptr, &err); + streams[0] = + clCreateBuffer(context, CL_MEM_USE_HOST_PTR, + sizeof(cl_uint) * num_elements, input_ptr, &err); test_error(err, "clCreateBuffer failed"); delta_offset = num_elements * sizeof(cl_uint) / num_copies; @@ -103,7 +106,8 @@ test_arraycopy(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr[i] = (cl_uint)(genrand_int32(d) & 0x7FFFFFFF); // no backing - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE) , sizeof(cl_uint) * num_elements, NULL, &err); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, &err); test_error(err, "clCreateBuffer failed"); for (i=0; iimage_channel_order), GetChannelTypeName(format->image_channel_data_type)); - image = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), format, img_width, img_height, 0, NULL, &err); + image = create_image_2d(context, CL_MEM_READ_WRITE, format, img_width, + img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); err = clGetImageInfo(image, CL_IMAGE_ELEMENT_SIZE, sizeof(size_t), &elem_size, NULL); @@ -46,7 +47,7 @@ int test_arrayimagecopy_single_format(cl_device_id device, cl_context context, c buffer_size = sizeof(cl_uchar) * elem_size * img_width * img_height; - buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), buffer_size, NULL, &err); + buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, buffer_size, NULL, &err); test_error(err, "clCreateBuffer failed"); d = init_genrand( gRandomSeed ); diff --git a/test_conformance/basic/test_arrayimagecopy3d.cpp b/test_conformance/basic/test_arrayimagecopy3d.cpp index 0d6a5245..1b08ec92 100644 --- a/test_conformance/basic/test_arrayimagecopy3d.cpp +++ b/test_conformance/basic/test_arrayimagecopy3d.cpp @@ -48,7 +48,7 @@ int test_arrayimagecopy3d_single_format(cl_device_id device, cl_context context, 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); + buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, buffer_size, NULL, &err); test_error(err, "clCreateBuffer failed"); d = init_genrand( gRandomSeed ); diff --git a/test_conformance/basic/test_arrayreadwrite.cpp b/test_conformance/basic/test_arrayreadwrite.cpp index 68664398..25e8ed99 100644 --- a/test_conformance/basic/test_arrayreadwrite.cpp +++ b/test_conformance/basic/test_arrayreadwrite.cpp @@ -43,7 +43,8 @@ test_arrayreadwrite(cl_device_id device, cl_context context, cl_command_queue qu for (i=0; iimage_channel_order), GetChannelTypeName(format->image_channel_data_type)); - image = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), format, img_width, img_height, 0, NULL, &err); + image = create_image_2d(context, CL_MEM_READ_WRITE, format, img_width, + img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); err = clGetImageInfo(image, CL_IMAGE_ELEMENT_SIZE, sizeof(size_t), &elem_size, NULL); @@ -46,7 +47,7 @@ int test_imagearraycopy_single_format(cl_device_id device, cl_context context, c buffer_size = sizeof(cl_uchar) * elem_size * img_width * img_height; - buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), buffer_size, NULL, &err); + buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, buffer_size, NULL, &err); test_error(err, "clCreateBuffer failed"); d = init_genrand( gRandomSeed ); diff --git a/test_conformance/basic/test_imagearraycopy3d.cpp b/test_conformance/basic/test_imagearraycopy3d.cpp index 91ef1fcc..19dfdbc7 100644 --- a/test_conformance/basic/test_imagearraycopy3d.cpp +++ b/test_conformance/basic/test_imagearraycopy3d.cpp @@ -47,7 +47,7 @@ int test_imagearraycopy3d_single_format(cl_device_id device, cl_context context, 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); + buffer = clCreateBuffer(context, CL_MEM_READ_WRITE, buffer_size, NULL, &err); test_error(err, "clCreateBuffer failed"); d = init_genrand( gRandomSeed ); diff --git a/test_conformance/basic/test_imagecopy.cpp b/test_conformance/basic/test_imagecopy.cpp index e74827d2..bcb9fef9 100644 --- a/test_conformance/basic/test_imagecopy.cpp +++ b/test_conformance/basic/test_imagecopy.cpp @@ -132,23 +132,29 @@ test_imagecopy(cl_device_id device, cl_context context, cl_command_queue queue, img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[0] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[1] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT16; - streams[2] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[2] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[3] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[3] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_FLOAT; - streams[4] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[4] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[5] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[5] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); for (i=0; i<3; i++) diff --git a/test_conformance/basic/test_imagedim.cpp b/test_conformance/basic/test_imagedim.cpp index 6d8cdb36..6064655f 100644 --- a/test_conformance/basic/test_imagedim.cpp +++ b/test_conformance/basic/test_imagedim.cpp @@ -163,7 +163,9 @@ test_imagedim_pow2(cl_device_id device, cl_context context, cl_command_queue que img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, NULL); + streams[0] = + create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[0]) { log_error("create_image_2d failed. width = %d, height = %d\n", img_width, img_height); @@ -174,7 +176,9 @@ test_imagedim_pow2(cl_device_id device, cl_context context, cl_command_queue que } img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, NULL); + streams[1] = + create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[1]) { log_error("create_image_2d failed. width = %d, height = %d\n", img_width, img_height); @@ -404,7 +408,9 @@ test_imagedim_non_pow2(cl_device_id device, cl_context context, cl_command_queue img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, effective_img_width, effective_img_height, 0, NULL, NULL); + streams[0] = create_image_2d( + context, CL_MEM_READ_WRITE, &img_format, + effective_img_width, effective_img_height, 0, NULL, NULL); if (!streams[0]) { log_error("create_image_2d failed. width = %d, height = %d\n", effective_img_width, effective_img_height); @@ -415,7 +421,9 @@ test_imagedim_non_pow2(cl_device_id device, cl_context context, cl_command_queue } img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, effective_img_width, effective_img_height, 0, NULL, NULL); + streams[1] = create_image_2d( + context, CL_MEM_READ_WRITE, &img_format, + effective_img_width, effective_img_height, 0, NULL, NULL); if (!streams[1]) { log_error("create_image_2d failed. width = %d, height = %d\n", effective_img_width, effective_img_height); diff --git a/test_conformance/basic/test_imagenpot.cpp b/test_conformance/basic/test_imagenpot.cpp index 4713c30e..baa5b2e4 100644 --- a/test_conformance/basic/test_imagenpot.cpp +++ b/test_conformance/basic/test_imagenpot.cpp @@ -110,8 +110,8 @@ test_imagenpot(cl_device_id device_id, cl_context context, cl_command_queue queu img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, - img_width, img_height, 0, NULL, NULL); + streams[0] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[0]) { log_error("create_image_2d failed\n"); @@ -120,8 +120,8 @@ test_imagenpot(cl_device_id device_id, cl_context context, cl_command_queue queu } img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, - img_width, img_height, 0, NULL, NULL); + streams[1] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[1]) { log_error("create_image_2d failed\n"); diff --git a/test_conformance/basic/test_imagerandomcopy.cpp b/test_conformance/basic/test_imagerandomcopy.cpp index 494d6c25..c3355de3 100644 --- a/test_conformance/basic/test_imagerandomcopy.cpp +++ b/test_conformance/basic/test_imagerandomcopy.cpp @@ -146,23 +146,29 @@ test_imagerandomcopy(cl_device_id device, cl_context context, cl_command_queue q img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[0] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[1] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT16; - streams[2] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[2] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[3] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[3] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_FLOAT; - streams[4] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[4] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); - streams[5] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[5] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); for (i=0; i<3; i++) diff --git a/test_conformance/basic/test_imagereadwrite.cpp b/test_conformance/basic/test_imagereadwrite.cpp index dd1923eb..c074238d 100644 --- a/test_conformance/basic/test_imagereadwrite.cpp +++ b/test_conformance/basic/test_imagereadwrite.cpp @@ -215,17 +215,20 @@ test_imagereadwrite(cl_device_id device, cl_context context, cl_command_queue qu img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[0] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT16; - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[1] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_FLOAT; - streams[2] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, &err); + streams[2] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, &err); test_error(err, "create_image_2d failed"); for (i=0; i<3; i++) diff --git a/test_conformance/basic/test_int2float.cpp b/test_conformance/basic/test_int2float.cpp index d298dc7f..483698a2 100644 --- a/test_conformance/basic/test_int2float.cpp +++ b/test_conformance/basic/test_int2float.cpp @@ -68,13 +68,15 @@ test_int2float(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/basic/test_local_linear_id.cpp b/test_conformance/basic/test_local_linear_id.cpp index da6af0d7..279bd713 100644 --- a/test_conformance/basic/test_local_linear_id.cpp +++ b/test_conformance/basic/test_local_linear_id.cpp @@ -66,20 +66,21 @@ verify_local_linear_id(int *result, int n) int test_local_linear_id(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) { - cl_mem streams; - cl_program program[2]; - cl_kernel kernel[2]; + cl_mem streams; + cl_program program[2]; + cl_kernel kernel[2]; int *output_ptr; - size_t threads[2]; - int err; - num_elements = (int)sqrt((float)num_elements); - int length = num_elements * num_elements; + size_t threads[2]; + int err; + num_elements = (int)sqrt((float)num_elements); + int length = num_elements * num_elements; - output_ptr = (cl_int*)malloc(sizeof(int) * length); + output_ptr = (cl_int *)malloc(sizeof(int) * length); - streams = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), length*sizeof(int), NULL, &err); - test_error( err, "clCreateBuffer failed."); + streams = clCreateBuffer(context, CL_MEM_READ_WRITE, length * sizeof(int), + NULL, &err); + test_error(err, "clCreateBuffer failed."); err = create_single_kernel_helper(context, &program[0], &kernel[0], 1, &local_linear_id_1d_code, diff --git a/test_conformance/basic/test_multireadimagemultifmt.cpp b/test_conformance/basic/test_multireadimagemultifmt.cpp index 5c93d2fc..7fe58d3c 100644 --- a/test_conformance/basic/test_multireadimagemultifmt.cpp +++ b/test_conformance/basic/test_multireadimagemultifmt.cpp @@ -136,7 +136,8 @@ test_mri_multiple(cl_device_id device, cl_context context, cl_command_queue queu img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT8; - streams[0] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, NULL); + streams[0] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[0]) { log_error("create_image_2d failed\n"); @@ -144,7 +145,8 @@ test_mri_multiple(cl_device_id device, cl_context context, cl_command_queue queu } img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_UNORM_INT16; - streams[1] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, NULL); + streams[1] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[1]) { log_error("create_image_2d failed\n"); @@ -152,14 +154,17 @@ test_mri_multiple(cl_device_id device, cl_context context, cl_command_queue queu } img_format.image_channel_order = CL_RGBA; img_format.image_channel_data_type = CL_FLOAT; - streams[2] = create_image_2d(context, (cl_mem_flags)(CL_MEM_READ_WRITE), &img_format, img_width, img_height, 0, NULL, NULL); + streams[2] = create_image_2d(context, CL_MEM_READ_WRITE, &img_format, + img_width, img_height, 0, NULL, NULL); if (!streams[2]) { log_error("create_image_2d failed\n"); return -1; } - streams[3] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(float)*4 * img_width*img_height, NULL, NULL); + streams[3] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(float) * 4 * img_width * img_height, NULL, NULL); if (!streams[3]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/basic/test_numeric_constants.cpp b/test_conformance/basic/test_numeric_constants.cpp index 5aeca0ed..83687ee3 100644 --- a/test_conformance/basic/test_numeric_constants.cpp +++ b/test_conformance/basic/test_numeric_constants.cpp @@ -242,11 +242,14 @@ int test_kernel_numeric_constants(cl_device_id deviceID, cl_context context, cl_ } /* Create some I/O streams */ - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(float_out), NULL, &error); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(float_out), + NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(int_out), NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(int_out), + NULL, &error); test_error( error, "Creating test array failed" ); - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(uint_out), NULL, &error); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(uint_out), + NULL, &error); test_error( error, "Creating test array failed" ); error = clSetKernelArg(kernel, 1, sizeof( streams[1] ), &streams[1]); @@ -348,9 +351,11 @@ int test_kernel_numeric_constants(cl_device_id deviceID, cl_context context, cl_ return -1; } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(long_out), NULL, &error); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(long_out), NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(ulong_out), NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(ulong_out), NULL, &error); test_error( error, "Creating test array failed" ); error = clSetKernelArg(kernel, 1, sizeof( streams[1] ), &streams[1]); @@ -389,9 +394,11 @@ int test_kernel_numeric_constants(cl_device_id deviceID, cl_context context, cl_ return -1; } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(double_out), NULL, &error); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(double_out), NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(long_out), NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(long_out), NULL, &error); test_error( error, "Creating test array failed" ); error = clSetKernelArg(kernel, 1, sizeof( streams[1] ), &streams[1]); @@ -533,9 +540,11 @@ int test_kernel_limit_constants(cl_device_id deviceID, cl_context context, cl_co /* Create some I/O streams */ - intStream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(intOut), NULL, &error ); + intStream = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(intOut), NULL, + &error); test_error( error, "Creating test array failed" ); - floatStream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(floatOut), NULL, &error ); + floatStream = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(floatOut), + NULL, &error); test_error( error, "Creating test array failed" ); // Stage 1: basic limits on MAXFLOAT @@ -677,7 +686,8 @@ int test_kernel_limit_constants(cl_device_id deviceID, cl_context context, cl_co return -1; } - doubleStream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(doubleOut), NULL, &error ); + doubleStream = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(doubleOut), NULL, &error); test_error( error, "Creating test array failed" ); error = clSetKernelArg( kernel, 0, sizeof( intStream ), &intStream ); diff --git a/test_conformance/basic/test_preprocessors.cpp b/test_conformance/basic/test_preprocessors.cpp index 73f75fb0..2038d150 100644 --- a/test_conformance/basic/test_preprocessors.cpp +++ b/test_conformance/basic/test_preprocessors.cpp @@ -125,11 +125,14 @@ int test_kernel_preprocessor_macros(cl_device_id deviceID, cl_context context, c } /* Create some I/O streams */ - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(results), NULL, &error); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(results), + NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(fileString), NULL, &error); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(fileString), + NULL, &error); test_error( error, "Creating test array failed" ); - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(roundingString), NULL, &error); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(roundingString), NULL, &error); test_error( error, "Creating test array failed" ); // Set up and run diff --git a/test_conformance/basic/test_queue_priority.cpp b/test_conformance/basic/test_queue_priority.cpp index 831defe7..57ce5041 100644 --- a/test_conformance/basic/test_queue_priority.cpp +++ b/test_conformance/basic/test_queue_priority.cpp @@ -235,18 +235,18 @@ int test_queue_priority(cl_device_id device, cl_context context, cl_command_queu oldMode = get_round(); } - input_ptr[0] = (cl_float*)malloc(length); - input_ptr[1] = (cl_float*)malloc(length); - input_ptr[2] = (cl_float*)malloc(length); - output_ptr = (cl_float*)malloc(length); + input_ptr[0] = (cl_float *)malloc(length); + input_ptr[1] = (cl_float *)malloc(length); + input_ptr[2] = (cl_float *)malloc(length); + output_ptr = (cl_float *)malloc(length); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), length, NULL, &err); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, &err); test_error( err, "clCreateBuffer failed."); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), length, NULL, &err); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, &err); test_error( err, "clCreateBuffer failed."); - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), length, NULL, &err); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, &err); test_error( err, "clCreateBuffer failed."); - streams[3] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), length, NULL, &err); + streams[3] = clCreateBuffer(context, CL_MEM_READ_WRITE, length, NULL, &err); test_error( err, "clCreateBuffer failed."); p = input_ptr[0]; diff --git a/test_conformance/basic/test_rw_image_access_qualifier.cpp b/test_conformance/basic/test_rw_image_access_qualifier.cpp index c841a1dd..ffb8fe15 100644 --- a/test_conformance/basic/test_rw_image_access_qualifier.cpp +++ b/test_conformance/basic/test_rw_image_access_qualifier.cpp @@ -121,8 +121,7 @@ int test_rw_image_access_qualifier(cl_device_id device_id, cl_context context, c format.image_channel_data_type = CL_UNSIGNED_INT32; /* Create input image */ - flags = (cl_mem_flags) (CL_MEM_READ_WRITE - | CL_MEM_COPY_HOST_PTR); + flags = CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR; src_image = create_image_2d(context, flags, &format, size_x, size_y, 0, (void *)input, &err); diff --git a/test_conformance/basic/test_wg_barrier.cpp b/test_conformance/basic/test_wg_barrier.cpp index e89f4db5..a237d80b 100644 --- a/test_conformance/basic/test_wg_barrier.cpp +++ b/test_conformance/basic/test_wg_barrier.cpp @@ -110,11 +110,15 @@ test_wg_barrier(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr = (int*)malloc(sizeof(int) * num_elements); output_ptr = (int*)malloc(sizeof(int)); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, &err); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, &err); test_error(err, "clCreateBuffer failed."); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int), NULL, &err); + streams[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int), NULL, &err); test_error(err, "clCreateBuffer failed."); - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * max_threadgroup_size, NULL, &err); + streams[2] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * max_threadgroup_size, NULL, &err); test_error(err, "clCreateBuffer failed."); d = init_genrand( gRandomSeed ); diff --git a/test_conformance/buffers/array_info.cpp b/test_conformance/buffers/array_info.cpp index be33c007..f143cf37 100644 --- a/test_conformance/buffers/array_info.cpp +++ b/test_conformance/buffers/array_info.cpp @@ -33,7 +33,8 @@ int test_array_info_size( cl_device_id deviceID, cl_context context, cl_command_ size_t retSize; size_t elementSize = sizeof( cl_int ); - memobj = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), elementSize * w*h*d, NULL, &err); + memobj = clCreateBuffer(context, CL_MEM_READ_WRITE, elementSize * w * h * d, + NULL, &err); test_error(err, "clCreateBuffer failed."); err = clGetMemObjectInfo(memobj, CL_MEM_SIZE, sizeof( size_t ), (void *)&retSize, NULL); diff --git a/test_conformance/buffers/test_buffer_mem.cpp b/test_conformance/buffers/test_buffer_mem.cpp index a471c0f7..4671f1a8 100644 --- a/test_conformance/buffers/test_buffer_mem.cpp +++ b/test_conformance/buffers/test_buffer_mem.cpp @@ -328,7 +328,8 @@ int test_mem_read_only_flags( cl_device_id deviceID, cl_context context, cl_comm for (i=0; i::ExecuteSingleTest(cl_device_id dev return -1; } memcpy(svmAtomicBuffer, &destItems[0], typeSize * numDestItems); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_USE_HOST_PTR), typeSize * numDestItems, svmAtomicBuffer, NULL); + streams[0] = clCreateBuffer(context, CL_MEM_USE_HOST_PTR, + typeSize * numDestItems, svmAtomicBuffer, NULL); } else { - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * numDestItems, &destItems[0], NULL); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + typeSize * numDestItems, &destItems[0], NULL); } if (!streams[0]) { @@ -1102,12 +1104,18 @@ int CBasicTest::ExecuteSingleTest(cl_device_id dev } if(startRefValues.size()) memcpy(svmDataBuffer, &startRefValues[0], typeSize*threadCount*NumNonAtomicVariablesPerThread()); - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_USE_HOST_PTR), typeSize*threadCount*NumNonAtomicVariablesPerThread(), svmDataBuffer, NULL); + streams[1] = clCreateBuffer(context, CL_MEM_USE_HOST_PTR, + typeSize * threadCount + * NumNonAtomicVariablesPerThread(), + svmDataBuffer, NULL); } else { - streams[1] = clCreateBuffer(context, (cl_mem_flags)((startRefValues.size() ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE)), - typeSize * threadCount*NumNonAtomicVariablesPerThread(), startRefValues.size() ? &startRefValues[0] : 0, NULL); + streams[1] = clCreateBuffer( + context, + ((startRefValues.size() ? CL_MEM_COPY_HOST_PTR : CL_MEM_READ_WRITE)), + typeSize * threadCount * NumNonAtomicVariablesPerThread(), + startRefValues.size() ? &startRefValues[0] : 0, NULL); } if (!streams[1]) { diff --git a/test_conformance/clcpp/address_spaces/common.hpp b/test_conformance/clcpp/address_spaces/common.hpp index 47b78ea9..fad7ba96 100644 --- a/test_conformance/clcpp/address_spaces/common.hpp +++ b/test_conformance/clcpp/address_spaces/common.hpp @@ -165,9 +165,8 @@ int run_address_spaces_test(cl_device_id device, cl_context context, cl_command_ std::vector output = generate_output(work_size[0], 9999); // output buffer - buffers[0] = clCreateBuffer - (context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(TYPE) * output.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") // Execute test diff --git a/test_conformance/clcpp/address_spaces/test_pointer_types.hpp b/test_conformance/clcpp/address_spaces/test_pointer_types.hpp index edc50b6f..af228d0d 100644 --- a/test_conformance/clcpp/address_spaces/test_pointer_types.hpp +++ b/test_conformance/clcpp/address_spaces/test_pointer_types.hpp @@ -357,7 +357,8 @@ struct constant_pointer_test : public address_spaces_test RETURN_ON_CL_ERROR(err, "clGetCommandQueueInfo"); // Create constant buffer - auto const_buff = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_ONLY), sizeof(cl_uint), NULL, &err); + auto const_buff = clCreateBuffer(context, CL_MEM_READ_ONLY, + sizeof(cl_uint), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); // Write m_test_value to const_buff diff --git a/test_conformance/clcpp/api/test_ctors.hpp b/test_conformance/clcpp/api/test_ctors.hpp index 8cdfc6ea..ae0695ca 100644 --- a/test_conformance/clcpp/api/test_ctors.hpp +++ b/test_conformance/clcpp/api/test_ctors.hpp @@ -128,7 +128,9 @@ int test_ctors_execution(cl_device_id device, // host vector, size == count, output[0...count-1] == 1 std::vector output(count, cl_uint(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer(queue, output_buffer, CL_TRUE, 0, sizeof(cl_uint) * output.size(), static_cast(output.data()), 0, NULL, NULL); @@ -298,7 +300,9 @@ AUTO_TEST_CASE(test_global_scope_ctors_executed_once) // host vector, size == count, output[0...count-1] == 1 std::vector output(count, cl_uint(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") for(size_t i = 0; i < 4; i++) @@ -435,7 +439,9 @@ AUTO_TEST_CASE(test_global_scope_ctors_ndrange) // host vector, size == count, output[0...count-1] == 1 std::vector output(count, cl_uint(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/api/test_dtors.hpp b/test_conformance/clcpp/api/test_dtors.hpp index 2f4fd0c7..e04cbb1c 100644 --- a/test_conformance/clcpp/api/test_dtors.hpp +++ b/test_conformance/clcpp/api/test_dtors.hpp @@ -114,7 +114,9 @@ AUTO_TEST_CASE(test_global_scope_dtor_is_executed) // host vector, size == count, output[0...count-1] == 0xbeefbeef (3203383023) // values in output __MUST BE__ greater than 0 for the test to work correctly std::vector output(count, cl_uint(0xbeefbeef)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer( @@ -297,7 +299,9 @@ AUTO_TEST_CASE(test_global_scope_dtors_executed_once) // values in output __MUST BE__ greater than 0 for the test to work correctly cl_uint init_value = cl_uint(0xbeefbeef); std::vector output(count, init_value); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer( @@ -497,7 +501,9 @@ AUTO_TEST_CASE(test_global_scope_dtor_ndrange) // host vector, size == count, output[0...count-1] == 0xbeefbeef (3203383023) // values in output __MUST BE__ greater than 0 for the test to work correctly std::vector output(count, cl_uint(0xbeefbeef)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/api/test_spec_consts.hpp b/test_conformance/clcpp/api/test_spec_consts.hpp index 1d061683..c403f4d9 100644 --- a/test_conformance/clcpp/api/test_spec_consts.hpp +++ b/test_conformance/clcpp/api/test_spec_consts.hpp @@ -124,7 +124,9 @@ AUTO_TEST_CASE(test_spec_consts_defaults) // host vector, size == 1, output[0] == 1 std::vector output(1, cl_int(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer(queue, output_buffer, CL_TRUE, 0, sizeof(cl_int) * output.size(), static_cast(output.data()), 0, NULL, NULL); @@ -248,7 +250,9 @@ AUTO_TEST_CASE(test_spec_consts_many_constants) // host vector, size == 1, output[0] == 1 std::vector output(1, cl_int(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer(queue, output_buffer, CL_TRUE, 0, sizeof(cl_int) * output.size(), static_cast(output.data()), 0, NULL, NULL); @@ -443,7 +447,9 @@ AUTO_TEST_CASE(test_spec_consts_different_types) // host vector, size == 1, output[0] == 1 std::vector output(1, cl_int(1)); - output_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * output.size(), NULL, &error); + output_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * output.size(), NULL, &error); RETURN_ON_CL_ERROR(error, "clCreateBuffer") error = clEnqueueWriteBuffer(queue, output_buffer, CL_TRUE, 0, sizeof(cl_int) * output.size(), static_cast(output.data()), 0, NULL, NULL); diff --git a/test_conformance/clcpp/atomics/atomic_fetch.hpp b/test_conformance/clcpp/atomics/atomic_fetch.hpp index 5618375e..39a99488 100644 --- a/test_conformance/clcpp/atomics/atomic_fetch.hpp +++ b/test_conformance/clcpp/atomics/atomic_fetch.hpp @@ -130,10 +130,12 @@ int test_atomic_fetch_func(cl_device_id device, cl_context context, cl_command_q std::vector input = generate_input(count, op.min1(), op.max1(), std::vector()); std::vector output = generate_output((count - 1) / atomic_bucket_size + 1); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(TYPE) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/math_funcs/logarithmic_funcs.hpp b/test_conformance/clcpp/math_funcs/logarithmic_funcs.hpp index cd25d8e8..23e98302 100644 --- a/test_conformance/clcpp/math_funcs/logarithmic_funcs.hpp +++ b/test_conformance/clcpp/math_funcs/logarithmic_funcs.hpp @@ -49,7 +49,8 @@ int get_ilogb_nan_zero(cl_device_id device, cl_context context, cl_command_queue std::vector output = generate_output(2); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * output.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clSetKernelArg(kernel, 0, sizeof(buffers[0]), &buffers[0]); diff --git a/test_conformance/clcpp/program_scope_ctors_dtors/common.hpp b/test_conformance/clcpp/program_scope_ctors_dtors/common.hpp index 35bf81c9..9eb17f92 100644 --- a/test_conformance/clcpp/program_scope_ctors_dtors/common.hpp +++ b/test_conformance/clcpp/program_scope_ctors_dtors/common.hpp @@ -230,9 +230,8 @@ int run_ps_ctor_dtor_test(cl_device_id device, cl_context context, cl_command_qu std::vector output = generate_output(work_size[0], 9999); // device output buffer - buffers[0] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") // Execute test diff --git a/test_conformance/clcpp/spec_constants/common.hpp b/test_conformance/clcpp/spec_constants/common.hpp index 3846fe83..17b31aeb 100644 --- a/test_conformance/clcpp/spec_constants/common.hpp +++ b/test_conformance/clcpp/spec_constants/common.hpp @@ -213,9 +213,8 @@ int run_spec_constants_test(cl_device_id device, cl_context context, cl_command_ std::vector output = generate_output(work_size[0], 9999); // device output buffer - buffers[0] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(TYPE) * output.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); // Execute test diff --git a/test_conformance/clcpp/subgroups/test_sg_all.hpp b/test_conformance/clcpp/subgroups/test_sg_all.hpp index 01d66386..5dc060ce 100644 --- a/test_conformance/clcpp/subgroups/test_sg_all.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_all.hpp @@ -169,10 +169,12 @@ int sub_group_all(cl_device_id device, cl_context context, cl_command_queue queu std::vector input = generate_input_sg_all(flat_work_size + 1, wg_size); std::vector output = generate_output_sg_all(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/subgroups/test_sg_any.hpp b/test_conformance/clcpp/subgroups/test_sg_any.hpp index 769bef06..4c6adce9 100644 --- a/test_conformance/clcpp/subgroups/test_sg_any.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_any.hpp @@ -169,10 +169,12 @@ int sub_group_any(cl_device_id device, cl_context context, cl_command_queue queu std::vector input = generate_input_sg_any(flat_work_size + 1, wg_size); std::vector output = generate_output_sg_any(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/subgroups/test_sg_broadcast.hpp b/test_conformance/clcpp/subgroups/test_sg_broadcast.hpp index 39e420ac..22317be5 100644 --- a/test_conformance/clcpp/subgroups/test_sg_broadcast.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_broadcast.hpp @@ -156,10 +156,12 @@ int sub_group_broadcast(cl_device_id device, cl_context context, cl_command_queu std::vector input = generate_input_sg_broadcast(flat_work_size, wg_size); std::vector output = generate_output_sg_broadcast(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL,&err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/subgroups/test_sg_reduce.hpp b/test_conformance/clcpp/subgroups/test_sg_reduce.hpp index 6b20d507..91acd474 100644 --- a/test_conformance/clcpp/subgroups/test_sg_reduce.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_reduce.hpp @@ -223,10 +223,13 @@ int sub_group_reduce(cl_device_id device, cl_context context, cl_command_queue q std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/subgroups/test_sg_scan_exclusive.hpp b/test_conformance/clcpp/subgroups/test_sg_scan_exclusive.hpp index 7bb2b18b..72081750 100644 --- a/test_conformance/clcpp/subgroups/test_sg_scan_exclusive.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_scan_exclusive.hpp @@ -210,10 +210,13 @@ int sub_group_scan_exclusive(cl_device_id device, cl_context context, cl_command std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/subgroups/test_sg_scan_inclusive.hpp b/test_conformance/clcpp/subgroups/test_sg_scan_inclusive.hpp index 803daa00..0218668c 100644 --- a/test_conformance/clcpp/subgroups/test_sg_scan_inclusive.hpp +++ b/test_conformance/clcpp/subgroups/test_sg_scan_inclusive.hpp @@ -210,10 +210,13 @@ int sub_group_scan_inclusive(cl_device_id device, cl_context context, cl_command std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/synchronization/named_barrier/common.hpp b/test_conformance/clcpp/synchronization/named_barrier/common.hpp index da34dceb..e6ce8b20 100644 --- a/test_conformance/clcpp/synchronization/named_barrier/common.hpp +++ b/test_conformance/clcpp/synchronization/named_barrier/common.hpp @@ -133,7 +133,8 @@ int run_work_group_named_barrier_barrier_test(cl_device_id device, cl_context co std::vector output = generate_output(work_size[0], 9999); // device output buffer - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") // Execute test kernels diff --git a/test_conformance/clcpp/synchronization/named_barrier/test_named_barrier.hpp b/test_conformance/clcpp/synchronization/named_barrier/test_named_barrier.hpp index a4f9a04a..a0f57b24 100644 --- a/test_conformance/clcpp/synchronization/named_barrier/test_named_barrier.hpp +++ b/test_conformance/clcpp/synchronization/named_barrier/test_named_barrier.hpp @@ -276,7 +276,9 @@ struct global_fence_named_barrier_test : public work_group_named_barrier_test_ba RETURN_ON_CL_ERROR(err, "clGetCommandQueueInfo") // create temp buffer - auto temp_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * work_size, NULL, &err); + auto temp_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * work_size, NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clSetKernelArg(kernel, 0, sizeof(output_buffer), &output_buffer); @@ -420,10 +422,9 @@ struct global_local_fence_named_barrier_test : public work_group_named_barrier_t RETURN_ON_CL_ERROR(err, "clGetCommandQueueInfo") // create temp buffer - auto temp_buffer = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), - sizeof(cl_uint) * work_size, NULL, &err - ); + auto temp_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * work_size, NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clSetKernelArg(kernel, 0, sizeof(output_buffer), &output_buffer); diff --git a/test_conformance/clcpp/synchronization/named_barrier/test_spec_example.hpp b/test_conformance/clcpp/synchronization/named_barrier/test_spec_example.hpp index c80ab717..7afbd00f 100644 --- a/test_conformance/clcpp/synchronization/named_barrier/test_spec_example.hpp +++ b/test_conformance/clcpp/synchronization/named_barrier/test_spec_example.hpp @@ -270,7 +270,9 @@ struct spec_example_work_group_named_barrier_test : public work_group_named_barr RETURN_ON_CL_ERROR(err, "clGetCommandQueueInfo") // create temp buffer - auto temp_buffer = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * work_size, NULL, &err); + auto temp_buffer = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * work_size, NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clSetKernelArg(kernel, 0, sizeof(output_buffer), &output_buffer); diff --git a/test_conformance/clcpp/utils_test/binary.hpp b/test_conformance/clcpp/utils_test/binary.hpp index 5ff35c91..893cbed0 100644 --- a/test_conformance/clcpp/utils_test/binary.hpp +++ b/test_conformance/clcpp/utils_test/binary.hpp @@ -243,19 +243,16 @@ int test_binary_func(cl_device_id device, cl_context context, cl_command_queue q std::vector input2 = generate_input(count, op.min2(), op.max2(), in2_spec_cases); std::vector output = generate_output(count); - buffers[0] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT1) * input1.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT1) * input1.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[1] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT2) * input2.size(), NULL, &err - ); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT2) * input2.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[2] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(OUTPUT) * output.size(), NULL, &err - ); + buffers[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(OUTPUT) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/utils_test/ternary.hpp b/test_conformance/clcpp/utils_test/ternary.hpp index 342681e1..2a6f6b55 100644 --- a/test_conformance/clcpp/utils_test/ternary.hpp +++ b/test_conformance/clcpp/utils_test/ternary.hpp @@ -284,24 +284,20 @@ int test_ternary_func(cl_device_id device, cl_context context, cl_command_queue std::vector input3 = generate_input(count, op.min3(), op.max3(), in3_spec_cases); std::vector output = generate_output(count); - buffers[0] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT1) * input1.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT1) * input1.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[1] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT2) * input2.size(), NULL, &err - ); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT2) * input2.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[2] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT3) * input3.size(), NULL, &err - ); + buffers[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT3) * input3.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[3] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(OUTPUT) * output.size(), NULL, &err - ); + buffers[3] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(OUTPUT) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/utils_test/unary.hpp b/test_conformance/clcpp/utils_test/unary.hpp index 2dbc6471..456ad3f0 100644 --- a/test_conformance/clcpp/utils_test/unary.hpp +++ b/test_conformance/clcpp/utils_test/unary.hpp @@ -215,14 +215,12 @@ int test_unary_func(cl_device_id device, cl_context context, cl_command_queue qu std::vector input = generate_input(count, op.min1(), op.max1(), op.in_special_cases()); std::vector output = generate_output(count); - buffers[0] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT) * input.size(), NULL, &err - ); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") - buffers[1] = clCreateBuffer( - context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(OUTPUT) * output.size(), NULL, &err - ); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(OUTPUT) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer") err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/vload_vstore/vload_funcs.hpp b/test_conformance/clcpp/vload_vstore/vload_funcs.hpp index 5805f8b8..cb9415e0 100644 --- a/test_conformance/clcpp/vload_vstore/vload_funcs.hpp +++ b/test_conformance/clcpp/vload_vstore/vload_funcs.hpp @@ -140,10 +140,12 @@ int test_vload_func(cl_device_id device, cl_context context, cl_command_queue qu ); std::vector output = generate_output(count); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(OUTPUT) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(OUTPUT) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/vload_vstore/vstore_funcs.hpp b/test_conformance/clcpp/vload_vstore/vstore_funcs.hpp index 290c273f..7ffc584e 100644 --- a/test_conformance/clcpp/vload_vstore/vstore_funcs.hpp +++ b/test_conformance/clcpp/vload_vstore/vstore_funcs.hpp @@ -138,10 +138,12 @@ int test_vstore_func(cl_device_id device, cl_context context, cl_command_queue q std::vector input = generate_input(count, op.min1(), op.max1(), op.in_special_cases()); std::vector output = generate_output(count * vector_size::value); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(INPUT) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(INPUT) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(OUTPUT) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(OUTPUT) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_all.hpp b/test_conformance/clcpp/workgroups/test_wg_all.hpp index 103ce2bf..35ee5217 100644 --- a/test_conformance/clcpp/workgroups/test_wg_all.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_all.hpp @@ -164,10 +164,12 @@ int work_group_all(cl_device_id device, cl_context context, cl_command_queue que std::vector input = generate_input_wg_all(flat_work_size + 1, wg_size); std::vector output = generate_output_wg_all(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_any.hpp b/test_conformance/clcpp/workgroups/test_wg_any.hpp index 724b3ceb..1ceb1ef6 100644 --- a/test_conformance/clcpp/workgroups/test_wg_any.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_any.hpp @@ -164,10 +164,12 @@ int work_group_any(cl_device_id device, cl_context context, cl_command_queue que std::vector input = generate_input_wg_any(flat_work_size + 1, wg_size); std::vector output = generate_output_wg_any(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_broadcast.hpp b/test_conformance/clcpp/workgroups/test_wg_broadcast.hpp index 4dc5559e..999aef19 100644 --- a/test_conformance/clcpp/workgroups/test_wg_broadcast.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_broadcast.hpp @@ -368,10 +368,12 @@ int work_group_broadcast(cl_device_id device, cl_context context, cl_command_que std::vector input = generate_input_wg_broadcast(flat_work_size, flat_wg_size); std::vector output = generate_output_wg_broadcast(flat_work_size, flat_wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * output.size(), NULL, &err); + buffers[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_reduce.hpp b/test_conformance/clcpp/workgroups/test_wg_reduce.hpp index 616cbdb0..160b2e86 100644 --- a/test_conformance/clcpp/workgroups/test_wg_reduce.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_reduce.hpp @@ -209,10 +209,13 @@ int work_group_reduce(cl_device_id device, cl_context context, cl_command_queue std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_scan_exclusive.hpp b/test_conformance/clcpp/workgroups/test_wg_scan_exclusive.hpp index 35ec4b13..ef0e8ffc 100644 --- a/test_conformance/clcpp/workgroups/test_wg_scan_exclusive.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_scan_exclusive.hpp @@ -202,10 +202,13 @@ int work_group_scan_exclusive(cl_device_id device, cl_context context, cl_comman std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/clcpp/workgroups/test_wg_scan_inclusive.hpp b/test_conformance/clcpp/workgroups/test_wg_scan_inclusive.hpp index 34096ebb..5623aed7 100644 --- a/test_conformance/clcpp/workgroups/test_wg_scan_inclusive.hpp +++ b/test_conformance/clcpp/workgroups/test_wg_scan_inclusive.hpp @@ -202,10 +202,13 @@ int work_group_scan_inclusive(cl_device_id device, cl_context context, cl_comman std::vector input = generate_input(flat_work_size, wg_size); std::vector output = generate_output(flat_work_size, wg_size); - buffers[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * input.size(), NULL, &err); + buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * input.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); - buffers[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(CL_INT_TYPE) * output.size(), NULL, &err); + buffers[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(CL_INT_TYPE) * output.size(), NULL, &err); RETURN_ON_CL_ERROR(err, "clCreateBuffer"); err = clEnqueueWriteBuffer( diff --git a/test_conformance/commonfns/test_binary_fn.cpp b/test_conformance/commonfns/test_binary_fn.cpp index 51d73659..b40bf1f6 100644 --- a/test_conformance/commonfns/test_binary_fn.cpp +++ b/test_conformance/commonfns/test_binary_fn.cpp @@ -86,15 +86,19 @@ int test_binary_fn( cl_device_id device, cl_context context, cl_command_queue qu for( i = 0; i < 3; i++ ) { - streams[ i ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, &err ); + streams[i] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, &err); test_error( err, "clCreateBuffer failed"); } if (test_double) for( i = 3; i < 6; i++ ) { - streams[ i ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, &err ); - test_error( err, "clCreateBuffer failed"); + streams[i] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, &err); + test_error(err, "clCreateBuffer failed"); } d = init_genrand( gRandomSeed ); diff --git a/test_conformance/commonfns/test_clamp.cpp b/test_conformance/commonfns/test_clamp.cpp index 5d01900f..bbb83645 100644 --- a/test_conformance/commonfns/test_clamp.cpp +++ b/test_conformance/commonfns/test_clamp.cpp @@ -152,7 +152,9 @@ test_clamp(cl_device_id device, cl_context context, cl_command_queue queue, int // why does this go from 0 to 3? for( i = 0; i < 4; i++ ) { - streams[ i ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[i] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); @@ -162,8 +164,10 @@ test_clamp(cl_device_id device, cl_context context, cl_command_queue queue, int if (test_double) for( i = 4; i < 8; i++ ) { - streams[ i ] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); - if (!streams[0]) + streams[i] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); + if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; diff --git a/test_conformance/commonfns/test_degrees.cpp b/test_conformance/commonfns/test_degrees.cpp index d6593db3..7360c034 100644 --- a/test_conformance/commonfns/test_degrees.cpp +++ b/test_conformance/commonfns/test_degrees.cpp @@ -130,14 +130,16 @@ test_degrees(cl_device_id device, cl_context context, cl_command_queue queue, in input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -359,14 +361,16 @@ test_degrees_double(cl_device_id device, cl_context context, cl_command_queue qu input_ptr[0] = (cl_double*)malloc(sizeof(cl_double) * num_elements); output_ptr = (cl_double*)malloc(sizeof(cl_double) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_fmax.cpp b/test_conformance/commonfns/test_fmax.cpp index 462f9e49..2441e695 100644 --- a/test_conformance/commonfns/test_fmax.cpp +++ b/test_conformance/commonfns/test_fmax.cpp @@ -103,19 +103,22 @@ test_fmax(cl_device_id device, cl_context context, cl_command_queue queue, int n input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_fmaxf.cpp b/test_conformance/commonfns/test_fmaxf.cpp index 2ed1bcc2..1aed5390 100644 --- a/test_conformance/commonfns/test_fmaxf.cpp +++ b/test_conformance/commonfns/test_fmaxf.cpp @@ -109,20 +109,25 @@ test_fmaxf(cl_device_id device, cl_context context, cl_command_queue queue, int input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); - if (!streams[1]) + streams[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); + if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); - if (!streams[2]) + streams[2] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); + if (!streams[2]) { log_error("clCreateBuffer failed\n"); return -1; diff --git a/test_conformance/commonfns/test_fmin.cpp b/test_conformance/commonfns/test_fmin.cpp index 7efbb8fe..19bc7b65 100644 --- a/test_conformance/commonfns/test_fmin.cpp +++ b/test_conformance/commonfns/test_fmin.cpp @@ -108,20 +108,23 @@ test_fmin(cl_device_id device, cl_context context, cl_command_queue queue, int n input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_fminf.cpp b/test_conformance/commonfns/test_fminf.cpp index f04fb1ef..e0e455ab 100644 --- a/test_conformance/commonfns/test_fminf.cpp +++ b/test_conformance/commonfns/test_fminf.cpp @@ -104,19 +104,22 @@ test_fminf(cl_device_id device, cl_context context, cl_command_queue queue, int input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_mix.cpp b/test_conformance/commonfns/test_mix.cpp index d773f76c..51baac40 100644 --- a/test_conformance/commonfns/test_mix.cpp +++ b/test_conformance/commonfns/test_mix.cpp @@ -66,26 +66,30 @@ test_mix(cl_device_id device, cl_context context, cl_command_queue queue, int nu input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[2] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[3] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[3]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_radians.cpp b/test_conformance/commonfns/test_radians.cpp index 9ff53a67..0a580c19 100644 --- a/test_conformance/commonfns/test_radians.cpp +++ b/test_conformance/commonfns/test_radians.cpp @@ -131,14 +131,16 @@ test_radians(cl_device_id device, cl_context context, cl_command_queue queue, in input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -361,14 +363,16 @@ test_radians_double(cl_device_id device, cl_context context, cl_command_queue qu input_ptr[0] = (cl_double*)malloc(sizeof(cl_double) * num_elements); output_ptr = (cl_double*)malloc(sizeof(cl_double) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_sign.cpp b/test_conformance/commonfns/test_sign.cpp index bf8d8c79..1b842e35 100644 --- a/test_conformance/commonfns/test_sign.cpp +++ b/test_conformance/commonfns/test_sign.cpp @@ -117,14 +117,16 @@ test_sign(cl_device_id device, cl_context context, cl_command_queue queue, int n input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -331,14 +333,16 @@ test_sign_double(cl_device_id device, cl_context context, cl_command_queue queue input_ptr[0] = (cl_double*)malloc(sizeof(cl_double) * num_elements); output_ptr = (cl_double*)malloc(sizeof(cl_double) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_smoothstep.cpp b/test_conformance/commonfns/test_smoothstep.cpp index 19201fd5..c0cc1d40 100644 --- a/test_conformance/commonfns/test_smoothstep.cpp +++ b/test_conformance/commonfns/test_smoothstep.cpp @@ -116,26 +116,30 @@ test_smoothstep(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[2] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[3] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[3]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_smoothstepf.cpp b/test_conformance/commonfns/test_smoothstepf.cpp index 7d708de7..ac09e9ec 100644 --- a/test_conformance/commonfns/test_smoothstepf.cpp +++ b/test_conformance/commonfns/test_smoothstepf.cpp @@ -93,26 +93,30 @@ test_smoothstepf(cl_device_id device, cl_context context, cl_command_queue queue input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[2] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[3] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[3]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_step.cpp b/test_conformance/commonfns/test_step.cpp index 3b1a5ba3..0e3cfe07 100644 --- a/test_conformance/commonfns/test_step.cpp +++ b/test_conformance/commonfns/test_step.cpp @@ -109,19 +109,22 @@ test_step(cl_device_id device, cl_context context, cl_command_queue queue, int n input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); @@ -373,19 +376,22 @@ test_step_double(cl_device_id device, cl_context context, cl_command_queue queue input_ptr[0] = (cl_double*)malloc(sizeof(cl_double) * num_elements); input_ptr[1] = (cl_double*)malloc(sizeof(cl_double) * num_elements); output_ptr = (cl_double*)malloc(sizeof(cl_double) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/commonfns/test_stepf.cpp b/test_conformance/commonfns/test_stepf.cpp index ba7d2e1a..efada227 100644 --- a/test_conformance/commonfns/test_stepf.cpp +++ b/test_conformance/commonfns/test_stepf.cpp @@ -111,19 +111,22 @@ int test_stepf(cl_device_id device, cl_context context, cl_command_queue queue, input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); input_ptr[1] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); @@ -377,19 +380,22 @@ int test_stepf_double(cl_device_id device, cl_context context, cl_command_queue input_ptr[0] = (cl_double*)malloc(sizeof(cl_double) * num_elements); input_ptr[1] = (cl_double*)malloc(sizeof(cl_double) * num_elements); output_ptr = (cl_double*)malloc(sizeof(cl_double) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * num_elements, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * num_elements, NULL, NULL); if (!streams[2]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/compiler/test_build_options.cpp b/test_conformance/compiler/test_build_options.cpp index 71f84c30..7ab4454f 100644 --- a/test_conformance/compiler/test_build_options.cpp +++ b/test_conformance/compiler/test_build_options.cpp @@ -73,7 +73,8 @@ cl_int get_result_from_program( cl_context context, cl_command_queue queue, cl_p test_error( error, "Unable to create kernel from program" ); clMemWrapper outStream; - outStream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int), NULL, &error ); + outStream = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int), NULL, + &error); test_error( error, "Unable to create test buffer" ); error = clSetKernelArg( kernel, 0, sizeof( outStream ), &outStream ); @@ -312,7 +313,8 @@ cl_int get_float_result_from_program( cl_context context, cl_command_queue queue clKernelWrapper kernel = clCreateKernel( program, "sample_test", &error ); test_error( error, "Unable to create kernel from program" ); - clMemWrapper outStream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float), NULL, &error ); + clMemWrapper outStream = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float), NULL, &error); test_error( error, "Unable to create test buffer" ); error = clSetKernelArg( kernel, 0, sizeof( cl_float ), &inA ); diff --git a/test_conformance/device_partition/test_device_partition.cpp b/test_conformance/device_partition/test_device_partition.cpp index b90fca85..f9952ec8 100644 --- a/test_conformance/device_partition/test_device_partition.cpp +++ b/test_conformance/device_partition/test_device_partition.cpp @@ -265,7 +265,8 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices for( i = 0; i < TEST_SIZE; i++ ) data[i] = genrand_int32(seed); - stream = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_int) * TEST_SIZE, data, &error); + stream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_int) * TEST_SIZE, data, &error); test_error( error, "Unable to create test array" ); // Update the expected results diff --git a/test_conformance/events/action_classes.cpp b/test_conformance/events/action_classes.cpp index 122c21ff..d70d76bd 100644 --- a/test_conformance/events/action_classes.cpp +++ b/test_conformance/events/action_classes.cpp @@ -145,9 +145,11 @@ cl_int NDRangeKernelAction::Setup( cl_device_id device, cl_context context, cl_c error = get_max_common_work_group_size( context, mKernel, threads[0], &mLocalThreads[0] ); test_error( error, "Unable to get work group size to use" ); - mStreams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1000, NULL, &error ); + mStreams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1000, NULL, &error); test_error( error, "Creating test array failed" ); - mStreams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * 1000, NULL, &error ); + mStreams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * 1000, NULL, &error); test_error( error, "Creating test array failed" ); /* Set the arguments */ diff --git a/test_conformance/events/test_events.cpp b/test_conformance/events/test_events.cpp index c2524b16..26693f99 100644 --- a/test_conformance/events/test_events.cpp +++ b/test_conformance/events/test_events.cpp @@ -47,9 +47,11 @@ int create_and_execute_kernel( cl_context inContext, cl_command_queue inQueue, c error = get_max_common_work_group_size( inContext, *outKernel, threads[0], &localThreads[0] ); test_error( error, "Unable to get work group size to use" ); - streams[0] = clCreateBuffer(inContext, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1000, NULL, &error); + streams[0] = clCreateBuffer(inContext, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1000, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer(inContext, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * 1000, NULL, &error); + streams[1] = clCreateBuffer(inContext, CL_MEM_READ_WRITE, + sizeof(cl_int) * 1000, NULL, &error); test_error( error, "Creating test array failed" ); /* Set the arguments */ @@ -178,7 +180,8 @@ int test_event_get_write_array_status( cl_device_id deviceID, cl_context context cl_int status; - stream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + stream = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); error = clEnqueueWriteBuffer(queue, stream, CL_FALSE, 0, sizeof(cl_float)*1024*32, (void *)testArray, 0, NULL, &event); @@ -212,7 +215,8 @@ int test_event_get_read_array_status( cl_device_id deviceID, cl_context context, cl_int status; - stream = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + stream = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); error = clEnqueueReadBuffer(queue, stream, CL_FALSE, 0, sizeof(cl_float)*1024*32, (void *)testArray, 0, NULL, &event); @@ -282,9 +286,11 @@ int test_event_wait_for_array( cl_device_id deviceID, cl_context context, cl_com cl_int status; - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); error = clEnqueueReadBuffer(queue, streams[0], CL_FALSE, 0, sizeof(cl_float)*1024*32, (void *)readArray, 0, NULL, &events[0]); @@ -421,9 +427,11 @@ int test_event_finish_array( cl_device_id deviceID, cl_context context, cl_comma cl_int status; - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * 1024 * 32, NULL, &error ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * 1024 * 32, NULL, &error); test_error( error, "Creating test array failed" ); error = clEnqueueReadBuffer(queue, streams[0], CL_FALSE, 0, sizeof(cl_float)*1024*32, (void *)readArray, 0, NULL, &events[0]); @@ -509,8 +517,12 @@ int test_event_release_before_done( cl_device_id deviceID, cl_context context, c // Create a set of streams to use as arguments for( i = 0; i < NUM_EVENT_RUNS; i++ ) { - streams[i][0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * threads[0], NULL, &error ); - streams[i][1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * threads[0], NULL, &error ); + streams[i][0] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * threads[0], NULL, &error); + streams[i][1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * threads[0], NULL, &error); if( ( streams[i][0] == NULL ) || ( streams[i][1] == NULL ) ) { log_error( "ERROR: Unable to allocate testing streams" ); diff --git a/test_conformance/geometrics/test_geometrics.cpp b/test_conformance/geometrics/test_geometrics.cpp index 2fcf31ce..e305026c 100644 --- a/test_conformance/geometrics/test_geometrics.cpp +++ b/test_conformance/geometrics/test_geometrics.cpp @@ -188,19 +188,25 @@ int test_geom_cross(cl_device_id deviceID, cl_context context, cl_command_queue } fillWithTrickyNumbers( inDataA, inDataB, vecsize ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_float) * vecsize * TEST_SIZE, inDataA, NULL); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecsize * TEST_SIZE, + inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_float) * vecsize * TEST_SIZE, inDataB, NULL); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecsize * TEST_SIZE, + inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * vecsize * TEST_SIZE, NULL, NULL); + streams[2] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * vecsize * TEST_SIZE, NULL, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -353,19 +359,24 @@ int test_twoToFloat_kernel(cl_command_queue queue, cl_context context, const cha } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_float) * vecSize * TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_float) * vecSize * TEST_SIZE, inDataB, NULL); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * TEST_SIZE, NULL, NULL); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * TEST_SIZE, NULL, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -660,14 +671,15 @@ int test_oneToFloat_kernel(cl_command_queue queue, cl_context context, const cha } } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - sizeof(cl_float) * vecSize * TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_float) * TEST_SIZE, NULL, NULL); if( streams[1] == NULL ) { @@ -872,13 +884,17 @@ int test_oneToOne_kernel(cl_command_queue queue, cl_context context, const char inDataA[i] = any_float(d); } - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_float) * vecSize* TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * vecSize * TEST_SIZE, NULL, NULL); + streams[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * vecSize * TEST_SIZE, NULL, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating output array failed!\n"); diff --git a/test_conformance/geometrics/test_geometrics_double.cpp b/test_conformance/geometrics/test_geometrics_double.cpp index 7dec7514..222017e6 100644 --- a/test_conformance/geometrics/test_geometrics_double.cpp +++ b/test_conformance/geometrics/test_geometrics_double.cpp @@ -210,19 +210,22 @@ int test_geom_cross_double(cl_device_id deviceID, cl_context context, cl_command } fillWithTrickyNumbers_double( inDataA, inDataB, vecsize ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), bufSize, inDataA, NULL); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, bufSize, + inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), bufSize, inDataB, NULL); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, bufSize, + inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), bufSize, NULL, NULL); + streams[2] = + clCreateBuffer(context, CL_MEM_READ_WRITE, bufSize, NULL, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -324,19 +327,24 @@ int test_twoToFloat_kernel_double(cl_command_queue queue, cl_context context, co fillWithTrickyNumbers_double( inDataA, inDataB, vecSize ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_double) * vecSize * TEST_SIZE, inDataB, NULL); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * TEST_SIZE, NULL, NULL); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * TEST_SIZE, NULL, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -555,13 +563,16 @@ int test_oneToFloat_kernel_double(cl_command_queue queue, cl_context context, co fillWithTrickyNumbers_double( inDataA, NULL, vecSize ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * TEST_SIZE, NULL, NULL); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * TEST_SIZE, NULL, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -759,13 +770,17 @@ int test_oneToOne_kernel_double(cl_command_queue queue, cl_context context, cons inDataA[ i ] = any_double(d); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_double) * vecSize * TEST_SIZE, NULL, NULL); + streams[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_double) * vecSize * TEST_SIZE, NULL, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating output array failed!\n"); diff --git a/test_conformance/gl/test_image_methods.cpp b/test_conformance/gl/test_image_methods.cpp index a841e2d2..afaa08fc 100644 --- a/test_conformance/gl/test_image_methods.cpp +++ b/test_conformance/gl/test_image_methods.cpp @@ -277,7 +277,8 @@ int test_image_format_methods( cl_device_id device, cl_context context, cl_comma test_error( error, "Unable to create kernel to test against" ); // Create an output buffer - outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error ); + outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(outKernelData), NULL, &error); test_error( error, "Unable to create output buffer" ); // Set up arguments and run diff --git a/test_conformance/images/kernel_image_methods/test_1D.cpp b/test_conformance/images/kernel_image_methods/test_1D.cpp index 757a4a00..f0c7685e 100644 --- a/test_conformance/images/kernel_image_methods/test_1D.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D.cpp @@ -97,7 +97,8 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu test_error( error, "Unable to create kernel to test against" ); // Create an output buffer - outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error ); + outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(outKernelData), NULL, &error); test_error( error, "Unable to create output buffer" ); // Set up arguments and run diff --git a/test_conformance/images/kernel_image_methods/test_1D_array.cpp b/test_conformance/images/kernel_image_methods/test_1D_array.cpp index f5e778b6..5353fa65 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_array.cpp @@ -101,7 +101,8 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que test_error( error, "Unable to create kernel to test against" ); // Create an output buffer - outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error ); + outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(outKernelData), NULL, &error); test_error( error, "Unable to create output buffer" ); // Set up arguments and run diff --git a/test_conformance/images/kernel_image_methods/test_2D.cpp b/test_conformance/images/kernel_image_methods/test_2D.cpp index 64b9f265..05e63628 100644 --- a/test_conformance/images/kernel_image_methods/test_2D.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D.cpp @@ -125,7 +125,8 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag test_error( error, "Unable to create kernel to test against" ); // Create an output buffer - outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error ); + outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(outKernelData), NULL, &error); test_error( error, "Unable to create output buffer" ); // Set up arguments and run diff --git a/test_conformance/images/kernel_image_methods/test_2D_array.cpp b/test_conformance/images/kernel_image_methods/test_2D_array.cpp index 85b8a7a3..b9bd6bd5 100644 --- a/test_conformance/images/kernel_image_methods/test_2D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D_array.cpp @@ -105,7 +105,8 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que test_error( error, "Unable to create kernel to test against" ); // Create an output buffer - outDataBuffer = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof( outKernelData ), NULL, &error ); + outDataBuffer = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(outKernelData), NULL, &error); test_error( error, "Unable to create output buffer" ); // Set up arguments and run diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index 0b7d4243..7281564b 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -1428,11 +1428,20 @@ int test_read_image_2D( cl_context context, cl_command_queue queue, cl_kernel ke if( gDebugTrace ) log_info( " - Creating kernel arguments...\n" ); - xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height, xOffsetValues, &error ); + xOffsets = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width * imageInfo->height, + xOffsetValues, &error); test_error( error, "Unable to create x offset buffer" ); - yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height, yOffsetValues, &error ); + yOffsets = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width * imageInfo->height, + yOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height, NULL, &error ); + results = clCreateBuffer(context, CL_MEM_READ_WRITE, + get_explicit_type_size(outputType) * 4 + * imageInfo->width * imageInfo->height, + NULL, &error); test_error( error, "Unable to create result buffer" ); // Create sampler to use diff --git a/test_conformance/images/kernel_read_write/test_read_1D.cpp b/test_conformance/images/kernel_read_write/test_read_1D.cpp index e2e36a6f..f094ed63 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D.cpp @@ -394,9 +394,14 @@ int test_read_image_1D( cl_context context, cl_command_queue queue, cl_kernel ke if( gDebugTrace ) log_info( " - Creating kernel arguments...\n" ); - xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width, xOffsetValues, &error ); + xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width, + xOffsetValues, &error); test_error( error, "Unable to create x offset buffer" ); - results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width, NULL, &error ); + results = clCreateBuffer(context, CL_MEM_READ_WRITE, + get_explicit_type_size(outputType) * 4 + * imageInfo->width, + NULL, &error); test_error( error, "Unable to create result buffer" ); // Create sampler to use diff --git a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp index eede817c..1826f208 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D_array.cpp @@ -468,16 +468,22 @@ int test_read_image_1D_array( cl_context context, cl_command_queue queue, cl_ker if( gDebugTrace ) log_info( " - Creating kernel arguments...\n" ); - xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - sizeof( cl_float ) * imageInfo->width * imageInfo->arraySize, xOffsetValues, &error ); + xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->arraySize, + xOffsetValues, &error); test_error( error, "Unable to create x offset buffer" ); - yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - sizeof( cl_float ) * imageInfo->width * imageInfo->arraySize, yOffsetValues, &error ); + yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->arraySize, + yOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), - get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->arraySize, NULL, &error ); + results = clCreateBuffer(context, CL_MEM_READ_WRITE, + get_explicit_type_size(outputType) * 4 + * imageInfo->width * imageInfo->arraySize, + NULL, &error); test_error( error, "Unable to create result buffer" ); // Create sampler to use diff --git a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp index 79420b4c..ceabceaa 100644 --- a/test_conformance/images/kernel_read_write/test_read_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_read_2D_array.cpp @@ -478,13 +478,26 @@ int test_read_image_2D_array( cl_context context, cl_command_queue queue, cl_ker } } - xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, xOffsetValues, &error ); + xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->arraySize, + xOffsetValues, &error); test_error( error, "Unable to create x offset buffer" ); - yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, yOffsetValues, &error ); + yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->arraySize, + yOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - zOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->arraySize, zOffsetValues, &error ); + zOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->arraySize, + zOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height * imageInfo->arraySize, NULL, &error ); + results = + clCreateBuffer(context, CL_MEM_READ_WRITE, + get_explicit_type_size(outputType) * 4 * imageInfo->width + * imageInfo->height * imageInfo->arraySize, + NULL, &error); test_error( error, "Unable to create result buffer" ); // Create sampler to use diff --git a/test_conformance/images/kernel_read_write/test_read_3D.cpp b/test_conformance/images/kernel_read_write/test_read_3D.cpp index 0b9e8dee..ffb5779a 100644 --- a/test_conformance/images/kernel_read_write/test_read_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_3D.cpp @@ -368,9 +368,9 @@ int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel ke ( gEnablePitch ? imageInfo->rowPitch : 0 ), ( gEnablePitch ? imageInfo->slicePitch : 0 ), maxImageUseHostPtrBackingStore, &error ); } else { - error = protImage.Create( context, - (cl_mem_flags)(image_read_write_flags), - imageInfo->format, imageInfo->width, imageInfo->height, imageInfo->depth ); + error = protImage.Create(context, image_read_write_flags, + imageInfo->format, imageInfo->width, + imageInfo->height, imageInfo->depth); } if( error != CL_SUCCESS ) { @@ -487,13 +487,26 @@ int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel ke } } - xOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, xOffsetValues, &error ); + xOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->depth, + xOffsetValues, &error); test_error( error, "Unable to create x offset buffer" ); - yOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, yOffsetValues, &error ); + yOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->depth, + yOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - zOffsets = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), sizeof( cl_float ) * imageInfo->width * imageInfo->height * imageInfo->depth, zOffsetValues, &error ); + zOffsets = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * imageInfo->width + * imageInfo->height * imageInfo->depth, + zOffsetValues, &error); test_error( error, "Unable to create y offset buffer" ); - results = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( outputType ) * 4 * imageInfo->width * imageInfo->height * imageInfo->depth, NULL, &error ); + results = + clCreateBuffer(context, CL_MEM_READ_WRITE, + get_explicit_type_size(outputType) * 4 * imageInfo->width + * imageInfo->height * imageInfo->depth, + NULL, &error); test_error( error, "Unable to create result buffer" ); // Create sampler to use diff --git a/test_conformance/images/kernel_read_write/test_write_1D.cpp b/test_conformance/images/kernel_read_write/test_write_1D.cpp index 845ba830..bda5a442 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D.cpp @@ -271,8 +271,10 @@ int test_write_image_1D( cl_device_id device, cl_context context, cl_command_que clMemWrapper inputStream; char *imagePtrOffset = imageValues + nextLevelOffset; - inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - get_explicit_type_size( inputType ) * 4 * width_lod, imagePtrOffset, &error ); + inputStream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(inputType) * 4 + * width_lod, + imagePtrOffset, &error); test_error( error, "Unable to create input buffer" ); // Set arguments diff --git a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp index 5fe928f1..1ab59604 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D_array.cpp @@ -285,8 +285,10 @@ int test_write_image_1D_array( cl_device_id device, cl_context context, cl_comma clMemWrapper inputStream; char *imagePtrOffset = imageValues + nextLevelOffset; - inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - get_explicit_type_size( inputType ) * 4 * width_lod * imageInfo->arraySize, imagePtrOffset, &error ); + inputStream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(inputType) * 4 + * width_lod * imageInfo->arraySize, + imagePtrOffset, &error); test_error( error, "Unable to create input buffer" ); // Set arguments diff --git a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp index 01050c2c..949bc690 100644 --- a/test_conformance/images/kernel_read_write/test_write_2D_array.cpp +++ b/test_conformance/images/kernel_read_write/test_write_2D_array.cpp @@ -305,8 +305,11 @@ int test_write_image_2D_array( cl_device_id device, cl_context context, cl_comma clMemWrapper inputStream; char *imagePtrOffset = imageValues + nextLevelOffset; - inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - get_explicit_type_size( inputType ) * 4 * width_lod * height_lod * imageInfo->arraySize, imagePtrOffset, &error ); + inputStream = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(inputType) * 4 * width_lod + * height_lod * imageInfo->arraySize, + imagePtrOffset, &error); test_error( error, "Unable to create input buffer" ); // Set arguments diff --git a/test_conformance/images/kernel_read_write/test_write_3D.cpp b/test_conformance/images/kernel_read_write/test_write_3D.cpp index b67a7325..1ec3f6d7 100644 --- a/test_conformance/images/kernel_read_write/test_write_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_3D.cpp @@ -311,8 +311,11 @@ int test_write_image_3D( cl_device_id device, cl_context context, cl_command_que clMemWrapper inputStream; char *imagePtrOffset = imageValues + nextLevelOffset; - inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - get_explicit_type_size( inputType ) * 4 * width_lod * height_lod * depth_lod, imagePtrOffset, &error ); + inputStream = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(inputType) * 4 * width_lod + * height_lod * depth_lod, + imagePtrOffset, &error); test_error( error, "Unable to create input buffer" ); // Set arguments diff --git a/test_conformance/images/kernel_read_write/test_write_image.cpp b/test_conformance/images/kernel_read_write/test_write_image.cpp index 37274f3a..5830370f 100644 --- a/test_conformance/images/kernel_read_write/test_write_image.cpp +++ b/test_conformance/images/kernel_read_write/test_write_image.cpp @@ -333,8 +333,11 @@ int test_write_image( cl_device_id device, cl_context context, cl_command_queue char *imagePtrOffset = imageValues + nextLevelOffset; - inputStream = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_COPY_HOST_PTR ), - get_explicit_type_size( inputType ) * channel_scale * width_lod * height_lod, imagePtrOffset, &error ); + inputStream = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(inputType) * channel_scale + * width_lod * height_lod, + imagePtrOffset, &error); test_error( error, "Unable to create input buffer" ); // Set arguments diff --git a/test_conformance/integer_ops/test_int_basic_ops.cpp b/test_conformance/integer_ops/test_int_basic_ops.cpp index 2d628d46..519e5bee 100644 --- a/test_conformance/integer_ops/test_int_basic_ops.cpp +++ b/test_conformance/integer_ops/test_int_basic_ops.cpp @@ -244,18 +244,21 @@ cl_int perThreadDataInit(perThreadData * pThis, ExplicitType type, (cl_int*)malloc(pThis->m_type_size * num_elements * vectorSize); pThis->m_output_ptr = (cl_int*)malloc(pThis->m_type_size * num_elements * vectorSize); - pThis->m_streams[0] = - clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * inputAVecSize, NULL, &err); + pThis->m_streams[0] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + pThis->m_type_size * num_elements * inputAVecSize, NULL, &err); test_error(err, "clCreateBuffer failed"); - pThis->m_streams[1] = - clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * inputBVecSize, NULL, &err ); + pThis->m_streams[1] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + pThis->m_type_size * num_elements * inputBVecSize, NULL, &err); test_error(err, "clCreateBuffer failed"); - pThis->m_streams[2] = - clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), pThis->m_type_size * num_elements * vectorSize, NULL, &err ); + pThis->m_streams[2] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + pThis->m_type_size * num_elements * vectorSize, NULL, &err); test_error(err, "clCreateBuffer failed"); @@ -1445,13 +1448,21 @@ int test_question_colon_op(cl_device_id deviceID, cl_context context, generate_random_data( type, num_elements * inputBVecSize, s_randStates, input_ptr[ 1 ] ); generate_random_bool_data( num_elements * inputCVecSize, s_randStates, (cl_char *)input_ptr[ 2 ], type_size ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputAVecSize, input_ptr[0], &err); + streams[0] = clCreateBuffer( + context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + type_size * num_elements * inputAVecSize, input_ptr[0], &err); test_error(err, "clCreateBuffer failed"); - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputBVecSize, input_ptr[1], &err ); + streams[1] = clCreateBuffer( + context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + type_size * num_elements * inputBVecSize, input_ptr[1], &err); test_error(err, "clCreateBuffer failed"); - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), type_size * num_elements * inputCVecSize, input_ptr[2], &err ); + streams[2] = clCreateBuffer( + context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + type_size * num_elements * inputCVecSize, input_ptr[2], &err); test_error(err, "clCreateBuffer failed"); - streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_WRITE_ONLY), type_size * num_elements * vectorSize, NULL, &err ); + streams[3] = + clCreateBuffer(context, CL_MEM_WRITE_ONLY, + type_size * num_elements * vectorSize, NULL, &err); test_error(err, "clCreateBuffer failed"); const char *vectorString = sizeNames[ vectorSize ]; diff --git a/test_conformance/integer_ops/test_integers.cpp b/test_conformance/integer_ops/test_integers.cpp index 727a77cf..8d77b24b 100644 --- a/test_conformance/integer_ops/test_integers.cpp +++ b/test_conformance/integer_ops/test_integers.cpp @@ -96,9 +96,9 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context, /* Generate some streams */ generate_random_data( vecType, vecSize * TEST_SIZE, d, inDataA ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - get_explicit_type_size( vecType ) * vecSize * TEST_SIZE, - inDataA, NULL); + streams[0] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecType) * vecSize * TEST_SIZE, inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); @@ -110,9 +110,10 @@ int test_single_param_integer_kernel(cl_command_queue queue, cl_context context, // Op kernels use an r/w buffer for the second param, so we need to init it with data generate_random_data( vecType, vecSize * TEST_SIZE, d, inDataB ); } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE | ( useOpKernel ? CL_MEM_COPY_HOST_PTR : 0 )), - get_explicit_type_size( vecType ) * vecSize * TEST_SIZE, - ( useOpKernel ) ? &inDataB : NULL, NULL ); + streams[1] = clCreateBuffer( + context, (CL_MEM_READ_WRITE | (useOpKernel ? CL_MEM_COPY_HOST_PTR : 0)), + get_explicit_type_size(vecType) * vecSize * TEST_SIZE, + (useOpKernel) ? &inDataB : NULL, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -667,25 +668,25 @@ int test_two_param_integer_kernel(cl_command_queue queue, cl_context context, co generate_random_data( vecAType, vecSize * TEST_SIZE, d, inDataA ); generate_random_data( vecBType, vecSize * TEST_SIZE, d, inDataB ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE, - &inDataA, NULL); + streams[0] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, &inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - get_explicit_type_size( vecBType ) * vecSize * TEST_SIZE, - &inDataB, NULL); + streams[1] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecBType) * vecSize * TEST_SIZE, &inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), - get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE, - NULL, NULL ); + streams[2] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, NULL, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating output array failed!\n"); @@ -1324,25 +1325,33 @@ int test_three_param_integer_kernel(cl_command_queue queue, cl_context context, generate_random_data( vecBType, vecSize * TEST_SIZE, d, inDataB ); generate_random_data( vecCType, vecSize * TEST_SIZE, d, inDataC ); - streams[0] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecAType ) * vecSize * TEST_SIZE, &inDataA, NULL); + streams[0] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecAType) * vecSize * TEST_SIZE, &inDataA, NULL); if( streams[0] == NULL ) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecBType ) * vecSize * TEST_SIZE, &inDataB, NULL); + streams[1] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecBType) * vecSize * TEST_SIZE, &inDataB, NULL); if( streams[1] == NULL ) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecCType ) * vecSize * TEST_SIZE, &inDataC, NULL); + streams[2] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecCType) * vecSize * TEST_SIZE, &inDataC, NULL); if( streams[2] == NULL ) { log_error("ERROR: Creating input array C failed!\n"); return -1; } - streams[3] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), get_explicit_type_size( destType ) * vecSize * TEST_SIZE, NULL, NULL ); + streams[3] = clCreateBuffer( + context, CL_MEM_READ_WRITE, + get_explicit_type_size(destType) * vecSize * TEST_SIZE, NULL, NULL); if( streams[3] == NULL ) { log_error("ERROR: Creating output array failed!\n"); diff --git a/test_conformance/integer_ops/test_unary_ops.cpp b/test_conformance/integer_ops/test_unary_ops.cpp index 0b4d0b81..72940eaa 100644 --- a/test_conformance/integer_ops/test_unary_ops.cpp +++ b/test_conformance/integer_ops/test_unary_ops.cpp @@ -90,9 +90,9 @@ int test_unary_op( cl_command_queue queue, cl_context context, OpKonstants which // Generate two streams. The first is our random data to test against, the second is our control stream generate_random_data( vecType, vecSize * TEST_SIZE, d, inData ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - get_explicit_type_size( vecType ) * vecSize * TEST_SIZE, - inData, &error ); + streams[0] = clCreateBuffer( + context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecType) * vecSize * TEST_SIZE, inData, &error); test_error( error, "Creating input data array failed" ); cl_uint bits; @@ -110,8 +110,8 @@ int test_unary_op( cl_command_queue queue, cl_context context, OpKonstants which // For addition ops, the MAX control value is 1. Otherwise, it's 3 controlData[ i ] &= ~0x02; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), - sizeof( controlData ), controlData, &error ); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(controlData), controlData, &error); test_error( error, "Unable to create control stream" ); // Assign streams and execute diff --git a/test_conformance/integer_ops/test_upsample.cpp b/test_conformance/integer_ops/test_upsample.cpp index 2fbbcc4b..9ae3f0c3 100644 --- a/test_conformance/integer_ops/test_upsample.cpp +++ b/test_conformance/integer_ops/test_upsample.cpp @@ -92,19 +92,24 @@ int test_upsample_2_param_fn(cl_command_queue queue, cl_context context, const c } /* Set up parameters */ - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sourceATypeSize * sourceAVecSize * count, sourceA, NULL ); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sourceATypeSize * sourceAVecSize * count, sourceA, NULL); if (!streams[0]) { log_error("ERROR: Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sourceBTypeSize * sourceBVecSize * count, sourceB, NULL ); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sourceBTypeSize * sourceBVecSize * count, sourceB, NULL); if (!streams[1]) { log_error("ERROR: Creating input array B failed!\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), outStride * count, NULL, NULL ); + streams[2] = clCreateBuffer(context, CL_MEM_READ_WRITE, outStride * count, + NULL, NULL); if (!streams[2]) { log_error("ERROR: Creating output array failed!\n"); diff --git a/test_conformance/multiple_device_context/test_multiple_devices.cpp b/test_conformance/multiple_device_context/test_multiple_devices.cpp index b6f15f64..59543ade 100644 --- a/test_conformance/multiple_device_context/test_multiple_devices.cpp +++ b/test_conformance/multiple_device_context/test_multiple_devices.cpp @@ -91,7 +91,7 @@ int test_device_set(size_t deviceCount, size_t queueCount, cl_device_id *devices for( i = 0; i < TEST_SIZE; i++ ) data[i] = genrand_int32(seed); - stream = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), + stream = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, sizeof(cl_uint) * TEST_SIZE, data, &error); test_error(error, "Unable to create test array"); diff --git a/test_conformance/profiling/copy.cpp b/test_conformance/profiling/copy.cpp index 83c5db27..46d15605 100644 --- a/test_conformance/profiling/copy.cpp +++ b/test_conformance/profiling/copy.cpp @@ -107,12 +107,14 @@ static int copy_size( cl_device_id device, cl_context context, cl_command_queue int_input_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); int_output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, &err ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, &err); if( !streams[0] ){ log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, &err ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, &err); if( !streams[1] ){ log_error("clCreateBuffer failed\n"); return -1; @@ -250,13 +252,15 @@ static int copy_partial_size( cl_device_id device, cl_context context, cl_comman inptr = (cl_int *)malloc(sizeof(cl_int) * num_elements); outptr = (cl_int *)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, &err ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, &err); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, &err ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, &err); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -467,7 +471,7 @@ static int copy_image_size( cl_device_id device, cl_context context, } // allocate the input image - flags = (cl_mem_flags)(CL_MEM_READ_WRITE); + flags = CL_MEM_READ_WRITE; memobjs[0] = create_image_2d(context, flags, &image_format_desc, w, h, 0, NULL, &err); if( memobjs[0] == (cl_mem)0 ) { free( dst ); @@ -476,7 +480,8 @@ static int copy_image_size( cl_device_id device, cl_context context, return -1; } - memobjs[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), num_bytes, NULL, &err ); + memobjs[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, num_bytes, NULL, &err); if( memobjs[1] == (cl_mem)0 ) { clReleaseMemObject(memobjs[0]); free( dst ); @@ -784,7 +789,7 @@ int test_copy_array_to_image( cl_device_id device, cl_context context, cl_comman } // allocate the input image - flags = (cl_mem_flags)(CL_MEM_READ_WRITE); + flags = CL_MEM_READ_WRITE; memobjs[0] = create_image_2d( context, flags, &image_format_desc, w, h, 0, NULL, &err ); if( memobjs[0] == (cl_mem)0 ){ free( dst ); @@ -793,7 +798,9 @@ int test_copy_array_to_image( cl_device_id device, cl_context context, cl_comman return -1; } - memobjs[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), channel_nbytes * num_channels*w*h, NULL, &err ); + memobjs[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + channel_nbytes * num_channels * w * h, NULL, &err); if( memobjs[1] == (cl_mem)0 ) { clReleaseMemObject( memobjs[0] ); free( dst ); diff --git a/test_conformance/profiling/execute.cpp b/test_conformance/profiling/execute.cpp index 25ebfd12..edfc043c 100644 --- a/test_conformance/profiling/execute.cpp +++ b/test_conformance/profiling/execute.cpp @@ -184,8 +184,9 @@ static int kernelFilter( cl_device_id device, cl_context context, cl_command_que threads[1] = h; // allocate the input and output image memory objects - memobjs[0] = create_image_2d( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), - &image_format_desc, w, h, 0, inptr, &err ); + memobjs[0] = + create_image_2d(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + &image_format_desc, w, h, 0, inptr, &err); if( memobjs[0] == (cl_mem)0 ){ log_error( " unable to create 2D image using create_image_2d\n" ); return -1; @@ -199,8 +200,9 @@ static int kernelFilter( cl_device_id device, cl_context context, cl_command_que } // allocate an array memory object to load the filter weights - memobjs[2] = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR ), - sizeof( cl_float ) * filter_w * filter_h, &filter_weights, &err ); + memobjs[2] = clCreateBuffer( + context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * filter_w * filter_h, &filter_weights, &err); if( memobjs[2] == (cl_mem)0 ){ log_error( " unable to create array using clCreateBuffer\n" ); clReleaseMemObject( memobjs[1] ); diff --git a/test_conformance/profiling/execute_multipass.cpp b/test_conformance/profiling/execute_multipass.cpp index 70512441..a264232e 100644 --- a/test_conformance/profiling/execute_multipass.cpp +++ b/test_conformance/profiling/execute_multipass.cpp @@ -122,14 +122,18 @@ static int run_kernel( cl_device_id device, cl_context context, cl_command_queue } // allocate the input and output image memory objects - memobjs[0] = create_image_3d( context, (cl_mem_flags)(CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR), &image_format_desc, w, h, d, 0, 0, inptr, &err ); + memobjs[0] = + create_image_3d(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR, + &image_format_desc, w, h, d, 0, 0, inptr, &err); if( memobjs[0] == (cl_mem)0 ){ log_error( " unable to create 2D image using create_image_2d\n" ); return -1; } // allocate an array memory object to load the filter weights - memobjs[1] = clCreateBuffer( context, (cl_mem_flags)( CL_MEM_READ_WRITE ), sizeof( cl_float ) * w*h*d*nChannels, NULL, &err ); + memobjs[1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * w * h * d * nChannels, NULL, &err); if( memobjs[1] == (cl_mem)0 ){ log_error( " unable to create array using clCreateBuffer\n" ); clReleaseMemObject( memobjs[0] ); diff --git a/test_conformance/profiling/readArray.cpp b/test_conformance/profiling/readArray.cpp index 2260c28c..85ab9a27 100644 --- a/test_conformance/profiling/readArray.cpp +++ b/test_conformance/profiling/readArray.cpp @@ -639,7 +639,8 @@ int test_stream_read( cl_device_id device, cl_context context, cl_command_queue log_error( " unable to allocate %d bytes for outptr\n", (int)( ptrSizes[i] * num_elements ) ); return -1; } - streams[i] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), ptrSizes[i] * num_elements, NULL, &err ); + streams[i] = clCreateBuffer(context, CL_MEM_READ_WRITE, + ptrSizes[i] * num_elements, NULL, &err); if( !streams[i] ){ log_error( " clCreateBuffer failed\n" ); free( outptr[i] ); diff --git a/test_conformance/profiling/readImage.cpp b/test_conformance/profiling/readImage.cpp index 191044e1..9ba6b472 100644 --- a/test_conformance/profiling/readImage.cpp +++ b/test_conformance/profiling/readImage.cpp @@ -167,7 +167,7 @@ int read_image( cl_device_id device, cl_context context, cl_command_queue queue, } // allocate the input and output image memory objects - flags = (cl_mem_flags)(CL_MEM_READ_WRITE); + flags = CL_MEM_READ_WRITE; memobjs[0] = create_image_2d( context, flags, &image_format_desc, w, h, 0, NULL, &err ); if( memobjs[0] == (cl_mem)0 ){ free( dst ); @@ -176,7 +176,8 @@ int read_image( cl_device_id device, cl_context context, cl_command_queue queue, return -1; } - memobjs[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), channel_nbytes * 4 * w * h, NULL, &err ); + memobjs[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + channel_nbytes * 4 * w * h, NULL, &err); if( memobjs[1] == (cl_mem)0 ){ free( dst ); free( (void *)inptr ); diff --git a/test_conformance/profiling/writeArray.cpp b/test_conformance/profiling/writeArray.cpp index c3481e60..acfe8f29 100644 --- a/test_conformance/profiling/writeArray.cpp +++ b/test_conformance/profiling/writeArray.cpp @@ -639,7 +639,8 @@ int test_stream_write( cl_device_id device, cl_context context, cl_command_queue for( i = 0; i < loops; i++ ){ ii = i << 1; - streams[ii] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), ptrSizes[i] * num_elements, NULL, &err ); + streams[ii] = clCreateBuffer(context, CL_MEM_READ_WRITE, + ptrSizes[i] * num_elements, NULL, &err); if( ! streams[ii] ){ free( outptr[i] ); log_error( " clCreateBuffer failed\n" ); @@ -647,11 +648,15 @@ int test_stream_write( cl_device_id device, cl_context context, cl_command_queue } if( ! strcmp( type, "half" ) ){ outptr[i] = malloc( outPtrSizes[i] * num_elements * 2 ); - streams[ii+1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), outPtrSizes[i] * 2 * num_elements, NULL, &err ); + streams[ii + 1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + outPtrSizes[i] * 2 * num_elements, NULL, &err); } else{ outptr[i] = malloc( outPtrSizes[i] * num_elements ); - streams[ii+1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), outPtrSizes[i] * num_elements, NULL, &err ); + streams[ii + 1] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + outPtrSizes[i] * num_elements, NULL, &err); } if( ! streams[ii+1] ){ clReleaseMemObject(streams[ii]); diff --git a/test_conformance/profiling/writeImage.cpp b/test_conformance/profiling/writeImage.cpp index 2615250a..fbc8fbcd 100644 --- a/test_conformance/profiling/writeImage.cpp +++ b/test_conformance/profiling/writeImage.cpp @@ -452,7 +452,7 @@ int write_image( cl_device_id device, cl_context context, cl_command_queue queue } // allocate the input and output image memory objects - flags = (cl_mem_flags)(CL_MEM_READ_WRITE); + flags = CL_MEM_READ_WRITE; memobjs[0] = create_image_2d( context, flags, &image_format_desc, w, h, 0, NULL, &err ); if( memobjs[0] == (cl_mem)0 ){ free( dst ); @@ -461,7 +461,8 @@ int write_image( cl_device_id device, cl_context context, cl_command_queue queue return -1; } - memobjs[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), channel_nbytes * 4 * w * h, NULL, &err ); + memobjs[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + channel_nbytes * 4 * w * h, NULL, &err); if( memobjs[1] == (cl_mem)0 ){ free( dst ); free( (void *)inptr ); diff --git a/test_conformance/relationals/test_comparisons_double.cpp b/test_conformance/relationals/test_comparisons_double.cpp index 9dc737fd..3fe1124c 100644 --- a/test_conformance/relationals/test_comparisons_double.cpp +++ b/test_conformance/relationals/test_comparisons_double.cpp @@ -151,13 +151,17 @@ int test_equiv_kernel_double(cl_context context, cl_command_queue queue, const c generate_equiv_test_data_double( inDataA, vecSize, true, d ); generate_equiv_test_data_double( inDataB, vecSize, false, d ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof( cl_double ) * vecSize * TEST_SIZE, &inDataA, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, + &inDataA, &error); if( streams[0] == NULL ) { print_error( error, "Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof( cl_double ) * vecSize * TEST_SIZE, &inDataB, &error); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_double) * vecSize * TEST_SIZE, + &inDataB, &error); if( streams[1] == NULL ) { print_error( error, "Creating input array A failed!\n"); diff --git a/test_conformance/relationals/test_comparisons_float.cpp b/test_conformance/relationals/test_comparisons_float.cpp index e8178d84..989c70c7 100644 --- a/test_conformance/relationals/test_comparisons_float.cpp +++ b/test_conformance/relationals/test_comparisons_float.cpp @@ -158,13 +158,17 @@ int test_equiv_kernel_float(cl_context context, cl_command_queue queue, const ch generate_equiv_test_data_float( inDataA, vecSize, true, d ); generate_equiv_test_data_float( inDataB, vecSize, false, d ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof( cl_float ) * vecSize * TEST_SIZE, &inDataA, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, + &inDataA, &error); if( streams[0] == NULL ) { print_error( error, "Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof( cl_float ) * vecSize * TEST_SIZE, &inDataB, &error); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_float) * vecSize * TEST_SIZE, + &inDataB, &error); if( streams[1] == NULL ) { print_error( error, "Creating input array A failed!\n"); diff --git a/test_conformance/relationals/test_relationals.cpp b/test_conformance/relationals/test_relationals.cpp index 70952409..5a874af7 100644 --- a/test_conformance/relationals/test_relationals.cpp +++ b/test_conformance/relationals/test_relationals.cpp @@ -89,13 +89,19 @@ int test_any_all_kernel(cl_context context, cl_command_queue queue, generate_random_data( vecType, TEST_SIZE * g_vector_aligns[vecSize], d, inDataA ); memset( clearData, 0, sizeof( clearData ) ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecType ) * g_vector_aligns[vecSize] * TEST_SIZE, &inDataA, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecType) + * g_vector_aligns[vecSize] * TEST_SIZE, + &inDataA, &error); if( streams[0] == NULL ) { print_error( error, "Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), sizeof(cl_int) * g_vector_aligns[vecSize] * TEST_SIZE, clearData, &error ); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + sizeof(cl_int) * g_vector_aligns[vecSize] * TEST_SIZE, + clearData, &error); if( streams[1] == NULL ) { print_error( error, "Creating output array failed!\n"); @@ -363,19 +369,28 @@ int test_select_kernel(cl_context context, cl_command_queue queue, const char *f generate_random_data( vecType, TEST_SIZE * g_vector_aligns[vecSize], d, inDataB ); generate_random_data( testVecType, TEST_SIZE * g_vector_aligns[vecSize], d, inDataC ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecType ) * g_vector_aligns[vecSize] * TEST_SIZE, &inDataA, &error); + streams[0] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecType) + * g_vector_aligns[vecSize] * TEST_SIZE, + &inDataA, &error); if( streams[0] == NULL ) { print_error( error, "Creating input array A failed!\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( vecType ) * g_vector_aligns[vecSize] * TEST_SIZE, &inDataB, &error); + streams[1] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(vecType) + * g_vector_aligns[vecSize] * TEST_SIZE, + &inDataB, &error); if( streams[1] == NULL ) { print_error( error, "Creating input array A failed!\n"); return -1; } - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), get_explicit_type_size( testVecType ) * g_vector_aligns[vecSize] * TEST_SIZE, &inDataC, &error); + streams[2] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + get_explicit_type_size(testVecType) + * g_vector_aligns[vecSize] * TEST_SIZE, + &inDataC, &error); if( streams[2] == NULL ) { print_error( error, "Creating input array A failed!\n"); diff --git a/test_conformance/relationals/test_shuffles.cpp b/test_conformance/relationals/test_shuffles.cpp index c784b650..5fd3b6c5 100644 --- a/test_conformance/relationals/test_shuffles.cpp +++ b/test_conformance/relationals/test_shuffles.cpp @@ -621,16 +621,22 @@ int test_shuffle_dual_kernel(cl_context context, cl_command_queue queue, if( shuffleMode == kBuiltInDualInputFnMode ) generate_random_data( vecType, (unsigned int)( numOrders * inVecSize ), d, inSecondData ); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * inVecSize * numOrders, inData, &error); + streams[0] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + typeSize * inVecSize * numOrders, inData, &error); test_error( error, "Unable to create input stream" ); - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * outRealVecSize * numOrders, outData, &error); + streams[1] = + clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + typeSize * outRealVecSize * numOrders, outData, &error); test_error( error, "Unable to create output stream" ); int argIndex = 0; if( shuffleMode == kBuiltInDualInputFnMode ) { - streams[2] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_COPY_HOST_PTR), typeSize * inVecSize * numOrders, inSecondData, &error); + streams[2] = clCreateBuffer(context, CL_MEM_COPY_HOST_PTR, + typeSize * inVecSize * numOrders, + inSecondData, &error); test_error( error, "Unable to create second input stream" ); error = clSetKernelArg( kernel, argIndex++, sizeof( streams[ 2 ] ), &streams[ 2 ] ); diff --git a/test_conformance/spir/kernelargs.h b/test_conformance/spir/kernelargs.h index 2aa86d7a..7c5673e8 100644 --- a/test_conformance/spir/kernelargs.h +++ b/test_conformance/spir/kernelargs.h @@ -348,9 +348,9 @@ public: if( NULL != buffer ) { int error = CL_SUCCESS; - m_memObj = clCreateBuffer( context, - (cl_mem_flags)( CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR ), - size, buffer, &error ); + m_memObj = clCreateBuffer(context, + CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, + size, buffer, &error); if( error != CL_SUCCESS ) { throw Exceptions::TestError("clCreateBuffer failed\n", error); diff --git a/test_conformance/thread_dimensions/test_thread_dimensions.cpp b/test_conformance/thread_dimensions/test_thread_dimensions.cpp index 84f5708f..c8d22c66 100644 --- a/test_conformance/thread_dimensions/test_thread_dimensions.cpp +++ b/test_conformance/thread_dimensions/test_thread_dimensions.cpp @@ -501,7 +501,8 @@ test_thread_dimensions(cl_device_id device, cl_context context, cl_command_queue log_info("Memory allocation size to use is %gMB, max workgroup size is %d.\n", max_memory_size/(1024.0*1024.0), (int)max_workgroup_size); while (!found_size && memory_size >= max_memory_size/8) { - array = clCreateBuffer(context, (cl_mem_flags)(CL_MEM_READ_WRITE), memory_size, NULL, &err); + array = + clCreateBuffer(context, CL_MEM_READ_WRITE, memory_size, NULL, &err); if (err == CL_MEM_OBJECT_ALLOCATION_FAILURE || err == CL_OUT_OF_HOST_MEMORY) { memory_size -= max_memory_size/16; continue; diff --git a/test_conformance/workgroups/test_wg_all.cpp b/test_conformance/workgroups/test_wg_all.cpp index 33ebe993..2148fba7 100644 --- a/test_conformance/workgroups/test_wg_all.cpp +++ b/test_conformance/workgroups/test_wg_all.cpp @@ -91,14 +91,17 @@ test_work_group_all(cl_device_id device, cl_context context, cl_command_queue qu input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * (num_elements+1)); output_ptr = (cl_int*)malloc(sizeof(cl_int) * (num_elements+1)); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * (num_elements+1), NULL, NULL ); + streams[0] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * (num_elements + 1), NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_any.cpp b/test_conformance/workgroups/test_wg_any.cpp index cd1ebffc..35ce0d52 100644 --- a/test_conformance/workgroups/test_wg_any.cpp +++ b/test_conformance/workgroups/test_wg_any.cpp @@ -91,14 +91,17 @@ test_work_group_any(cl_device_id device, cl_context context, cl_command_queue qu input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * (num_elements+1)); output_ptr = (cl_int*)malloc(sizeof(cl_int) * (num_elements+1)); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * (num_elements+1), NULL, NULL ); + streams[0] = + clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * (num_elements + 1), NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_broadcast.cpp b/test_conformance/workgroups/test_wg_broadcast.cpp index df4263b9..3da14fb5 100644 --- a/test_conformance/workgroups/test_wg_broadcast.cpp +++ b/test_conformance/workgroups/test_wg_broadcast.cpp @@ -186,14 +186,16 @@ test_work_group_broadcast_1D(cl_device_id device, cl_context context, cl_command input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -311,14 +313,16 @@ test_work_group_broadcast_2D(cl_device_id device, cl_context context, cl_command input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -435,14 +439,16 @@ test_work_group_broadcast_3D(cl_device_id device, cl_context context, cl_command input_ptr[0] = (cl_float*)malloc(sizeof(cl_float) * num_elements); output_ptr = (cl_float*)malloc(sizeof(cl_float) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_float) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_float) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_reduce.cpp b/test_conformance/workgroups/test_wg_reduce.cpp index 92a5165e..5da7284a 100644 --- a/test_conformance/workgroups/test_wg_reduce.cpp +++ b/test_conformance/workgroups/test_wg_reduce.cpp @@ -188,14 +188,16 @@ test_work_group_reduce_add_int(cl_device_id device, cl_context context, cl_comma input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -289,14 +291,16 @@ test_work_group_reduce_add_uint(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -389,14 +393,16 @@ test_work_group_reduce_add_long(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -490,14 +496,16 @@ test_work_group_reduce_add_ulong(cl_device_id device, cl_context context, cl_com input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_reduce_max.cpp b/test_conformance/workgroups/test_wg_reduce_max.cpp index 7f37b5ad..2464beda 100644 --- a/test_conformance/workgroups/test_wg_reduce_max.cpp +++ b/test_conformance/workgroups/test_wg_reduce_max.cpp @@ -197,14 +197,16 @@ test_work_group_reduce_max_int(cl_device_id device, cl_context context, cl_comma input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -307,14 +309,16 @@ test_work_group_reduce_max_uint(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -416,14 +420,16 @@ test_work_group_reduce_max_long(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -526,14 +532,16 @@ test_work_group_reduce_max_ulong(cl_device_id device, cl_context context, cl_com input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_reduce_min.cpp b/test_conformance/workgroups/test_wg_reduce_min.cpp index 9d929c81..f415aa74 100644 --- a/test_conformance/workgroups/test_wg_reduce_min.cpp +++ b/test_conformance/workgroups/test_wg_reduce_min.cpp @@ -197,14 +197,16 @@ test_work_group_reduce_min_int(cl_device_id device, cl_context context, cl_comma input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -307,14 +309,16 @@ test_work_group_reduce_min_uint(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -416,14 +420,16 @@ test_work_group_reduce_min_long(cl_device_id device, cl_context context, cl_comm input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -526,14 +532,16 @@ test_work_group_reduce_min_ulong(cl_device_id device, cl_context context, cl_com input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_exclusive_add.cpp b/test_conformance/workgroups/test_wg_scan_exclusive_add.cpp index 40c50c8c..07eedc16 100644 --- a/test_conformance/workgroups/test_wg_scan_exclusive_add.cpp +++ b/test_conformance/workgroups/test_wg_scan_exclusive_add.cpp @@ -196,14 +196,16 @@ test_work_group_scan_exclusive_add_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -297,14 +299,16 @@ test_work_group_scan_exclusive_add_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -397,14 +401,16 @@ test_work_group_scan_exclusive_add_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -498,14 +504,16 @@ test_work_group_scan_exclusive_add_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_exclusive_max.cpp b/test_conformance/workgroups/test_wg_scan_exclusive_max.cpp index 7f37acd2..d20a3199 100644 --- a/test_conformance/workgroups/test_wg_scan_exclusive_max.cpp +++ b/test_conformance/workgroups/test_wg_scan_exclusive_max.cpp @@ -196,14 +196,16 @@ test_work_group_scan_exclusive_max_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -306,14 +308,16 @@ test_work_group_scan_exclusive_max_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -415,14 +419,16 @@ test_work_group_scan_exclusive_max_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -525,14 +531,16 @@ test_work_group_scan_exclusive_max_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_exclusive_min.cpp b/test_conformance/workgroups/test_wg_scan_exclusive_min.cpp index 61110533..eb997960 100644 --- a/test_conformance/workgroups/test_wg_scan_exclusive_min.cpp +++ b/test_conformance/workgroups/test_wg_scan_exclusive_min.cpp @@ -197,14 +197,16 @@ test_work_group_scan_exclusive_min_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -307,14 +309,16 @@ test_work_group_scan_exclusive_min_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -416,14 +420,16 @@ test_work_group_scan_exclusive_min_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -526,14 +532,16 @@ test_work_group_scan_exclusive_min_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_inclusive_add.cpp b/test_conformance/workgroups/test_wg_scan_inclusive_add.cpp index 9546794b..bff0b0f7 100644 --- a/test_conformance/workgroups/test_wg_scan_inclusive_add.cpp +++ b/test_conformance/workgroups/test_wg_scan_inclusive_add.cpp @@ -185,14 +185,16 @@ test_work_group_scan_inclusive_add_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -286,14 +288,16 @@ test_work_group_scan_inclusive_add_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -386,14 +390,16 @@ test_work_group_scan_inclusive_add_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -487,14 +493,16 @@ test_work_group_scan_inclusive_add_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_inclusive_max.cpp b/test_conformance/workgroups/test_wg_scan_inclusive_max.cpp index 23d518c8..c2455e9c 100644 --- a/test_conformance/workgroups/test_wg_scan_inclusive_max.cpp +++ b/test_conformance/workgroups/test_wg_scan_inclusive_max.cpp @@ -187,14 +187,16 @@ test_work_group_scan_inclusive_max_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -288,14 +290,16 @@ test_work_group_scan_inclusive_max_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -388,14 +392,16 @@ test_work_group_scan_inclusive_max_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -489,14 +495,16 @@ test_work_group_scan_inclusive_max_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); diff --git a/test_conformance/workgroups/test_wg_scan_inclusive_min.cpp b/test_conformance/workgroups/test_wg_scan_inclusive_min.cpp index f4c788f5..a73c35a6 100644 --- a/test_conformance/workgroups/test_wg_scan_inclusive_min.cpp +++ b/test_conformance/workgroups/test_wg_scan_inclusive_min.cpp @@ -187,14 +187,16 @@ test_work_group_scan_inclusive_min_int(cl_device_id device, cl_context context, input_ptr[0] = (cl_int*)malloc(sizeof(cl_int) * num_elements); output_ptr = (cl_int*)malloc(sizeof(cl_int) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_int) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_int) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -288,14 +290,16 @@ test_work_group_scan_inclusive_min_uint(cl_device_id device, cl_context context, input_ptr[0] = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); output_ptr = (cl_uint*)malloc(sizeof(cl_uint) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_uint) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_uint) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -388,14 +392,16 @@ test_work_group_scan_inclusive_min_long(cl_device_id device, cl_context context, input_ptr[0] = (cl_long*)malloc(sizeof(cl_long) * num_elements); output_ptr = (cl_long*)malloc(sizeof(cl_long) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_long) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_long) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); @@ -489,14 +495,16 @@ test_work_group_scan_inclusive_min_ulong(cl_device_id device, cl_context context input_ptr[0] = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); output_ptr = (cl_ulong*)malloc(sizeof(cl_ulong) * num_elements); - streams[0] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[0]) { log_error("clCreateBuffer failed\n"); return -1; } - streams[1] = clCreateBuffer( context, (cl_mem_flags)(CL_MEM_READ_WRITE), sizeof(cl_ulong) * num_elements, NULL, NULL ); + streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE, + sizeof(cl_ulong) * num_elements, NULL, NULL); if (!streams[1]) { log_error("clCreateBuffer failed\n"); From 0a8c5feed73d9480fef1df8efb221ae3c4863729 Mon Sep 17 00:00:00 2001 From: james-morrissey-arm Date: Mon, 19 Oct 2020 13:57:01 +0100 Subject: [PATCH 33/37] Fix floating point validation in write_image tests (#1017) Fix validate_float/half_write_results so that when nan/inf is encountered on a channel, the rest of the channel values are still considered for correctness. Signed-off-by: John Kesapides Signed-off-by: James Morrissey Co-authored-by: John Kesapides --- .../images/kernel_read_write/test_iterations.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index 7281564b..c518b768 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -1174,8 +1174,11 @@ bool validate_float_write_results( float *expected, float *actual, image_descrip continue; if ( IsFloatSubnormal( expected[j] ) && actual[j] == 0.0f ) continue; - pass = false; - break; + if (expected[j] != actual[j]) + { + pass = false; + break; + } } } return pass; @@ -1193,8 +1196,11 @@ bool validate_half_write_results( cl_half *expected, cl_half *actual, image_desc continue; if ( is_half_denorm( expected[j] ) && is_half_zero( actual[j] ) ) continue; - pass = false; - break; + if (expected[j] != actual[j]) + { + pass = false; + break; + } } } return pass; From 90c9ea5d7c3c3a6aeb7c86e1874d75a153f111c7 Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Mon, 19 Oct 2020 13:58:35 +0100 Subject: [PATCH 34/37] Fix compilation failure with -Werror=narrowing (#901) Signed-off-by: Stuart Brady --- test_common/harness/conversions.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_common/harness/conversions.cpp b/test_common/harness/conversions.cpp index 3c5ec964..633c6382 100644 --- a/test_common/harness/conversions.cpp +++ b/test_common/harness/conversions.cpp @@ -206,8 +206,8 @@ static Long sLowerLimits[ kNumExplicitTypes ] = -1, -128, 0, 0, -32768, 0, 0, - 0xffffffff80000000LL, 0, 0, - 0x8000000000000000LL, 0, 0, + (Long)0xffffffff80000000LL, 0, 0, + (Long)0x8000000000000000LL, 0, 0, 0, 0 }; // Last two values aren't stored here #define BOOL_CASE(inType) \ From b165de7649b7c8930c638884e8385ed58b47dc2f Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Mon, 19 Oct 2020 16:08:06 -0600 Subject: [PATCH 35/37] conversions: Use ARM emulation for aarch64 (#967) The host compiler will not always calculate reference values the same, depending on optimization level. It generates instructions that do not respond to CPU rounding mode in the same way. Use QCOM rounding mode emulation to correctly calculate reference values on aarch64. --- test_conformance/conversions/CMakeLists.txt | 2 +- .../conversions/basic_test_conversions.cpp | 36 ++++++++++++------- .../conversions/test_conversions.cpp | 20 +++++++---- 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/test_conformance/conversions/CMakeLists.txt b/test_conformance/conversions/CMakeLists.txt index 8886ba0f..523b6ead 100644 --- a/test_conformance/conversions/CMakeLists.txt +++ b/test_conformance/conversions/CMakeLists.txt @@ -4,7 +4,7 @@ set (${MODULE_NAME}_SOURCES Sleep.cpp test_conversions.cpp basic_test_conversions.cpp ) -if("${CLConform_TARGET_ARCH}" STREQUAL "ARM") +if("${CLConform_TARGET_ARCH}" STREQUAL "ARM" OR "${CLConform_TARGET_ARCH}" STREQUAL "ARM64") list(APPEND ${MODULE_NAME}_SOURCES fplib.cpp) endif() diff --git a/test_conformance/conversions/basic_test_conversions.cpp b/test_conformance/conversions/basic_test_conversions.cpp index d32694a1..44417262 100644 --- a/test_conformance/conversions/basic_test_conversions.cpp +++ b/test_conformance/conversions/basic_test_conversions.cpp @@ -21,11 +21,11 @@ #include "harness/mt19937.h" -#if defined( __arm__ ) && defined( __GNUC__ ) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) #include "fplib.h" #endif -#if defined( __arm__ ) && defined( __GNUC__ ) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) /* Rounding modes and saturation for use with qcom 64 bit to float conversion library */ bool qcom_sat; roundingMode qcom_rm; @@ -759,12 +759,18 @@ static void ulong2float( void *out, void *in) ((float*) out)[0] = (l == 0 ? 0.0f : (((cl_long)l < 0) ? result * 2.0f : result)); #else cl_ulong l = ((cl_ulong*) in)[0]; -#if defined( __arm__ ) && defined( __GNUC__ ) - /* ARM VFP doesn't have hardware instruction for converting from 64-bit integer to float types, hence GCC ARM uses the floating-point emulation code - * despite which -mfloat-abi setting it is. But the emulation code in libgcc.a has only one rounding mode (round to nearest even in this case) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) + /* ARM VFP doesn't have hardware instruction for converting from 64-bit + * integer to float types, hence GCC ARM uses the floating-point emulation + * code despite which -mfloat-abi setting it is. But the emulation code in + * libgcc.a has only one rounding mode (round to nearest even in this case) * and ignores the user rounding mode setting in hardware. - * As a result setting rounding modes in hardware won't give correct rounding results for type covert from 64-bit integer to float using GCC for ARM compiler - * so for testing different rounding modes, we need to use alternative reference function */ + * As a result setting rounding modes in hardware won't give correct + * rounding results for type covert from 64-bit integer to float using GCC + * for ARM compiler so for testing different rounding modes, we need to use + * alternative reference function. ARM64 does have an instruction, however + * we cannot guarantee the compiler will use it. On all ARM architechures + * use emulation to calculate reference.*/ ((float*) out)[0] = qcom_u64_2_f32(l, qcom_sat, qcom_rm); #else ((float*) out)[0] = (l == 0 ? 0.0f : (float) l); // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0 @@ -806,12 +812,18 @@ static void long2float( void *out, void *in) ((float*) out)[0] = (l == 0 ? 0.0f : result); // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0 #else cl_long l = ((cl_long*) in)[0]; -#if defined( __arm__ ) && defined( __GNUC__ ) - /* ARM VFP doesn't have hardware instruction for converting from 64-bit integer to float types, hence GCC ARM uses the floating-point emulation code - * despite which -mfloat-abi setting it is. But the emulation code in libgcc.a has only one rounding mode (round to nearest even in this case) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) + /* ARM VFP doesn't have hardware instruction for converting from 64-bit + * integer to float types, hence GCC ARM uses the floating-point emulation + * code despite which -mfloat-abi setting it is. But the emulation code in + * libgcc.a has only one rounding mode (round to nearest even in this case) * and ignores the user rounding mode setting in hardware. - * As a result setting rounding modes in hardware won't give correct rounding results for type covert from 64-bit integer to float using GCC for ARM compiler - * so for testing different rounding modes, we need to use alternative reference function */ + * As a result setting rounding modes in hardware won't give correct + * rounding results for type covert from 64-bit integer to float using GCC + * for ARM compiler so for testing different rounding modes, we need to use + * alternative reference function. ARM64 does have an instruction, however + * we cannot guarantee the compiler will use it. On all ARM architechures + * use emulation to calculate reference.*/ ((float*) out)[0] = (l == 0 ? 0.0f : qcom_s64_2_f32(l, qcom_sat, qcom_rm)); #else ((float*) out)[0] = (l == 0 ? 0.0f : (float) l); // Per IEEE-754-2008 5.4.1, 0's always convert to +0.0 diff --git a/test_conformance/conversions/test_conversions.cpp b/test_conformance/conversions/test_conversions.cpp index 2af85558..87b8ead7 100644 --- a/test_conformance/conversions/test_conversions.cpp +++ b/test_conformance/conversions/test_conversions.cpp @@ -65,7 +65,7 @@ #define kCallStyleCount (kVectorSizeCount + 1 /* for implicit scalar */) -#if defined( __arm__ ) && defined( __GNUC__ ) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) #include "fplib.h" extern bool qcom_sat; extern roundingMode qcom_rm; @@ -884,12 +884,18 @@ cl_int PrepareReference( cl_uint job_id, cl_uint thread_id, void *p ) if( info->sat ) f = gSaturatedConversions[ outType ][ inType ]; -#if defined( __arm__ ) && defined( __GNUC__ ) - /* ARM VFP doesn't have hardware instruction for converting from 64-bit integer to float types, hence GCC ARM uses the floating-point emulation code - * despite which -mfloat-abi setting it is. But the emulation code in libgcc.a has only one rounding mode (round to nearest even in this case) - * and ignores the user rounding mode setting in hardware. - * As a result setting rounding modes in hardware won't give correct rounding results for type covert from 64-bit integer to float using GCC for ARM compiler - * so for testing different rounding modes, we need to use alternative reference function */ +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) + /* ARM VFP doesn't have hardware instruction for converting from 64-bit + * integer to float types, hence GCC ARM uses the floating-point + * emulation code despite which -mfloat-abi setting it is. But the + * emulation code in libgcc.a has only one rounding mode (round to + * nearest even in this case) and ignores the user rounding mode setting + * in hardware. As a result setting rounding modes in hardware won't + * give correct rounding results for type covert from 64-bit integer to + * float using GCC for ARM compiler so for testing different rounding + * modes, we need to use alternative reference function. ARM64 does have + * an instruction, however we cannot guarantee the compiler will use it. + * On all ARM architechures use emulation to calculate reference.*/ switch (round) { /* conversions to floating-point type use the current rounding mode. From 8d44302935fa59593bbb1d8606cb83286d5e50a8 Mon Sep 17 00:00:00 2001 From: Kenneth Benzie Date: Tue, 20 Oct 2020 07:08:40 +0100 Subject: [PATCH 36/37] Return a non-zero exit-code when a sub-test fails (#951) When running sub-tests explicitly on the command line and that sub-test fails, the test harness returns `0` from `main()`. This is problematic in automated testing environments as failed tests can be hidden. This patch iterates over all the test results in the `resultTestList` after all sub-tests have completed, if any of the tests failed a non-zero value is returned from `parseAndCallCommandLineTests()` which is then propagated up the call stack to `main()`. --- test_common/harness/testHarness.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 83a575b4..51bbba05 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -15,6 +15,7 @@ // #include "testHarness.h" #include "compat.h" +#include #include #include #include @@ -639,6 +640,19 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev } } + if (std::any_of(resultTestList, resultTestList + testNum, + [](test_status result) { + switch (result) + { + case TEST_PASS: + case TEST_SKIP: return false; + case TEST_FAIL: return true; + }; + })) + { + ret = EXIT_FAILURE; + } + free( selectedTestList ); free( resultTestList ); From 6adf4ead5cc39f405568ff4f30095dcccaecd9a4 Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Wed, 21 Oct 2020 03:02:22 -0600 Subject: [PATCH 37/37] build: Various improvements. (#743) (#1006) - Remove the build_ scripts that were simply calling cmake in favor of using cmake directly - Move flag CRT_SECURE_NO_WARNING into a section specifically for visual studio - Change vendor file selection to just use the file if present - Add a variable for determining whether to link against pthread - Delete all lines in CMakeVendor.txt so each implementation can define their own Change-Id: Ibbd83521ce4d42d09dcbd0b16efa9fbe6cbf785d --- .gitignore | 4 - CMakeLists.txt | 28 ++-- CMakeVendor.txt | 8 -- build_android.py | 161 ----------------------- build_lnx.sh | 12 -- build_win.bat | 32 ----- test_conformance/CMakeLists.txt | 4 +- test_conformance/compiler/CMakeLists.txt | 28 ++-- 8 files changed, 35 insertions(+), 242 deletions(-) delete mode 100644 .gitignore delete mode 100644 CMakeVendor.txt delete mode 100755 build_android.py delete mode 100755 build_lnx.sh delete mode 100644 build_win.bat diff --git a/.gitignore b/.gitignore deleted file mode 100644 index b826e68b..00000000 --- a/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# build directories -build/ -build_lnx/ -build_win/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d8206637..64f513e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.5.1) set( CONFORMANCE_SUFFIX "" ) set(CLConform_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -60,10 +60,7 @@ set(CONFORMANCE_SUFFIX "" ) #----------------------------------------------------------- #Vendor Customization File can be included here to provide a way to automatically #build driver as a dependency of the conformance tests, or other such CMake customization -option(USE_VENDOR_CUSTOM_FILE "Use Vendor Customization File" OFF) -if(USE_VENDOR_CUSTOM_FILE) - include(CMakeVendor.txt OPTIONAL) -endif(USE_VENDOR_CUSTOM_FILE) +include(CMakeVendor.txt OPTIONAL) #----------------------------------------------------------- # Development options for OpenCL C++ tests @@ -175,17 +172,30 @@ else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D__SSE__") endif() +if(MSVC) + # Don't warn when using standard non-secure functions. + add_compile_definitions(_CRT_SECURE_NO_WARNINGS) +endif() + if( WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel" ) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Qlong-double -Qpc80 /DWIN32 /D_WINDOWS /W3 /GR /EHsc -nologo -Od -D_CRT_NONSTDC_NO_WARNINGS -EHsc -Wall -Qdiag-disable:68,111,177,186,161,869,1028,2259,2553,181,239,265,1188 -fp:strict -fp:source") endif() list(APPEND CLConform_LIBRARIES ${OPENCL_LIBRARIES}) if(ANDROID) list(APPEND CLConform_LIBRARIES m) -elseif(NOT WIN32) +endif() +if(NOT DEFINED LINK_PTHREAD) + if(ANDROID OR WIN32) + set(LINK_PTHREAD OFF) + else() + set(LINK_PTHREAD ON) + endif() +endif() +if(LINK_PTHREAD) list(APPEND CLConform_LIBRARIES pthread) -endif(ANDROID) +endif() if(APPLE) find_library(corefoundation CoreFoundation) diff --git a/CMakeVendor.txt b/CMakeVendor.txt deleted file mode 100644 index 14486ece..00000000 --- a/CMakeVendor.txt +++ /dev/null @@ -1,8 +0,0 @@ -# We intentionally hardcode "_win32" to ensure backwards compatibility (to avoid breaking HAAVE) -if(ANDROID) - if(ARM64_V8A) - set(ARCH "64") - else(ARM64_V8A) - set(ARCH "32") - endif(ARM64_V8A) -endif (ANDROID) diff --git a/build_android.py b/build_android.py deleted file mode 100755 index e1b8c1e9..00000000 --- a/build_android.py +++ /dev/null @@ -1,161 +0,0 @@ -#!/usr/bin/python - - -#-------------------------------------------------------------------------------# -# android-cmake and android-ndk based build script for conformance -#-------------------------------------------------------------------------------# -""" -Dependencies: - -1) android-ndk version android-ndk-r10d or higher is required. Further, the environment - variable ANDROID_NDK should be defined to point to it. - -2) android-cmake should be installed (else the script can install it for you). If installed, - the environment variable ANDROID_CMAKE should point to install location, unless it is in the current - working directory in which case it is picked up by default. - -3) CL_INCLUDE_DIR should be defined to point to CL headers. Alternately, this can be provided - as an input (-I) - -4) Path to opencl library to link against (libOpenCL.so) can be provided using -L. If this isn't - available the script will try to use CL_LIB_DIR_64 or CL_LIB_DIR_32 environment variables - - if available - to pick up the right library for the architecture being built. - - -""" - -import os -import sys -import subprocess -import argparse -import time -import shlex - -start = time.time() -script = os.path.basename( sys.argv[ 0 ] ) - -def die (msg): - print msg - exit(-1) - -def execute (cmdline): - retcode = subprocess.call(cmdline) - if retcode != 0: - raise Exception("Failed to execute '%s', got %d" % (commandLine, retcode)) - -def build(args): - if not (args.testDir): - print("building...") - execute("make") - else: - if os.path.exists( os.path.join(args.bld_dir, "test_conformance", args.testDir) ): - os.chdir( os.path.join("test_conformance",args.testDir) ) - print("Building test: %s..." %args.testDir) - execute("make") - os.chdir(args.bld_dir) - else: - print ("Error: %s test doesn't exist" %args.testDir) - - -def configure (args): - print("configuring...") - cmdline = [] - cmdline.extend(['cmake', "-DCMAKE_TOOLCHAIN_FILE=" + os.path.join(args.android_cmake,"android.toolchain.cmake")]) - for var in args.cmake_defs : - cmdline.extend([ '-D', var ]) - cmdline.extend(['-DCL_INCLUDE_DIR=' + args.inc_dir]) - cmdline.extend(['-DCL_LIB_DIR=' + args.lib_dir]) - cmdline.extend(['-DANDROID_NATIVE_API_LEVEL=' + "android-21"]) - if args.arch == "64": - cmdline.extend(['-DANDROID_ABI=arm64-v8a']) - cmdline.extend(['-DANDROID_SO_UNDEFINED=ON']) - cmdline.extend([args.src_dir]) - execute(cmdline) - -def check_var (parser, args, name): - if not(args.__dict__[name]): - parser.error("%s needs to be defined" % name) - -def print_config(args): - print("----------CONFIGURATION--------------\n") - print("android_cmake: %s" % args.android_cmake) - print("android_ndk: %s" % args.android_ndk) - print("lib_dir: %s" % args.lib_dir) - print("inc_dir: %s" % args.inc_dir) - if len(args.cmake_defs): - print("cmake options:" + "\n:".join( [ " `%s'" % dir for dir in args.cmake_defs ] )) - print("architecture: %s" % args.arch) - print("-------------------------------------\n") - -def get_input(): - yes = set(['yes','y', 'ye', '']) - no = set(['no','n']) - - choice = raw_input().lower() - if choice in yes: - return True - elif choice in no: - return False - else: - sys.stdout.write("Please respond with 'yes' or 'no'") - exit() - -def install_android_cmake(): - parser.print_help() - print "\nandroid-cmake doesn't seem to be installed - It should be provided as a) cmdline input b) environment variable $ANDROID_CMAKE or c) present in the current directory\n" - print "if you would like to download and install it in the current directory please enter yes\n" - print "if you would like to provide an environment variable($ANDROID_CMAKE) or command-line input(--android_cmake) rerun the script enter no\n" - print "input: " - if get_input(): - print("installing android-cmake") - #subprocess.call(['git', 'clone', 'https://github.com/taka-no-me/android-cmake']) - # Use a newer fork of android-cmake which has been updated to support Clang. GCC is deprecated in newer NDKs and C11 atomics conformance doesn't build with NDK > 10. - subprocess.call(['git', 'clone', 'https://github.com/daewoong-jang/android-cmake']) - args.android_cmake = os.path.join(args.src_dir,"android-cmake") - else: - exit() - -try: - parser = argparse.ArgumentParser() - parser.add_argument('--android_cmake', dest='android_cmake', default=os.environ.get('ANDROID_CMAKE'), help="Path to android-cmake (can also be set using environment variable $ANDROID_CMAKE).") - parser.add_argument('--android_ndk', dest='android_ndk', default=os.environ.get('ANDROID_NDK'), help="Path to android-ndk (can also be set using environment variable $ANDROID_NDK).") - parser.add_argument('-L','--lib_dir', dest='lib_dir', default="", help="Path to libOpenCL to link against (can also be set using environment variable $CL_LIB_DIR_32 and $CL_LIB_DIR_64).") - parser.add_argument('-I','--include_dir', dest='inc_dir', default=os.environ.get('CL_INCLUDE_DIR'), help="Path to headers (can also be set using environment variable $CL_INCLUDE_DIR).") - parser.add_argument('-D', dest='cmake_defs', action='append', default=[], help="Define CMAKE variable") - parser.add_argument('-a','--arch', default="32", help="Architecture to build for (32 or 64)") - parser.add_argument('-t','--test', dest='testDir', default="", help="Builds the given test") - - args = parser.parse_args() - - args.src_dir = os.path.realpath(os.path.dirname( sys.argv[ 0 ])) - - if not (args.android_cmake): - if os.path.exists(os.path.join(args.src_dir,"android-cmake")): - args.android_cmake = os.path.join(args.src_dir,"android-cmake") - else: - install_android_cmake() - - if not (args.lib_dir): - lib_var_name = "CL_LIB_DIR_" + ("32" if (args.arch == "32") else "64") - args.lib_dir = os.environ.get(lib_var_name) - - check_var(parser, args, "android_cmake") - check_var(parser, args, "lib_dir") - check_var(parser, args, "inc_dir") - check_var(parser, args, "android_ndk") - - print_config(args) - - args.bld_dir = os.path.join(args.src_dir, 'bld_android_%s' % args.arch) - if not os.path.exists(args.bld_dir): - os.makedirs(args.bld_dir) - os.chdir(args.bld_dir) - - configure(args) - build(args) - - sys.exit( 0 ) - -finally: - finish = time.time() - print("Elapsed time: %.0f s." % ( finish - start ) ) diff --git a/build_lnx.sh b/build_lnx.sh deleted file mode 100755 index be0da149..00000000 --- a/build_lnx.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -mkdir -p build_lnx -cd build_lnx -cmake -G "Unix Makefiles" ../ \ - -DKHRONOS_OFFLINE_COMPILER= \ - -DCL_LIBCLCXX_DIR= \ - -DCL_INCLUDE_DIR= \ - -DCL_LIB_DIR= \ - -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=. \ - -DOPENCL_LIBRARIES=OpenCL -make --jobs 8 diff --git a/build_win.bat b/build_win.bat deleted file mode 100644 index 6ae31827..00000000 --- a/build_win.bat +++ /dev/null @@ -1,32 +0,0 @@ -@ECHO off -setlocal ENABLEDELAYEDEXPANSION - -IF DEFINED ProgramFiles(x86) SET ProgFilesDir=%ProgramFiles(x86)% -IF NOT DEFINED ProgFilesDir SET ProgFilesDir=%ProgramFiles% - -rem -------------------------------- Update these to match what's on your PC ------------------------------------------------ - -SET VCPATH="%ProgFilesDir%\Microsoft Visual Studio 14.0\Common7\IDE\devenv.com" - -SET PATH=%CMAKEPATH%;%PATH% - -rem ------------------------------------------------------------------------------------------------------------------------- - -setlocal ENABLEDELAYEDEXPANSION - -call "%VS140COMNTOOLS%\vsvars32.bat" - -mkdir build_win -pushd build_win -IF NOT EXIST CLConform.sln ( - echo "Solution file not found, running Cmake" - cmake -G "Visual Studio 14 2015 Win64" ..\. -DKHRONOS_OFFLINE_COMPILER= -DCL_LIBCLCXX_DIR= -DCL_INCLUDE_DIR= -DCL_LIB_DIR= -DCMAKE_RUNTIME_OUTPUT_DIRECTORY=. -DOPENCL_LIBRARIES=OpenCL -) else ( - echo "Solution file found CLConform.sln " -) - -echo Building CLConform.sln... -%VCPATH% CLConform.sln /build - - -GOTO:EOF diff --git a/test_conformance/CMakeLists.txt b/test_conformance/CMakeLists.txt index 83d18ea1..6714e234 100644 --- a/test_conformance/CMakeLists.txt +++ b/test_conformance/CMakeLists.txt @@ -49,7 +49,9 @@ add_subdirectory( subgroups ) add_subdirectory( workgroups ) add_subdirectory( pipes ) add_subdirectory( device_timer ) -add_subdirectory( clcpp ) +if(KHRONOS_OFFLINE_COMPILER) + add_subdirectory( clcpp ) +endif() add_subdirectory( spirv_new ) add_subdirectory( spir ) diff --git a/test_conformance/compiler/CMakeLists.txt b/test_conformance/compiler/CMakeLists.txt index 0960b1c0..e703471d 100644 --- a/test_conformance/compiler/CMakeLists.txt +++ b/test_conformance/compiler/CMakeLists.txt @@ -17,19 +17,17 @@ set(${MODULE_NAME}_SOURCES include(../CMakeCommon.txt) -# Copy required CL include directories into the binary directory - -set(COMPILER_SOURCE_DIR ${CLConform_SOURCE_DIR}/test_conformance/compiler) -set(COMPILER_TARGET ${${MODULE_NAME}_OUT}) - +# Copy the required test include directories into the build directory. +if(NOT DEFINED COMPILER_TEST_RESOURCES) + set(COMPILER_TEST_RESOURCES $) +endif() add_custom_command( - TARGET ${COMPILER_TARGET} - COMMAND ${CMAKE_COMMAND} -E copy_directory - "${COMPILER_SOURCE_DIR}/includeTestDirectory" - $/includeTestDirectory) - -add_custom_command( - TARGET ${COMPILER_TARGET} - COMMAND ${CMAKE_COMMAND} -E copy_directory - "${COMPILER_SOURCE_DIR}/secondIncludeTestDirectory" - $/secondIncludeTestDirectory) + COMMENT "Copying compiler test resources..." + TARGET ${${MODULE_NAME}_OUT} + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CLConform_SOURCE_DIR}/test_conformance/compiler/includeTestDirectory + ${COMPILER_TEST_RESOURCES}/includeTestDirectory + COMMAND ${CMAKE_COMMAND} -E copy_directory + ${CLConform_SOURCE_DIR}/test_conformance/compiler/secondIncludeTestDirectory + ${COMPILER_TEST_RESOURCES}/secondIncludeTestDirectory)