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_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/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..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) \ @@ -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/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/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 3238a956..36868f8d 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__) @@ -62,16 +62,26 @@ 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) -// 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 @@ -112,9 +122,9 @@ 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 ); @@ -125,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_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_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index 807f4338..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); @@ -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..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,18 +638,22 @@ 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); +extern const char *convert_image_type_to_string(cl_mem_object_type imageType); + + #endif // _imageHelpers_h diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index aa721180..3f73638c 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -1616,48 +1616,22 @@ 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; } 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. @@ -1693,6 +1667,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 @@ -1706,10 +1721,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. @@ -1731,6 +1747,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 eecc8f02..4b1462e5 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.h @@ -152,38 +152,48 @@ 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 */ 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_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 718983a7..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 @@ -54,8 +55,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 +402,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 ) )) { @@ -662,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 ); 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/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/api/CMakeLists.txt b/test_conformance/api/CMakeLists.txt index 20d69830..9bd6c6e4 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 @@ -32,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 8d8d20ad..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)), @@ -142,6 +143,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..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); @@ -186,3 +188,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_api_min_max.cpp b/test_conformance/api/test_api_min_max.cpp index 4d902116..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 */ @@ -692,7 +694,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 +751,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 +809,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 */ @@ -991,6 +996,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 */ @@ -1004,8 +1010,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); @@ -1021,7 +1028,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), @@ -1092,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++) { @@ -1246,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 ); @@ -1347,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" ); @@ -1513,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" ); } @@ -1721,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 a6ed7ad1..55300a62 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,54 +207,55 @@ 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); + 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."); - 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) { 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/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; +} 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/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_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 d1d36524..1b08ec92 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); @@ -47,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 ); @@ -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_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 e34aa7d9..19dfdbc7 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); @@ -46,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 ); @@ -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++) { 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 332f99de..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 @@ -213,33 +216,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 +235,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; } 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_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; +} 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 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..3f0d2c5e 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,29 @@ 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" @@ -948,51 +963,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) @@ -1037,11 +1077,13 @@ int CBasicTest::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]) { @@ -1062,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/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..6d8ffc9f 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) { @@ -1615,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(); 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/CMakeLists.txt b/test_conformance/compiler/CMakeLists.txt index 1090db38..e703471d 100644 --- a/test_conformance/compiler/CMakeLists.txt +++ b/test_conformance/compiler/CMakeLists.txt @@ -7,27 +7,27 @@ 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 test_unload_platform_compiler.cpp + test_feature_macro.cpp ) 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) diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index 45b7496d..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), @@ -89,8 +90,9 @@ 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_invalid), // disabling temporarily, see GitHub #977 ADD_TEST(unload_repeated), ADD_TEST(unload_compile_unload_link), ADD_TEST(unload_build_unload_create_kernel), @@ -98,6 +100,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..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, @@ -212,7 +214,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_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/compiler/test_feature_macro.cpp b/test_conformance/compiler/test_feature_macro.cpp new file mode 100644 index 00000000..1dd3549b --- /dev/null +++ b/test_conformance/compiler/test_feature_macro.cpp @@ -0,0 +1,761 @@ +// +// 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 Feature macro was not defined + #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 Feature macro was defined + #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()); + + if (vec_device_feature_names == vec_to_cmp) + { + 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_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; + 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; +} 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; +} 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; 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); 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. 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", 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/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; } } } 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/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, 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..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; @@ -1428,11 +1434,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 ca022629..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 @@ -472,8 +474,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..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 @@ -491,8 +493,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..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 @@ -514,8 +517,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..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 @@ -521,8 +524,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..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 @@ -538,8 +541,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/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); 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/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_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 . 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..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 @@ -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 # ######################################### @@ -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_21_full_spirv.csv b/test_conformance/opencl_conformance_tests_full_spirv.csv similarity index 99% rename from test_conformance/opencl_conformance_tests_21_full_spirv.csv rename to test_conformance/opencl_conformance_tests_full_spirv.csv index 1c2b7499..24b41865 100644 --- a/test_conformance/opencl_conformance_tests_21_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 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 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/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 1455c1e3..acfe8f29 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] ) @@ -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/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; 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 fb6a06c3..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv32 and /dev/null differ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv64 deleted file mode 100644 index 3c2a9517..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_coherent.spv64 and /dev/null differ 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 62594fa5..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv32 and /dev/null differ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv64 deleted file mode 100644 index c56fc97f..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_nonreadable.spv64 and /dev/null differ 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 5d1e2ac2..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv32 and /dev/null differ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv64 deleted file mode 100644 index 05450370..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_nonwritable.spv64 and /dev/null differ 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 78c6b05d..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv32 and /dev/null differ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv64 deleted file mode 100644 index 794c0faa..00000000 Binary files a/test_conformance/spirv_new/spirv_bin/decorate_volatile.spv64 and /dev/null differ 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, diff --git a/test_conformance/submission_details_template.txt b/test_conformance/submission_details_template.txt index 20554c83..9d276a62 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 $ ############################################################################## @@ -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 # ############################################################################## @@ -27,7 +26,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 @@ -74,19 +73,18 @@ Platform Version: ############################################################################## # -# Further submission information (mostly section 7 of Conformance Process -# Document). +# Further submission information # ############################################################################## -# Date of tests used, 8 digit string as given in filename. +# git tag of the tests used from GitHub (e.g. vYYYY-MM-DD-XX) # -Tests date: +Tests version: - -# SHA-1 git identifier of the tests used from Gitlab (ex: 0a7770f98664a092c70d0a7d9a48d229b5fd8039) -# -Test ID: +# 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). @@ -99,47 +97,9 @@ 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. +# 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. # -Test Bugs: - -############################################################################## -# -# Tested device configuration -# -############################################################################## - -# 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: - -# 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: 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");