From c2bca05a32f035ac1bdacfafcd7d352bdec42fe3 Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Wed, 28 Oct 2020 09:04:05 +0100 Subject: [PATCH 01/36] Add new subgroup extensions to the compiler test (#1009) --- .../compiler/test_compiler_defines_for_extensions.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test_conformance/compiler/test_compiler_defines_for_extensions.cpp b/test_conformance/compiler/test_compiler_defines_for_extensions.cpp index 43f3f965..a4a82512 100644 --- a/test_conformance/compiler/test_compiler_defines_for_extensions.cpp +++ b/test_conformance/compiler/test_compiler_defines_for_extensions.cpp @@ -42,6 +42,13 @@ const char *known_extensions[] = { "cl_khr_mipmap_image_writes", "cl_khr_srgb_image_writes", "cl_khr_subgroup_named_barrier", + "cl_khr_subgroup_extended_types", + "cl_khr_subgroup_non_uniform_vote", + "cl_khr_subgroup_ballot", + "cl_khr_subgroup_non_uniform_arithmetic", + "cl_khr_subgroup_shuffle", + "cl_khr_subgroup_shuffle_relative", + "cl_khr_subgroup_clustered_reduce", // API-only extensions after this point. If you add above here, modify // first_API_extension below. @@ -67,7 +74,7 @@ const char *known_extensions[] = { }; size_t num_known_extensions = sizeof(known_extensions)/sizeof(char*); -size_t first_API_extension = 20; +size_t first_API_extension = 27; const char *known_embedded_extensions[] = { "cles_khr_int64", From f162c8b5ef71f2f9d39b6c65a065bb8d7819b9ab Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Wed, 28 Oct 2020 08:06:11 +0000 Subject: [PATCH 02/36] Skip compiler unload/reload tests if compiler is not available (#986) * Skip compiler unload/reload tests if compiler is not available Note that tests that use the compiler helper functions but won't work without a compiler are in the `subtests_to_skip_with_offline_compiler` list. I didn't do that here because they tests directly use `clBuildProgram` etc directly, because they're specifically testing it's behaviour in edge-cases. * Change type of status variable --- test_conformance/compiler/procs.h | 19 ++++++++++++++++ .../compiler/test_feature_macro.cpp | 22 +++++++------------ .../compiler/test_opencl_c_versions.cpp | 10 +-------- .../test_unload_platform_compiler.cpp | 14 ++++++++++++ 4 files changed, 42 insertions(+), 23 deletions(-) diff --git a/test_conformance/compiler/procs.h b/test_conformance/compiler/procs.h index 38188d31..10ae142b 100644 --- a/test_conformance/compiler/procs.h +++ b/test_conformance/compiler/procs.h @@ -19,6 +19,25 @@ #include "harness/mt19937.h" #include "harness/typeWrappers.h" +// This is a macro rather than a function to be able to use and act like the +// existing test_error macro. +// +// Not all compiler tests need to use this macro, only those that don't use the +// test harness compiler helpers. +#define check_compiler_available(DEVICE) \ + { \ + cl_bool compilerAvailable = CL_FALSE; \ + cl_int error = clGetDeviceInfo((DEVICE), CL_DEVICE_COMPILER_AVAILABLE, \ + sizeof(compilerAvailable), \ + &compilerAvailable, NULL); \ + test_error(error, "Unable to query CL_DEVICE_COMPILER_AVAILABLE"); \ + if (compilerAvailable == CL_FALSE) \ + { \ + log_info("Skipping test - no compiler is available.\n"); \ + return TEST_SKIPPED_ITSELF; \ + } \ + } + extern int test_load_program_source(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_load_multistring_source(cl_device_id deviceID, diff --git a/test_conformance/compiler/test_feature_macro.cpp b/test_conformance/compiler/test_feature_macro.cpp index 1dd3549b..ac355dd4 100644 --- a/test_conformance/compiler/test_feature_macro.cpp +++ b/test_conformance/compiler/test_feature_macro.cpp @@ -721,21 +721,15 @@ int test_consistency_c_features_list(cl_device_id deviceID, int test_features_macro(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { - cl_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; - } + // Note: Not checking that the feature array is empty for the compiler not + // available case 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". + check_compiler_available(deviceID); + + int error = TEST_PASS; cl_bool supported = CL_FALSE; std::string test_macro_name = ""; std::vector supported_features_vec; diff --git a/test_conformance/compiler/test_opencl_c_versions.cpp b/test_conformance/compiler/test_opencl_c_versions.cpp index d3c28c30..d750366e 100644 --- a/test_conformance/compiler/test_opencl_c_versions.cpp +++ b/test_conformance/compiler/test_opencl_c_versions.cpp @@ -289,15 +289,7 @@ static int test_CL_DEVICE_OPENCL_C_VERSION_versions(cl_device_id device, 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; - } + check_compiler_available(device); const Version version = get_device_cl_version(device); diff --git a/test_conformance/compiler/test_unload_platform_compiler.cpp b/test_conformance/compiler/test_unload_platform_compiler.cpp index bb3ee95b..a180a58d 100644 --- a/test_conformance/compiler/test_unload_platform_compiler.cpp +++ b/test_conformance/compiler/test_unload_platform_compiler.cpp @@ -409,6 +409,8 @@ int test_unload_invalid(cl_device_id, cl_context, cl_command_queue, int) int test_unload_repeated(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); try { @@ -438,6 +440,8 @@ int test_unload_repeated(cl_device_id device, cl_context context, int test_unload_compile_unload_link(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); try { @@ -468,6 +472,8 @@ int test_unload_build_unload_create_kernel(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); try { @@ -497,6 +503,8 @@ int test_unload_build_unload_create_kernel(cl_device_id device, int test_unload_link_different(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); static const char *sources_1[] = { "unsigned int a() { return 42; }" }; @@ -645,6 +653,8 @@ int test_unload_build_threaded(cl_device_id device, cl_context context, { using clock = std::chrono::steady_clock; + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); const auto end = clock::now() + std::chrono::seconds(5); @@ -732,6 +742,8 @@ int test_unload_build_threaded(cl_device_id device, cl_context context, int test_unload_build_info(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); static const char *sources[] = { write_kernel_source }; @@ -893,6 +905,8 @@ int test_unload_build_info(cl_device_id device, cl_context context, int test_unload_program_binaries(cl_device_id device, cl_context context, cl_command_queue, int) { + check_compiler_available(device); + const cl_platform_id platform = device_platform(device); static const char *sources[] = { write_kernel_source }; From 55976fad351dbdfce34b87a7054ef96859247e18 Mon Sep 17 00:00:00 2001 From: Ewan Crawford Date: Wed, 28 Oct 2020 10:13:40 +0000 Subject: [PATCH 03/36] Permit half overflow within allowable ULP (#600) * Permit half overflow within allowable ULP Modify the algorithm for calculating half precision ULP error so that it duplicates the behaviour of the single precision ULP algorithm, in regards to allowing overflow within the defined ULP error. In the case where the test value is infinity, but the reference is finite, pretend the test value is 63336.0 and calculate the ULP error against that. Encountered this while testing half precision `hypot()` in PR !529, for inputs `hypot(-48864.0, 43648.0)` which has reference `65519.755799`. With RTE rounding this only just rounds to `65504` as half, and returning INF is currently infinite ULP error. Using the leniency introduced by this change however the error is `~0.5` within the `2` ULP bounds defined by the spec. * Run clang-format over changes Code now conforms to style guidelines and allows `check-format.sh` to pass. --- test_common/harness/errorHelpers.cpp | 27 +++++++----- test_conformance/math_brute_force/Utility.h | 1 - test_conformance/math_brute_force/main.cpp | 47 --------------------- 3 files changed, 17 insertions(+), 58 deletions(-) diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index 5fee9a2c..fd5a75e5 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -307,8 +307,6 @@ const char *GetQueuePropertyName(cl_command_queue_properties property) #define scalbnl(_a, _i ) ldexpl( _a, _i ) #endif -static float Ulp_Error_Half_Float( float test, double reference ); - // taken from math tests #define HALF_MIN_EXP -13 #define HALF_MANT_DIG 11 @@ -327,6 +325,23 @@ static float Ulp_Error_Half_Float( float test, double reference ) // results. double testVal = test; + + if (isinf(reference)) + { + if (testVal == reference) return 0.0f; + + return (float)(testVal - reference); + } + + if (isinf(testVal)) + { + // Allow overflow within the limit of the allowed ulp error. Towards + // that end we pretend the test value is actually 2**16, the next value + // that would appear in the number line if half had sufficient range. + testVal = copysign(65536.0, testVal); + } + + if( u.u & 0x000fffffffffffffULL ) { // Non-power of two and NaN if( isnan( reference ) && isnan( test ) ) @@ -339,14 +354,6 @@ static float Ulp_Error_Half_Float( float test, double reference ) return (float) scalbn( testVal - reference, ulp_exp ); } - if( isinf( reference ) ) - { - if( (double) test == reference ) - return 0.0f; - - return (float) (testVal - reference ); - } - // reference is a normal power of two or a zero int ulp_exp = HALF_MANT_DIG - 1 - MAX( ilogb( reference) - 1, HALF_MIN_EXP-1 ); diff --git a/test_conformance/math_brute_force/Utility.h b/test_conformance/math_brute_force/Utility.h index 7a4cac6c..31256358 100644 --- a/test_conformance/math_brute_force/Utility.h +++ b/test_conformance/math_brute_force/Utility.h @@ -95,7 +95,6 @@ extern cl_device_fp_config gDoubleCapabilities; float Abs_Error( float test, double reference ); float Ulp_Error( float test, double reference ); -//float Ulp_Error_Half( float test, double reference ); float Bruteforce_Ulp_Error_Double( double test, long double reference ); uint64_t GetTime( void ); diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index 142ac64c..8f2e0a0c 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -1739,53 +1739,6 @@ float Abs_Error( float test, double reference ) return fabs((float)(reference-(double)test)); } -/* -#define HALF_MIN_EXP -13 -#define HALF_MANT_DIG 11 -float Ulp_Error_Half( float test, double reference ) -{ - union{ double d; uint64_t u; }u; u.d = reference; - - // Note: This function presumes that someone has already tested whether the result is correctly, - // rounded before calling this function. That test: - // - // if( (float) reference == test ) - // return 0.0f; - // - // would ensure that cases like fabs(reference) > FLT_MAX are weeded out before we get here. - // Otherwise, we'll return inf ulp error here, for what are otherwise correctly rounded - // results. - - double testVal = test; - if( u.u & 0x000fffffffffffffULL ) - { // Non-power of two and NaN - if( isnan( reference ) && isnan( test ) ) - return 0.0f; // if we are expecting a NaN, any NaN is fine - - // The unbiased exponent of the ulp unit place - int ulp_exp = HALF_MANT_DIG - 1 - MAX( ilogb( reference), HALF_MIN_EXP-1 ); - - // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); - } - - if( isinf( reference ) ) - { - if( (double) test == reference ) - return 0.0f; - - return (float) (testVal - reference ); - } - - // reference is a normal power of two or a zero - int ulp_exp = HALF_MANT_DIG - 1 - MAX( ilogb( reference) - 1, HALF_MIN_EXP-1 ); - - // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); -} -*/ - - #if defined( __APPLE__ ) #include #endif From af7d91451437b7ef88a457af83d04b5179215d9f Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Fri, 30 Oct 2020 14:13:52 +0000 Subject: [PATCH 04/36] Reformat test harness code (#940) * Reformat common help text Signed-off-by: Stuart Brady * Reformat test harness code This goes part of the way to fixing issue #625. Signed-off-by: Stuart Brady --- test_common/harness/ThreadPool.cpp | 830 ++--- test_common/harness/ThreadPool.h | 63 +- test_common/harness/alloc.h | 28 +- test_common/harness/clImageHelper.h | 368 +-- test_common/harness/compat.h | 469 +-- test_common/harness/conversions.cpp | 1311 ++++---- test_common/harness/conversions.h | 76 +- test_common/harness/crc32.h | 2 +- test_common/harness/deviceInfo.cpp | 4 +- test_common/harness/deviceInfo.h | 2 +- test_common/harness/errorHelpers.cpp | 774 +++-- test_common/harness/errorHelpers.h | 165 +- test_common/harness/fpcontrol.h | 156 +- test_common/harness/genericThread.cpp | 27 +- test_common/harness/genericThread.h | 27 +- test_common/harness/imageHelpers.cpp | 3986 ++++++++++++----------- test_common/harness/imageHelpers.h | 660 ++-- test_common/harness/kernelHelpers.cpp | 1141 ++++--- test_common/harness/kernelHelpers.h | 157 +- test_common/harness/mingw_compat.c | 33 +- test_common/harness/mingw_compat.h | 4 +- test_common/harness/msvc9.c | 418 +-- test_common/harness/mt19937.cpp | 176 +- test_common/harness/mt19937.h | 48 +- test_common/harness/os_helpers.cpp | 807 +++-- test_common/harness/os_helpers.h | 20 +- test_common/harness/parseParameters.cpp | 120 +- test_common/harness/parseParameters.h | 8 +- test_common/harness/ref_counting.h | 51 +- test_common/harness/rounding_mode.cpp | 301 +- test_common/harness/rounding_mode.h | 19 +- test_common/harness/testHarness.cpp | 774 +++-- test_common/harness/testHarness.h | 146 +- test_common/harness/test_mt19937.c | 26 +- test_common/harness/threadTesting.cpp | 4 +- test_common/harness/threadTesting.h | 19 +- test_common/harness/typeWrappers.cpp | 633 ++-- test_common/harness/typeWrappers.h | 515 +-- 38 files changed, 7676 insertions(+), 6692 deletions(-) diff --git a/test_common/harness/ThreadPool.cpp b/test_common/harness/ThreadPool.cpp index 6d64681a..31985aa0 100644 --- a/test_common/harness/ThreadPool.cpp +++ b/test_common/harness/ThreadPool.cpp @@ -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 @@ -19,9 +19,10 @@ #include #include -#if defined( __APPLE__ ) || defined( __linux__ ) || defined( _WIN32 ) // or any other POSIX system +#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32) +// or any other POSIX system -#if defined( _WIN32 ) +#if defined(_WIN32) #include #if defined(_MSC_VER) #include @@ -38,84 +39,89 @@ #endif // !_WIN32 // declarations -#ifdef _WIN32 -void ThreadPool_WorkerFunc( void *p ); +#ifdef _WIN32 +void ThreadPool_WorkerFunc(void *p); #else -void *ThreadPool_WorkerFunc( void *p ); +void *ThreadPool_WorkerFunc(void *p); #endif void ThreadPool_Init(void); void ThreadPool_Exit(void); -#if defined (__MINGW32__) - // Mutex for implementing super heavy atomic operations if you don't have GCC or MSVC - CRITICAL_SECTION gAtomicLock; -#elif defined( __GNUC__ ) || defined( _MSC_VER) +#if defined(__MINGW32__) +// Mutex for implementing super heavy atomic operations if you don't have GCC or +// MSVC +CRITICAL_SECTION gAtomicLock; +#elif defined(__GNUC__) || defined(_MSC_VER) #else - pthread_mutex_t gAtomicLock; +pthread_mutex_t gAtomicLock; #endif -// Atomic add operator with mem barrier. Mem barrier needed to protect state modified by the worker functions. -cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ) +// Atomic add operator with mem barrier. Mem barrier needed to protect state +// modified by the worker functions. +cl_int ThreadPool_AtomicAdd(volatile cl_int *a, cl_int b) { -#if defined (__MINGW32__) +#if defined(__MINGW32__) // No atomics on Mingw32 EnterCriticalSection(&gAtomicLock); cl_int old = *a; *a = old + b; LeaveCriticalSection(&gAtomicLock); return old; -#elif defined( __GNUC__ ) - // GCC extension: http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins - return __sync_fetch_and_add( a, b ); - // do we need __sync_synchronize() here, too? GCC docs are unclear whether __sync_fetch_and_add does a synchronize -#elif defined( _MSC_VER ) - return (cl_int) _InterlockedExchangeAdd( (volatile LONG*) a, (LONG) b ); +#elif defined(__GNUC__) + // GCC extension: + // http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins + return __sync_fetch_and_add(a, b); + // do we need __sync_synchronize() here, too? GCC docs are unclear whether + // __sync_fetch_and_add does a synchronize +#elif defined(_MSC_VER) + return (cl_int)_InterlockedExchangeAdd((volatile LONG *)a, (LONG)b); #else - #warning Please add a atomic add implementation here, with memory barrier. Fallback code is slow. - if( pthread_mutex_lock(&gAtomicLock) ) - log_error( "Atomic operation failed. pthread_mutex_lock(&gAtomicLock) returned an error\n"); +#warning Please add a atomic add implementation here, with memory barrier. Fallback code is slow. + if (pthread_mutex_lock(&gAtomicLock)) + log_error("Atomic operation failed. pthread_mutex_lock(&gAtomicLock) " + "returned an error\n"); cl_int old = *a; *a = old + b; - if( pthread_mutex_unlock(&gAtomicLock) ) - log_error( "Failed to release gAtomicLock. Further atomic operations may deadlock!\n"); + if (pthread_mutex_unlock(&gAtomicLock)) + log_error("Failed to release gAtomicLock. Further atomic operations " + "may deadlock!\n"); return old; #endif } -#if defined( _WIN32 ) +#if defined(_WIN32) // Uncomment the following line if Windows XP support is not required. // #define HAS_INIT_ONCE_EXECUTE_ONCE 1 #if defined(HAS_INIT_ONCE_EXECUTE_ONCE) -#define _INIT_ONCE INIT_ONCE -#define _PINIT_ONCE PINIT_ONCE +#define _INIT_ONCE INIT_ONCE +#define _PINIT_ONCE PINIT_ONCE #define _InitOnceExecuteOnce InitOnceExecuteOnce #else // !HAS_INIT_ONCE_EXECUTE_ONCE typedef volatile LONG _INIT_ONCE; typedef _INIT_ONCE *_PINIT_ONCE; -typedef BOOL (CALLBACK *_PINIT_ONCE_FN)(_PINIT_ONCE, PVOID, PVOID *); +typedef BOOL(CALLBACK *_PINIT_ONCE_FN)(_PINIT_ONCE, PVOID, PVOID *); #define _INIT_ONCE_UNINITIALIZED 0 -#define _INIT_ONCE_IN_PROGRESS 1 -#define _INIT_ONCE_DONE 2 +#define _INIT_ONCE_IN_PROGRESS 1 +#define _INIT_ONCE_DONE 2 -static BOOL _InitOnceExecuteOnce( - _PINIT_ONCE InitOnce, - _PINIT_ONCE_FN InitFn, - PVOID Parameter, - LPVOID *Context -) +static BOOL _InitOnceExecuteOnce(_PINIT_ONCE InitOnce, _PINIT_ONCE_FN InitFn, + PVOID Parameter, LPVOID *Context) { - while ( *InitOnce != _INIT_ONCE_DONE ) + while (*InitOnce != _INIT_ONCE_DONE) { - if (*InitOnce != _INIT_ONCE_IN_PROGRESS && _InterlockedCompareExchange( InitOnce, _INIT_ONCE_IN_PROGRESS, _INIT_ONCE_UNINITIALIZED ) == _INIT_ONCE_UNINITIALIZED ) + if (*InitOnce != _INIT_ONCE_IN_PROGRESS + && _InterlockedCompareExchange(InitOnce, _INIT_ONCE_IN_PROGRESS, + _INIT_ONCE_UNINITIALIZED) + == _INIT_ONCE_UNINITIALIZED) { - InitFn( InitOnce, Parameter, Context ); + InitFn(InitOnce, Parameter, Context); *InitOnce = _INIT_ONCE_DONE; return TRUE; } - Sleep( 1 ); + Sleep(1); } return TRUE; } @@ -125,310 +131,352 @@ static BOOL _InitOnceExecuteOnce( // #define HAS_CONDITION_VARIABLE 1 #if defined(HAS_CONDITION_VARIABLE) -#define _CONDITION_VARIABLE CONDITION_VARIABLE +#define _CONDITION_VARIABLE CONDITION_VARIABLE #define _InitializeConditionVariable InitializeConditionVariable -#define _SleepConditionVariableCS SleepConditionVariableCS -#define _WakeAllConditionVariable WakeAllConditionVariable +#define _SleepConditionVariableCS SleepConditionVariableCS +#define _WakeAllConditionVariable WakeAllConditionVariable #else // !HAS_CONDITION_VARIABLE typedef struct { - HANDLE mEvent; // Used to park the thread. - CRITICAL_SECTION mLock[1]; // Used to protect mWaiters, mGeneration and mReleaseCount. - volatile cl_int mWaiters; // Number of threads waiting on this cond var. - volatile cl_int mGeneration; // Wait generation count. - volatile cl_int mReleaseCount; // Number of releases to execute before reseting the event. + HANDLE mEvent; // Used to park the thread. + // Used to protect mWaiters, mGeneration and mReleaseCount: + CRITICAL_SECTION mLock[1]; + volatile cl_int mWaiters; // Number of threads waiting on this cond var. + volatile cl_int mGeneration; // Wait generation count. + volatile cl_int mReleaseCount; // Number of releases to execute before + // reseting the event. } _CONDITION_VARIABLE; typedef _CONDITION_VARIABLE *_PCONDITION_VARIABLE; -static void _InitializeConditionVariable( _PCONDITION_VARIABLE cond_var ) +static void _InitializeConditionVariable(_PCONDITION_VARIABLE cond_var) { - cond_var->mEvent = CreateEvent( NULL, TRUE, FALSE, NULL ); - InitializeCriticalSection( cond_var->mLock ); + cond_var->mEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + InitializeCriticalSection(cond_var->mLock); cond_var->mWaiters = 0; cond_var->mGeneration = 0; -#if !defined ( NDEBUG ) +#if !defined(NDEBUG) cond_var->mReleaseCount = 0; #endif // !NDEBUG } -static void _SleepConditionVariableCS( _PCONDITION_VARIABLE cond_var, PCRITICAL_SECTION cond_lock, DWORD ignored) +static void _SleepConditionVariableCS(_PCONDITION_VARIABLE cond_var, + PCRITICAL_SECTION cond_lock, + DWORD ignored) { - EnterCriticalSection( cond_var->mLock ); + EnterCriticalSection(cond_var->mLock); cl_int generation = cond_var->mGeneration; ++cond_var->mWaiters; - LeaveCriticalSection( cond_var->mLock ); - LeaveCriticalSection( cond_lock ); + LeaveCriticalSection(cond_var->mLock); + LeaveCriticalSection(cond_lock); - while ( TRUE ) + while (TRUE) { - WaitForSingleObject( cond_var->mEvent, INFINITE ); - EnterCriticalSection( cond_var->mLock ); - BOOL done = cond_var->mReleaseCount > 0 && cond_var->mGeneration != generation; - LeaveCriticalSection( cond_var->mLock ); - if ( done ) + WaitForSingleObject(cond_var->mEvent, INFINITE); + EnterCriticalSection(cond_var->mLock); + BOOL done = + cond_var->mReleaseCount > 0 && cond_var->mGeneration != generation; + LeaveCriticalSection(cond_var->mLock); + if (done) { break; } } - EnterCriticalSection( cond_lock ); - EnterCriticalSection( cond_var->mLock ); - if ( --cond_var->mReleaseCount == 0 ) + EnterCriticalSection(cond_lock); + EnterCriticalSection(cond_var->mLock); + if (--cond_var->mReleaseCount == 0) { - ResetEvent( cond_var->mEvent ); + ResetEvent(cond_var->mEvent); } --cond_var->mWaiters; - LeaveCriticalSection( cond_var->mLock ); + LeaveCriticalSection(cond_var->mLock); } -static void _WakeAllConditionVariable( _PCONDITION_VARIABLE cond_var ) +static void _WakeAllConditionVariable(_PCONDITION_VARIABLE cond_var) { - EnterCriticalSection( cond_var->mLock ); - if (cond_var->mWaiters > 0 ) + EnterCriticalSection(cond_var->mLock); + if (cond_var->mWaiters > 0) { ++cond_var->mGeneration; cond_var->mReleaseCount = cond_var->mWaiters; - SetEvent( cond_var->mEvent ); + SetEvent(cond_var->mEvent); } - LeaveCriticalSection( cond_var->mLock ); + LeaveCriticalSection(cond_var->mLock); } #endif // !HAS_CONDITION_VARIABLE #endif // _WIN32 -#define MAX_COUNT (1<<29) +#define MAX_COUNT (1 << 29) -// Global state to coordinate whether the threads have been launched successfully or not -#if defined( _MSC_VER ) && (_WIN32_WINNT >= 0x600) +// Global state to coordinate whether the threads have been launched +// successfully or not +#if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600) static _INIT_ONCE threadpool_init_control; -#elif defined (_WIN32) // MingW of XP +#elif defined(_WIN32) // MingW of XP static int threadpool_init_control; #else // Posix platforms pthread_once_t threadpool_init_control = PTHREAD_ONCE_INIT; #endif -cl_int threadPoolInitErr = -1; // set to CL_SUCCESS on successful thread launch +cl_int threadPoolInitErr = -1; // set to CL_SUCCESS on successful thread launch -// critical region lock around ThreadPool_Do. We can only run one ThreadPool_Do at a time, -// because we are too lazy to set up a queue here, and don't expect to need one. -#if defined( _WIN32 ) -CRITICAL_SECTION gThreadPoolLock[1]; +// critical region lock around ThreadPool_Do. We can only run one ThreadPool_Do +// at a time, because we are too lazy to set up a queue here, and don't expect +// to need one. +#if defined(_WIN32) +CRITICAL_SECTION gThreadPoolLock[1]; #else // !_WIN32 -pthread_mutex_t gThreadPoolLock; +pthread_mutex_t gThreadPoolLock; #endif // !_WIN32 // Condition variable to park ThreadPool threads when not working -#if defined( _WIN32 ) -CRITICAL_SECTION cond_lock[1]; +#if defined(_WIN32) +CRITICAL_SECTION cond_lock[1]; _CONDITION_VARIABLE cond_var[1]; #else // !_WIN32 -pthread_mutex_t cond_lock; -pthread_cond_t cond_var; +pthread_mutex_t cond_lock; +pthread_cond_t cond_var; #endif // !_WIN32 -volatile cl_int gRunCount = 0; // Condition variable state. How many iterations on the function left to run. - // set to CL_INT_MAX to cause worker threads to exit. Note: this value might go negative. + +// Condition variable state. How many iterations on the function left to run, +// set to CL_INT_MAX to cause worker threads to exit. Note: this value might +// go negative. +volatile cl_int gRunCount = 0; // State that only changes when the threadpool is not working. -volatile TPFuncPtr gFunc_ptr = NULL; -volatile void *gUserInfo = NULL; -volatile cl_int gJobCount = 0; +volatile TPFuncPtr gFunc_ptr = NULL; +volatile void *gUserInfo = NULL; +volatile cl_int gJobCount = 0; // State that may change while the thread pool is working -volatile cl_int jobError = CL_SUCCESS; // err code return for the job as a whole +volatile cl_int jobError = CL_SUCCESS; // err code return for the job as a whole // Condition variable to park caller while waiting -#if defined( _WIN32 ) -HANDLE caller_event; +#if defined(_WIN32) +HANDLE caller_event; #else // !_WIN32 -pthread_mutex_t caller_cond_lock; -pthread_cond_t caller_cond_var; +pthread_mutex_t caller_cond_lock; +pthread_cond_t caller_cond_var; #endif // !_WIN32 -volatile cl_int gRunning = 0; // # of threads intended to be running. Running threads will decrement this as they discover they've run out of work to do. + +// # of threads intended to be running. Running threads will decrement this +// as they discover they've run out of work to do. +volatile cl_int gRunning = 0; // The total number of threads launched. -volatile cl_int gThreadCount = 0; +volatile cl_int gThreadCount = 0; #ifdef _WIN32 -void ThreadPool_WorkerFunc( void *p ) +void ThreadPool_WorkerFunc(void *p) #else -void *ThreadPool_WorkerFunc( void *p ) +void *ThreadPool_WorkerFunc(void *p) #endif { - cl_uint threadID = ThreadPool_AtomicAdd( (volatile cl_int *) p, 1 ); - cl_int item = ThreadPool_AtomicAdd( &gRunCount, -1 ); -// log_info( "ThreadPool_WorkerFunc start: gRunning = %d\n", gRunning ); + cl_uint threadID = ThreadPool_AtomicAdd((volatile cl_int *)p, 1); + cl_int item = ThreadPool_AtomicAdd(&gRunCount, -1); + // log_info( "ThreadPool_WorkerFunc start: gRunning = %d\n", gRunning ); - while( MAX_COUNT > item ) + while (MAX_COUNT > item) { cl_int err; // check for more work to do - if( 0 >= item ) + if (0 >= item) { -// log_info( "Thread %d has run out of work.\n", threadID ); + // log_info("Thread %d has run out of work.\n", threadID); // No work to do. Attempt to block waiting for work -#if defined( _WIN32 ) - EnterCriticalSection( cond_lock ); +#if defined(_WIN32) + EnterCriticalSection(cond_lock); #else // !_WIN32 - if((err = pthread_mutex_lock( &cond_lock) )) + if ((err = pthread_mutex_lock(&cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Worker %d unable to block waiting for work. ThreadPool_WorkerFunc failed.\n", err, threadID ); + log_error( + "Error %d from pthread_mutex_lock. Worker %d unable to " + "block waiting for work. ThreadPool_WorkerFunc failed.\n", + err, threadID); goto exit; } #endif // !_WIN32 - cl_int remaining = ThreadPool_AtomicAdd( &gRunning, -1 ); -// log_info( "ThreadPool_WorkerFunc: gRunning = %d\n", remaining - 1 ); - if( 1 == remaining ) + cl_int remaining = ThreadPool_AtomicAdd(&gRunning, -1); + // log_info("ThreadPool_WorkerFunc: gRunning = %d\n", + // remaining - 1); + if (1 == remaining) { // last thread out signal the main thread to wake up -#if defined( _WIN32 ) - SetEvent( caller_event ); +#if defined(_WIN32) + SetEvent(caller_event); #else // !_WIN32 - if((err = pthread_mutex_lock( &caller_cond_lock) )) + if ((err = pthread_mutex_lock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Unable to wake caller.\n", err ); + log_error("Error %d from pthread_mutex_lock. Unable to " + "wake caller.\n", + err); goto exit; } - if( (err = pthread_cond_broadcast( &caller_cond_var ))) + if ((err = pthread_cond_broadcast(&caller_cond_var))) { - log_error("Error %d from pthread_cond_broadcast. Unable to wake up main thread. ThreadPool_WorkerFunc failed.\n", err ); + log_error( + "Error %d from pthread_cond_broadcast. Unable to wake " + "up main thread. ThreadPool_WorkerFunc failed.\n", + err); goto exit; } - if((err = pthread_mutex_unlock( &caller_cond_lock) )) + if ((err = pthread_mutex_unlock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Unable to wake caller.\n", err ); + log_error("Error %d from pthread_mutex_lock. Unable to " + "wake caller.\n", + err); goto exit; } #endif // !_WIN32 } - // loop in case we are woken only to discover that some other thread already did all the work - while( 0 >= item ) + // loop in case we are woken only to discover that some other thread + // already did all the work + while (0 >= item) { -#if defined( _WIN32 ) - _SleepConditionVariableCS( cond_var, cond_lock, INFINITE ); +#if defined(_WIN32) + _SleepConditionVariableCS(cond_var, cond_lock, INFINITE); #else // !_WIN32 - if((err = pthread_cond_wait( &cond_var, &cond_lock) )) + if ((err = pthread_cond_wait(&cond_var, &cond_lock))) { - log_error("Error %d from pthread_cond_wait. Unable to block for waiting for work. ThreadPool_WorkerFunc failed.\n", err ); - pthread_mutex_unlock( &cond_lock); + log_error( + "Error %d from pthread_cond_wait. Unable to block for " + "waiting for work. ThreadPool_WorkerFunc failed.\n", + err); + pthread_mutex_unlock(&cond_lock); goto exit; } #endif // !_WIN32 // try again to get a valid item id - item = ThreadPool_AtomicAdd( &gRunCount, -1 ); - if( MAX_COUNT <= item ) // exit if we are done + item = ThreadPool_AtomicAdd(&gRunCount, -1); + if (MAX_COUNT <= item) // exit if we are done { -#if defined( _WIN32 ) - LeaveCriticalSection( cond_lock ); +#if defined(_WIN32) + LeaveCriticalSection(cond_lock); #else // !_WIN32 - pthread_mutex_unlock( &cond_lock); + pthread_mutex_unlock(&cond_lock); #endif // !_WIN32 goto exit; } } - ThreadPool_AtomicAdd( &gRunning, 1 ); -// log_info( "Thread %d has found work.\n", threadID); + ThreadPool_AtomicAdd(&gRunning, 1); + // log_info("Thread %d has found work.\n", threadID); -#if defined( _WIN32 ) - LeaveCriticalSection( cond_lock ); +#if defined(_WIN32) + LeaveCriticalSection(cond_lock); #else // !_WIN32 - if((err = pthread_mutex_unlock( &cond_lock) )) + if ((err = pthread_mutex_unlock(&cond_lock))) { - log_error("Error %d from pthread_mutex_unlock. Unable to block for waiting for work. ThreadPool_WorkerFunc failed.\n", err ); + log_error( + "Error %d from pthread_mutex_unlock. Unable to block for " + "waiting for work. ThreadPool_WorkerFunc failed.\n", + err); goto exit; } #endif // !_WIN32 - } // we have a valid item, so do the work - if( CL_SUCCESS == jobError ) // but only if we haven't already encountered an error + // but only if we haven't already encountered an error + if (CL_SUCCESS == jobError) { -// log_info( "Thread %d doing job %d\n", threadID, item - 1); + // log_info("Thread %d doing job %d\n", threadID, item - 1); #if defined(__APPLE__) && defined(__arm__) - // On most platforms which support denorm, default is FTZ off. However, - // on some hardware where the reference is computed, default might be flush denorms to zero e.g. arm. - // This creates issues in result verification. Since spec allows the implementation to either flush or - // not flush denorms to zero, an implementation may choose not be flush i.e. return denorm result whereas - // reference result may be zero (flushed denorm). Hence we need to disable denorm flushing on host side - // where reference is being computed to make sure we get non-flushed reference result. If implementation - // returns flushed result, we correctly take care of that in verification code. + // On most platforms which support denorm, default is FTZ off. + // However, on some hardware where the reference is computed, + // default might be flush denorms to zero e.g. arm. This creates + // issues in result verification. Since spec allows the + // implementation to either flush or not flush denorms to zero, an + // implementation may choose not be flush i.e. return denorm result + // whereas reference result may be zero (flushed denorm). Hence we + // need to disable denorm flushing on host side where reference is + // being computed to make sure we get non-flushed reference result. + // If implementation returns flushed result, we correctly take care + // of that in verification code. FPU_mode_type oldMode; - DisableFTZ( &oldMode ); + DisableFTZ(&oldMode); #endif // Call the user's function with this item ID - err = gFunc_ptr( item - 1, threadID, (void*) gUserInfo ); + err = gFunc_ptr(item - 1, threadID, (void *)gUserInfo); #if defined(__APPLE__) && defined(__arm__) // Restore FP state - RestoreFPState( &oldMode ); + RestoreFPState(&oldMode); #endif - if( err ) + if (err) { #if (__MINGW32__) EnterCriticalSection(&gAtomicLock); if (jobError == CL_SUCCESS) jobError = err; gRunCount = 0; LeaveCriticalSection(&gAtomicLock); -#elif defined( __GNUC__ ) - // GCC extension: http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins +#elif defined(__GNUC__) + // GCC extension: + // http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins // set the new error if we are the first one there. - __sync_val_compare_and_swap( &jobError, CL_SUCCESS, err ); + __sync_val_compare_and_swap(&jobError, CL_SUCCESS, err); // drop run count to 0 gRunCount = 0; __sync_synchronize(); -#elif defined( _MSC_VER ) +#elif defined(_MSC_VER) // set the new error if we are the first one there. - _InterlockedCompareExchange( (volatile LONG*) &jobError, err, CL_SUCCESS ); + _InterlockedCompareExchange((volatile LONG *)&jobError, err, + CL_SUCCESS); // drop run count to 0 gRunCount = 0; _mm_mfence(); #else - if( pthread_mutex_lock(&gAtomicLock) ) - log_error( "Atomic operation failed. pthread_mutex_lock(&gAtomicLock) returned an error\n"); + if (pthread_mutex_lock(&gAtomicLock)) + log_error( + "Atomic operation failed. " + "pthread_mutex_lock(&gAtomicLock) returned an error\n"); if (jobError == CL_SUCCESS) jobError = err; gRunCount = 0; - if( pthread_mutex_unlock(&gAtomicLock) ) - log_error( "Failed to release gAtomicLock. Further atomic operations may deadlock\n"); + if (pthread_mutex_unlock(&gAtomicLock)) + log_error("Failed to release gAtomicLock. Further atomic " + "operations may deadlock\n"); #endif } } // get the next item - item = ThreadPool_AtomicAdd( &gRunCount, -1 ); + item = ThreadPool_AtomicAdd(&gRunCount, -1); } exit: - log_info( "ThreadPool: thread %d exiting.\n", threadID ); - ThreadPool_AtomicAdd( &gThreadCount, -1 ); + log_info("ThreadPool: thread %d exiting.\n", threadID); + ThreadPool_AtomicAdd(&gThreadCount, -1); #if !defined(_WIN32) return NULL; #endif } // SetThreadCount() may be used to artifically set the number of worker threads -// If the value is 0 (the default) the number of threads will be determined based on -// the number of CPU cores. If it is a unicore machine, then 2 will be used, so -// that we still get some testing for thread safety. +// If the value is 0 (the default) the number of threads will be determined +// based on the number of CPU cores. If it is a unicore machine, then 2 will be +// used, so that we still get some testing for thread safety. // -// If count < 2 or the CL_TEST_SINGLE_THREADED environment variable is set then the -// code will run single threaded, but will report an error to indicate that the test -// is invalid. This option is intended for debugging purposes only. It is suggested -// as a convention that test apps set the thread count to 1 in response to the -m flag. +// If count < 2 or the CL_TEST_SINGLE_THREADED environment variable is set then +// the code will run single threaded, but will report an error to indicate that +// the test is invalid. This option is intended for debugging purposes only. It +// is suggested as a convention that test apps set the thread count to 1 in +// response to the -m flag. // -// SetThreadCount() must be called before the first call to GetThreadCount() or ThreadPool_Do(), -// otherwise the behavior is indefined. -void SetThreadCount( int count ) +// SetThreadCount() must be called before the first call to GetThreadCount() or +// ThreadPool_Do(), otherwise the behavior is indefined. +void SetThreadCount(int count) { - if( threadPoolInitErr == CL_SUCCESS ) + if (threadPoolInitErr == CL_SUCCESS) { - log_error( "Error: It is illegal to set the thread count after the first call to ThreadPool_Do or GetThreadCount\n" ); + log_error("Error: It is illegal to set the thread count after the " + "first call to ThreadPool_Do or GetThreadCount\n"); abort(); } @@ -441,35 +489,42 @@ void ThreadPool_Init(void) int err; volatile cl_uint threadID = 0; - // Check for manual override of multithreading code. We add this for better debuggability. - if( getenv( "CL_TEST_SINGLE_THREADED" ) ) + // Check for manual override of multithreading code. We add this for better + // debuggability. + if (getenv("CL_TEST_SINGLE_THREADED")) { - log_error("ERROR: CL_TEST_SINGLE_THREADED is set in the environment. Running single threaded.\n*** TEST IS INVALID! ***\n"); + log_error("ERROR: CL_TEST_SINGLE_THREADED is set in the environment. " + "Running single threaded.\n*** TEST IS INVALID! ***\n"); gThreadCount = 1; return; } - // Figure out how many threads to run -- check first for non-zero to give the implementation the chance - if( 0 == gThreadCount ) + // Figure out how many threads to run -- check first for non-zero to give + // the implementation the chance + if (0 == gThreadCount) { -#if defined(_MSC_VER) || defined (__MINGW64__) +#if defined(_MSC_VER) || defined(__MINGW64__) PSYSTEM_LOGICAL_PROCESSOR_INFORMATION buffer = NULL; DWORD length = 0; - GetLogicalProcessorInformation( NULL, &length ); - buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION) malloc( length ); - if( buffer != NULL ) + GetLogicalProcessorInformation(NULL, &length); + buffer = (PSYSTEM_LOGICAL_PROCESSOR_INFORMATION)malloc(length); + if (buffer != NULL) { - if ( GetLogicalProcessorInformation( buffer, &length ) == TRUE ) + if (GetLogicalProcessorInformation(buffer, &length) == TRUE) { PSYSTEM_LOGICAL_PROCESSOR_INFORMATION ptr = buffer; - while( ptr < &buffer[ length / sizeof( SYSTEM_LOGICAL_PROCESSOR_INFORMATION ) ] ) + while ( + ptr + < &buffer[length + / sizeof(SYSTEM_LOGICAL_PROCESSOR_INFORMATION)]) { - if( ptr->Relationship == RelationProcessorCore ) + if (ptr->Relationship == RelationProcessorCore) { - // Count the number of bits in ProcessorMask (number of logical cores) + // Count the number of bits in ProcessorMask (number of + // logical cores) ULONG mask = ptr->ProcessorMask; - while( mask ) + while (mask) { ++gThreadCount; mask &= mask - 1; // Remove 1 bit at a time @@ -480,66 +535,71 @@ void ThreadPool_Init(void) } free(buffer); } -#elif defined (__MINGW32__) +#elif defined(__MINGW32__) { - #warning How about this, instead of hard coding it to 2? +#warning How about this, instead of hard coding it to 2? SYSTEM_INFO sysinfo; - GetSystemInfo( &sysinfo ); + GetSystemInfo(&sysinfo); gThreadCount = sysinfo.dwNumberOfProcessors; } -#elif defined (__linux__) && !defined(__ANDROID__) - cpu_set_t affinity; - if ( 0 == sched_getaffinity(0, sizeof(cpu_set_t), &affinity) ) +#elif defined(__linux__) && !defined(__ANDROID__) + cpu_set_t affinity; + if (0 == sched_getaffinity(0, sizeof(cpu_set_t), &affinity)) { #if !(defined(CPU_COUNT)) - gThreadCount = 1; + gThreadCount = 1; #else gThreadCount = CPU_COUNT(&affinity); #endif } else { - gThreadCount = (cl_int) sysconf(_SC_NPROCESSORS_CONF); // Hopefully your system returns logical cpus here, as does MacOS X + // Hopefully your system returns logical cpus here, as does MacOS X + gThreadCount = (cl_int)sysconf(_SC_NPROCESSORS_CONF); } -#else // !_WIN32 - gThreadCount = (cl_int) sysconf(_SC_NPROCESSORS_CONF); // Hopefully your system returns logical cpus here, as does MacOS X +#else /* !_WIN32 */ + // Hopefully your system returns logical cpus here, as does MacOS X + gThreadCount = (cl_int)sysconf(_SC_NPROCESSORS_CONF); #endif // !_WIN32 - // Multithreaded tests are required to run multithreaded even on unicore systems so as to test thread safety - if( 1 == gThreadCount ) - gThreadCount = 2; + // Multithreaded tests are required to run multithreaded even on unicore + // systems so as to test thread safety + if (1 == gThreadCount) gThreadCount = 2; } - // When working in 32 bit limit the thread number to 12 - // This fix was made due to memory issues in integer_ops test - // When running integer_ops, the test opens as many threads as the - // machine has and each thread allocates a fixed amount of memory - // When running this test on dual socket machine in 32-bit, the - // process memory is not sufficient and the test fails - #if defined(_WIN32) && !defined(_M_X64) - if (gThreadCount > 12) { - gThreadCount = 12; - } - #endif - - //Allow the app to set thread count to <0 for debugging purposes. This will cause the test to run single threaded. - if( gThreadCount < 2 ) +// When working in 32 bit limit the thread number to 12 +// This fix was made due to memory issues in integer_ops test +// When running integer_ops, the test opens as many threads as the +// machine has and each thread allocates a fixed amount of memory +// When running this test on dual socket machine in 32-bit, the +// process memory is not sufficient and the test fails +#if defined(_WIN32) && !defined(_M_X64) + if (gThreadCount > 12) { - log_error( "ERROR: Running single threaded because thread count < 2. \n*** TEST IS INVALID! ***\n"); + gThreadCount = 12; + } +#endif + + // Allow the app to set thread count to <0 for debugging purposes. + // This will cause the test to run single threaded. + if (gThreadCount < 2) + { + log_error("ERROR: Running single threaded because thread count < 2. " + "\n*** TEST IS INVALID! ***\n"); gThreadCount = 1; return; } -#if defined( _WIN32 ) - InitializeCriticalSection( gThreadPoolLock ); - InitializeCriticalSection( cond_lock ); - _InitializeConditionVariable( cond_var ); - caller_event = CreateEvent( NULL, FALSE, FALSE, NULL ); -#elif defined (__GNUC__) - // Dont rely on PTHREAD_MUTEX_INITIALIZER for intialization of a mutex since it might cause problem - // with some flavors of gcc compilers. +#if defined(_WIN32) + InitializeCriticalSection(gThreadPoolLock); + InitializeCriticalSection(cond_lock); + _InitializeConditionVariable(cond_var); + caller_event = CreateEvent(NULL, FALSE, FALSE, NULL); +#elif defined(__GNUC__) + // Dont rely on PTHREAD_MUTEX_INITIALIZER for intialization of a mutex since + // it might cause problem with some flavors of gcc compilers. pthread_cond_init(&cond_var, NULL); - pthread_mutex_init(&cond_lock ,NULL); + pthread_mutex_init(&cond_lock, NULL); pthread_cond_init(&caller_cond_var, NULL); pthread_mutex_init(&caller_cond_lock, NULL); pthread_mutex_init(&gThreadPoolLock, NULL); @@ -547,15 +607,18 @@ void ThreadPool_Init(void) #if !(defined(__GNUC__) || defined(_MSC_VER) || defined(__MINGW32__)) pthread_mutex_initialize(gAtomicLock); -#elif defined (__MINGW32__) +#elif defined(__MINGW32__) InitializeCriticalSection(&gAtomicLock); #endif - // Make sure the last thread done in the work pool doesn't signal us to wake before we get to the point where we are supposed to wait + // Make sure the last thread done in the work pool doesn't signal us to wake + // before we get to the point where we are supposed to wait // That would cause a deadlock. -#if !defined( _WIN32 ) - if((err = pthread_mutex_lock( &caller_cond_lock) )) +#if !defined(_WIN32) + if ((err = pthread_mutex_lock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Unable to block for work to finish. ThreadPool_Init failed.\n", err ); + log_error("Error %d from pthread_mutex_lock. Unable to block for work " + "to finish. ThreadPool_Init failed.\n", + err); gThreadCount = 1; return; } @@ -563,45 +626,50 @@ void ThreadPool_Init(void) gRunning = gThreadCount; // init threads - for( i = 0; i < gThreadCount; i++ ) + for (i = 0; i < gThreadCount; i++) { -#if defined( _WIN32 ) - uintptr_t handle = _beginthread(ThreadPool_WorkerFunc, 0, (void*) &threadID); - err = ( handle == 0 ); +#if defined(_WIN32) + uintptr_t handle = + _beginthread(ThreadPool_WorkerFunc, 0, (void *)&threadID); + err = (handle == 0); #else // !_WIN32 pthread_t tid = 0; - err = pthread_create( &tid, NULL, ThreadPool_WorkerFunc, (void*) &threadID ); + err = pthread_create(&tid, NULL, ThreadPool_WorkerFunc, + (void *)&threadID); #endif // !_WIN32 - if( err ) + if (err) { - log_error( "Error %d launching thread %d\n", err, i ); + log_error("Error %d launching thread %d\n", err, i); threadPoolInitErr = err; gThreadCount = i; break; } } - atexit( ThreadPool_Exit ); + atexit(ThreadPool_Exit); -// block until they are done launching. + // block until they are done launching. do { -#if defined( _WIN32 ) - WaitForSingleObject( caller_event, INFINITE ); +#if defined(_WIN32) + WaitForSingleObject(caller_event, INFINITE); #else // !_WIN32 - if((err = pthread_cond_wait( &caller_cond_var, &caller_cond_lock) )) + if ((err = pthread_cond_wait(&caller_cond_var, &caller_cond_lock))) { - log_error("Error %d from pthread_cond_wait. Unable to block for work to finish. ThreadPool_Init failed.\n", err ); - pthread_mutex_unlock( &caller_cond_lock); + log_error("Error %d from pthread_cond_wait. Unable to block for " + "work to finish. ThreadPool_Init failed.\n", + err); + pthread_mutex_unlock(&caller_cond_lock); return; } #endif // !_WIN32 - } - while( gRunCount != -gThreadCount ); -#if !defined( _WIN32 ) - if((err = pthread_mutex_unlock( &caller_cond_lock) )) + } while (gRunCount != -gThreadCount); +#if !defined(_WIN32) + if ((err = pthread_mutex_unlock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_unlock. Unable to block for work to finish. ThreadPool_Init failed.\n", err ); + log_error("Error %d from pthread_mutex_unlock. Unable to block for " + "work to finish. ThreadPool_Init failed.\n", + err); return; } #endif // !_WIN32 @@ -610,7 +678,8 @@ void ThreadPool_Init(void) } #if defined(_MSC_VER) -static BOOL CALLBACK _ThreadPool_Init(_PINIT_ONCE InitOnce, PVOID Parameter, PVOID *lpContex) +static BOOL CALLBACK _ThreadPool_Init(_PINIT_ONCE InitOnce, PVOID Parameter, + PVOID *lpContex) { ThreadPool_Init(); return TRUE; @@ -622,35 +691,40 @@ void ThreadPool_Exit(void) int err, count; gRunCount = CL_INT_MAX; -#if defined( __GNUC__ ) - // GCC extension: http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins +#if defined(__GNUC__) + // GCC extension: + // http://gcc.gnu.org/onlinedocs/gcc/Atomic-Builtins.html#Atomic-Builtins __sync_synchronize(); -#elif defined( _MSC_VER ) +#elif defined(_MSC_VER) _mm_mfence(); #else - #warning If this is a weakly ordered memory system, please add a memory barrier here to force this and everything else to memory before we proceed +#warning If this is a weakly ordered memory system, please add a memory barrier here to force this and everything else to memory before we proceed #endif // spin waiting for threads to die for (count = 0; 0 != gThreadCount && count < 1000; count++) { -#if defined( _WIN32 ) - _WakeAllConditionVariable( cond_var ); +#if defined(_WIN32) + _WakeAllConditionVariable(cond_var); Sleep(1); #else // !_WIN32 - if( (err = pthread_cond_broadcast( &cond_var ))) + if ((err = pthread_cond_broadcast(&cond_var))) { - log_error("Error %d from pthread_cond_broadcast. Unable to wake up work threads. ThreadPool_Exit failed.\n", err ); + log_error("Error %d from pthread_cond_broadcast. Unable to wake up " + "work threads. ThreadPool_Exit failed.\n", + err); break; } usleep(1000); #endif // !_WIN32 } - if( gThreadCount ) - log_error( "Error: Thread pool timed out after 1 second with %d threads still active.\n", gThreadCount ); + if (gThreadCount) + log_error("Error: Thread pool timed out after 1 second with %d threads " + "still active.\n", + gThreadCount); else - log_info( "Thread pool exited in a orderly fashion.\n" ); + log_info("Thread pool exited in a orderly fashion.\n"); } @@ -662,108 +736,123 @@ void ThreadPool_Exit(void) // can be running at a time. It is not intended for general purpose use. // If clEnqueueNativeKernelFn, out of order queues and a CL_DEVICE_TYPE_CPU were // all available then it would make more sense to use those features. -cl_int ThreadPool_Do( TPFuncPtr func_ptr, - cl_uint count, - void *userInfo ) +cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo) { cl_int newErr; cl_int err = 0; // Lazily set up our threads #if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600) - err = !_InitOnceExecuteOnce( &threadpool_init_control, _ThreadPool_Init, NULL, NULL ); -#elif defined (_WIN32) - if (threadpool_init_control == 0) { - #warning This is buggy and race prone. Find a better way. + err = !_InitOnceExecuteOnce(&threadpool_init_control, _ThreadPool_Init, + NULL, NULL); +#elif defined(_WIN32) + if (threadpool_init_control == 0) + { +#warning This is buggy and race prone. Find a better way. ThreadPool_Init(); threadpool_init_control = 1; } -#else //posix platform - err = pthread_once( &threadpool_init_control, ThreadPool_Init ); - if( err ) +#else // posix platform + err = pthread_once(&threadpool_init_control, ThreadPool_Init); + if (err) { - log_error("Error %d from pthread_once. Unable to init threads. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_once. Unable to init threads. " + "ThreadPool_Do failed.\n", + err); return err; } #endif - // Single threaded code to handle case where threadpool wasn't allocated or was disabled by environment variable - if( threadPoolInitErr ) + // Single threaded code to handle case where threadpool wasn't allocated or + // was disabled by environment variable + if (threadPoolInitErr) { cl_uint currentJob = 0; - cl_int result = CL_SUCCESS; + cl_int result = CL_SUCCESS; #if defined(__APPLE__) && defined(__arm__) // On most platforms which support denorm, default is FTZ off. However, - // on some hardware where the reference is computed, default might be flush denorms to zero e.g. arm. - // This creates issues in result verification. Since spec allows the implementation to either flush or - // not flush denorms to zero, an implementation may choose not be flush i.e. return denorm result whereas - // reference result may be zero (flushed denorm). Hence we need to disable denorm flushing on host side - // where reference is being computed to make sure we get non-flushed reference result. If implementation - // returns flushed result, we correctly take care of that in verification code. + // on some hardware where the reference is computed, default might be + // flush denorms to zero e.g. arm. This creates issues in result + // verification. Since spec allows the implementation to either flush or + // not flush denorms to zero, an implementation may choose not be flush + // i.e. return denorm result whereas reference result may be zero + // (flushed denorm). Hence we need to disable denorm flushing on host + // side where reference is being computed to make sure we get + // non-flushed reference result. If implementation returns flushed + // result, we correctly take care of that in verification code. FPU_mode_type oldMode; - DisableFTZ( &oldMode ); + DisableFTZ(&oldMode); #endif - for( currentJob = 0; currentJob < count; currentJob++ ) - if((result = func_ptr( currentJob, 0, userInfo ))) + for (currentJob = 0; currentJob < count; currentJob++) + if ((result = func_ptr(currentJob, 0, userInfo))) { #if defined(__APPLE__) && defined(__arm__) // Restore FP state before leaving - RestoreFPState( &oldMode ); + RestoreFPState(&oldMode); #endif return result; } #if defined(__APPLE__) && defined(__arm__) // Restore FP state before leaving - RestoreFPState( &oldMode ); + RestoreFPState(&oldMode); #endif return CL_SUCCESS; } - if( count >= MAX_COUNT ) + if (count >= MAX_COUNT) { - log_error("Error: ThreadPool_Do count %d >= max threadpool count of %d\n", count, MAX_COUNT ); + log_error( + "Error: ThreadPool_Do count %d >= max threadpool count of %d\n", + count, MAX_COUNT); return -1; } // Enter critical region -#if defined( _WIN32 ) - EnterCriticalSection( gThreadPoolLock ); +#if defined(_WIN32) + EnterCriticalSection(gThreadPoolLock); #else // !_WIN32 - if( (err = pthread_mutex_lock( &gThreadPoolLock ))) + if ((err = pthread_mutex_lock(&gThreadPoolLock))) { switch (err) { case EDEADLK: - log_error("Error EDEADLK returned in ThreadPool_Do(). ThreadPool_Do is not designed to work recursively!\n" ); + log_error( + "Error EDEADLK returned in ThreadPool_Do(). ThreadPool_Do " + "is not designed to work recursively!\n"); break; case EINVAL: - log_error("Error EINVAL returned in ThreadPool_Do(). How did we end up with an invalid gThreadPoolLock?\n" ); - break; - default: + log_error("Error EINVAL returned in ThreadPool_Do(). How did " + "we end up with an invalid gThreadPoolLock?\n"); break; + default: break; } return err; } #endif // !_WIN32 // Start modifying the job state observable by worker threads -#if defined( _WIN32 ) - EnterCriticalSection( cond_lock ); +#if defined(_WIN32) + EnterCriticalSection(cond_lock); #else // !_WIN32 - if((err = pthread_mutex_lock( &cond_lock) )) + if ((err = pthread_mutex_lock(&cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Unable to wake up work threads. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_mutex_lock. Unable to wake up work " + "threads. ThreadPool_Do failed.\n", + err); goto exit; } #endif // !_WIN32 - // Make sure the last thread done in the work pool doesn't signal us to wake before we get to the point where we are supposed to wait + // Make sure the last thread done in the work pool doesn't signal us to wake + // before we get to the point where we are supposed to wait // That would cause a deadlock. -#if !defined( _WIN32 ) - if((err = pthread_mutex_lock( &caller_cond_lock) )) +#if !defined(_WIN32) + if ((err = pthread_mutex_lock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_lock. Unable to block for work to finish. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_mutex_lock. Unable to block for work " + "to finish. ThreadPool_Do failed.\n", + err); goto exit; } #endif // !_WIN32 @@ -774,42 +863,50 @@ cl_int ThreadPool_Do( TPFuncPtr func_ptr, gFunc_ptr = func_ptr; gUserInfo = userInfo; -#if defined( _WIN32 ) +#if defined(_WIN32) ResetEvent(caller_event); - _WakeAllConditionVariable( cond_var ); - LeaveCriticalSection( cond_lock ); + _WakeAllConditionVariable(cond_var); + LeaveCriticalSection(cond_lock); #else // !_WIN32 - if( (err = pthread_cond_broadcast( &cond_var ))) + if ((err = pthread_cond_broadcast(&cond_var))) { - log_error("Error %d from pthread_cond_broadcast. Unable to wake up work threads. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_cond_broadcast. Unable to wake up " + "work threads. ThreadPool_Do failed.\n", + err); goto exit; } - if((err = pthread_mutex_unlock( &cond_lock) )) + if ((err = pthread_mutex_unlock(&cond_lock))) { - log_error("Error %d from pthread_mutex_unlock. Unable to wake up work threads. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_mutex_unlock. Unable to wake up work " + "threads. ThreadPool_Do failed.\n", + err); goto exit; } #endif // !_WIN32 -// block until they are done. It would be slightly more efficient to do some of the work here though. + // block until they are done. It would be slightly more efficient to do + // some of the work here though. do { -#if defined( _WIN32 ) - WaitForSingleObject( caller_event, INFINITE ); +#if defined(_WIN32) + WaitForSingleObject(caller_event, INFINITE); #else // !_WIN32 - if((err = pthread_cond_wait( &caller_cond_var, &caller_cond_lock) )) + if ((err = pthread_cond_wait(&caller_cond_var, &caller_cond_lock))) { - log_error("Error %d from pthread_cond_wait. Unable to block for work to finish. ThreadPool_Do failed.\n", err ); - pthread_mutex_unlock( &caller_cond_lock); + log_error("Error %d from pthread_cond_wait. Unable to block for " + "work to finish. ThreadPool_Do failed.\n", + err); + pthread_mutex_unlock(&caller_cond_lock); goto exit; } #endif // !_WIN32 - } - while( gRunning ); + } while (gRunning); #if !defined(_WIN32) - if((err = pthread_mutex_unlock( &caller_cond_lock) )) + if ((err = pthread_mutex_unlock(&caller_cond_lock))) { - log_error("Error %d from pthread_mutex_unlock. Unable to block for work to finish. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_mutex_unlock. Unable to block for " + "work to finish. ThreadPool_Do failed.\n", + err); goto exit; } #endif // !_WIN32 @@ -818,13 +915,15 @@ cl_int ThreadPool_Do( TPFuncPtr func_ptr, exit: // exit critical region -#if defined( _WIN32 ) - LeaveCriticalSection( gThreadPoolLock ); +#if defined(_WIN32) + LeaveCriticalSection(gThreadPoolLock); #else // !_WIN32 - newErr = pthread_mutex_unlock( &gThreadPoolLock ); - if( newErr) + newErr = pthread_mutex_unlock(&gThreadPoolLock); + if (newErr) { - log_error("Error %d from pthread_mutex_unlock. Unable to exit critical region. ThreadPool_Do failed.\n", newErr ); + log_error("Error %d from pthread_mutex_unlock. Unable to exit critical " + "region. ThreadPool_Do failed.\n", + newErr); return err; } #endif // !_WIN32 @@ -832,28 +931,31 @@ exit: return err; } -cl_uint GetThreadCount( void ) +cl_uint GetThreadCount(void) { // Lazily set up our threads #if defined(_MSC_VER) && (_WIN32_WINNT >= 0x600) - cl_int err = !_InitOnceExecuteOnce( &threadpool_init_control, _ThreadPool_Init, NULL, NULL ); -#elif defined (_WIN32) - if (threadpool_init_control == 0) { - #warning This is buggy and race prone. Find a better way. + cl_int err = !_InitOnceExecuteOnce(&threadpool_init_control, + _ThreadPool_Init, NULL, NULL); +#elif defined(_WIN32) + if (threadpool_init_control == 0) + { +#warning This is buggy and race prone. Find a better way. ThreadPool_Init(); threadpool_init_control = 1; } #else - cl_int err = pthread_once( &threadpool_init_control, ThreadPool_Init ); - if( err ) + cl_int err = pthread_once(&threadpool_init_control, ThreadPool_Init); + if (err) { - log_error("Error %d from pthread_once. Unable to init threads. ThreadPool_Do failed.\n", err ); + log_error("Error %d from pthread_once. Unable to init threads. " + "ThreadPool_Do failed.\n", + err); return err; } #endif // !_WIN32 - if( gThreadCount < 1 ) - return 1; + if (gThreadCount < 1) return 1; return gThreadCount; } @@ -861,24 +963,26 @@ cl_uint GetThreadCount( void ) #else #ifndef MY_OS_REALLY_REALLY_DOESNT_SUPPORT_THREADS - #error ThreadPool implementation has not been multithreaded for this operating system. You must multithread this section. +#error ThreadPool implementation has not been multithreaded for this operating system. You must multithread this section. #endif // -// We require multithreading in parts of the test as a means of simultaneously testing reentrancy requirements -// of OpenCL API, while also checking +// We require multithreading in parts of the test as a means of simultaneously +// testing reentrancy requirements of OpenCL API, while also checking // -// A sample single threaded implementation follows, for documentation / bootstrapping purposes. -// It is not okay to use this for conformance testing!!! +// A sample single threaded implementation follows, for documentation / +// bootstrapping purposes. It is not okay to use this for conformance testing!!! // -// Exception: If your operating system does not support multithreaded execution of any kind, then you may use this code. +// Exception: If your operating system does not support multithreaded execution +// of any kind, then you may use this code. // -cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ) +cl_int ThreadPool_AtomicAdd(volatile cl_int *a, cl_int b) { cl_uint r = *a; - // since this fallback code path is not multithreaded, we just do a regular add here - // If your operating system supports memory-barrier-atomics, use those here + // since this fallback code path is not multithreaded, we just do a regular + // add here. If your operating system supports memory-barrier-atomics, use + // those here. *a = r + b; return r; @@ -887,44 +991,38 @@ cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ) // Blocking API that farms out count jobs to a thread pool. // It may return with some work undone if func_ptr() returns a non-zero // result. -cl_int ThreadPool_Do( TPFuncPtr func_ptr, - cl_uint count, - void *userInfo ) +cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo) { cl_uint currentJob = 0; - cl_int result = CL_SUCCESS; + cl_int result = CL_SUCCESS; #ifndef MY_OS_REALLY_REALLY_DOESNT_SUPPORT_THREADS // THIS FUNCTION IS NOT INTENDED FOR USE!! - log_error( "ERROR: Test must be multithreaded!\n" ); + log_error("ERROR: Test must be multithreaded!\n"); exit(-1); #else static int spewCount = 0; - if( 0 == spewCount ) + if (0 == spewCount) { - log_info( "\nWARNING: The operating system is claimed not to support threads of any sort. Running single threaded.\n" ); + log_info("\nWARNING: The operating system is claimed not to support " + "threads of any sort. Running single threaded.\n"); spewCount = 1; } #endif -// The multithreaded code should mimic this behavior: - for( currentJob = 0; currentJob < count; currentJob++ ) - if((result = func_ptr( currentJob, 0, userInfo ))) - return result; + // The multithreaded code should mimic this behavior: + for (currentJob = 0; currentJob < count; currentJob++) + if ((result = func_ptr(currentJob, 0, userInfo))) return result; return CL_SUCCESS; } -cl_uint GetThreadCount( void ) -{ - return 1; -} +cl_uint GetThreadCount(void) { return 1; } -void SetThreadCount( int count ) +void SetThreadCount(int count) { - if( count > 1 ) - log_info( "WARNING: SetThreadCount(%d) ignored\n", count ); + if (count > 1) log_info("WARNING: SetThreadCount(%d) ignored\n", count); } #endif diff --git a/test_common/harness/ThreadPool.h b/test_common/harness/ThreadPool.h index 2fa9c7b5..2ef07b42 100644 --- a/test_common/harness/ThreadPool.h +++ b/test_common/harness/ThreadPool.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 @@ -16,53 +16,54 @@ #ifndef THREAD_POOL_H #define THREAD_POOL_H -#if defined( __APPLE__ ) - #include +#if defined(__APPLE__) +#include #else - #include +#include #endif // // An atomic add operator -cl_int ThreadPool_AtomicAdd( volatile cl_int *a, cl_int b ); // returns old value +cl_int ThreadPool_AtomicAdd(volatile cl_int *a, cl_int b); // returns old value // Your function prototype // -// A function pointer to the function you want to execute in a multithreaded context. No -// synchronization primitives are provided, other than the atomic add above. You may not -// call ThreadPool_Do from your function. ThreadPool_AtomicAdd() and GetThreadCount() should -// work, however. +// A function pointer to the function you want to execute in a multithreaded +// context. No synchronization primitives are provided, other than the atomic +// add above. You may not call ThreadPool_Do from your function. +// ThreadPool_AtomicAdd() and GetThreadCount() should work, however. // -// job ids and thread ids are 0 based. If number of jobs or threads was 8, they will numbered be 0 through 7. -// Note that while every job will be run, it is not guaranteed that every thread will wake up before -// the work is done. -typedef cl_int (*TPFuncPtr)( cl_uint /*job_id*/, cl_uint /* thread_id */, void *userInfo ); +// job ids and thread ids are 0 based. If number of jobs or threads was 8, they +// will numbered be 0 through 7. Note that while every job will be run, it is +// not guaranteed that every thread will wake up before the work is done. +typedef cl_int (*TPFuncPtr)(cl_uint /*job_id*/, cl_uint /* thread_id */, + void *userInfo); // returns first non-zero result from func_ptr, or CL_SUCCESS if all are zero. // Some workitems may not run if a non-zero result is returned from func_ptr(). // This function may not be called from a TPFuncPtr. -cl_int ThreadPool_Do( TPFuncPtr func_ptr, - cl_uint count, - void *userInfo ); +cl_int ThreadPool_Do(TPFuncPtr func_ptr, cl_uint count, void *userInfo); -// Returns the number of worker threads that underlie the threadpool. The value passed -// as the TPFuncPtrs thread_id will be between 0 and this value less one, inclusive. -// This is safe to call from a TPFuncPtr. -cl_uint GetThreadCount( void ); +// Returns the number of worker threads that underlie the threadpool. The value +// passed as the TPFuncPtrs thread_id will be between 0 and this value less one, +// inclusive. This is safe to call from a TPFuncPtr. +cl_uint GetThreadCount(void); // SetThreadCount() may be used to artifically set the number of worker threads -// If the value is 0 (the default) the number of threads will be determined based on -// the number of CPU cores. If it is a unicore machine, then 2 will be used, so -// that we still get some testing for thread safety. +// If the value is 0 (the default) the number of threads will be determined +// based on the number of CPU cores. If it is a unicore machine, then 2 will be +// used, so that we still get some testing for thread safety. // -// If count < 2 or the CL_TEST_SINGLE_THREADED environment variable is set then the -// code will run single threaded, but will report an error to indicate that the test -// is invalid. This option is intended for debugging purposes only. It is suggested -// as a convention that test apps set the thread count to 1 in response to the -m flag. +// If count < 2 or the CL_TEST_SINGLE_THREADED environment variable is set then +// the code will run single threaded, but will report an error to indicate that +// the test is invalid. This option is intended for debugging purposes only. It +// is suggested as a convention that test apps set the thread count to 1 in +// response to the -m flag. // -// SetThreadCount() must be called before the first call to GetThreadCount() or ThreadPool_Do(), -// otherwise the behavior is indefined. It may not be called from a TPFuncPtr. -void SetThreadCount( int count ); +// SetThreadCount() must be called before the first call to GetThreadCount() or +// ThreadPool_Do(), otherwise the behavior is indefined. It may not be called +// from a TPFuncPtr. +void SetThreadCount(int count); -#endif /* THREAD_POOL_H */ +#endif /* THREAD_POOL_H */ diff --git a/test_common/harness/alloc.h b/test_common/harness/alloc.h index 33e6bd81..653dde05 100644 --- a/test_common/harness/alloc.h +++ b/test_common/harness/alloc.h @@ -17,7 +17,7 @@ #ifndef HARNESS_ALLOC_H_ #define HARNESS_ALLOC_H_ -#if defined(__linux__) || defined (linux) || defined(__APPLE__) +#if defined(__linux__) || defined(linux) || defined(__APPLE__) #if defined(__ANDROID__) #include #else @@ -29,43 +29,41 @@ #include "mingw_compat.h" #endif -static void * align_malloc(size_t size, size_t alignment) +static void* align_malloc(size_t size, size_t alignment) { #if defined(_WIN32) && defined(_MSC_VER) return _aligned_malloc(size, alignment); -#elif defined(__linux__) || defined (linux) || defined(__APPLE__) - void * ptr = NULL; +#elif defined(__linux__) || defined(linux) || defined(__APPLE__) + void* ptr = NULL; #if defined(__ANDROID__) ptr = memalign(alignment, size); - if ( ptr ) - return ptr; + if (ptr) return ptr; #else - if (alignment < sizeof(void*)) { + if (alignment < sizeof(void*)) + { alignment = sizeof(void*); } - if (0 == posix_memalign(&ptr, alignment, size)) - return ptr; + if (0 == posix_memalign(&ptr, alignment, size)) return ptr; #endif return NULL; #elif defined(__MINGW32__) return __mingw_aligned_malloc(size, alignment); #else - #error "Please add support OS for aligned malloc" +#error "Please add support OS for aligned malloc" #endif } -static void align_free(void * ptr) +static void align_free(void* ptr) { #if defined(_WIN32) && defined(_MSC_VER) _aligned_free(ptr); -#elif defined(__linux__) || defined (linux) || defined(__APPLE__) - return free(ptr); +#elif defined(__linux__) || defined(linux) || defined(__APPLE__) + return free(ptr); #elif defined(__MINGW32__) return __mingw_aligned_free(ptr); #else - #error "Please add support OS for aligned free" +#error "Please add support OS for aligned free" #endif } #endif // #ifndef HARNESS_ALLOC_H_ - diff --git a/test_common/harness/clImageHelper.h b/test_common/harness/clImageHelper.h index 83f7b277..45395fb0 100644 --- a/test_common/harness/clImageHelper.h +++ b/test_common/harness/clImageHelper.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 @@ -26,18 +26,15 @@ #include "errorHelpers.h" - // helper function to replace clCreateImage2D , to make the existing code use - // the functions of version 1.2 and veriosn 1.1 respectively +// helper function to replace clCreateImage2D , to make the existing code use +// the functions of version 1.2 and veriosn 1.1 respectively - static inline cl_mem create_image_2d (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_height, - size_t image_row_pitch, - void *host_ptr, - cl_int *errcode_ret) - { +static inline cl_mem create_image_2d(cl_context context, cl_mem_flags flags, + const cl_image_format *image_format, + size_t image_width, size_t image_height, + size_t image_row_pitch, void *host_ptr, + cl_int *errcode_ret) +{ cl_mem mImage = NULL; #ifdef CL_VERSION_1_2 @@ -45,80 +42,81 @@ image_desc_dest.image_type = CL_MEM_OBJECT_IMAGE2D; image_desc_dest.image_width = image_width; image_desc_dest.image_height = image_height; - image_desc_dest.image_depth= 0;// not usedfor 2d - image_desc_dest.image_array_size = 0;// not used for 2d + image_desc_dest.image_depth = 0; // not usedfor 2d + image_desc_dest.image_array_size = 0; // not used for 2d image_desc_dest.image_row_pitch = image_row_pitch; image_desc_dest.image_slice_pitch = 0; image_desc_dest.num_mip_levels = 0; image_desc_dest.num_samples = 0; - image_desc_dest.mem_object = NULL;// no image type of CL_MEM_OBJECT_IMAGE1D_BUFFER in CL_VERSION_1_1, so always is NULL - mImage = clCreateImage( context, flags, image_format, &image_desc_dest, host_ptr, errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); + image_desc_dest.mem_object = + NULL; // no image type of CL_MEM_OBJECT_IMAGE1D_BUFFER in + // CL_VERSION_1_1, so always is NULL + mImage = clCreateImage(context, flags, image_format, &image_desc_dest, + host_ptr, errcode_ret); + if (errcode_ret && (*errcode_ret)) + { + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } #else - mImage = clCreateImage2D( context, flags, image_format, image_width, image_height, image_row_pitch, host_ptr, errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage2D failed (%d)\n", *errcode_ret); + mImage = + clCreateImage2D(context, flags, image_format, image_width, image_height, + image_row_pitch, host_ptr, errcode_ret); + if (errcode_ret && (*errcode_ret)) + { + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage2D failed (%d)\n", *errcode_ret); } #endif return mImage; - } +} - // helper function to replace clCreateImage2D , to make the existing code use - // the functions of version 1.2 and veriosn 1.1 respectively +// helper function to replace clCreateImage2D , to make the existing code use +// the functions of version 1.2 and veriosn 1.1 respectively - static inline cl_mem create_image_2d_buffer (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_height, - size_t image_row_pitch, - cl_mem buffer, - cl_int *errcode_ret) +static inline cl_mem +create_image_2d_buffer(cl_context context, cl_mem_flags flags, + const cl_image_format *image_format, size_t image_width, + size_t image_height, size_t image_row_pitch, + cl_mem buffer, cl_int *errcode_ret) +{ + cl_mem mImage = NULL; + + cl_image_desc image_desc_dest; + image_desc_dest.image_type = CL_MEM_OBJECT_IMAGE2D; + image_desc_dest.image_width = image_width; + image_desc_dest.image_height = image_height; + image_desc_dest.image_depth = 0; // not usedfor 2d + image_desc_dest.image_array_size = 0; // not used for 2d + image_desc_dest.image_row_pitch = image_row_pitch; + image_desc_dest.image_slice_pitch = 0; + image_desc_dest.num_mip_levels = 0; + image_desc_dest.num_samples = 0; + image_desc_dest.mem_object = buffer; + mImage = clCreateImage(context, flags, image_format, &image_desc_dest, NULL, + errcode_ret); + if (errcode_ret && (*errcode_ret)) { - cl_mem mImage = NULL; - - cl_image_desc image_desc_dest; - image_desc_dest.image_type = CL_MEM_OBJECT_IMAGE2D; - image_desc_dest.image_width = image_width; - image_desc_dest.image_height = image_height; - image_desc_dest.image_depth= 0;// not usedfor 2d - image_desc_dest.image_array_size = 0;// not used for 2d - image_desc_dest.image_row_pitch = image_row_pitch; - image_desc_dest.image_slice_pitch = 0; - image_desc_dest.num_mip_levels = 0; - image_desc_dest.num_samples = 0; - image_desc_dest.mem_object = buffer; - mImage = clCreateImage( context, flags, image_format, &image_desc_dest, NULL, errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); - } - - return mImage; + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } + return mImage; +} - static inline cl_mem create_image_3d (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_height, - size_t image_depth, - size_t image_row_pitch, - size_t image_slice_pitch, - void *host_ptr, - cl_int *errcode_ret) - { +static inline cl_mem create_image_3d(cl_context context, cl_mem_flags flags, + const cl_image_format *image_format, + size_t image_width, size_t image_height, + size_t image_depth, size_t image_row_pitch, + size_t image_slice_pitch, void *host_ptr, + cl_int *errcode_ret) +{ cl_mem mImage; #ifdef CL_VERSION_1_2 @@ -127,156 +125,130 @@ image_desc.image_width = image_width; image_desc.image_height = image_height; image_desc.image_depth = image_depth; - image_desc.image_array_size = 0;// not used for one image + image_desc.image_array_size = 0; // not used for one image image_desc.image_row_pitch = image_row_pitch; image_desc.image_slice_pitch = image_slice_pitch; image_desc.num_mip_levels = 0; image_desc.num_samples = 0; - image_desc.mem_object = NULL; // no image type of CL_MEM_OBJECT_IMAGE1D_BUFFER in CL_VERSION_1_1, so always is NULL - mImage = clCreateImage( context, - flags, - image_format, - &image_desc, - host_ptr, - errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); + image_desc.mem_object = + NULL; // no image type of CL_MEM_OBJECT_IMAGE1D_BUFFER in + // CL_VERSION_1_1, so always is NULL + mImage = clCreateImage(context, flags, image_format, &image_desc, host_ptr, + errcode_ret); + if (errcode_ret && (*errcode_ret)) + { + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } #else - mImage = clCreateImage3D( context, - flags, image_format, - image_width, - image_height, - image_depth, - image_row_pitch, - image_slice_pitch, - host_ptr, - errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage3D failed (%d)\n", *errcode_ret); + mImage = clCreateImage3D(context, flags, image_format, image_width, + image_height, image_depth, image_row_pitch, + image_slice_pitch, host_ptr, errcode_ret); + if (errcode_ret && (*errcode_ret)) + { + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage3D failed (%d)\n", *errcode_ret); } #endif return mImage; - } +} - static inline cl_mem create_image_2d_array (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_height, - size_t image_array_size, - size_t image_row_pitch, - size_t image_slice_pitch, - void *host_ptr, - cl_int *errcode_ret) +static inline cl_mem +create_image_2d_array(cl_context context, cl_mem_flags flags, + const cl_image_format *image_format, size_t image_width, + size_t image_height, size_t image_array_size, + size_t image_row_pitch, size_t image_slice_pitch, + void *host_ptr, cl_int *errcode_ret) +{ + cl_mem mImage; + + cl_image_desc image_desc; + image_desc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; + image_desc.image_width = image_width; + image_desc.image_height = image_height; + image_desc.image_depth = 1; + image_desc.image_array_size = image_array_size; + image_desc.image_row_pitch = image_row_pitch; + image_desc.image_slice_pitch = image_slice_pitch; + image_desc.num_mip_levels = 0; + image_desc.num_samples = 0; + image_desc.mem_object = NULL; + mImage = clCreateImage(context, flags, image_format, &image_desc, host_ptr, + errcode_ret); + if (errcode_ret && (*errcode_ret)) { - cl_mem mImage; - - cl_image_desc image_desc; - image_desc.image_type = CL_MEM_OBJECT_IMAGE2D_ARRAY; - image_desc.image_width = image_width; - image_desc.image_height = image_height; - image_desc.image_depth = 1; - image_desc.image_array_size = image_array_size; - image_desc.image_row_pitch = image_row_pitch; - image_desc.image_slice_pitch = image_slice_pitch; - image_desc.num_mip_levels = 0; - image_desc.num_samples = 0; - image_desc.mem_object = NULL; - mImage = clCreateImage( context, - flags, - image_format, - &image_desc, - host_ptr, - errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); - } - - return mImage; + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } - static inline cl_mem create_image_1d_array (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_array_size, - size_t image_row_pitch, - size_t image_slice_pitch, - void *host_ptr, - cl_int *errcode_ret) + return mImage; +} + +static inline cl_mem create_image_1d_array( + cl_context context, cl_mem_flags flags, const cl_image_format *image_format, + size_t image_width, size_t image_array_size, size_t image_row_pitch, + size_t image_slice_pitch, void *host_ptr, cl_int *errcode_ret) +{ + cl_mem mImage; + + cl_image_desc image_desc; + image_desc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; + image_desc.image_width = image_width; + image_desc.image_height = 1; + image_desc.image_depth = 1; + image_desc.image_array_size = image_array_size; + image_desc.image_row_pitch = image_row_pitch; + image_desc.image_slice_pitch = image_slice_pitch; + image_desc.num_mip_levels = 0; + image_desc.num_samples = 0; + image_desc.mem_object = NULL; + mImage = clCreateImage(context, flags, image_format, &image_desc, host_ptr, + errcode_ret); + if (errcode_ret && (*errcode_ret)) { - cl_mem mImage; - - cl_image_desc image_desc; - image_desc.image_type = CL_MEM_OBJECT_IMAGE1D_ARRAY; - image_desc.image_width = image_width; - image_desc.image_height = 1; - image_desc.image_depth = 1; - image_desc.image_array_size = image_array_size; - image_desc.image_row_pitch = image_row_pitch; - image_desc.image_slice_pitch = image_slice_pitch; - image_desc.num_mip_levels = 0; - image_desc.num_samples = 0; - image_desc.mem_object = NULL; - mImage = clCreateImage( context, - flags, - image_format, - &image_desc, - host_ptr, - errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); - } - - return mImage; + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } - static inline cl_mem create_image_1d (cl_context context, - cl_mem_flags flags, - const cl_image_format *image_format, - size_t image_width, - size_t image_row_pitch, - void *host_ptr, - cl_mem buffer, - cl_int *errcode_ret) + return mImage; +} + +static inline cl_mem create_image_1d(cl_context context, cl_mem_flags flags, + const cl_image_format *image_format, + size_t image_width, size_t image_row_pitch, + void *host_ptr, cl_mem buffer, + cl_int *errcode_ret) +{ + cl_mem mImage; + + cl_image_desc image_desc; + image_desc.image_type = + buffer ? CL_MEM_OBJECT_IMAGE1D_BUFFER : CL_MEM_OBJECT_IMAGE1D; + image_desc.image_width = image_width; + image_desc.image_height = 1; + image_desc.image_depth = 1; + image_desc.image_row_pitch = image_row_pitch; + image_desc.image_slice_pitch = 0; + image_desc.num_mip_levels = 0; + image_desc.num_samples = 0; + image_desc.mem_object = buffer; + mImage = clCreateImage(context, flags, image_format, &image_desc, host_ptr, + errcode_ret); + if (errcode_ret && (*errcode_ret)) { - cl_mem mImage; - - cl_image_desc image_desc; - image_desc.image_type = buffer ? CL_MEM_OBJECT_IMAGE1D_BUFFER: CL_MEM_OBJECT_IMAGE1D; - image_desc.image_width = image_width; - image_desc.image_height = 1; - image_desc.image_depth = 1; - image_desc.image_row_pitch = image_row_pitch; - image_desc.image_slice_pitch = 0; - image_desc.num_mip_levels = 0; - image_desc.num_samples = 0; - image_desc.mem_object = buffer; - mImage = clCreateImage( context, - flags, - image_format, - &image_desc, - host_ptr, - errcode_ret ); - if (errcode_ret && (*errcode_ret)) { - // Log an info message and rely on the calling function to produce an error - // if necessary. - log_info("clCreateImage failed (%d)\n", *errcode_ret); - } - - return mImage; + // Log an info message and rely on the calling function to produce an + // error if necessary. + log_info("clCreateImage failed (%d)\n", *errcode_ret); } + return mImage; +} + #endif diff --git a/test_common/harness/compat.h b/test_common/harness/compat.h index 3858a7ce..7aad15a0 100644 --- a/test_common/harness/compat.h +++ b/test_common/harness/compat.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 @@ -16,14 +16,14 @@ #ifndef _COMPAT_H_ #define _COMPAT_H_ -#if defined(_WIN32) && defined (_MSC_VER) +#if defined(_WIN32) && defined(_MSC_VER) #include #endif #ifdef __cplusplus - #define EXTERN_C extern "C" +#define EXTERN_C extern "C" #else - #define EXTERN_C +#define EXTERN_C #endif @@ -31,11 +31,11 @@ // stdlib.h // -#include // On Windows, _MAX_PATH defined there. +#include // On Windows, _MAX_PATH defined there. // llabs appeared in MS C v16 (VS 10/2010). -#if defined( _MSC_VER ) && _MSC_VER <= 1500 - EXTERN_C inline long long llabs(long long __x) { return __x >= 0 ? __x : -__x; } +#if defined(_MSC_VER) && _MSC_VER <= 1500 +EXTERN_C inline long long llabs(long long __x) { return __x >= 0 ? __x : -__x; } #endif @@ -44,16 +44,15 @@ // // stdbool.h appeared in MS C v18 (VS 12/2013). -#if defined( _MSC_VER ) && MSC_VER <= 1700 +#if defined(_MSC_VER) && MSC_VER <= 1700 #if !defined(__cplusplus) typedef char bool; - #define true 1 - #define false 0 - #endif -#else - #include +#define true 1 +#define false 0 #endif - +#else +#include +#endif // defined(_MSC_VER) && MSC_VER <= 1700 // @@ -61,24 +60,25 @@ typedef char bool; // // stdint.h appeared in MS C v16 (VS 10/2010) and Intel C v12. -#if defined( _MSC_VER ) && ( ! defined( __INTEL_COMPILER ) && _MSC_VER <= 1500 || defined( __INTEL_COMPILER ) && __INTEL_COMPILER < 1200 ) -typedef unsigned char uint8_t; -typedef char int8_t; -typedef unsigned short uint16_t; -typedef short int16_t; -typedef unsigned int uint32_t; -typedef int int32_t; -typedef unsigned long long uint64_t; -typedef long long int64_t; +#if defined(_MSC_VER) \ + && (!defined(__INTEL_COMPILER) && _MSC_VER <= 1500 \ + || defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1200) +typedef unsigned char uint8_t; +typedef char int8_t; +typedef unsigned short uint16_t; +typedef short int16_t; +typedef unsigned int uint32_t; +typedef int int32_t; +typedef unsigned long long uint64_t; +typedef long long int64_t; #else #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif - #include +#include #endif - // // float.h // @@ -86,24 +86,23 @@ typedef long long int64_t; #include - // // fenv.h // // fenv.h appeared in MS C v18 (VS 12/2013). -#if defined( _MSC_VER ) && _MSC_VER <= 1700 && ! defined( __INTEL_COMPILER ) - // reimplement fenv.h because windows doesn't have it - #define FE_INEXACT 0x0020 - #define FE_UNDERFLOW 0x0010 - #define FE_OVERFLOW 0x0008 - #define FE_DIVBYZERO 0x0004 - #define FE_INVALID 0x0001 - #define FE_ALL_EXCEPT 0x003D - int fetestexcept(int excepts); - int feclearexcept(int excepts); +#if defined(_MSC_VER) && _MSC_VER <= 1700 && !defined(__INTEL_COMPILER) +// reimplement fenv.h because windows doesn't have it +#define FE_INEXACT 0x0020 +#define FE_UNDERFLOW 0x0010 +#define FE_OVERFLOW 0x0008 +#define FE_DIVBYZERO 0x0004 +#define FE_INVALID 0x0001 +#define FE_ALL_EXCEPT 0x003D +int fetestexcept(int excepts); +int feclearexcept(int excepts); #else - #include +#include #endif @@ -111,138 +110,137 @@ typedef long long int64_t; // math.h // -#if defined( __INTEL_COMPILER ) - #include +#if defined(__INTEL_COMPILER) +#include #else - #include +#include #endif #ifndef M_PI - #define M_PI 3.14159265358979323846264338327950288 +#define M_PI 3.14159265358979323846264338327950288 #endif -#if defined( _MSC_VER ) - - #ifdef __cplusplus - extern "C" { - #endif - - #ifndef NAN - #define NAN (INFINITY - INFINITY) - #endif - - #ifndef HUGE_VALF - #define HUGE_VALF (float)HUGE_VAL - #endif - - #ifndef INFINITY - #define INFINITY (FLT_MAX + FLT_MAX) - #endif - - #ifndef isfinite - #define isfinite(x) _finite(x) - #endif - - #ifndef isnan - #define isnan( x ) ((x) != (x)) - #endif - - #ifndef isinf - #define isinf( _x) ((_x) == INFINITY || (_x) == -INFINITY) - #endif - - #if _MSC_VER < 1900 && ! defined( __INTEL_COMPILER ) - - double rint( double x); - float rintf( float x); - long double rintl( long double x); - - float cbrtf( float ); - double cbrt( double ); - - int ilogb( double x); - int ilogbf (float x); - int ilogbl(long double x); - - double fmax(double x, double y); - double fmin(double x, double y); - float fmaxf( float x, float y ); - float fminf(float x, float y); - - double log2(double x); - long double log2l(long double x); - - double exp2(double x); - long double exp2l(long double x); - - double fdim(double x, double y); - float fdimf(float x, float y); - long double fdiml(long double x, long double y); - - double remquo( double x, double y, int *quo); - float remquof( float x, float y, int *quo); - long double remquol( long double x, long double y, int *quo); - - long double scalblnl(long double x, long n); - - float hypotf(float x, float y); - long double hypotl(long double x, long double y) ; - double lgamma(double x); - float lgammaf(float x); - - double trunc(double x); - float truncf(float x); - - double log1p(double x); - float log1pf(float x); - long double log1pl(long double x); - - double copysign(double x, double y); - float copysignf(float x, float y); - long double copysignl(long double x, long double y); - - long lround(double x); - long lroundf(float x); - //long lroundl(long double x) - - double round(double x); - float roundf(float x); - long double roundl(long double x); - - int cf_signbit(double x); - int cf_signbitf(float x); - - // Added in _MSC_VER == 1800 (Visual Studio 2013) - #if _MSC_VER < 1800 - static int signbit(double x) { return cf_signbit(x); } - #endif - static int signbitf(float x) { return cf_signbitf(x); } - - long int lrint (double flt); - long int lrintf (float flt); - - float int2float (int32_t ix); - int32_t float2int (float fx); - - #endif // _MSC_VER < 1900 && ! defined( __INTEL_COMPILER ) - - #if _MSC_VER < 1900 && ( ! defined( __INTEL_COMPILER ) || __INTEL_COMPILER < 1300 ) - // These functions appeared in Intel C v13 and Visual Studio 2015 - float nanf( const char* str); - double nan( const char* str); - long double nanl( const char* str); - #endif - - #ifdef __cplusplus - } - #endif +#if defined(_MSC_VER) +#ifdef __cplusplus +extern "C" { #endif -#if defined( __ANDROID__ ) - #define log2(X) (log(X)/log(2)) +#ifndef NAN +#define NAN (INFINITY - INFINITY) #endif +#ifndef HUGE_VALF +#define HUGE_VALF (float)HUGE_VAL +#endif + +#ifndef INFINITY +#define INFINITY (FLT_MAX + FLT_MAX) +#endif + +#ifndef isfinite +#define isfinite(x) _finite(x) +#endif + +#ifndef isnan +#define isnan(x) ((x) != (x)) +#endif + +#ifndef isinf +#define isinf(_x) ((_x) == INFINITY || (_x) == -INFINITY) +#endif + +#if _MSC_VER < 1900 && !defined(__INTEL_COMPILER) + +double rint(double x); +float rintf(float x); +long double rintl(long double x); + +float cbrtf(float); +double cbrt(double); + +int ilogb(double x); +int ilogbf(float x); +int ilogbl(long double x); + +double fmax(double x, double y); +double fmin(double x, double y); +float fmaxf(float x, float y); +float fminf(float x, float y); + +double log2(double x); +long double log2l(long double x); + +double exp2(double x); +long double exp2l(long double x); + +double fdim(double x, double y); +float fdimf(float x, float y); +long double fdiml(long double x, long double y); + +double remquo(double x, double y, int* quo); +float remquof(float x, float y, int* quo); +long double remquol(long double x, long double y, int* quo); + +long double scalblnl(long double x, long n); + +float hypotf(float x, float y); +long double hypotl(long double x, long double y); +double lgamma(double x); +float lgammaf(float x); + +double trunc(double x); +float truncf(float x); + +double log1p(double x); +float log1pf(float x); +long double log1pl(long double x); + +double copysign(double x, double y); +float copysignf(float x, float y); +long double copysignl(long double x, long double y); + +long lround(double x); +long lroundf(float x); +// long lroundl(long double x) + +double round(double x); +float roundf(float x); +long double roundl(long double x); + +int cf_signbit(double x); +int cf_signbitf(float x); + +// Added in _MSC_VER == 1800 (Visual Studio 2013) +#if _MSC_VER < 1800 +static int signbit(double x) { return cf_signbit(x); } +#endif +static int signbitf(float x) { return cf_signbitf(x); } + +long int lrint(double flt); +long int lrintf(float flt); + +float int2float(int32_t ix); +int32_t float2int(float fx); + +#endif // _MSC_VER < 1900 && ! defined( __INTEL_COMPILER ) + +#if _MSC_VER < 1900 && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER < 1300) +// These functions appeared in Intel C v13 and Visual Studio 2015 +float nanf(const char* str); +double nan(const char* str); +long double nanl(const char* str); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // defined(_MSC_VER) + +#if defined(__ANDROID__) +#define log2(X) (log(X) / log(2)) +#endif // @@ -250,12 +248,11 @@ typedef long long int64_t; // #if defined(_MSC_VER) - // snprintf added in _MSC_VER == 1900 (Visual Studio 2015) - #if _MSC_VER < 1900 - #define snprintf sprintf_s - #endif +// snprintf added in _MSC_VER == 1900 (Visual Studio 2015) +#if _MSC_VER < 1900 +#define snprintf sprintf_s #endif - +#endif // defined(_MSC_VER) // @@ -263,35 +260,32 @@ typedef long long int64_t; // #if defined(_MSC_VER) - #define strtok_r strtok_s +#define strtok_r strtok_s #endif - // // unistd.h // -#if defined( _MSC_VER ) - EXTERN_C unsigned int sleep( unsigned int sec ); - EXTERN_C int usleep( int usec ); +#if defined(_MSC_VER) +EXTERN_C unsigned int sleep(unsigned int sec); +EXTERN_C int usleep(int usec); #endif - // // syscall.h // -#if defined( __ANDROID__ ) - // Android bionic's isn't providing SYS_sysctl wrappers. - #define SYS__sysctl __NR__sysctl +#if defined(__ANDROID__) +// Android bionic's isn't providing SYS_sysctl wrappers. +#define SYS__sysctl __NR__sysctl #endif - // Some tests use _malloca which defined in malloc.h. -#if !defined (__APPLE__) +#if !defined(__APPLE__) #include #endif @@ -300,104 +294,115 @@ typedef long long int64_t; // ??? // -#if defined( _MSC_VER ) +#if defined(_MSC_VER) - #define MAXPATHLEN _MAX_PATH +#define MAXPATHLEN _MAX_PATH - EXTERN_C uint64_t ReadTime( void ); - EXTERN_C double SubtractTime( uint64_t endTime, uint64_t startTime ); +EXTERN_C uint64_t ReadTime(void); +EXTERN_C double SubtractTime(uint64_t endTime, uint64_t startTime); /** Returns the number of leading 0-bits in x, starting at the most significant bit position. If x is 0, the result is undefined. */ - EXTERN_C int __builtin_clz(unsigned int pattern); +EXTERN_C int __builtin_clz(unsigned int pattern); #endif #ifndef MIN - #define MIN(x,y) (((x)<(y))?(x):(y)) +#define MIN(x, y) (((x) < (y)) ? (x) : (y)) #endif #ifndef MAX - #define MAX(x,y) (((x)>(y))?(x):(y)) +#define MAX(x, y) (((x) > (y)) ? (x) : (y)) #endif -/* - ------------------------------------------------------------------------------------------------ - WARNING: DO NOT USE THESE MACROS: MAKE_HEX_FLOAT, MAKE_HEX_DOUBLE, MAKE_HEX_LONG. +/*----------------------------------------------------------------------------- + WARNING: DO NOT USE THESE MACROS: + MAKE_HEX_FLOAT, MAKE_HEX_DOUBLE, MAKE_HEX_LONG. - This is a typical usage of the macros: + This is a typical usage of the macros: - double yhi = MAKE_HEX_DOUBLE(0x1.5555555555555p-2,0x15555555555555LL,-2); + double yhi = MAKE_HEX_DOUBLE(0x1.5555555555555p-2,0x15555555555555LL,-2); - (taken from math_brute_force/reference_math.c). There are two problems: + (taken from math_brute_force/reference_math.c). There are two problems: - 1. There is an error here. On Windows in will produce incorrect result - `0x1.5555555555555p+50'. To have a correct result it should be written as - `MAKE_HEX_DOUBLE(0x1.5555555555555p-2,0x15555555555555LL,-54)'. A proper value of the - third argument is not obvious -- sometimes it should be the same as exponent of the - first argument, but sometimes not. + 1. There is an error here. On Windows in will produce incorrect result + `0x1.5555555555555p+50'. + To have a correct result it should be written as: + MAKE_HEX_DOUBLE(0x1.5555555555555p-2, 0x15555555555555LL, -54) + A proper value of the third argument is not obvious -- sometimes it + should be the same as exponent of the first argument, but sometimes + not. - 2. Information is duplicated. It is easy to make a mistake. + 2. Information is duplicated. It is easy to make a mistake. - Use HEX_FLT, HEX_DBL, HEX_LDBL macros instead (see them in the bottom of the file). - ------------------------------------------------------------------------------------------------ -*/ -#if defined ( _MSC_VER ) && ! defined( __INTEL_COMPILER ) + Use HEX_FLT, HEX_DBL, HEX_LDBL macros instead + (see them in the bottom of the file). +-----------------------------------------------------------------------------*/ +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) - #define MAKE_HEX_FLOAT(x,y,z) ((float)ldexp( (float)(y), z)) - #define MAKE_HEX_DOUBLE(x,y,z) ldexp( (double)(y), z) - #define MAKE_HEX_LONG(x,y,z) ((long double) ldexp( (long double)(y), z)) +#define MAKE_HEX_FLOAT(x, y, z) ((float)ldexp((float)(y), z)) +#define MAKE_HEX_DOUBLE(x, y, z) ldexp((double)(y), z) +#define MAKE_HEX_LONG(x, y, z) ((long double)ldexp((long double)(y), z)) #else // Do not use these macros in new code, use HEX_FLT, HEX_DBL, HEX_LDBL instead. -#define MAKE_HEX_FLOAT(x,y,z) x -#define MAKE_HEX_DOUBLE(x,y,z) x -#define MAKE_HEX_LONG(x,y,z) x +#define MAKE_HEX_FLOAT(x, y, z) x +#define MAKE_HEX_DOUBLE(x, y, z) x +#define MAKE_HEX_LONG(x, y, z) x #endif -/* - ------------------------------------------------------------------------------------------------ - HEX_FLT, HEXT_DBL, HEX_LDBL -- Create hex floating point literal of type float, double, long - double respectively. Arguments: +/*----------------------------------------------------------------------------- + HEX_FLT, HEXT_DBL, HEX_LDBL -- Create hex floating point literal of type + float, double, long double respectively. Arguments: - sm -- sign of number, - int -- integer part of mantissa (without `0x' prefix), - fract -- fractional part of mantissa (without decimal point and `L' or `LL' suffixes), - se -- sign of exponent, - exp -- absolute value of (binary) exponent. + sm -- sign of number, + int -- integer part of mantissa (without `0x' prefix), + fract -- fractional part of mantissa (without decimal point and `L' or + `LL' suffixes), + se -- sign of exponent, + exp -- absolute value of (binary) exponent. - Example: + Example: - double yhi = HEX_DBL( +, 1, 5555555555555, -, 2 ); // == 0x1.5555555555555p-2 + double yhi = HEX_DBL(+, 1, 5555555555555, -, 2); // 0x1.5555555555555p-2 - Note: + Note: - We have to pass signs as separate arguments because gcc pass negative integer values - (e. g. `-2') into a macro as two separate tokens, so `HEX_FLT( 1, 0, -2 )' produces result - `0x1.0p- 2' (note a space between minus and two) which is not a correct floating point - literal. - ------------------------------------------------------------------------------------------------ -*/ -#if defined ( _MSC_VER ) && ! defined( __INTEL_COMPILER ) - // If compiler does not support hex floating point literals: - #define HEX_FLT( sm, int, fract, se, exp ) sm ldexpf( (float)( 0x ## int ## fract ## UL ), se exp + ilogbf( (float) 0x ## int ) - ilogbf( ( float )( 0x ## int ## fract ## UL ) ) ) - #define HEX_DBL( sm, int, fract, se, exp ) sm ldexp( (double)( 0x ## int ## fract ## ULL ), se exp + ilogb( (double) 0x ## int ) - ilogb( ( double )( 0x ## int ## fract ## ULL ) ) ) - #define HEX_LDBL( sm, int, fract, se, exp ) sm ldexpl( (long double)( 0x ## int ## fract ## ULL ), se exp + ilogbl( (long double) 0x ## int ) - ilogbl( ( long double )( 0x ## int ## fract ## ULL ) ) ) + We have to pass signs as separate arguments because gcc pass negative + integer values (e. g. `-2') into a macro as two separate tokens, so + `HEX_FLT(1, 0, -2)' produces result `0x1.0p- 2' (note a space between minus + and two) which is not a correct floating point literal. +-----------------------------------------------------------------------------*/ +#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) +// If compiler does not support hex floating point literals: +#define HEX_FLT(sm, int, fract, se, exp) \ + sm ldexpf((float)(0x##int##fract##UL), \ + se exp + ilogbf((float)0x##int) \ + - ilogbf((float)(0x##int##fract##UL))) +#define HEX_DBL(sm, int, fract, se, exp) \ + sm ldexp((double)(0x##int##fract##ULL), \ + se exp + ilogb((double)0x##int) \ + - ilogb((double)(0x##int##fract##ULL))) +#define HEX_LDBL(sm, int, fract, se, exp) \ + sm ldexpl((long double)(0x##int##fract##ULL), \ + se exp + ilogbl((long double)0x##int) \ + - ilogbl((long double)(0x##int##fract##ULL))) #else - // If compiler supports hex floating point literals: just concatenate all the parts into a literal. - #define HEX_FLT( sm, int, fract, se, exp ) sm 0x ## int ## . ## fract ## p ## se ## exp ## F - #define HEX_DBL( sm, int, fract, se, exp ) sm 0x ## int ## . ## fract ## p ## se ## exp - #define HEX_LDBL( sm, int, fract, se, exp ) sm 0x ## int ## . ## fract ## p ## se ## exp ## L +// If compiler supports hex floating point literals: just concatenate all the +// parts into a literal. +#define HEX_FLT(sm, int, fract, se, exp) sm 0x##int##.##fract##p##se##exp##F +#define HEX_DBL(sm, int, fract, se, exp) sm 0x##int##.##fract##p##se##exp +#define HEX_LDBL(sm, int, fract, se, exp) sm 0x##int##.##fract##p##se##exp##L #endif #if defined(__MINGW32__) - #include - #define sleep(sec) Sleep((sec) * 1000) +#include +#define sleep(sec) Sleep((sec)*1000) #endif #endif // _COMPAT_H_ diff --git a/test_common/harness/conversions.cpp b/test_common/harness/conversions.cpp index 633c6382..fc3317c7 100644 --- a/test_common/harness/conversions.cpp +++ b/test_common/harness/conversions.cpp @@ -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 @@ -20,123 +20,101 @@ #include "mt19937.h" #include "compat.h" -#if defined( __SSE__ ) || defined (_MSC_VER) - #include +#if defined(__SSE__) || defined(_MSC_VER) +#include #endif -#if defined( __SSE2__ ) || defined (_MSC_VER) - #include +#if defined(__SSE2__) || defined(_MSC_VER) +#include #endif -void print_type_to_string(ExplicitType type, void *data, char* string) { - switch (type) { - case kBool: - if (*(char*)data) - sprintf(string, "true"); - else - sprintf(string, "false"); +void print_type_to_string(ExplicitType type, void *data, char *string) +{ + switch (type) + { + case kBool: + if (*(char *)data) + sprintf(string, "true"); + else + sprintf(string, "false"); return; - case kChar: - sprintf(string, "%d", (int)*((cl_char*)data)); - return; - case kUChar: - case kUnsignedChar: - sprintf(string, "%u", (int)*((cl_uchar*)data)); - return; - case kShort: - sprintf(string, "%d", (int)*((cl_short*)data)); - return; - case kUShort: - case kUnsignedShort: - sprintf(string, "%u", (int)*((cl_ushort*)data)); - return; - case kInt: - sprintf(string, "%d", *((cl_int*)data)); - return; - case kUInt: - case kUnsignedInt: - sprintf(string, "%u", *((cl_uint*)data)); - return; - case kLong: - sprintf(string, "%lld", *((cl_long*)data)); - return; - case kULong: - case kUnsignedLong: - sprintf(string, "%llu", *((cl_ulong*)data)); - return; - case kFloat: - sprintf(string, "%f", *((cl_float*)data)); - return; - case kHalf: - sprintf(string, "half"); - return; - case kDouble: - sprintf(string, "%g", *((cl_double*)data)); - return; - default: - sprintf(string, "INVALID"); - return; - } - + case kChar: sprintf(string, "%d", (int)*((cl_char *)data)); return; + case kUChar: + case kUnsignedChar: + sprintf(string, "%u", (int)*((cl_uchar *)data)); + return; + case kShort: sprintf(string, "%d", (int)*((cl_short *)data)); return; + case kUShort: + case kUnsignedShort: + sprintf(string, "%u", (int)*((cl_ushort *)data)); + return; + case kInt: sprintf(string, "%d", *((cl_int *)data)); return; + case kUInt: + case kUnsignedInt: sprintf(string, "%u", *((cl_uint *)data)); return; + case kLong: sprintf(string, "%lld", *((cl_long *)data)); return; + case kULong: + case kUnsignedLong: + sprintf(string, "%llu", *((cl_ulong *)data)); + return; + case kFloat: sprintf(string, "%f", *((cl_float *)data)); return; + case kHalf: sprintf(string, "half"); return; + case kDouble: sprintf(string, "%g", *((cl_double *)data)); return; + default: sprintf(string, "INVALID"); return; + } } -size_t get_explicit_type_size( ExplicitType type ) +size_t get_explicit_type_size(ExplicitType type) { - /* Quick method to avoid branching: make sure the following array matches the Enum order */ - static size_t sExplicitTypeSizes[] = { - sizeof( cl_bool ), - sizeof( cl_char ), - sizeof( cl_uchar ), - sizeof( cl_uchar ), - sizeof( cl_short ), - sizeof( cl_ushort ), - sizeof( cl_ushort ), - sizeof( cl_int ), - sizeof( cl_uint ), - sizeof( cl_uint ), - sizeof( cl_long ), - sizeof( cl_ulong ), - sizeof( cl_ulong ), - sizeof( cl_float ), - sizeof( cl_half ), - sizeof( cl_double ) - }; + /* Quick method to avoid branching: make sure the following array matches + * the Enum order */ + static size_t sExplicitTypeSizes[] = { + sizeof(cl_bool), sizeof(cl_char), sizeof(cl_uchar), + sizeof(cl_uchar), sizeof(cl_short), sizeof(cl_ushort), + sizeof(cl_ushort), sizeof(cl_int), sizeof(cl_uint), + sizeof(cl_uint), sizeof(cl_long), sizeof(cl_ulong), + sizeof(cl_ulong), sizeof(cl_float), sizeof(cl_half), + sizeof(cl_double) + }; - return sExplicitTypeSizes[ type ]; + return sExplicitTypeSizes[type]; } -const char * get_explicit_type_name( ExplicitType type ) +const char *get_explicit_type_name(ExplicitType type) { - /* Quick method to avoid branching: make sure the following array matches the Enum order */ - static const char *sExplicitTypeNames[] = { "bool", "char", "uchar", "unsigned char", "short", "ushort", "unsigned short", "int", - "uint", "unsigned int", "long", "ulong", "unsigned long", "float", "half", "double" }; + /* Quick method to avoid branching: make sure the following array matches + * the Enum order */ + static const char *sExplicitTypeNames[] = { + "bool", "char", "uchar", "unsigned char", "short", "ushort", + "unsigned short", "int", "uint", "unsigned int", "long", "ulong", + "unsigned long", "float", "half", "double" + }; - return sExplicitTypeNames[ type ]; + return sExplicitTypeNames[type]; } -static long lrintf_clamped( float f ); -static long lrintf_clamped( float f ) +static long lrintf_clamped(float f); +static long lrintf_clamped(float f) { - static const float magic[2] = { MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23), - MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23) }; + static const float magic[2] = { MAKE_HEX_FLOAT(0x1.0p23f, 0x1, 23), + -MAKE_HEX_FLOAT(0x1.0p23f, 0x1, 23) }; - if( f >= -(float) LONG_MIN ) - return LONG_MAX; + if (f >= -(float)LONG_MIN) return LONG_MAX; - if( f <= (float) LONG_MIN ) - return LONG_MIN; + if (f <= (float)LONG_MIN) return LONG_MIN; // Round fractional values to integer in round towards nearest mode - if( fabsf(f) < MAKE_HEX_FLOAT( 0x1.0p23f, 0x1, 23 ) ) + if (fabsf(f) < MAKE_HEX_FLOAT(0x1.0p23f, 0x1, 23)) { volatile float x = f; - float magicVal = magic[ f < 0 ]; + float magicVal = magic[f < 0]; -#if defined( __SSE__ ) || defined (_WIN32) - // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly - __m128 v = _mm_set_ss( x ); - __m128 m = _mm_set_ss( magicVal ); - v = _mm_add_ss( v, m ); - v = _mm_sub_ss( v, m ); - _mm_store_ss( (float*) &x, v ); +#if defined(__SSE__) || defined(_WIN32) + // Defeat x87 based arithmetic, which cant do FTZ, and will round this + // incorrectly + __m128 v = _mm_set_ss(x); + __m128 m = _mm_set_ss(magicVal); + v = _mm_add_ss(v, m); + v = _mm_sub_ss(v, m); + _mm_store_ss((float *)&x, v); #else x += magicVal; x -= magicVal; @@ -144,40 +122,39 @@ static long lrintf_clamped( float f ) f = x; } - return (long) f; + return (long)f; } -static long lrint_clamped( double f ); -static long lrint_clamped( double f ) +static long lrint_clamped(double f); +static long lrint_clamped(double f) { - static const double magic[2] = { MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52), MAKE_HEX_DOUBLE(-0x1.0p52, -0x1LL, 52) }; + static const double magic[2] = { MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52), + MAKE_HEX_DOUBLE(-0x1.0p52, -0x1LL, 52) }; - if( sizeof( long ) > 4 ) + if (sizeof(long) > 4) { - if( f >= -(double) LONG_MIN ) - return LONG_MAX; + if (f >= -(double)LONG_MIN) return LONG_MAX; } else { - if( f >= LONG_MAX ) - return LONG_MAX; + if (f >= LONG_MAX) return LONG_MAX; } - if( f <= (double) LONG_MIN ) - return LONG_MIN; + if (f <= (double)LONG_MIN) return LONG_MIN; // Round fractional values to integer in round towards nearest mode - if( fabs(f) < MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52) ) + if (fabs(f) < MAKE_HEX_DOUBLE(0x1.0p52, 0x1LL, 52)) { volatile double x = f; - double magicVal = magic[ f < 0 ]; -#if defined( __SSE2__ ) || (defined (_MSC_VER)) - // Defeat x87 based arithmetic, which cant do FTZ, and will round this incorrectly - __m128d v = _mm_set_sd( x ); - __m128d m = _mm_set_sd( magicVal ); - v = _mm_add_sd( v, m ); - v = _mm_sub_sd( v, m ); - _mm_store_sd( (double*) &x, v ); + double magicVal = magic[f < 0]; +#if defined(__SSE2__) || (defined(_MSC_VER)) + // Defeat x87 based arithmetic, which cant do FTZ, and will round this + // incorrectly + __m128d v = _mm_set_sd(x); + __m128d m = _mm_set_sd(magicVal); + v = _mm_add_sd(v, m); + v = _mm_sub_sd(v, m); + _mm_store_sd((double *)&x, v); #else x += magicVal; x -= magicVal; @@ -185,195 +162,236 @@ static long lrint_clamped( double f ) f = x; } - return (long) f; + return (long)f; } typedef cl_long Long; typedef cl_ulong ULong; -static ULong sUpperLimits[ kNumExplicitTypes ] = - { - 0, - 127, 255, 255, - 32767, 65535, 65535, - 0x7fffffffLL, 0xffffffffLL, 0xffffffffLL, - 0x7fffffffffffffffLL, 0xffffffffffffffffLL, 0xffffffffffffffffLL, - 0, 0 }; // Last two values aren't stored here +static ULong sUpperLimits[kNumExplicitTypes] = { + 0, + 127, + 255, + 255, + 32767, + 65535, + 65535, + 0x7fffffffLL, + 0xffffffffLL, + 0xffffffffLL, + 0x7fffffffffffffffLL, + 0xffffffffffffffffLL, + 0xffffffffffffffffLL, + 0, + 0 +}; // Last two values aren't stored here -static Long sLowerLimits[ kNumExplicitTypes ] = - { - -1, - -128, 0, 0, - -32768, 0, 0, - (Long)0xffffffff80000000LL, 0, 0, - (Long)0x8000000000000000LL, 0, 0, - 0, 0 }; // Last two values aren't stored here +static Long sLowerLimits[kNumExplicitTypes] = { + -1, + -128, + 0, + 0, + -32768, + 0, + 0, + (Long)0xffffffff80000000LL, + 0, + 0, + (Long)0x8000000000000000LL, + 0, + 0, + 0, + 0 +}; // Last two values aren't stored here -#define BOOL_CASE(inType) \ - case kBool: \ - boolPtr = (bool *)outRaw; \ - *boolPtr = ( *inType##Ptr ) != 0 ? true : false; \ - break; - -#define SIMPLE_CAST_CASE(inType,outEnum,outType) \ - case outEnum: \ - outType##Ptr = (outType *)outRaw; \ - *outType##Ptr = (outType)(*inType##Ptr); \ - break; - -// Sadly, the ULong downcasting cases need a separate #define to get rid of signed/unsigned comparison warnings -#define DOWN_CAST_CASE(inType,outEnum,outType,sat) \ - case outEnum: \ - outType##Ptr = (outType *)outRaw; \ - if( sat ) \ - { \ - if( ( sLowerLimits[outEnum] < 0 && *inType##Ptr > (Long)sUpperLimits[outEnum] ) || ( sLowerLimits[outEnum] == 0 && (ULong)*inType##Ptr > sUpperLimits[outEnum] ) )\ - *outType##Ptr = (outType)sUpperLimits[outEnum];\ - else if( *inType##Ptr < sLowerLimits[outEnum] )\ - *outType##Ptr = (outType)sLowerLimits[outEnum]; \ - else \ - *outType##Ptr = (outType)*inType##Ptr; \ - } else { \ - *outType##Ptr = (outType)( *inType##Ptr & ( 0xffffffffffffffffLL >> ( 64 - ( sizeof( outType ) * 8 ) ) ) ); \ - } \ - break; - -#define U_DOWN_CAST_CASE(inType,outEnum,outType,sat) \ - case outEnum: \ - outType##Ptr = (outType *)outRaw; \ - if( sat ) \ - { \ - if( (ULong)*inType##Ptr > sUpperLimits[outEnum] )\ - *outType##Ptr = (outType)sUpperLimits[outEnum];\ - else \ - *outType##Ptr = (outType)*inType##Ptr; \ - } else { \ - *outType##Ptr = (outType)( *inType##Ptr & ( 0xffffffffffffffffLL >> ( 64 - ( sizeof( outType ) * 8 ) ) ) ); \ - } \ - break; - -#define TO_FLOAT_CASE(inType) \ - case kFloat: \ - floatPtr = (float *)outRaw; \ - *floatPtr = (float)(*inType##Ptr); \ - break; -#define TO_DOUBLE_CASE(inType) \ - case kDouble: \ - doublePtr = (double *)outRaw; \ - *doublePtr = (double)(*inType##Ptr); \ - break; - - -/* Note: we use lrintf here to force the rounding instead of whatever the processor's current rounding mode is */ -#define FLOAT_ROUND_TO_NEAREST_CASE(outEnum,outType) \ - case outEnum: \ - outType##Ptr = (outType *)outRaw; \ - *outType##Ptr = (outType)lrintf_clamped( *floatPtr ); \ - break; - -#define FLOAT_ROUND_CASE(outEnum,outType,rounding,sat) \ - case outEnum: \ - { \ - outType##Ptr = (outType *)outRaw; \ - /* Get the tens digit */ \ - Long wholeValue = (Long)*floatPtr;\ - float largeRemainder = ( *floatPtr - (float)wholeValue ) * 10.f; \ - /* What do we do based on that? */ \ - if( rounding == kRoundToEven ) \ - { \ - if( wholeValue & 1LL ) /*between 1 and 1.99 */ \ - wholeValue += 1LL; /* round up to even */ \ - } \ - else if( rounding == kRoundToZero ) \ - { \ - /* Nothing to do, round-to-zero is what C casting does */ \ - } \ - else if( rounding == kRoundToPosInf ) \ - { \ - /* Only positive numbers are wrong */ \ - if( largeRemainder != 0.f && wholeValue >= 0 ) \ - wholeValue++; \ - } \ - else if( rounding == kRoundToNegInf ) \ - { \ - /* Only negative numbers are off */ \ - if( largeRemainder != 0.f && wholeValue < 0 ) \ - wholeValue--; \ - } \ - else \ - { /* Default is round-to-nearest */ \ - wholeValue = (Long)lrintf_clamped( *floatPtr ); \ - } \ - /* Now apply saturation rules */ \ - if( sat ) \ - { \ - if( ( sLowerLimits[outEnum] < 0 && wholeValue > (Long)sUpperLimits[outEnum] ) || ( sLowerLimits[outEnum] == 0 && (ULong)wholeValue > sUpperLimits[outEnum] ) )\ - *outType##Ptr = (outType)sUpperLimits[outEnum];\ - else if( wholeValue < sLowerLimits[outEnum] )\ - *outType##Ptr = (outType)sLowerLimits[outEnum]; \ - else \ - *outType##Ptr = (outType)wholeValue; \ - } else { \ - *outType##Ptr = (outType)( wholeValue & ( 0xffffffffffffffffLL >> ( 64 - ( sizeof( outType ) * 8 ) ) ) ); \ - } \ - } \ +#define BOOL_CASE(inType) \ + case kBool: \ + boolPtr = (bool *)outRaw; \ + *boolPtr = (*inType##Ptr) != 0 ? true : false; \ break; -#define DOUBLE_ROUND_CASE(outEnum,outType,rounding,sat) \ - case outEnum: \ - { \ - outType##Ptr = (outType *)outRaw; \ - /* Get the tens digit */ \ - Long wholeValue = (Long)*doublePtr;\ - double largeRemainder = ( *doublePtr - (double)wholeValue ) * 10.0; \ - /* What do we do based on that? */ \ - if( rounding == kRoundToEven ) \ - { \ - if( wholeValue & 1LL ) /*between 1 and 1.99 */ \ - wholeValue += 1LL; /* round up to even */ \ - } \ - else if( rounding == kRoundToZero ) \ - { \ - /* Nothing to do, round-to-zero is what C casting does */ \ - } \ - else if( rounding == kRoundToPosInf ) \ - { \ - /* Only positive numbers are wrong */ \ - if( largeRemainder != 0.0 && wholeValue >= 0 ) \ - wholeValue++; \ - } \ - else if( rounding == kRoundToNegInf ) \ - { \ - /* Only negative numbers are off */ \ - if( largeRemainder != 0.0 && wholeValue < 0 ) \ - wholeValue--; \ - } \ - else \ - { /* Default is round-to-nearest */ \ - wholeValue = (Long)lrint_clamped( *doublePtr ); \ - } \ - /* Now apply saturation rules */ \ - if( sat ) \ - { \ - if( ( sLowerLimits[outEnum] < 0 && wholeValue > (Long)sUpperLimits[outEnum] ) || ( sLowerLimits[outEnum] == 0 && (ULong)wholeValue > sUpperLimits[outEnum] ) )\ - *outType##Ptr = (outType)sUpperLimits[outEnum];\ - else if( wholeValue < sLowerLimits[outEnum] )\ - *outType##Ptr = (outType)sLowerLimits[outEnum]; \ - else \ - *outType##Ptr = (outType)wholeValue; \ - } else { \ - *outType##Ptr = (outType)( wholeValue & ( 0xffffffffffffffffLL >> ( 64 - ( sizeof( outType ) * 8 ) ) ) ); \ - } \ - } \ +#define SIMPLE_CAST_CASE(inType, outEnum, outType) \ + case outEnum: \ + outType##Ptr = (outType *)outRaw; \ + *outType##Ptr = (outType)(*inType##Ptr); \ break; +// Sadly, the ULong downcasting cases need a separate #define to get rid of +// signed/unsigned comparison warnings +#define DOWN_CAST_CASE(inType, outEnum, outType, sat) \ + case outEnum: \ + outType##Ptr = (outType *)outRaw; \ + if (sat) \ + { \ + if ((sLowerLimits[outEnum] < 0 \ + && *inType##Ptr > (Long)sUpperLimits[outEnum]) \ + || (sLowerLimits[outEnum] == 0 \ + && (ULong)*inType##Ptr > sUpperLimits[outEnum])) \ + *outType##Ptr = (outType)sUpperLimits[outEnum]; \ + else if (*inType##Ptr < sLowerLimits[outEnum]) \ + *outType##Ptr = (outType)sLowerLimits[outEnum]; \ + else \ + *outType##Ptr = (outType)*inType##Ptr; \ + } \ + else \ + { \ + *outType##Ptr = (outType)( \ + *inType##Ptr \ + & (0xffffffffffffffffLL >> (64 - (sizeof(outType) * 8)))); \ + } \ + break; + +#define U_DOWN_CAST_CASE(inType, outEnum, outType, sat) \ + case outEnum: \ + outType##Ptr = (outType *)outRaw; \ + if (sat) \ + { \ + if ((ULong)*inType##Ptr > sUpperLimits[outEnum]) \ + *outType##Ptr = (outType)sUpperLimits[outEnum]; \ + else \ + *outType##Ptr = (outType)*inType##Ptr; \ + } \ + else \ + { \ + *outType##Ptr = (outType)( \ + *inType##Ptr \ + & (0xffffffffffffffffLL >> (64 - (sizeof(outType) * 8)))); \ + } \ + break; + +#define TO_FLOAT_CASE(inType) \ + case kFloat: \ + floatPtr = (float *)outRaw; \ + *floatPtr = (float)(*inType##Ptr); \ + break; +#define TO_DOUBLE_CASE(inType) \ + case kDouble: \ + doublePtr = (double *)outRaw; \ + *doublePtr = (double)(*inType##Ptr); \ + break; + + +/* Note: we use lrintf here to force the rounding instead of whatever the + * processor's current rounding mode is */ +#define FLOAT_ROUND_TO_NEAREST_CASE(outEnum, outType) \ + case outEnum: \ + outType##Ptr = (outType *)outRaw; \ + *outType##Ptr = (outType)lrintf_clamped(*floatPtr); \ + break; + +#define FLOAT_ROUND_CASE(outEnum, outType, rounding, sat) \ + case outEnum: { \ + outType##Ptr = (outType *)outRaw; \ + /* Get the tens digit */ \ + Long wholeValue = (Long)*floatPtr; \ + float largeRemainder = (*floatPtr - (float)wholeValue) * 10.f; \ + /* What do we do based on that? */ \ + if (rounding == kRoundToEven) \ + { \ + if (wholeValue & 1LL) /*between 1 and 1.99 */ \ + wholeValue += 1LL; /* round up to even */ \ + } \ + else if (rounding == kRoundToZero) \ + { \ + /* Nothing to do, round-to-zero is what C casting does */ \ + } \ + else if (rounding == kRoundToPosInf) \ + { \ + /* Only positive numbers are wrong */ \ + if (largeRemainder != 0.f && wholeValue >= 0) wholeValue++; \ + } \ + else if (rounding == kRoundToNegInf) \ + { \ + /* Only negative numbers are off */ \ + if (largeRemainder != 0.f && wholeValue < 0) wholeValue--; \ + } \ + else \ + { /* Default is round-to-nearest */ \ + wholeValue = (Long)lrintf_clamped(*floatPtr); \ + } \ + /* Now apply saturation rules */ \ + if (sat) \ + { \ + if ((sLowerLimits[outEnum] < 0 \ + && wholeValue > (Long)sUpperLimits[outEnum]) \ + || (sLowerLimits[outEnum] == 0 \ + && (ULong)wholeValue > sUpperLimits[outEnum])) \ + *outType##Ptr = (outType)sUpperLimits[outEnum]; \ + else if (wholeValue < sLowerLimits[outEnum]) \ + *outType##Ptr = (outType)sLowerLimits[outEnum]; \ + else \ + *outType##Ptr = (outType)wholeValue; \ + } \ + else \ + { \ + *outType##Ptr = (outType)( \ + wholeValue \ + & (0xffffffffffffffffLL >> (64 - (sizeof(outType) * 8)))); \ + } \ + } \ + break; + +#define DOUBLE_ROUND_CASE(outEnum, outType, rounding, sat) \ + case outEnum: { \ + outType##Ptr = (outType *)outRaw; \ + /* Get the tens digit */ \ + Long wholeValue = (Long)*doublePtr; \ + double largeRemainder = (*doublePtr - (double)wholeValue) * 10.0; \ + /* What do we do based on that? */ \ + if (rounding == kRoundToEven) \ + { \ + if (wholeValue & 1LL) /*between 1 and 1.99 */ \ + wholeValue += 1LL; /* round up to even */ \ + } \ + else if (rounding == kRoundToZero) \ + { \ + /* Nothing to do, round-to-zero is what C casting does */ \ + } \ + else if (rounding == kRoundToPosInf) \ + { \ + /* Only positive numbers are wrong */ \ + if (largeRemainder != 0.0 && wholeValue >= 0) wholeValue++; \ + } \ + else if (rounding == kRoundToNegInf) \ + { \ + /* Only negative numbers are off */ \ + if (largeRemainder != 0.0 && wholeValue < 0) wholeValue--; \ + } \ + else \ + { /* Default is round-to-nearest */ \ + wholeValue = (Long)lrint_clamped(*doublePtr); \ + } \ + /* Now apply saturation rules */ \ + if (sat) \ + { \ + if ((sLowerLimits[outEnum] < 0 \ + && wholeValue > (Long)sUpperLimits[outEnum]) \ + || (sLowerLimits[outEnum] == 0 \ + && (ULong)wholeValue > sUpperLimits[outEnum])) \ + *outType##Ptr = (outType)sUpperLimits[outEnum]; \ + else if (wholeValue < sLowerLimits[outEnum]) \ + *outType##Ptr = (outType)sLowerLimits[outEnum]; \ + else \ + *outType##Ptr = (outType)wholeValue; \ + } \ + else \ + { \ + *outType##Ptr = (outType)( \ + wholeValue \ + & (0xffffffffffffffffLL >> (64 - (sizeof(outType) * 8)))); \ + } \ + } \ + break; + typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; -void convert_explicit_value( void *inRaw, void *outRaw, ExplicitType inType, bool saturate, RoundingType roundType, ExplicitType outType ) +void convert_explicit_value(void *inRaw, void *outRaw, ExplicitType inType, + bool saturate, RoundingType roundType, + ExplicitType outType) { bool *boolPtr; char *charPtr; @@ -388,14 +406,14 @@ void convert_explicit_value( void *inRaw, void *outRaw, ExplicitType inType, boo double *doublePtr; - switch( inType ) + switch (inType) { case kBool: boolPtr = (bool *)inRaw; - switch( outType ) + switch (outType) { case kBool: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; case kChar: @@ -410,464 +428,482 @@ void convert_explicit_value( void *inRaw, void *outRaw, ExplicitType inType, boo case kLong: case kULong: case kUnsignedLong: - memset( outRaw, *boolPtr ? 0xff : 0, get_explicit_type_size( outType ) ); + memset(outRaw, *boolPtr ? 0xff : 0, + get_explicit_type_size(outType)); break; case kFloat: floatPtr = (float *)outRaw; - *floatPtr = ( *boolPtr ) ? -1.f : 0.f; + *floatPtr = (*boolPtr) ? -1.f : 0.f; break; case kDouble: doublePtr = (double *)outRaw; - *doublePtr = ( *boolPtr ) ? -1.0 : 0.0; + *doublePtr = (*boolPtr) ? -1.0 : 0.0; break; default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kChar: charPtr = (char *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(char) case kChar: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(char,kUChar,uchar,saturate) - SIMPLE_CAST_CASE(char,kUnsignedChar,uchar) - SIMPLE_CAST_CASE(char,kShort,short) - SIMPLE_CAST_CASE(char,kUShort,ushort) - SIMPLE_CAST_CASE(char,kUnsignedShort,ushort) - SIMPLE_CAST_CASE(char,kInt,int) - SIMPLE_CAST_CASE(char,kUInt,uint) - SIMPLE_CAST_CASE(char,kUnsignedInt,uint) - SIMPLE_CAST_CASE(char,kLong,Long) - SIMPLE_CAST_CASE(char,kULong,ULong) - SIMPLE_CAST_CASE(char,kUnsignedLong,ULong) + DOWN_CAST_CASE(char, kUChar, uchar, saturate) + SIMPLE_CAST_CASE(char, kUnsignedChar, uchar) + SIMPLE_CAST_CASE(char, kShort, short) + SIMPLE_CAST_CASE(char, kUShort, ushort) + SIMPLE_CAST_CASE(char, kUnsignedShort, ushort) + SIMPLE_CAST_CASE(char, kInt, int) + SIMPLE_CAST_CASE(char, kUInt, uint) + SIMPLE_CAST_CASE(char, kUnsignedInt, uint) + SIMPLE_CAST_CASE(char, kLong, Long) + SIMPLE_CAST_CASE(char, kULong, ULong) + SIMPLE_CAST_CASE(char, kUnsignedLong, ULong) - TO_FLOAT_CASE(char) - TO_DOUBLE_CASE(char) + TO_FLOAT_CASE(char) + TO_DOUBLE_CASE(char) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUChar: ucharPtr = (uchar *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(uchar) case kUChar: case kUnsignedChar: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(uchar,kChar,char,saturate) - SIMPLE_CAST_CASE(uchar,kShort,short) - SIMPLE_CAST_CASE(uchar,kUShort,ushort) - SIMPLE_CAST_CASE(uchar,kUnsignedShort,ushort) - SIMPLE_CAST_CASE(uchar,kInt,int) - SIMPLE_CAST_CASE(uchar,kUInt,uint) - SIMPLE_CAST_CASE(uchar,kUnsignedInt,uint) - SIMPLE_CAST_CASE(uchar,kLong,Long) - SIMPLE_CAST_CASE(uchar,kULong,ULong) - SIMPLE_CAST_CASE(uchar,kUnsignedLong,ULong) + DOWN_CAST_CASE(uchar, kChar, char, saturate) + SIMPLE_CAST_CASE(uchar, kShort, short) + SIMPLE_CAST_CASE(uchar, kUShort, ushort) + SIMPLE_CAST_CASE(uchar, kUnsignedShort, ushort) + SIMPLE_CAST_CASE(uchar, kInt, int) + SIMPLE_CAST_CASE(uchar, kUInt, uint) + SIMPLE_CAST_CASE(uchar, kUnsignedInt, uint) + SIMPLE_CAST_CASE(uchar, kLong, Long) + SIMPLE_CAST_CASE(uchar, kULong, ULong) + SIMPLE_CAST_CASE(uchar, kUnsignedLong, ULong) - TO_FLOAT_CASE(uchar) - TO_DOUBLE_CASE(uchar) + TO_FLOAT_CASE(uchar) + TO_DOUBLE_CASE(uchar) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUnsignedChar: ucharPtr = (uchar *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(uchar) case kUChar: case kUnsignedChar: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(uchar,kChar,char,saturate) - SIMPLE_CAST_CASE(uchar,kShort,short) - SIMPLE_CAST_CASE(uchar,kUShort,ushort) - SIMPLE_CAST_CASE(uchar,kUnsignedShort,ushort) - SIMPLE_CAST_CASE(uchar,kInt,int) - SIMPLE_CAST_CASE(uchar,kUInt,uint) - SIMPLE_CAST_CASE(uchar,kUnsignedInt,uint) - SIMPLE_CAST_CASE(uchar,kLong,Long) - SIMPLE_CAST_CASE(uchar,kULong,ULong) - SIMPLE_CAST_CASE(uchar,kUnsignedLong,ULong) + DOWN_CAST_CASE(uchar, kChar, char, saturate) + SIMPLE_CAST_CASE(uchar, kShort, short) + SIMPLE_CAST_CASE(uchar, kUShort, ushort) + SIMPLE_CAST_CASE(uchar, kUnsignedShort, ushort) + SIMPLE_CAST_CASE(uchar, kInt, int) + SIMPLE_CAST_CASE(uchar, kUInt, uint) + SIMPLE_CAST_CASE(uchar, kUnsignedInt, uint) + SIMPLE_CAST_CASE(uchar, kLong, Long) + SIMPLE_CAST_CASE(uchar, kULong, ULong) + SIMPLE_CAST_CASE(uchar, kUnsignedLong, ULong) - TO_FLOAT_CASE(uchar) - TO_DOUBLE_CASE(uchar) + TO_FLOAT_CASE(uchar) + TO_DOUBLE_CASE(uchar) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kShort: shortPtr = (short *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(short) case kShort: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(short,kChar,char,saturate) - DOWN_CAST_CASE(short,kUChar,uchar,saturate) - DOWN_CAST_CASE(short,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(short,kUShort,ushort,saturate) - DOWN_CAST_CASE(short,kUnsignedShort,ushort,saturate) - SIMPLE_CAST_CASE(short,kInt,int) - SIMPLE_CAST_CASE(short,kUInt,uint) - SIMPLE_CAST_CASE(short,kUnsignedInt,uint) - SIMPLE_CAST_CASE(short,kLong,Long) - SIMPLE_CAST_CASE(short,kULong,ULong) - SIMPLE_CAST_CASE(short,kUnsignedLong,ULong) + DOWN_CAST_CASE(short, kChar, char, saturate) + DOWN_CAST_CASE(short, kUChar, uchar, saturate) + DOWN_CAST_CASE(short, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(short, kUShort, ushort, saturate) + DOWN_CAST_CASE(short, kUnsignedShort, ushort, saturate) + SIMPLE_CAST_CASE(short, kInt, int) + SIMPLE_CAST_CASE(short, kUInt, uint) + SIMPLE_CAST_CASE(short, kUnsignedInt, uint) + SIMPLE_CAST_CASE(short, kLong, Long) + SIMPLE_CAST_CASE(short, kULong, ULong) + SIMPLE_CAST_CASE(short, kUnsignedLong, ULong) - TO_FLOAT_CASE(short) - TO_DOUBLE_CASE(short) + TO_FLOAT_CASE(short) + TO_DOUBLE_CASE(short) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUShort: ushortPtr = (ushort *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(ushort) case kUShort: case kUnsignedShort: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(ushort,kChar,char,saturate) - DOWN_CAST_CASE(ushort,kUChar,uchar,saturate) - DOWN_CAST_CASE(ushort,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(ushort,kShort,short,saturate) - SIMPLE_CAST_CASE(ushort,kInt,int) - SIMPLE_CAST_CASE(ushort,kUInt,uint) - SIMPLE_CAST_CASE(ushort,kUnsignedInt,uint) - SIMPLE_CAST_CASE(ushort,kLong,Long) - SIMPLE_CAST_CASE(ushort,kULong,ULong) - SIMPLE_CAST_CASE(ushort,kUnsignedLong,ULong) + DOWN_CAST_CASE(ushort, kChar, char, saturate) + DOWN_CAST_CASE(ushort, kUChar, uchar, saturate) + DOWN_CAST_CASE(ushort, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(ushort, kShort, short, saturate) + SIMPLE_CAST_CASE(ushort, kInt, int) + SIMPLE_CAST_CASE(ushort, kUInt, uint) + SIMPLE_CAST_CASE(ushort, kUnsignedInt, uint) + SIMPLE_CAST_CASE(ushort, kLong, Long) + SIMPLE_CAST_CASE(ushort, kULong, ULong) + SIMPLE_CAST_CASE(ushort, kUnsignedLong, ULong) - TO_FLOAT_CASE(ushort) - TO_DOUBLE_CASE(ushort) + TO_FLOAT_CASE(ushort) + TO_DOUBLE_CASE(ushort) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUnsignedShort: ushortPtr = (ushort *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(ushort) case kUShort: case kUnsignedShort: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(ushort,kChar,char,saturate) - DOWN_CAST_CASE(ushort,kUChar,uchar,saturate) - DOWN_CAST_CASE(ushort,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(ushort,kShort,short,saturate) - SIMPLE_CAST_CASE(ushort,kInt,int) - SIMPLE_CAST_CASE(ushort,kUInt,uint) - SIMPLE_CAST_CASE(ushort,kUnsignedInt,uint) - SIMPLE_CAST_CASE(ushort,kLong,Long) - SIMPLE_CAST_CASE(ushort,kULong,ULong) - SIMPLE_CAST_CASE(ushort,kUnsignedLong,ULong) + DOWN_CAST_CASE(ushort, kChar, char, saturate) + DOWN_CAST_CASE(ushort, kUChar, uchar, saturate) + DOWN_CAST_CASE(ushort, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(ushort, kShort, short, saturate) + SIMPLE_CAST_CASE(ushort, kInt, int) + SIMPLE_CAST_CASE(ushort, kUInt, uint) + SIMPLE_CAST_CASE(ushort, kUnsignedInt, uint) + SIMPLE_CAST_CASE(ushort, kLong, Long) + SIMPLE_CAST_CASE(ushort, kULong, ULong) + SIMPLE_CAST_CASE(ushort, kUnsignedLong, ULong) - TO_FLOAT_CASE(ushort) - TO_DOUBLE_CASE(ushort) + TO_FLOAT_CASE(ushort) + TO_DOUBLE_CASE(ushort) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kInt: intPtr = (int *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(int) case kInt: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(int,kChar,char,saturate) - DOWN_CAST_CASE(int,kUChar,uchar,saturate) - DOWN_CAST_CASE(int,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(int,kShort,short,saturate) - DOWN_CAST_CASE(int,kUShort,ushort,saturate) - DOWN_CAST_CASE(int,kUnsignedShort,ushort,saturate) - DOWN_CAST_CASE(int,kUInt,uint,saturate) - DOWN_CAST_CASE(int,kUnsignedInt,uint,saturate) - SIMPLE_CAST_CASE(int,kLong,Long) - SIMPLE_CAST_CASE(int,kULong,ULong) - SIMPLE_CAST_CASE(int,kUnsignedLong,ULong) + DOWN_CAST_CASE(int, kChar, char, saturate) + DOWN_CAST_CASE(int, kUChar, uchar, saturate) + DOWN_CAST_CASE(int, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(int, kShort, short, saturate) + DOWN_CAST_CASE(int, kUShort, ushort, saturate) + DOWN_CAST_CASE(int, kUnsignedShort, ushort, saturate) + DOWN_CAST_CASE(int, kUInt, uint, saturate) + DOWN_CAST_CASE(int, kUnsignedInt, uint, saturate) + SIMPLE_CAST_CASE(int, kLong, Long) + SIMPLE_CAST_CASE(int, kULong, ULong) + SIMPLE_CAST_CASE(int, kUnsignedLong, ULong) - TO_FLOAT_CASE(int) - TO_DOUBLE_CASE(int) + TO_FLOAT_CASE(int) + TO_DOUBLE_CASE(int) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUInt: uintPtr = (uint *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(uint) case kUInt: case kUnsignedInt: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(uint,kChar,char,saturate) - DOWN_CAST_CASE(uint,kUChar,uchar,saturate) - DOWN_CAST_CASE(uint,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(uint,kShort,short,saturate) - DOWN_CAST_CASE(uint,kUShort,ushort,saturate) - DOWN_CAST_CASE(uint,kUnsignedShort,ushort,saturate) - DOWN_CAST_CASE(uint,kInt,int,saturate) - SIMPLE_CAST_CASE(uint,kLong,Long) - SIMPLE_CAST_CASE(uint,kULong,ULong) - SIMPLE_CAST_CASE(uint,kUnsignedLong,ULong) + DOWN_CAST_CASE(uint, kChar, char, saturate) + DOWN_CAST_CASE(uint, kUChar, uchar, saturate) + DOWN_CAST_CASE(uint, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(uint, kShort, short, saturate) + DOWN_CAST_CASE(uint, kUShort, ushort, saturate) + DOWN_CAST_CASE(uint, kUnsignedShort, ushort, saturate) + DOWN_CAST_CASE(uint, kInt, int, saturate) + SIMPLE_CAST_CASE(uint, kLong, Long) + SIMPLE_CAST_CASE(uint, kULong, ULong) + SIMPLE_CAST_CASE(uint, kUnsignedLong, ULong) - TO_FLOAT_CASE(uint) - TO_DOUBLE_CASE(uint) + TO_FLOAT_CASE(uint) + TO_DOUBLE_CASE(uint) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUnsignedInt: uintPtr = (uint *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(uint) case kUInt: case kUnsignedInt: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(uint,kChar,char,saturate) - DOWN_CAST_CASE(uint,kUChar,uchar,saturate) - DOWN_CAST_CASE(uint,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(uint,kShort,short,saturate) - DOWN_CAST_CASE(uint,kUShort,ushort,saturate) - DOWN_CAST_CASE(uint,kUnsignedShort,ushort,saturate) - DOWN_CAST_CASE(uint,kInt,int,saturate) - SIMPLE_CAST_CASE(uint,kLong,Long) - SIMPLE_CAST_CASE(uint,kULong,ULong) - SIMPLE_CAST_CASE(uint,kUnsignedLong,ULong) + DOWN_CAST_CASE(uint, kChar, char, saturate) + DOWN_CAST_CASE(uint, kUChar, uchar, saturate) + DOWN_CAST_CASE(uint, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(uint, kShort, short, saturate) + DOWN_CAST_CASE(uint, kUShort, ushort, saturate) + DOWN_CAST_CASE(uint, kUnsignedShort, ushort, saturate) + DOWN_CAST_CASE(uint, kInt, int, saturate) + SIMPLE_CAST_CASE(uint, kLong, Long) + SIMPLE_CAST_CASE(uint, kULong, ULong) + SIMPLE_CAST_CASE(uint, kUnsignedLong, ULong) - TO_FLOAT_CASE(uint) - TO_DOUBLE_CASE(uint) + TO_FLOAT_CASE(uint) + TO_DOUBLE_CASE(uint) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kLong: LongPtr = (Long *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(Long) case kLong: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - DOWN_CAST_CASE(Long,kChar,char,saturate) - DOWN_CAST_CASE(Long,kUChar,uchar,saturate) - DOWN_CAST_CASE(Long,kUnsignedChar,uchar,saturate) - DOWN_CAST_CASE(Long,kShort,short,saturate) - DOWN_CAST_CASE(Long,kUShort,ushort,saturate) - DOWN_CAST_CASE(Long,kUnsignedShort,ushort,saturate) - DOWN_CAST_CASE(Long,kInt,int,saturate) - DOWN_CAST_CASE(Long,kUInt,uint,saturate) - DOWN_CAST_CASE(Long,kUnsignedInt,uint,saturate) - DOWN_CAST_CASE(Long,kULong,ULong,saturate) - DOWN_CAST_CASE(Long,kUnsignedLong,ULong,saturate) + DOWN_CAST_CASE(Long, kChar, char, saturate) + DOWN_CAST_CASE(Long, kUChar, uchar, saturate) + DOWN_CAST_CASE(Long, kUnsignedChar, uchar, saturate) + DOWN_CAST_CASE(Long, kShort, short, saturate) + DOWN_CAST_CASE(Long, kUShort, ushort, saturate) + DOWN_CAST_CASE(Long, kUnsignedShort, ushort, saturate) + DOWN_CAST_CASE(Long, kInt, int, saturate) + DOWN_CAST_CASE(Long, kUInt, uint, saturate) + DOWN_CAST_CASE(Long, kUnsignedInt, uint, saturate) + DOWN_CAST_CASE(Long, kULong, ULong, saturate) + DOWN_CAST_CASE(Long, kUnsignedLong, ULong, saturate) - TO_FLOAT_CASE(Long) - TO_DOUBLE_CASE(Long) + TO_FLOAT_CASE(Long) + TO_DOUBLE_CASE(Long) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kULong: ULongPtr = (ULong *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(ULong) case kUnsignedLong: case kULong: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - U_DOWN_CAST_CASE(ULong,kChar,char,saturate) - U_DOWN_CAST_CASE(ULong,kUChar,uchar,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedChar,uchar,saturate) - U_DOWN_CAST_CASE(ULong,kShort,short,saturate) - U_DOWN_CAST_CASE(ULong,kUShort,ushort,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedShort,ushort,saturate) - U_DOWN_CAST_CASE(ULong,kInt,int,saturate) - U_DOWN_CAST_CASE(ULong,kUInt,uint,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedInt,uint,saturate) - U_DOWN_CAST_CASE(ULong,kLong,Long,saturate) + U_DOWN_CAST_CASE(ULong, kChar, char, saturate) + U_DOWN_CAST_CASE(ULong, kUChar, uchar, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedChar, uchar, saturate) + U_DOWN_CAST_CASE(ULong, kShort, short, saturate) + U_DOWN_CAST_CASE(ULong, kUShort, ushort, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedShort, ushort, saturate) + U_DOWN_CAST_CASE(ULong, kInt, int, saturate) + U_DOWN_CAST_CASE(ULong, kUInt, uint, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedInt, uint, saturate) + U_DOWN_CAST_CASE(ULong, kLong, Long, saturate) - TO_FLOAT_CASE(ULong) - TO_DOUBLE_CASE(ULong) + TO_FLOAT_CASE(ULong) + TO_DOUBLE_CASE(ULong) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kUnsignedLong: ULongPtr = (ULong *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(ULong) case kULong: case kUnsignedLong: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - U_DOWN_CAST_CASE(ULong,kChar,char,saturate) - U_DOWN_CAST_CASE(ULong,kUChar,uchar,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedChar,uchar,saturate) - U_DOWN_CAST_CASE(ULong,kShort,short,saturate) - U_DOWN_CAST_CASE(ULong,kUShort,ushort,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedShort,ushort,saturate) - U_DOWN_CAST_CASE(ULong,kInt,int,saturate) - U_DOWN_CAST_CASE(ULong,kUInt,uint,saturate) - U_DOWN_CAST_CASE(ULong,kUnsignedInt,uint,saturate) - U_DOWN_CAST_CASE(ULong,kLong,Long,saturate) + U_DOWN_CAST_CASE(ULong, kChar, char, saturate) + U_DOWN_CAST_CASE(ULong, kUChar, uchar, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedChar, uchar, saturate) + U_DOWN_CAST_CASE(ULong, kShort, short, saturate) + U_DOWN_CAST_CASE(ULong, kUShort, ushort, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedShort, ushort, saturate) + U_DOWN_CAST_CASE(ULong, kInt, int, saturate) + U_DOWN_CAST_CASE(ULong, kUInt, uint, saturate) + U_DOWN_CAST_CASE(ULong, kUnsignedInt, uint, saturate) + U_DOWN_CAST_CASE(ULong, kLong, Long, saturate) - TO_FLOAT_CASE(ULong) - TO_DOUBLE_CASE(ULong) + TO_FLOAT_CASE(ULong) + TO_DOUBLE_CASE(ULong) default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kFloat: floatPtr = (float *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(float) - FLOAT_ROUND_CASE(kChar,char,roundType,saturate) - FLOAT_ROUND_CASE(kUChar,uchar,roundType,saturate) - FLOAT_ROUND_CASE(kUnsignedChar,uchar,roundType,saturate) - FLOAT_ROUND_CASE(kShort,short,roundType,saturate) - FLOAT_ROUND_CASE(kUShort,ushort,roundType,saturate) - FLOAT_ROUND_CASE(kUnsignedShort,ushort,roundType,saturate) - FLOAT_ROUND_CASE(kInt,int,roundType,saturate) - FLOAT_ROUND_CASE(kUInt,uint,roundType,saturate) - FLOAT_ROUND_CASE(kUnsignedInt,uint,roundType,saturate) - FLOAT_ROUND_CASE(kLong,Long,roundType,saturate) - FLOAT_ROUND_CASE(kULong,ULong,roundType,saturate) - FLOAT_ROUND_CASE(kUnsignedLong,ULong,roundType,saturate) + FLOAT_ROUND_CASE(kChar, char, roundType, saturate) + FLOAT_ROUND_CASE(kUChar, uchar, roundType, saturate) + FLOAT_ROUND_CASE(kUnsignedChar, uchar, roundType, saturate) + FLOAT_ROUND_CASE(kShort, short, roundType, saturate) + FLOAT_ROUND_CASE(kUShort, ushort, roundType, saturate) + FLOAT_ROUND_CASE(kUnsignedShort, ushort, roundType, saturate) + FLOAT_ROUND_CASE(kInt, int, roundType, saturate) + FLOAT_ROUND_CASE(kUInt, uint, roundType, saturate) + FLOAT_ROUND_CASE(kUnsignedInt, uint, roundType, saturate) + FLOAT_ROUND_CASE(kLong, Long, roundType, saturate) + FLOAT_ROUND_CASE(kULong, ULong, roundType, saturate) + FLOAT_ROUND_CASE(kUnsignedLong, ULong, roundType, saturate) case kFloat: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; - TO_DOUBLE_CASE(float); + TO_DOUBLE_CASE(float); default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; case kDouble: doublePtr = (double *)inRaw; - switch( outType ) + switch (outType) { BOOL_CASE(double) - DOUBLE_ROUND_CASE(kChar,char,roundType,saturate) - DOUBLE_ROUND_CASE(kUChar,uchar,roundType,saturate) - DOUBLE_ROUND_CASE(kUnsignedChar,uchar,roundType,saturate) - DOUBLE_ROUND_CASE(kShort,short,roundType,saturate) - DOUBLE_ROUND_CASE(kUShort,ushort,roundType,saturate) - DOUBLE_ROUND_CASE(kUnsignedShort,ushort,roundType,saturate) - DOUBLE_ROUND_CASE(kInt,int,roundType,saturate) - DOUBLE_ROUND_CASE(kUInt,uint,roundType,saturate) - DOUBLE_ROUND_CASE(kUnsignedInt,uint,roundType,saturate) - DOUBLE_ROUND_CASE(kLong,Long,roundType,saturate) - DOUBLE_ROUND_CASE(kULong,ULong,roundType,saturate) - DOUBLE_ROUND_CASE(kUnsignedLong,ULong,roundType,saturate) + DOUBLE_ROUND_CASE(kChar, char, roundType, saturate) + DOUBLE_ROUND_CASE(kUChar, uchar, roundType, saturate) + DOUBLE_ROUND_CASE(kUnsignedChar, uchar, roundType, saturate) + DOUBLE_ROUND_CASE(kShort, short, roundType, saturate) + DOUBLE_ROUND_CASE(kUShort, ushort, roundType, saturate) + DOUBLE_ROUND_CASE(kUnsignedShort, ushort, roundType, saturate) + DOUBLE_ROUND_CASE(kInt, int, roundType, saturate) + DOUBLE_ROUND_CASE(kUInt, uint, roundType, saturate) + DOUBLE_ROUND_CASE(kUnsignedInt, uint, roundType, saturate) + DOUBLE_ROUND_CASE(kLong, Long, roundType, saturate) + DOUBLE_ROUND_CASE(kULong, ULong, roundType, saturate) + DOUBLE_ROUND_CASE(kUnsignedLong, ULong, roundType, saturate) TO_FLOAT_CASE(double); case kDouble: - memcpy( outRaw, inRaw, get_explicit_type_size( inType ) ); + memcpy(outRaw, inRaw, get_explicit_type_size(inType)); break; default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error("ERROR: Invalid type given to " + "convert_explicit_value!!\n"); break; } break; default: - log_error( "ERROR: Invalid type given to convert_explicit_value!!\n" ); + log_error( + "ERROR: Invalid type given to convert_explicit_value!!\n"); break; } } -void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outData ) +void generate_random_data(ExplicitType type, size_t count, MTdata d, + void *outData) { bool *boolPtr; cl_char *charPtr; @@ -885,83 +921,88 @@ void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outD cl_uint bits = genrand_int32(d); cl_uint bitsLeft = 32; - switch( type ) + switch (type) { case kBool: boolPtr = (bool *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - boolPtr[i] = ( bits & 1 ) ? true : false; - bits >>= 1; bitsLeft -= 1; + boolPtr[i] = (bits & 1) ? true : false; + bits >>= 1; + bitsLeft -= 1; } break; case kChar: charPtr = (cl_char *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - charPtr[i] = (cl_char)( (cl_int)(bits & 255 ) - 127 ); - bits >>= 8; bitsLeft -= 8; + charPtr[i] = (cl_char)((cl_int)(bits & 255) - 127); + bits >>= 8; + bitsLeft -= 8; } break; case kUChar: case kUnsignedChar: ucharPtr = (cl_uchar *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - ucharPtr[i] = (cl_uchar)( bits & 255 ); - bits >>= 8; bitsLeft -= 8; + ucharPtr[i] = (cl_uchar)(bits & 255); + bits >>= 8; + bitsLeft -= 8; } break; case kShort: shortPtr = (cl_short *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - shortPtr[i] = (cl_short)( (cl_int)( bits & 65535 ) - 32767 ); - bits >>= 16; bitsLeft -= 16; + shortPtr[i] = (cl_short)((cl_int)(bits & 65535) - 32767); + bits >>= 16; + bitsLeft -= 16; } break; case kUShort: case kUnsignedShort: ushortPtr = (cl_ushort *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - ushortPtr[i] = (cl_ushort)( (cl_int)( bits & 65535 ) ); - bits >>= 16; bitsLeft -= 16; + ushortPtr[i] = (cl_ushort)((cl_int)(bits & 65535)); + bits >>= 16; + bitsLeft -= 16; } break; case kInt: intPtr = (cl_int *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { intPtr[i] = (cl_int)genrand_int32(d); } @@ -970,7 +1011,7 @@ void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outD case kUInt: case kUnsignedInt: uintPtr = (cl_uint *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { uintPtr[i] = (unsigned int)genrand_int32(d); } @@ -978,157 +1019,136 @@ void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outD case kLong: longPtr = (cl_long *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - longPtr[i] = (cl_long)genrand_int32(d) | ( (cl_long)genrand_int32(d) << 32 ); + longPtr[i] = (cl_long)genrand_int32(d) + | ((cl_long)genrand_int32(d) << 32); } break; case kULong: case kUnsignedLong: ulongPtr = (cl_ulong *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - ulongPtr[i] = (cl_ulong)genrand_int32(d) | ( (cl_ulong)genrand_int32(d) << 32 ); + ulongPtr[i] = (cl_ulong)genrand_int32(d) + | ((cl_ulong)genrand_int32(d) << 32); } break; case kFloat: floatPtr = (cl_float *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { // [ -(double) 0x7fffffff, (double) 0x7fffffff ] double t = genrand_real1(d); - floatPtr[i] = (float) ((1.0 - t) * -(double) 0x7fffffff + t * (double) 0x7fffffff); + floatPtr[i] = (float)((1.0 - t) * -(double)0x7fffffff + + t * (double)0x7fffffff); } break; case kDouble: doublePtr = (cl_double *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - cl_long u = (cl_long)genrand_int32(d) | ( (cl_long)genrand_int32(d) << 32 ); - double t = (double) u; - t *= MAKE_HEX_DOUBLE( 0x1.0p-32, 0x1, -32 ); // scale [-2**63, 2**63] to [-2**31, 2**31] + cl_long u = (cl_long)genrand_int32(d) + | ((cl_long)genrand_int32(d) << 32); + double t = (double)u; + // scale [-2**63, 2**63] to [-2**31, 2**31] + t *= MAKE_HEX_DOUBLE(0x1.0p-32, 0x1, -32); doublePtr[i] = t; } break; case kHalf: halfPtr = (ushort *)outData; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( 0 == bitsLeft) + if (0 == bitsLeft) { bits = genrand_int32(d); bitsLeft = 32; } - halfPtr[i] = bits & 65535; /* Kindly generates random bits for us */ - bits >>= 16; bitsLeft -= 16; + halfPtr[i] = + bits & 65535; /* Kindly generates random bits for us */ + bits >>= 16; + bitsLeft -= 16; } break; default: - log_error( "ERROR: Invalid type passed in to generate_random_data!\n" ); + log_error( + "ERROR: Invalid type passed in to generate_random_data!\n"); break; } } -void * create_random_data( ExplicitType type, MTdata d, size_t count ) +void *create_random_data(ExplicitType type, MTdata d, size_t count) { - void *data = malloc( get_explicit_type_size( type ) * count ); - generate_random_data( type, count, d, data ); + void *data = malloc(get_explicit_type_size(type) * count); + generate_random_data(type, count, d, data); return data; } -cl_long read_upscale_signed( void *inRaw, ExplicitType inType ) +cl_long read_upscale_signed(void *inRaw, ExplicitType inType) { - switch( inType ) + switch (inType) { - case kChar: - return (cl_long)( *( (cl_char *)inRaw ) ); + case kChar: return (cl_long)(*((cl_char *)inRaw)); case kUChar: - case kUnsignedChar: - return (cl_long)( *( (cl_uchar *)inRaw ) ); - case kShort: - return (cl_long)( *( (cl_short *)inRaw ) ); + case kUnsignedChar: return (cl_long)(*((cl_uchar *)inRaw)); + case kShort: return (cl_long)(*((cl_short *)inRaw)); case kUShort: - case kUnsignedShort: - return (cl_long)( *( (cl_ushort *)inRaw ) ); - case kInt: - return (cl_long)( *( (cl_int *)inRaw ) ); + case kUnsignedShort: return (cl_long)(*((cl_ushort *)inRaw)); + case kInt: return (cl_long)(*((cl_int *)inRaw)); case kUInt: - case kUnsignedInt: - return (cl_long)( *( (cl_uint *)inRaw ) ); - case kLong: - return (cl_long)( *( (cl_long *)inRaw ) ); + case kUnsignedInt: return (cl_long)(*((cl_uint *)inRaw)); + case kLong: return (cl_long)(*((cl_long *)inRaw)); case kULong: - case kUnsignedLong: - return (cl_long)( *( (cl_ulong *)inRaw ) ); - default: - return 0; + case kUnsignedLong: return (cl_long)(*((cl_ulong *)inRaw)); + default: return 0; } } -cl_ulong read_upscale_unsigned( void *inRaw, ExplicitType inType ) +cl_ulong read_upscale_unsigned(void *inRaw, ExplicitType inType) { - switch( inType ) + switch (inType) { - case kChar: - return (cl_ulong)( *( (cl_char *)inRaw ) ); + case kChar: return (cl_ulong)(*((cl_char *)inRaw)); case kUChar: - case kUnsignedChar: - return (cl_ulong)( *( (cl_uchar *)inRaw ) ); - case kShort: - return (cl_ulong)( *( (cl_short *)inRaw ) ); + case kUnsignedChar: return (cl_ulong)(*((cl_uchar *)inRaw)); + case kShort: return (cl_ulong)(*((cl_short *)inRaw)); case kUShort: - case kUnsignedShort: - return (cl_ulong)( *( (cl_ushort *)inRaw ) ); - case kInt: - return (cl_ulong)( *( (cl_int *)inRaw ) ); + case kUnsignedShort: return (cl_ulong)(*((cl_ushort *)inRaw)); + case kInt: return (cl_ulong)(*((cl_int *)inRaw)); case kUInt: - case kUnsignedInt: - return (cl_ulong)( *( (cl_uint *)inRaw ) ); - case kLong: - return (cl_ulong)( *( (cl_long *)inRaw ) ); + case kUnsignedInt: return (cl_ulong)(*((cl_uint *)inRaw)); + case kLong: return (cl_ulong)(*((cl_long *)inRaw)); case kULong: - case kUnsignedLong: - return (cl_ulong)( *( (cl_ulong *)inRaw ) ); - default: - return 0; + case kUnsignedLong: return (cl_ulong)(*((cl_ulong *)inRaw)); + default: return 0; } } -float read_as_float( void *inRaw, ExplicitType inType ) +float read_as_float(void *inRaw, ExplicitType inType) { - switch( inType ) + switch (inType) { - case kChar: - return (float)( *( (cl_char *)inRaw ) ); + case kChar: return (float)(*((cl_char *)inRaw)); case kUChar: - case kUnsignedChar: - return (float)( *( (cl_char *)inRaw ) ); - case kShort: - return (float)( *( (cl_short *)inRaw ) ); + case kUnsignedChar: return (float)(*((cl_char *)inRaw)); + case kShort: return (float)(*((cl_short *)inRaw)); case kUShort: - case kUnsignedShort: - return (float)( *( (cl_ushort *)inRaw ) ); - case kInt: - return (float)( *( (cl_int *)inRaw ) ); + case kUnsignedShort: return (float)(*((cl_ushort *)inRaw)); + case kInt: return (float)(*((cl_int *)inRaw)); case kUInt: - case kUnsignedInt: - return (float)( *( (cl_uint *)inRaw ) ); - case kLong: - return (float)( *( (cl_long *)inRaw ) ); + case kUnsignedInt: return (float)(*((cl_uint *)inRaw)); + case kLong: return (float)(*((cl_long *)inRaw)); case kULong: - case kUnsignedLong: - return (float)( *( (cl_ulong *)inRaw ) ); - case kFloat: - return *( (float *)inRaw ); - case kDouble: - return (float) *( (double*)inRaw ); - default: - return 0; + case kUnsignedLong: return (float)(*((cl_ulong *)inRaw)); + case kFloat: return *((float *)inRaw); + case kDouble: return (float)*((double *)inRaw); + default: return 0; } } @@ -1140,59 +1160,60 @@ float get_random_float(float low, float high, MTdata d) double get_random_double(double low, double high, MTdata d) { - cl_ulong u = (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32 ); - double t = (double) u * MAKE_HEX_DOUBLE( 0x1.0p-64, 0x1, -64); + cl_ulong u = + (cl_ulong)genrand_int32(d) | ((cl_ulong)genrand_int32(d) << 32); + double t = (double)u * MAKE_HEX_DOUBLE(0x1.0p-64, 0x1, -64); return (1.0f - t) * low + t * high; } -float any_float( MTdata d ) +float any_float(MTdata d) { - union - { - float f; + union { + float f; cl_uint u; - }u; + } u; u.u = genrand_int32(d); return u.f; } -double any_double( MTdata d ) +double any_double(MTdata d) { - union - { - double f; + union { + double f; cl_ulong u; - }u; + } u; - u.u = (cl_ulong) genrand_int32(d) | ((cl_ulong) genrand_int32(d) << 32); + u.u = (cl_ulong)genrand_int32(d) | ((cl_ulong)genrand_int32(d) << 32); return u.f; } -int random_in_range( int minV, int maxV, MTdata d ) +int random_in_range(int minV, int maxV, MTdata d) { - cl_ulong r = ((cl_ulong) genrand_int32(d) ) * (maxV - minV + 1); + cl_ulong r = ((cl_ulong)genrand_int32(d)) * (maxV - minV + 1); return (cl_uint)(r >> 32) + minV; } size_t get_random_size_t(size_t low, size_t high, MTdata d) { - enum { N = sizeof(size_t)/sizeof(int) }; + enum + { + N = sizeof(size_t) / sizeof(int) + }; - union { - int word[N]; - size_t size; - } u; + union { + int word[N]; + size_t size; + } u; - for (unsigned i=0; i != N; ++i) { - u.word[i] = genrand_int32(d); - } + for (unsigned i = 0; i != N; ++i) + { + u.word[i] = genrand_int32(d); + } - assert(low <= high && "Invalid random number range specified"); - size_t range = high - low; + assert(low <= high && "Invalid random number range specified"); + size_t range = high - low; - return (range) ? low + ((u.size - low) % range) : low; + return (range) ? low + ((u.size - low) % range) : low; } - - diff --git a/test_common/harness/conversions.h b/test_common/harness/conversions.h index 8e5346d4..e6880e05 100644 --- a/test_common/harness/conversions.h +++ b/test_common/harness/conversions.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 @@ -29,7 +29,7 @@ enum ExplicitTypes { - kBool = 0, + kBool = 0, kChar, kUChar, kUnsignedChar, @@ -48,7 +48,7 @@ enum ExplicitTypes kNumExplicitTypes }; -typedef enum ExplicitTypes ExplicitType; +typedef enum ExplicitTypes ExplicitType; enum RoundingTypes { @@ -63,62 +63,72 @@ enum RoundingTypes kDefaultRoundingType = kRoundToNearest }; -typedef enum RoundingTypes RoundingType; +typedef enum RoundingTypes RoundingType; -extern void print_type_to_string(ExplicitType type, void *data, char* string); -extern size_t get_explicit_type_size( ExplicitType type ); -extern const char * get_explicit_type_name( ExplicitType type ); -extern void convert_explicit_value( void *inRaw, void *outRaw, ExplicitType inType, bool saturate, RoundingType roundType, ExplicitType outType ); +extern void print_type_to_string(ExplicitType type, void *data, char *string); +extern size_t get_explicit_type_size(ExplicitType type); +extern const char *get_explicit_type_name(ExplicitType type); +extern void convert_explicit_value(void *inRaw, void *outRaw, + ExplicitType inType, bool saturate, + RoundingType roundType, + ExplicitType outType); -extern void generate_random_data( ExplicitType type, size_t count, MTdata d, void *outData ); -extern void * create_random_data( ExplicitType type, MTdata d, size_t count ); +extern void generate_random_data(ExplicitType type, size_t count, MTdata d, + void *outData); +extern void *create_random_data(ExplicitType type, MTdata d, size_t count); -extern cl_long read_upscale_signed( void *inRaw, ExplicitType inType ); -extern cl_ulong read_upscale_unsigned( void *inRaw, ExplicitType inType ); -extern float read_as_float( void *inRaw, ExplicitType inType ); +extern cl_long read_upscale_signed(void *inRaw, ExplicitType inType); +extern cl_ulong read_upscale_unsigned(void *inRaw, ExplicitType inType); +extern float read_as_float(void *inRaw, ExplicitType inType); -extern float get_random_float(float low, float high, MTdata d); -extern double get_random_double(double low, double high, MTdata d); -extern float any_float( MTdata d ); -extern double any_double( MTdata d ); +extern float get_random_float(float low, float high, MTdata d); +extern double get_random_double(double low, double high, MTdata d); +extern float any_float(MTdata d); +extern double any_double(MTdata d); -extern int random_in_range( int minV, int maxV, MTdata d ); +extern int random_in_range(int minV, int maxV, MTdata d); size_t get_random_size_t(size_t low, size_t high, MTdata d); // Note: though this takes a double, this is for use with single precision tests -static inline int IsFloatSubnormal( float x ) +static inline int IsFloatSubnormal(float x) { #if 2 == FLT_RADIX // Do this in integer to avoid problems with FTZ behavior - union{ float d; uint32_t u;}u; + union { + float d; + uint32_t u; + } u; u.d = fabsf(x); - return (u.u-1) < 0x007fffffU; + return (u.u - 1) < 0x007fffffU; #else - // rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- will fail if you flush subnormals to zero - return fabs(x) < (double) FLT_MIN && x != 0.0; + // rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- + // will fail if you flush subnormals to zero + return fabs(x) < (double)FLT_MIN && x != 0.0; #endif } -static inline int IsDoubleSubnormal( double x ) +static inline int IsDoubleSubnormal(double x) { #if 2 == FLT_RADIX // Do this in integer to avoid problems with FTZ behavior - union{ double d; uint64_t u;}u; - u.d = fabs( x); - return (u.u-1) < 0x000fffffffffffffULL; + union { + double d; + uint64_t u; + } u; + u.d = fabs(x); + return (u.u - 1) < 0x000fffffffffffffULL; #else - // rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- will fail if you flush subnormals to zero - return fabs(x) < (double) DBL_MIN && x != 0.0; + // rely on floating point hardware for non-radix2 non-IEEE-754 hardware -- + // will fail if you flush subnormals to zero + return fabs(x) < (double)DBL_MIN && x != 0.0; #endif } -static inline int IsHalfSubnormal( cl_half x ) +static inline int IsHalfSubnormal(cl_half x) { // this relies on interger overflow to exclude 0 as a subnormal - return ( ( x & 0x7fffU ) - 1U ) < 0x03ffU; + return ((x & 0x7fffU) - 1U) < 0x03ffU; } #endif // _conversions_h - - diff --git a/test_common/harness/crc32.h b/test_common/harness/crc32.h index 1913063e..65ca15ee 100644 --- a/test_common/harness/crc32.h +++ b/test_common/harness/crc32.h @@ -18,7 +18,7 @@ executed between Khronos and the recipient. #ifndef _CRC32_H_ #define _CRC32_H_ -#include +#include #include uint32_t crc32(const void *buf, size_t size); diff --git a/test_common/harness/deviceInfo.cpp b/test_common/harness/deviceInfo.cpp index 83db2926..12611873 100644 --- a/test_common/harness/deviceInfo.cpp +++ b/test_common/harness/deviceInfo.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017-2019 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 @@ -31,7 +31,7 @@ std::string get_device_info_string(cl_device_id device, int err; if ((err = clGetDeviceInfo(device, param_name, 0, NULL, &size)) - != CL_SUCCESS + != CL_SUCCESS || size == 0) { throw std::runtime_error("clGetDeviceInfo failed\n"); diff --git a/test_common/harness/deviceInfo.h b/test_common/harness/deviceInfo.h index 300c6d38..af923a2f 100644 --- a/test_common/harness/deviceInfo.h +++ b/test_common/harness/deviceInfo.h @@ -1,6 +1,6 @@ // // Copyright (c) 2017-2019 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 diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index fd5a75e5..b01e5298 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -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 @@ -24,62 +24,71 @@ #include -const char *IGetErrorString( int clErrorCode ) +const char *IGetErrorString(int clErrorCode) { - switch( clErrorCode ) + switch (clErrorCode) { - case CL_SUCCESS: return "CL_SUCCESS"; - case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; - case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE"; - case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILABLE"; - case CL_MEM_OBJECT_ALLOCATION_FAILURE: return "CL_MEM_OBJECT_ALLOCATION_FAILURE"; - case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; - case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; - case CL_PROFILING_INFO_NOT_AVAILABLE: return "CL_PROFILING_INFO_NOT_AVAILABLE"; - case CL_MEM_COPY_OVERLAP: return "CL_MEM_COPY_OVERLAP"; - case CL_IMAGE_FORMAT_MISMATCH: return "CL_IMAGE_FORMAT_MISMATCH"; - case CL_IMAGE_FORMAT_NOT_SUPPORTED: return "CL_IMAGE_FORMAT_NOT_SUPPORTED"; + case CL_SUCCESS: return "CL_SUCCESS"; + case CL_DEVICE_NOT_FOUND: return "CL_DEVICE_NOT_FOUND"; + case CL_DEVICE_NOT_AVAILABLE: return "CL_DEVICE_NOT_AVAILABLE"; + case CL_COMPILER_NOT_AVAILABLE: return "CL_COMPILER_NOT_AVAILABLE"; + case CL_MEM_OBJECT_ALLOCATION_FAILURE: + return "CL_MEM_OBJECT_ALLOCATION_FAILURE"; + case CL_OUT_OF_RESOURCES: return "CL_OUT_OF_RESOURCES"; + case CL_OUT_OF_HOST_MEMORY: return "CL_OUT_OF_HOST_MEMORY"; + case CL_PROFILING_INFO_NOT_AVAILABLE: + return "CL_PROFILING_INFO_NOT_AVAILABLE"; + case CL_MEM_COPY_OVERLAP: return "CL_MEM_COPY_OVERLAP"; + case CL_IMAGE_FORMAT_MISMATCH: return "CL_IMAGE_FORMAT_MISMATCH"; + case CL_IMAGE_FORMAT_NOT_SUPPORTED: + return "CL_IMAGE_FORMAT_NOT_SUPPORTED"; case CL_BUILD_PROGRAM_FAILURE: return "CL_BUILD_PROGRAM_FAILURE"; - case CL_MAP_FAILURE: return "CL_MAP_FAILURE"; - case CL_MISALIGNED_SUB_BUFFER_OFFSET: return "CL_MISALIGNED_SUB_BUFFER_OFFSET"; - case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"; + case CL_MAP_FAILURE: return "CL_MAP_FAILURE"; + case CL_MISALIGNED_SUB_BUFFER_OFFSET: + return "CL_MISALIGNED_SUB_BUFFER_OFFSET"; + case CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST: + return "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"; case CL_COMPILE_PROGRAM_FAILURE: return "CL_COMPILE_PROGRAM_FAILURE"; case CL_LINKER_NOT_AVAILABLE: return "CL_LINKER_NOT_AVAILABLE"; case CL_LINK_PROGRAM_FAILURE: return "CL_LINK_PROGRAM_FAILURE"; case CL_DEVICE_PARTITION_FAILED: return "CL_DEVICE_PARTITION_FAILED"; - case CL_KERNEL_ARG_INFO_NOT_AVAILABLE: return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE"; - case CL_INVALID_VALUE: return "CL_INVALID_VALUE"; + case CL_KERNEL_ARG_INFO_NOT_AVAILABLE: + return "CL_KERNEL_ARG_INFO_NOT_AVAILABLE"; + case CL_INVALID_VALUE: return "CL_INVALID_VALUE"; case CL_INVALID_DEVICE_TYPE: return "CL_INVALID_DEVICE_TYPE"; - case CL_INVALID_DEVICE: return "CL_INVALID_DEVICE"; - case CL_INVALID_CONTEXT: return "CL_INVALID_CONTEXT"; - case CL_INVALID_QUEUE_PROPERTIES: return "CL_INVALID_QUEUE_PROPERTIES"; - case CL_INVALID_COMMAND_QUEUE: return "CL_INVALID_COMMAND_QUEUE"; - case CL_INVALID_HOST_PTR: return "CL_INVALID_HOST_PTR"; - case CL_INVALID_MEM_OBJECT: return "CL_INVALID_MEM_OBJECT"; - case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"; - case CL_INVALID_IMAGE_SIZE: return "CL_INVALID_IMAGE_SIZE"; - case CL_INVALID_SAMPLER: return "CL_INVALID_SAMPLER"; - case CL_INVALID_BINARY: return "CL_INVALID_BINARY"; - case CL_INVALID_BUILD_OPTIONS: return "CL_INVALID_BUILD_OPTIONS"; - case CL_INVALID_PROGRAM: return "CL_INVALID_PROGRAM"; - case CL_INVALID_PROGRAM_EXECUTABLE: return "CL_INVALID_PROGRAM_EXECUTABLE"; - case CL_INVALID_KERNEL_NAME: return "CL_INVALID_KERNEL_NAME"; - case CL_INVALID_KERNEL_DEFINITION: return "CL_INVALID_KERNEL_DEFINITION"; - case CL_INVALID_KERNEL: return "CL_INVALID_KERNEL"; - case CL_INVALID_ARG_INDEX: return "CL_INVALID_ARG_INDEX"; - case CL_INVALID_ARG_VALUE: return "CL_INVALID_ARG_VALUE"; - case CL_INVALID_ARG_SIZE: return "CL_INVALID_ARG_SIZE"; - case CL_INVALID_KERNEL_ARGS: return "CL_INVALID_KERNEL_ARGS"; - case CL_INVALID_WORK_DIMENSION: return "CL_INVALID_WORK_DIMENSION"; - case CL_INVALID_WORK_GROUP_SIZE: return "CL_INVALID_WORK_GROUP_SIZE"; - case CL_INVALID_WORK_ITEM_SIZE: return "CL_INVALID_WORK_ITEM_SIZE"; - case CL_INVALID_GLOBAL_OFFSET: return "CL_INVALID_GLOBAL_OFFSET"; - case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_LIST"; - case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; - case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; - case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; - case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE"; - case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; + case CL_INVALID_DEVICE: return "CL_INVALID_DEVICE"; + case CL_INVALID_CONTEXT: return "CL_INVALID_CONTEXT"; + case CL_INVALID_QUEUE_PROPERTIES: return "CL_INVALID_QUEUE_PROPERTIES"; + case CL_INVALID_COMMAND_QUEUE: return "CL_INVALID_COMMAND_QUEUE"; + case CL_INVALID_HOST_PTR: return "CL_INVALID_HOST_PTR"; + case CL_INVALID_MEM_OBJECT: return "CL_INVALID_MEM_OBJECT"; + case CL_INVALID_IMAGE_FORMAT_DESCRIPTOR: + return "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"; + case CL_INVALID_IMAGE_SIZE: return "CL_INVALID_IMAGE_SIZE"; + case CL_INVALID_SAMPLER: return "CL_INVALID_SAMPLER"; + case CL_INVALID_BINARY: return "CL_INVALID_BINARY"; + case CL_INVALID_BUILD_OPTIONS: return "CL_INVALID_BUILD_OPTIONS"; + case CL_INVALID_PROGRAM: return "CL_INVALID_PROGRAM"; + case CL_INVALID_PROGRAM_EXECUTABLE: + return "CL_INVALID_PROGRAM_EXECUTABLE"; + case CL_INVALID_KERNEL_NAME: return "CL_INVALID_KERNEL_NAME"; + case CL_INVALID_KERNEL_DEFINITION: + return "CL_INVALID_KERNEL_DEFINITION"; + case CL_INVALID_KERNEL: return "CL_INVALID_KERNEL"; + case CL_INVALID_ARG_INDEX: return "CL_INVALID_ARG_INDEX"; + case CL_INVALID_ARG_VALUE: return "CL_INVALID_ARG_VALUE"; + case CL_INVALID_ARG_SIZE: return "CL_INVALID_ARG_SIZE"; + case CL_INVALID_KERNEL_ARGS: return "CL_INVALID_KERNEL_ARGS"; + case CL_INVALID_WORK_DIMENSION: return "CL_INVALID_WORK_DIMENSION"; + case CL_INVALID_WORK_GROUP_SIZE: return "CL_INVALID_WORK_GROUP_SIZE"; + case CL_INVALID_WORK_ITEM_SIZE: return "CL_INVALID_WORK_ITEM_SIZE"; + case CL_INVALID_GLOBAL_OFFSET: return "CL_INVALID_GLOBAL_OFFSET"; + case CL_INVALID_EVENT_WAIT_LIST: return "CL_INVALID_EVENT_WAIT_LIST"; + case CL_INVALID_EVENT: return "CL_INVALID_EVENT"; + case CL_INVALID_OPERATION: return "CL_INVALID_OPERATION"; + case CL_INVALID_GL_OBJECT: return "CL_INVALID_GL_OBJECT"; + case CL_INVALID_BUFFER_SIZE: return "CL_INVALID_BUFFER_SIZE"; + case CL_INVALID_MIP_LEVEL: return "CL_INVALID_MIP_LEVEL"; case CL_INVALID_GLOBAL_WORK_SIZE: return "CL_INVALID_GLOBAL_WORK_SIZE"; case CL_INVALID_PROPERTY: return "CL_INVALID_PROPERTY"; case CL_INVALID_IMAGE_DESCRIPTOR: return "CL_INVALID_IMAGE_DESCRIPTOR"; @@ -96,21 +105,21 @@ const char *IGetErrorString( int clErrorCode ) } } -const char *GetChannelOrderName( cl_channel_order order ) +const char *GetChannelOrderName(cl_channel_order order) { - switch( order ) + switch (order) { - case CL_R: return "CL_R"; - case CL_A: return "CL_A"; - case CL_Rx: return "CL_Rx"; - case CL_RG: return "CL_RG"; - case CL_RA: return "CL_RA"; - case CL_RGx: return "CL_RGx"; - case CL_RGB: return "CL_RGB"; - case CL_RGBx: return "CL_RGBx"; - case CL_RGBA: return "CL_RGBA"; - case CL_ARGB: return "CL_ARGB"; - case CL_BGRA: return "CL_BGRA"; + case CL_R: return "CL_R"; + case CL_A: return "CL_A"; + case CL_Rx: return "CL_Rx"; + case CL_RG: return "CL_RG"; + case CL_RA: return "CL_RA"; + case CL_RGx: return "CL_RGx"; + case CL_RGB: return "CL_RGB"; + case CL_RGBx: return "CL_RGBx"; + case CL_RGBA: return "CL_RGBA"; + case CL_ARGB: return "CL_ARGB"; + case CL_BGRA: return "CL_BGRA"; case CL_INTENSITY: return "CL_INTENSITY"; case CL_LUMINANCE: return "CL_LUMINANCE"; #if defined CL_1RGB_APPLE @@ -133,9 +142,9 @@ const char *GetChannelOrderName( cl_channel_order order ) } } -int IsChannelOrderSupported( cl_channel_order order ) +int IsChannelOrderSupported(cl_channel_order order) { - switch( order ) + switch (order) { case CL_R: case CL_A: @@ -155,51 +164,47 @@ int IsChannelOrderSupported( cl_channel_order order ) case CL_sRGBx: case CL_sBGRA: case CL_sRGBA: - case CL_DEPTH: - return 1; + case CL_DEPTH: return 1; #if defined CL_1RGB_APPLE - case CL_1RGB_APPLE: - return 1; + case CL_1RGB_APPLE: return 1; #endif #if defined CL_BGR1_APPLE - case CL_BGR1_APPLE: - return 1; + case CL_BGR1_APPLE: return 1; #endif - default: - return 0; + default: return 0; } } -const char *GetChannelTypeName( cl_channel_type type ) +const char *GetChannelTypeName(cl_channel_type type) { - switch( type ) + switch (type) { - case CL_SNORM_INT8: return "CL_SNORM_INT8"; - case CL_SNORM_INT16: return "CL_SNORM_INT16"; - case CL_UNORM_INT8: return "CL_UNORM_INT8"; - case CL_UNORM_INT16: return "CL_UNORM_INT16"; - case CL_UNORM_SHORT_565: return "CL_UNORM_SHORT_565"; - case CL_UNORM_SHORT_555: return "CL_UNORM_SHORT_555"; - case CL_UNORM_INT_101010: return "CL_UNORM_INT_101010"; - case CL_SIGNED_INT8: return "CL_SIGNED_INT8"; - case CL_SIGNED_INT16: return "CL_SIGNED_INT16"; - case CL_SIGNED_INT32: return "CL_SIGNED_INT32"; - case CL_UNSIGNED_INT8: return "CL_UNSIGNED_INT8"; - case CL_UNSIGNED_INT16: return "CL_UNSIGNED_INT16"; - case CL_UNSIGNED_INT32: return "CL_UNSIGNED_INT32"; - case CL_HALF_FLOAT: return "CL_HALF_FLOAT"; - case CL_FLOAT: return "CL_FLOAT"; + case CL_SNORM_INT8: return "CL_SNORM_INT8"; + case CL_SNORM_INT16: return "CL_SNORM_INT16"; + case CL_UNORM_INT8: return "CL_UNORM_INT8"; + case CL_UNORM_INT16: return "CL_UNORM_INT16"; + case CL_UNORM_SHORT_565: return "CL_UNORM_SHORT_565"; + case CL_UNORM_SHORT_555: return "CL_UNORM_SHORT_555"; + case CL_UNORM_INT_101010: return "CL_UNORM_INT_101010"; + case CL_SIGNED_INT8: return "CL_SIGNED_INT8"; + case CL_SIGNED_INT16: return "CL_SIGNED_INT16"; + case CL_SIGNED_INT32: return "CL_SIGNED_INT32"; + case CL_UNSIGNED_INT8: return "CL_UNSIGNED_INT8"; + case CL_UNSIGNED_INT16: return "CL_UNSIGNED_INT16"; + case CL_UNSIGNED_INT32: return "CL_UNSIGNED_INT32"; + case CL_HALF_FLOAT: return "CL_HALF_FLOAT"; + case CL_FLOAT: return "CL_FLOAT"; #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: return "CL_SFIXED14_APPLE"; + case CL_SFIXED14_APPLE: return "CL_SFIXED14_APPLE"; #endif - case CL_UNORM_INT24: return "CL_UNORM_INT24"; - default: return NULL; + case CL_UNORM_INT24: return "CL_UNORM_INT24"; + default: return NULL; } } -int IsChannelTypeSupported( cl_channel_type type ) +int IsChannelTypeSupported(cl_channel_type type) { - switch( type ) + switch (type) { case CL_SNORM_INT8: case CL_SNORM_INT16: @@ -216,70 +221,67 @@ int IsChannelTypeSupported( cl_channel_type type ) case CL_UNSIGNED_INT16: case CL_UNSIGNED_INT32: case CL_HALF_FLOAT: - case CL_FLOAT: - return 1; + case CL_FLOAT: return 1; #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - return 1; + case CL_SFIXED14_APPLE: return 1; #endif - default: - return 0; + default: return 0; } } -const char *GetAddressModeName( cl_addressing_mode mode ) +const char *GetAddressModeName(cl_addressing_mode mode) { - switch( mode ) + switch (mode) { - case CL_ADDRESS_NONE: return "CL_ADDRESS_NONE"; - case CL_ADDRESS_CLAMP_TO_EDGE: return "CL_ADDRESS_CLAMP_TO_EDGE"; - case CL_ADDRESS_CLAMP: return "CL_ADDRESS_CLAMP"; - case CL_ADDRESS_REPEAT: return "CL_ADDRESS_REPEAT"; - case CL_ADDRESS_MIRRORED_REPEAT: return "CL_ADDRESS_MIRRORED_REPEAT"; - default: return NULL; + case CL_ADDRESS_NONE: return "CL_ADDRESS_NONE"; + case CL_ADDRESS_CLAMP_TO_EDGE: return "CL_ADDRESS_CLAMP_TO_EDGE"; + case CL_ADDRESS_CLAMP: return "CL_ADDRESS_CLAMP"; + case CL_ADDRESS_REPEAT: return "CL_ADDRESS_REPEAT"; + case CL_ADDRESS_MIRRORED_REPEAT: return "CL_ADDRESS_MIRRORED_REPEAT"; + default: return NULL; } } -const char *GetDeviceTypeName( cl_device_type type ) +const char *GetDeviceTypeName(cl_device_type type) { - switch( type ) + switch (type) { - case CL_DEVICE_TYPE_GPU: return "CL_DEVICE_TYPE_GPU"; - case CL_DEVICE_TYPE_CPU: return "CL_DEVICE_TYPE_CPU"; - case CL_DEVICE_TYPE_ACCELERATOR: return "CL_DEVICE_TYPE_ACCELERATOR"; - case CL_DEVICE_TYPE_ALL: return "CL_DEVICE_TYPE_ALL"; - default: return NULL; + case CL_DEVICE_TYPE_GPU: return "CL_DEVICE_TYPE_GPU"; + case CL_DEVICE_TYPE_CPU: return "CL_DEVICE_TYPE_CPU"; + case CL_DEVICE_TYPE_ACCELERATOR: return "CL_DEVICE_TYPE_ACCELERATOR"; + case CL_DEVICE_TYPE_ALL: return "CL_DEVICE_TYPE_ALL"; + default: return NULL; } } -const char *GetDataVectorString( void *dataBuffer, size_t typeSize, size_t vecSize, char *buffer ) +const char *GetDataVectorString(void *dataBuffer, size_t typeSize, + size_t vecSize, char *buffer) { - static char scratch[ 1024 ]; + static char scratch[1024]; size_t i, j; - if( buffer == NULL ) - buffer = scratch; + if (buffer == NULL) buffer = scratch; unsigned char *p = (unsigned char *)dataBuffer; char *bPtr; - buffer[ 0 ] = 0; + buffer[0] = 0; bPtr = buffer; - for( i = 0; i < vecSize; i++ ) + for (i = 0; i < vecSize; i++) { - if( i > 0 ) + if (i > 0) { - bPtr[ 0 ] = ' '; + bPtr[0] = ' '; bPtr++; } - for( j = 0; j < typeSize; j++ ) + for (j = 0; j < typeSize; j++) { - sprintf( bPtr, "%02x", (unsigned int)p[ typeSize - j - 1 ] ); + sprintf(bPtr, "%02x", (unsigned int)p[typeSize - j - 1]); bPtr += 2; } p += typeSize; } - bPtr[ 0 ] = 0; + bPtr[0] = 0; return buffer; } @@ -298,31 +300,35 @@ const char *GetQueuePropertyName(cl_command_queue_properties property) } #ifndef MAX -#define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) +#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) #endif -#if defined( _MSC_VER ) -#define scalbnf(_a, _i ) ldexpf( _a, _i ) -#define scalbn(_a, _i ) ldexp( _a, _i ) -#define scalbnl(_a, _i ) ldexpl( _a, _i ) +#if defined(_MSC_VER) +#define scalbnf(_a, _i) ldexpf(_a, _i) +#define scalbn(_a, _i) ldexp(_a, _i) +#define scalbnl(_a, _i) ldexpl(_a, _i) #endif // taken from math tests -#define HALF_MIN_EXP -13 -#define HALF_MANT_DIG 11 -static float Ulp_Error_Half_Float( float test, double reference ) +#define HALF_MIN_EXP -13 +#define HALF_MANT_DIG 11 +static float Ulp_Error_Half_Float(float test, double reference) { - union{ double d; uint64_t u; }u; u.d = reference; + union { + double d; + uint64_t u; + } u; + u.d = reference; - // Note: This function presumes that someone has already tested whether the result is correctly, - // rounded before calling this function. That test: + // Note: This function presumes that someone has already tested whether the + // result is correctly, rounded before calling this function. That test: // // if( (float) reference == test ) // return 0.0f; // - // would ensure that cases like fabs(reference) > FLT_MAX are weeded out before we get here. - // Otherwise, we'll return inf ulp error here, for what are otherwise correctly rounded - // results. + // would ensure that cases like fabs(reference) > FLT_MAX are weeded out + // before we get here. Otherwise, we'll return inf ulp error here, for what + // are otherwise correctly rounded results. double testVal = test; @@ -342,23 +348,25 @@ static float Ulp_Error_Half_Float( float test, double reference ) } - if( u.u & 0x000fffffffffffffULL ) + if (u.u & 0x000fffffffffffffULL) { // Non-power of two and NaN - if( isnan( reference ) && isnan( test ) ) - return 0.0f; // if we are expecting a NaN, any NaN is fine + if (isnan(reference) && isnan(test)) + return 0.0f; // if we are expecting a NaN, any NaN is fine // The unbiased exponent of the ulp unit place - int ulp_exp = HALF_MANT_DIG - 1 - MAX( ilogb( reference), HALF_MIN_EXP-1 ); + int ulp_exp = + HALF_MANT_DIG - 1 - MAX(ilogb(reference), HALF_MIN_EXP - 1); // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); + return (float)scalbn(testVal - reference, ulp_exp); } // reference is a normal power of two or a zero - int ulp_exp = HALF_MANT_DIG - 1 - MAX( ilogb( reference) - 1, HALF_MIN_EXP-1 ); + int ulp_exp = + HALF_MANT_DIG - 1 - MAX(ilogb(reference) - 1, HALF_MIN_EXP - 1); // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); + return (float)scalbn(testVal - reference, ulp_exp); } float Ulp_Error_Half(cl_half test, float reference) @@ -367,331 +375,309 @@ float Ulp_Error_Half(cl_half test, float reference) } -float Ulp_Error( float test, double reference ) +float Ulp_Error(float test, double reference) { - union{ double d; uint64_t u; }u; u.d = reference; + union { + double d; + uint64_t u; + } u; + u.d = reference; double testVal = test; - // Note: This function presumes that someone has already tested whether the result is correctly, - // rounded before calling this function. That test: + // Note: This function presumes that someone has already tested whether the + // result is correctly, rounded before calling this function. That test: // // if( (float) reference == test ) // return 0.0f; // - // would ensure that cases like fabs(reference) > FLT_MAX are weeded out before we get here. - // Otherwise, we'll return inf ulp error here, for what are otherwise correctly rounded - // results. + // would ensure that cases like fabs(reference) > FLT_MAX are weeded out + // before we get here. Otherwise, we'll return inf ulp error here, for what + // are otherwise correctly rounded results. - if( isinf( reference ) ) + if (isinf(reference)) { - if( testVal == reference ) - return 0.0f; + if (testVal == reference) return 0.0f; - return (float) (testVal - reference ); + return (float)(testVal - reference); } - if( isinf( testVal) ) - { // infinite test value, but finite (but possibly overflowing in float) reference. + if (isinf(testVal)) + { // infinite test value, but finite (but possibly overflowing in float) + // reference. // - // The function probably overflowed prematurely here. Formally, the spec says this is - // an infinite ulp error and should not be tolerated. Unfortunately, this would mean - // that the internal precision of some half_pow implementations would have to be 29+ bits - // at half_powr( 0x1.fffffep+31, 4) to correctly determine that 4*log2( 0x1.fffffep+31 ) - // is not exactly 128.0. You might represent this for example as 4*(32 - ~2**-24), which - // after rounding to single is 4*32 = 128, which will ultimately result in premature - // overflow, even though a good faith representation would be correct to within 2**-29 - // interally. + // The function probably overflowed prematurely here. Formally, the spec + // says this is an infinite ulp error and should not be tolerated. + // Unfortunately, this would mean that the internal precision of some + // half_pow implementations would have to be 29+ bits at half_powr( + // 0x1.fffffep+31, 4) to correctly determine that 4*log2( 0x1.fffffep+31 ) + // is not exactly 128.0. You might represent this for example as 4*(32 - + // ~2**-24), which after rounding to single is 4*32 = 128, which will + // ultimately result in premature overflow, even though a good faith + // representation would be correct to within 2**-29 interally. - // In the interest of not requiring the implementation go to extraordinary lengths to - // deliver a half precision function, we allow premature overflow within the limit - // of the allowed ulp error. Towards, that end, we "pretend" the test value is actually - // 2**128, the next value that would appear in the number line if float had sufficient range. - testVal = copysign( MAKE_HEX_DOUBLE(0x1.0p128, 0x1LL, 128), testVal ); + // In the interest of not requiring the implementation go to + // extraordinary lengths to deliver a half precision function, we allow + // premature overflow within the limit of the allowed ulp error. + // Towards, that end, we "pretend" the test value is actually 2**128, + // the next value that would appear in the number line if float had + // sufficient range. + testVal = copysign(MAKE_HEX_DOUBLE(0x1.0p128, 0x1LL, 128), testVal); - // Note that the same hack may not work in long double, which is not guaranteed to have - // more range than double. It is not clear that premature overflow should be tolerated for - // double. + // Note that the same hack may not work in long double, which is not + // guaranteed to have more range than double. It is not clear that + // premature overflow should be tolerated for double. } - if( u.u & 0x000fffffffffffffULL ) + if (u.u & 0x000fffffffffffffULL) { // Non-power of two and NaN - if( isnan( reference ) && isnan( test ) ) - return 0.0f; // if we are expecting a NaN, any NaN is fine + if (isnan(reference) && isnan(test)) + return 0.0f; // if we are expecting a NaN, any NaN is fine // The unbiased exponent of the ulp unit place - int ulp_exp = FLT_MANT_DIG - 1 - MAX( ilogb( reference), FLT_MIN_EXP-1 ); + int ulp_exp = FLT_MANT_DIG - 1 - MAX(ilogb(reference), FLT_MIN_EXP - 1); // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); + return (float)scalbn(testVal - reference, ulp_exp); } // reference is a normal power of two or a zero // The unbiased exponent of the ulp unit place - int ulp_exp = FLT_MANT_DIG - 1 - MAX( ilogb( reference) - 1, FLT_MIN_EXP-1 ); + int ulp_exp = FLT_MANT_DIG - 1 - MAX(ilogb(reference) - 1, FLT_MIN_EXP - 1); // Scale the exponent of the error - return (float) scalbn( testVal - reference, ulp_exp ); + return (float)scalbn(testVal - reference, ulp_exp); } -float Ulp_Error_Double( double test, long double reference ) +float Ulp_Error_Double(double test, long double reference) { - // Deal with long double = double - // On most systems long double is a higher precision type than double. They provide either - // a 80-bit or greater floating point type, or they provide a head-tail double double format. - // That is sufficient to represent the accuracy of a floating point result to many more bits - // than double and we can calculate sub-ulp errors. This is the standard system for which this - // test suite is designed. - // - // On some systems double and long double are the same thing. Then we run into a problem, - // because our representation of the infinitely precise result (passed in as reference above) - // can be off by as much as a half double precision ulp itself. In this case, we inflate the - // reported error by half an ulp to take this into account. A more correct and permanent fix - // would be to undertake refactoring the reference code to return results in this format: - // - // typedef struct DoubleReference - // { // true value = correctlyRoundedResult + ulps * ulp(correctlyRoundedResult) (infinitely precise) - // double correctlyRoundedResult; // as best we can - // double ulps; // plus a fractional amount to account for the difference - // }DoubleReference; // between infinitely precise result and correctlyRoundedResult, in units of ulps. - // - // This would provide a useful higher-than-double precision format for everyone that we can use, - // and would solve a few problems with representing absolute errors below DBL_MIN and over DBL_MAX for systems - // that use a head to tail double double for long double. + // Deal with long double = double + // On most systems long double is a higher precision type than double. They + // provide either a 80-bit or greater floating point type, or they provide a + // head-tail double double format. That is sufficient to represent the + // accuracy of a floating point result to many more bits than double and we + // can calculate sub-ulp errors. This is the standard system for which this + // test suite is designed. + // + // On some systems double and long double are the same thing. Then we run + // into a problem, because our representation of the infinitely precise + // result (passed in as reference above) can be off by as much as a half + // double precision ulp itself. In this case, we inflate the reported error + // by half an ulp to take this into account. A more correct and permanent + // fix would be to undertake refactoring the reference code to return + // results in this format: + // + // typedef struct DoubleReference + // { + // // true value = correctlyRoundedResult + ulps * + // // ulp(correctlyRoundedResult) (infinitely precise) + // // as best we can: + // double correctlyRoundedResult; + // // plus a fractional amount to account for the difference + // // between infinitely precise result and correctlyRoundedResult, + // // in units of ulps: + // double ulps; + // } DoubleReference; + // + // This would provide a useful higher-than-double precision format for + // everyone that we can use, and would solve a few problems with + // representing absolute errors below DBL_MIN and over DBL_MAX for systems + // that use a head to tail double double for long double. - // Note: This function presumes that someone has already tested whether the result is correctly, - // rounded before calling this function. That test: + // Note: This function presumes that someone has already tested whether the + // result is correctly, rounded before calling this function. That test: // // if( (float) reference == test ) // return 0.0f; // - // would ensure that cases like fabs(reference) > FLT_MAX are weeded out before we get here. - // Otherwise, we'll return inf ulp error here, for what are otherwise correctly rounded - // results. + // would ensure that cases like fabs(reference) > FLT_MAX are weeded out + // before we get here. Otherwise, we'll return inf ulp error here, for what + // are otherwise correctly rounded results. int x; long double testVal = test; - if( 0.5L != frexpl( reference, &x) ) + if (0.5L != frexpl(reference, &x)) { // Non-power of two and NaN - if( isinf( reference ) ) + if (isinf(reference)) { - if( testVal == reference ) - return 0.0f; + if (testVal == reference) return 0.0f; - return (float) ( testVal - reference ); + return (float)(testVal - reference); } - if( isnan( reference ) && isnan( test ) ) - return 0.0f; // if we are expecting a NaN, any NaN is fine + if (isnan(reference) && isnan(test)) + return 0.0f; // if we are expecting a NaN, any NaN is fine // The unbiased exponent of the ulp unit place - int ulp_exp = DBL_MANT_DIG - 1 - MAX( ilogbl( reference), DBL_MIN_EXP-1 ); + int ulp_exp = + DBL_MANT_DIG - 1 - MAX(ilogbl(reference), DBL_MIN_EXP - 1); // Scale the exponent of the error - float result = (float) scalbnl( testVal - reference, ulp_exp ); + float result = (float)scalbnl(testVal - reference, ulp_exp); - // account for rounding error in reference result on systems that do not have a higher precision floating point type (see above) - if( sizeof(long double) == sizeof( double ) ) - result += copysignf( 0.5f, result); + // account for rounding error in reference result on systems that do not + // have a higher precision floating point type (see above) + if (sizeof(long double) == sizeof(double)) + result += copysignf(0.5f, result); return result; - } // reference is a normal power of two or a zero // The unbiased exponent of the ulp unit place - int ulp_exp = DBL_MANT_DIG - 1 - MAX( ilogbl( reference) - 1, DBL_MIN_EXP-1 ); + int ulp_exp = + DBL_MANT_DIG - 1 - MAX(ilogbl(reference) - 1, DBL_MIN_EXP - 1); // Scale the exponent of the error - float result = (float) scalbnl( testVal - reference, ulp_exp ); + float result = (float)scalbnl(testVal - reference, ulp_exp); - // account for rounding error in reference result on systems that do not have a higher precision floating point type (see above) - if( sizeof(long double) == sizeof( double ) ) - result += copysignf( 0.5f, result); + // account for rounding error in reference result on systems that do not + // have a higher precision floating point type (see above) + if (sizeof(long double) == sizeof(double)) + result += copysignf(0.5f, result); return result; } -cl_int OutputBuildLogs(cl_program program, cl_uint num_devices, cl_device_id *device_list) +cl_int OutputBuildLogs(cl_program program, cl_uint num_devices, + cl_device_id *device_list) { - int error; - size_t size_ret; + int error; + size_t size_ret; - // Does the program object exist? - if (program != NULL) { + // Does the program object exist? + if (program != NULL) + { - // Was the number of devices given - if (num_devices == 0) { + // Was the number of devices given + if (num_devices == 0) + { - // If zero devices were specified then allocate and query the device list from the context - cl_context context; - error = clGetProgramInfo(program, CL_PROGRAM_CONTEXT, sizeof(context), &context, NULL); - test_error( error, "Unable to query program's context" ); - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &size_ret); - test_error( error, "Unable to query context's device size" ); - num_devices = size_ret / sizeof(cl_device_id); - device_list = (cl_device_id *) malloc(size_ret); - if (device_list == NULL) { - print_error( error, "malloc failed" ); - return CL_OUT_OF_HOST_MEMORY; - } - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, size_ret, device_list, NULL); - test_error( error, "Unable to query context's devices" ); + // If zero devices were specified then allocate and query the device + // list from the context + cl_context context; + error = clGetProgramInfo(program, CL_PROGRAM_CONTEXT, + sizeof(context), &context, NULL); + test_error(error, "Unable to query program's context"); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, + &size_ret); + test_error(error, "Unable to query context's device size"); + num_devices = size_ret / sizeof(cl_device_id); + device_list = (cl_device_id *)malloc(size_ret); + if (device_list == NULL) + { + print_error(error, "malloc failed"); + return CL_OUT_OF_HOST_MEMORY; + } + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, size_ret, + device_list, NULL); + test_error(error, "Unable to query context's devices"); + } + // For each device in the device_list + unsigned int i; + for (i = 0; i < num_devices; i++) + { + + // Get the build status + cl_build_status build_status; + error = clGetProgramBuildInfo( + program, device_list[i], CL_PROGRAM_BUILD_STATUS, + sizeof(build_status), &build_status, &size_ret); + test_error(error, "Unable to query build status"); + + // If the build failed then log the status, and allocate the build + // log, log it and free it + if (build_status != CL_BUILD_SUCCESS) + { + + log_error("ERROR: CL_PROGRAM_BUILD_STATUS=%d\n", + (int)build_status); + error = clGetProgramBuildInfo(program, device_list[i], + CL_PROGRAM_BUILD_LOG, 0, NULL, + &size_ret); + test_error(error, "Unable to query build log size"); + char *build_log = (char *)malloc(size_ret); + error = clGetProgramBuildInfo(program, device_list[i], + CL_PROGRAM_BUILD_LOG, size_ret, + build_log, &size_ret); + test_error(error, "Unable to query build log"); + log_error("ERROR: CL_PROGRAM_BUILD_LOG:\n%s\n", build_log); + free(build_log); + } + } + + // Was the number of devices given + if (num_devices == 0) + { + + // If zero devices were specified then free the device list + free(device_list); + } } - // For each device in the device_list - unsigned int i; - for (i = 0; i < num_devices; i++) { - - // Get the build status - cl_build_status build_status; - error = clGetProgramBuildInfo(program, - device_list[i], - CL_PROGRAM_BUILD_STATUS, - sizeof(build_status), - &build_status, - &size_ret); - test_error( error, "Unable to query build status" ); - - // If the build failed then log the status, and allocate the build log, log it and free it - if (build_status != CL_BUILD_SUCCESS) { - - log_error("ERROR: CL_PROGRAM_BUILD_STATUS=%d\n", (int) build_status); - error = clGetProgramBuildInfo(program, device_list[i], CL_PROGRAM_BUILD_LOG, 0, NULL, &size_ret); - test_error( error, "Unable to query build log size" ); - char *build_log = (char *) malloc(size_ret); - error = clGetProgramBuildInfo(program, device_list[i], CL_PROGRAM_BUILD_LOG, size_ret, build_log, &size_ret); - test_error( error, "Unable to query build log" ); - log_error("ERROR: CL_PROGRAM_BUILD_LOG:\n%s\n", build_log); - free(build_log); - - } - - } - - // Was the number of devices given - if (num_devices == 0) { - - // If zero devices were specified then free the device list - free(device_list); - - } - - } - - return CL_SUCCESS; + return CL_SUCCESS; } -const char * subtests_requiring_opencl_1_2[] = { - "device_partition_equally", - "device_partition_by_counts", - "device_partition_by_affinity_domain_numa", - "device_partition_by_affinity_domain_l4_cache", - "device_partition_by_affinity_domain_l3_cache", - "device_partition_by_affinity_domain_l2_cache", - "device_partition_by_affinity_domain_l1_cache", - "device_partition_by_affinity_domain_next_partitionable", - "device_partition_all", - "buffer_fill_int", - "buffer_fill_uint", - "buffer_fill_short", - "buffer_fill_ushort", - "buffer_fill_char", - "buffer_fill_uchar", - "buffer_fill_long", - "buffer_fill_ulong", - "buffer_fill_float", - "buffer_fill_struct", - "test_mem_host_write_only_buffer", - "test_mem_host_write_only_subbuffer", - "test_mem_host_no_access_buffer", - "test_mem_host_no_access_subbuffer", - "test_mem_host_read_only_image", - "test_mem_host_write_only_image", - "test_mem_host_no_access_image", - // CL_MEM_HOST_{READ|WRITE}_ONLY api/ - "get_buffer_info", - "get_image1d_info", - "get_image1d_array_info", +const char *subtests_requiring_opencl_1_2[] = { + "device_partition_equally", "device_partition_by_counts", + "device_partition_by_affinity_domain_numa", + "device_partition_by_affinity_domain_l4_cache", + "device_partition_by_affinity_domain_l3_cache", + "device_partition_by_affinity_domain_l2_cache", + "device_partition_by_affinity_domain_l1_cache", + "device_partition_by_affinity_domain_next_partitionable", + "device_partition_all", "buffer_fill_int", "buffer_fill_uint", + "buffer_fill_short", "buffer_fill_ushort", "buffer_fill_char", + "buffer_fill_uchar", "buffer_fill_long", "buffer_fill_ulong", + "buffer_fill_float", "buffer_fill_struct", + "test_mem_host_write_only_buffer", "test_mem_host_write_only_subbuffer", + "test_mem_host_no_access_buffer", "test_mem_host_no_access_subbuffer", + "test_mem_host_read_only_image", "test_mem_host_write_only_image", + "test_mem_host_no_access_image", + // CL_MEM_HOST_{READ|WRITE}_ONLY api/ + "get_buffer_info", "get_image1d_info", "get_image1d_array_info", "get_image2d_array_info", - // gl/ - "images_read_1D", - "images_write_1D", - "images_1D_getinfo", - "images_read_1Darray", - "images_write_1Darray", - "images_1Darray_getinfo", - "images_read_2Darray", - "images_write_2Darray", - "images_2Darray_getinfo", - "buffer_migrate", - "image_migrate", - // compiler/ - "load_program_source", - "load_multistring_source", - "load_two_kernel_source", - "load_null_terminated_source", - "load_null_terminated_multi_line_source", + // gl/ + "images_read_1D", "images_write_1D", "images_1D_getinfo", + "images_read_1Darray", "images_write_1Darray", "images_1Darray_getinfo", + "images_read_2Darray", "images_write_2Darray", "images_2Darray_getinfo", + "buffer_migrate", "image_migrate", + // compiler/ + "load_program_source", "load_multistring_source", "load_two_kernel_source", + "load_null_terminated_source", "load_null_terminated_multi_line_source", "load_null_terminated_partial_multi_line_source", - "load_discreet_length_source", - "get_program_source", - "get_program_build_info", - "get_program_info", - "large_compile", - "async_build", - "options_build_optimizations", - "options_build_macro", - "options_build_macro_existence", - "options_include_directory", - "options_denorm_cache", - "preprocessor_define_udef", - "preprocessor_include", - "preprocessor_line_error", - "preprocessor_pragma", - "compiler_defines_for_extensions", - "image_macro", - "simple_compile_only", - "simple_static_compile_only", - "simple_extern_compile_only", - "simple_compile_with_callback", - "simple_embedded_header_compile", - "simple_link_only", - "two_file_regular_variable_access", - "two_file_regular_struct_access", - "two_file_regular_function_access", - "simple_link_with_callback", - "simple_embedded_header_link", + "load_discreet_length_source", "get_program_source", + "get_program_build_info", "get_program_info", "large_compile", + "async_build", "options_build_optimizations", "options_build_macro", + "options_build_macro_existence", "options_include_directory", + "options_denorm_cache", "preprocessor_define_udef", "preprocessor_include", + "preprocessor_line_error", "preprocessor_pragma", + "compiler_defines_for_extensions", "image_macro", "simple_compile_only", + "simple_static_compile_only", "simple_extern_compile_only", + "simple_compile_with_callback", "simple_embedded_header_compile", + "simple_link_only", "two_file_regular_variable_access", + "two_file_regular_struct_access", "two_file_regular_function_access", + "simple_link_with_callback", "simple_embedded_header_link", "execute_after_simple_compile_and_link", "execute_after_simple_compile_and_link_no_device_info", "execute_after_simple_compile_and_link_with_defines", "execute_after_simple_compile_and_link_with_callbacks", - "execute_after_simple_library_with_link", - "execute_after_two_file_link", - "execute_after_two_file_link", - "execute_after_embedded_header_link", + "execute_after_simple_library_with_link", "execute_after_two_file_link", + "execute_after_two_file_link", "execute_after_embedded_header_link", "execute_after_included_header_link", "execute_after_serialize_reload_object", - "execute_after_serialize_reload_library", - "simple_library_only", - "simple_library_with_callback", - "simple_library_with_link", - "two_file_link", - "multi_file_libraries", - "multiple_files", - "multiple_libraries", - "multiple_files_multiple_libraries", - "multiple_embedded_headers", - "program_binary_type", - "compile_and_link_status_options_log", + "execute_after_serialize_reload_library", "simple_library_only", + "simple_library_with_callback", "simple_library_with_link", "two_file_link", + "multi_file_libraries", "multiple_files", "multiple_libraries", + "multiple_files_multiple_libraries", "multiple_embedded_headers", + "program_binary_type", "compile_and_link_status_options_log", // CL_PROGRAM_NUM_KERNELS, in api/ - "get_kernel_arg_info", - "create_kernels_in_program", + "get_kernel_arg_info", "create_kernels_in_program", // clEnqueue..WithWaitList, in events/ "event_enqueue_marker_with_event_list", - "event_enqueue_barrier_with_event_list", - "popcount" + "event_enqueue_barrier_with_event_list", "popcount" }; const char *subtests_to_skip_with_offline_compiler[] = { @@ -754,14 +740,18 @@ const char *subtests_to_skip_with_offline_compiler[] = { "async_build", }; -int check_functions_for_offline_compiler(const char *subtestname, cl_device_id device) +int check_functions_for_offline_compiler(const char *subtestname, + cl_device_id device) { if (gCompilationMode != kOnline) { - int nNotRequiredWithOfflineCompiler = sizeof(subtests_to_skip_with_offline_compiler)/sizeof(char *); + int nNotRequiredWithOfflineCompiler = + sizeof(subtests_to_skip_with_offline_compiler) / sizeof(char *); size_t i; - for(i=0; i < nNotRequiredWithOfflineCompiler; ++i) { - if(!strcmp(subtestname, subtests_to_skip_with_offline_compiler[i])) { + for (i = 0; i < nNotRequiredWithOfflineCompiler; ++i) + { + if (!strcmp(subtestname, subtests_to_skip_with_offline_compiler[i])) + { return 1; } } diff --git a/test_common/harness/errorHelpers.h b/test_common/harness/errorHelpers.h index 36868f8d..19446014 100644 --- a/test_common/harness/errorHelpers.h +++ b/test_common/harness/errorHelpers.h @@ -24,18 +24,22 @@ #include #endif #include -#define LOWER_IS_BETTER 0 -#define HIGHER_IS_BETTER 1 +#define LOWER_IS_BETTER 0 +#define HIGHER_IS_BETTER 1 #include #define test_start() #define log_info printf #define log_error printf #define log_missing_feature printf -#define log_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 ) -#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) +#define log_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) +#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 @@ -52,16 +56,17 @@ static int vlog_win32(const char *format, ...); #define vlog printf #endif -#define ct_assert(b) ct_assert_i(b, __LINE__) -#define ct_assert_i(b, line) ct_assert_ii(b, line) -#define ct_assert_ii(b, line) int _compile_time_assertion_on_line_##line[b ? 1 : -1]; +#define ct_assert(b) ct_assert_i(b, __LINE__) +#define ct_assert_i(b, line) ct_assert_ii(b, line) +#define ct_assert_ii(b, line) \ + int _compile_time_assertion_on_line_##line[b ? 1 : -1]; #define test_fail(msg, ...) \ { \ log_error(msg, ##__VA_ARGS__); \ return TEST_FAIL; \ } -#define test_error(errCode,msg) test_error_ret(errCode,msg,errCode) +#define test_error(errCode, msg) test_error_ret(errCode, msg, errCode) #define test_error_ret(errCode, msg, retValue) \ { \ auto errCodeResult = errCode; \ @@ -71,26 +76,73 @@ static int vlog_win32(const char *format, ...); return retValue; \ } \ } -#define print_error(errCode,msg) log_error( "ERROR: %s! (%s from %s:%d)\n", msg, IGetErrorString( errCode ), __FILE__, __LINE__ ); +#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) +#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 -#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_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) +#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 -#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 ; } } +#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 -#define test_failure_error(errCode, expectedErrCode, msg) test_failure_error_ret(errCode, expectedErrCode, msg, errCode != expectedErrCode) -#define test_failure_error_ret(errCode, expectedErrCode, msg, retValue) { if( errCode != expectedErrCode ) { print_failure_error( errCode, expectedErrCode, msg ); return retValue ; } } -#define print_failure_error(errCode, expectedErrCode, msg) log_error( "ERROR: %s! (Got %s, expected %s from %s:%d)\n", msg, IGetErrorString( errCode ), IGetErrorString( expectedErrCode ), __FILE__, __LINE__ ); -#define test_failure_warning(errCode, expectedErrCode, msg) test_failure_warning_ret(errCode, expectedErrCode, msg, errCode != expectedErrCode) -#define test_failure_warning_ret(errCode, expectedErrCode, msg, retValue) { if( errCode != expectedErrCode ) { print_failure_warning( errCode, expectedErrCode, msg ); warnings++ ; } } -#define print_failure_warning(errCode, expectedErrCode, msg) log_error( "WARNING: %s! (Got %s, expected %s from %s:%d)\n", msg, IGetErrorString( errCode ), IGetErrorString( expectedErrCode ), __FILE__, __LINE__ ); +#define test_failure_error(errCode, expectedErrCode, msg) \ + test_failure_error_ret(errCode, expectedErrCode, msg, \ + errCode != expectedErrCode) +#define test_failure_error_ret(errCode, expectedErrCode, msg, retValue) \ + { \ + if (errCode != expectedErrCode) \ + { \ + print_failure_error(errCode, expectedErrCode, msg); \ + return retValue; \ + } \ + } +#define print_failure_error(errCode, expectedErrCode, msg) \ + log_error("ERROR: %s! (Got %s, expected %s from %s:%d)\n", msg, \ + IGetErrorString(errCode), IGetErrorString(expectedErrCode), \ + __FILE__, __LINE__); +#define test_failure_warning(errCode, expectedErrCode, msg) \ + test_failure_warning_ret(errCode, expectedErrCode, msg, \ + errCode != expectedErrCode) +#define test_failure_warning_ret(errCode, expectedErrCode, msg, retValue) \ + { \ + if (errCode != expectedErrCode) \ + { \ + print_failure_warning(errCode, expectedErrCode, msg); \ + warnings++; \ + } \ + } +#define print_failure_warning(errCode, expectedErrCode, msg) \ + log_error("WARNING: %s! (Got %s, expected %s from %s:%d)\n", msg, \ + IGetErrorString(errCode), IGetErrorString(expectedErrCode), \ + __FILE__, __LINE__); // generate an error when an assertion is false (not error code related) #define test_assert_error(condition, msg) \ @@ -107,40 +159,44 @@ static int vlog_win32(const char *format, ...); log_error("ERROR: %s! (!(%s) from %s:%d)\n", msg, #condition, __FILE__, \ __LINE__); -#define ASSERT_SUCCESS(expr, msg) \ - do \ - { \ - cl_int _temp_retval = (expr); \ - if (_temp_retval != CL_SUCCESS) \ - { \ - std::stringstream ss; \ - ss << "ERROR: " << msg << "=" << IGetErrorString(_temp_retval) \ - << " at " << __FILE__ << ":" << __LINE__ << "\n"; \ - throw std::runtime_error(ss.str()); \ - } \ +#define ASSERT_SUCCESS(expr, msg) \ + do \ + { \ + cl_int _temp_retval = (expr); \ + if (_temp_retval != CL_SUCCESS) \ + { \ + std::stringstream ss; \ + ss << "ERROR: " << msg << "=" << IGetErrorString(_temp_retval) \ + << " at " << __FILE__ << ":" << __LINE__ << "\n"; \ + throw std::runtime_error(ss.str()); \ + } \ } while (0) -extern const char *IGetErrorString( int clErrorCode ); +extern const char *IGetErrorString(int clErrorCode); 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 ); -extern const char *GetChannelOrderName( cl_channel_order order ); -extern int IsChannelOrderSupported( cl_channel_order order ); -extern const char *GetAddressModeName( cl_addressing_mode mode ); +extern const char *GetChannelTypeName(cl_channel_type type); +extern int IsChannelTypeSupported(cl_channel_type type); +extern const char *GetChannelOrderName(cl_channel_order order); +extern int IsChannelOrderSupported(cl_channel_order order); +extern const char *GetAddressModeName(cl_addressing_mode mode); 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); +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 ); -#if defined (_WIN32) && !defined(__MINGW32__) +// 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); + +#if defined(_WIN32) && !defined(__MINGW32__) #include #include #include @@ -148,17 +204,21 @@ static int vlog_win32(const char *format, ...) { const char *new_format = format; - if (strstr(format, "%a")) { + if (strstr(format, "%a")) + { char *temp; - if ((temp = strdup(format)) == NULL) { + if ((temp = strdup(format)) == NULL) + { printf("vlog_win32: Failed to allocate memory for strdup\n"); return -1; } new_format = temp; - while (*temp) { + while (*temp) + { // replace %a with %f - if ((*temp == '%') && (*(temp+1) == 'a')) { - *(temp+1) = 'f'; + if ((*temp == '%') && (*(temp + 1) == 'a')) + { + *(temp + 1) = 'f'; } temp++; } @@ -169,8 +229,9 @@ static int vlog_win32(const char *format, ...) vprintf(new_format, args); va_end(args); - if (new_format != format) { - free((void*)new_format); + if (new_format != format) + { + free((void *)new_format); } return 0; @@ -179,5 +240,3 @@ static int vlog_win32(const char *format, ...) #endif // _errorHelpers_h - - diff --git a/test_common/harness/fpcontrol.h b/test_common/harness/fpcontrol.h index 4835db45..40826c5c 100644 --- a/test_common/harness/fpcontrol.h +++ b/test_common/harness/fpcontrol.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 @@ -16,89 +16,99 @@ #ifndef _fpcontrol_h #define _fpcontrol_h -// In order to get tests for correctly rounded operations (e.g. multiply) to work properly we need to be able to set the reference hardware -// to FTZ mode if the device hardware is running in that mode. We have explored all other options short of writing correctly rounded operations -// in integer code, and have found this is the only way to correctly verify operation. +// In order to get tests for correctly rounded operations (e.g. multiply) to +// work properly we need to be able to set the reference hardware to FTZ mode if +// the device hardware is running in that mode. We have explored all other +// options short of writing correctly rounded operations in integer code, and +// have found this is the only way to correctly verify operation. // -// Non-Apple implementations will need to provide their own implentation for these features. If the reference hardware and device are both -// running in the same state (either FTZ or IEEE compliant modes) then these functions may be empty. If the device is running in non-default -// rounding mode (e.g. round toward zero), then these functions should also set the reference device into that rounding mode. -#if defined( __APPLE__ ) || defined( _MSC_VER ) || defined( __linux__ ) || defined (__MINGW32__) - typedef int FPU_mode_type; -#if defined( __i386__ ) || defined( __x86_64__ ) || defined( _MSC_VER ) || defined( __MINGW32__ ) - #include -#elif defined( __PPC__ ) - #include - extern __thread fpu_control_t fpu_control; +// Non-Apple implementations will need to provide their own implentation for +// these features. If the reference hardware and device are both running in the +// same state (either FTZ or IEEE compliant modes) then these functions may be +// empty. If the device is running in non-default rounding mode (e.g. round +// toward zero), then these functions should also set the reference device into +// that rounding mode. +#if defined(__APPLE__) || defined(_MSC_VER) || defined(__linux__) \ + || defined(__MINGW32__) +typedef int FPU_mode_type; +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ + || defined(__MINGW32__) +#include +#elif defined(__PPC__) +#include +extern __thread fpu_control_t fpu_control; #endif - // Set the reference hardware floating point unit to FTZ mode - static inline void ForceFTZ( FPU_mode_type *mode ) - { -#if defined( __i386__ ) || defined( __x86_64__ ) || defined( _MSC_VER ) || defined (__MINGW32__) - *mode = _mm_getcsr(); - _mm_setcsr( *mode | 0x8040); -#elif defined( __PPC__ ) - *mode = fpu_control; - fpu_control |= _FPU_MASK_NI; -#elif defined ( __arm__ ) - unsigned fpscr; - __asm__ volatile ("fmrx %0, fpscr" : "=r"(fpscr)); - *mode = fpscr; - __asm__ volatile ("fmxr fpscr, %0" :: "r"(fpscr | (1U << 24))); - // Add 64 bit support -#elif defined (__aarch64__) - unsigned fpscr; - __asm__ volatile ("mrs %0, fpcr" : "=r"(fpscr)); - *mode = fpscr; - __asm__ volatile ("msr fpcr, %0" :: "r"(fpscr | (1U << 24))); +// Set the reference hardware floating point unit to FTZ mode +static inline void ForceFTZ(FPU_mode_type *mode) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ + || defined(__MINGW32__) + *mode = _mm_getcsr(); + _mm_setcsr(*mode | 0x8040); +#elif defined(__PPC__) + *mode = fpu_control; + fpu_control |= _FPU_MASK_NI; +#elif defined(__arm__) + unsigned fpscr; + __asm__ volatile("fmrx %0, fpscr" : "=r"(fpscr)); + *mode = fpscr; + __asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr | (1U << 24))); + // Add 64 bit support +#elif defined(__aarch64__) + unsigned fpscr; + __asm__ volatile("mrs %0, fpcr" : "=r"(fpscr)); + *mode = fpscr; + __asm__ volatile("msr fpcr, %0" ::"r"(fpscr | (1U << 24))); #else - #error ForceFTZ needs an implentation +#error ForceFTZ needs an implentation #endif - } +} - // Disable the denorm flush to zero - static inline void DisableFTZ( FPU_mode_type *mode ) - { -#if defined( __i386__ ) || defined( __x86_64__ ) || defined( _MSC_VER ) || defined (__MINGW32__) - *mode = _mm_getcsr(); - _mm_setcsr( *mode & ~0x8040); -#elif defined( __PPC__ ) - *mode = fpu_control; - fpu_control &= ~_FPU_MASK_NI; -#elif defined ( __arm__ ) - unsigned fpscr; - __asm__ volatile ("fmrx %0, fpscr" : "=r"(fpscr)); - *mode = fpscr; - __asm__ volatile ("fmxr fpscr, %0" :: "r"(fpscr & ~(1U << 24))); - // Add 64 bit support -#elif defined (__aarch64__) - unsigned fpscr; - __asm__ volatile ("mrs %0, fpcr" : "=r"(fpscr)); - *mode = fpscr; - __asm__ volatile ("msr fpcr, %0" :: "r"(fpscr & ~(1U << 24))); +// Disable the denorm flush to zero +static inline void DisableFTZ(FPU_mode_type *mode) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ + || defined(__MINGW32__) + *mode = _mm_getcsr(); + _mm_setcsr(*mode & ~0x8040); +#elif defined(__PPC__) + *mode = fpu_control; + fpu_control &= ~_FPU_MASK_NI; +#elif defined(__arm__) + unsigned fpscr; + __asm__ volatile("fmrx %0, fpscr" : "=r"(fpscr)); + *mode = fpscr; + __asm__ volatile("fmxr fpscr, %0" ::"r"(fpscr & ~(1U << 24))); + // Add 64 bit support +#elif defined(__aarch64__) + unsigned fpscr; + __asm__ volatile("mrs %0, fpcr" : "=r"(fpscr)); + *mode = fpscr; + __asm__ volatile("msr fpcr, %0" ::"r"(fpscr & ~(1U << 24))); #else - #error DisableFTZ needs an implentation +#error DisableFTZ needs an implentation #endif - } +} - // Restore the reference hardware to floating point state indicated by *mode - static inline void RestoreFPState( FPU_mode_type *mode ) - { -#if defined( __i386__ ) || defined( __x86_64__ ) || defined( _MSC_VER ) || defined (__MINGW32__) - _mm_setcsr( *mode ); -#elif defined( __PPC__) - fpu_control = *mode; -#elif defined (__arm__) - __asm__ volatile ("fmxr fpscr, %0" :: "r"(*mode)); - // Add 64 bit support -#elif defined (__aarch64__) - __asm__ volatile ("msr fpcr, %0" :: "r"(*mode)); +// Restore the reference hardware to floating point state indicated by *mode +static inline void RestoreFPState(FPU_mode_type *mode) +{ +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) \ + || defined(__MINGW32__) + _mm_setcsr(*mode); +#elif defined(__PPC__) + fpu_control = *mode; +#elif defined(__arm__) + __asm__ volatile("fmxr fpscr, %0" ::"r"(*mode)); + // Add 64 bit support +#elif defined(__aarch64__) + __asm__ volatile("msr fpcr, %0" ::"r"(*mode)); #else - #error RestoreFPState needs an implementation +#error RestoreFPState needs an implementation #endif - } +} #else - #error ForceFTZ and RestoreFPState need implentations +#error ForceFTZ and RestoreFPState need implentations #endif #endif diff --git a/test_common/harness/genericThread.cpp b/test_common/harness/genericThread.cpp index 2b742fa3..f50ee6e2 100644 --- a/test_common/harness/genericThread.cpp +++ b/test_common/harness/genericThread.cpp @@ -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 @@ -21,33 +21,34 @@ #include #endif -void * genericThread::IStaticReflector( void * data ) +void *genericThread::IStaticReflector(void *data) { genericThread *t = (genericThread *)data; return t->IRun(); } -bool genericThread::Start( void ) +bool genericThread::Start(void) { #if defined(_WIN32) - mHandle = CreateThread( NULL, 0, (LPTHREAD_START_ROUTINE) IStaticReflector, this, 0, NULL ); - return ( mHandle != NULL ); + mHandle = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)IStaticReflector, + this, 0, NULL); + return (mHandle != NULL); #else // !_WIN32 - int error = pthread_create( (pthread_t*)&mHandle, NULL, IStaticReflector, (void *)this ); - return ( error == 0 ); + int error = pthread_create((pthread_t *)&mHandle, NULL, IStaticReflector, + (void *)this); + return (error == 0); #endif // !_WIN32 } -void * genericThread::Join( void ) +void *genericThread::Join(void) { #if defined(_WIN32) - WaitForSingleObject( (HANDLE)mHandle, INFINITE ); + WaitForSingleObject((HANDLE)mHandle, INFINITE); return NULL; #else // !_WIN32 - void * retVal; - int error = pthread_join( (pthread_t)mHandle, &retVal ); - if( error != 0 ) - retVal = NULL; + void *retVal; + int error = pthread_join((pthread_t)mHandle, &retVal); + if (error != 0) retVal = NULL; return retVal; #endif // !_WIN32 } diff --git a/test_common/harness/genericThread.h b/test_common/harness/genericThread.h index 168b7407..cc7c010a 100644 --- a/test_common/harness/genericThread.h +++ b/test_common/harness/genericThread.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 @@ -18,25 +18,20 @@ #include -class genericThread -{ - public: +class genericThread { +public: + virtual ~genericThread() {} - virtual ~genericThread() {} + bool Start(void); + void* Join(void); - bool Start( void ); - void * Join( void ); +protected: + virtual void* IRun(void) = 0; - protected: +private: + void* mHandle; - virtual void * IRun( void ) = 0; - - private: - - void* mHandle; - - static void * IStaticReflector( void * data ); + static void* IStaticReflector(void* data); }; #endif // _genericThread_h - diff --git a/test_common/harness/imageHelpers.cpp b/test_common/harness/imageHelpers.cpp index af1aea3d..26110a47 100644 --- a/test_common/harness/imageHelpers.cpp +++ b/test_common/harness/imageHelpers.cpp @@ -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 @@ -16,15 +16,15 @@ #include "imageHelpers.h" #include #include -#if defined( __APPLE__ ) +#if defined(__APPLE__) #include #endif -#if !defined (_WIN32) && !defined(__APPLE__) +#if !defined(_WIN32) && !defined(__APPLE__) #include #endif #include #include -#if !defined (_WIN32) +#if !defined(_WIN32) #include #endif @@ -32,17 +32,14 @@ RoundingMode gFloatToHalfRoundingMode = kDefaultRoundingMode; cl_device_type gDeviceType = CL_DEVICE_TYPE_DEFAULT; bool gTestRounding = false; -double -sRGBmap(float fc) +double sRGBmap(float fc) { double c = (double)fc; -#if !defined (_WIN32) - if (std::isnan(c)) - c = 0.0; +#if !defined(_WIN32) + if (std::isnan(c)) c = 0.0; #else - if (_isnan(c)) - c = 0.0; + if (_isnan(c)) c = 0.0; #endif if (c > 1.0) @@ -52,13 +49,12 @@ sRGBmap(float fc) else if (c < 0.0031308) c = 12.92 * c; else - c = (1055.0/1000.0) * pow(c, 5.0/12.0) - (55.0/1000.0); + c = (1055.0 / 1000.0) * pow(c, 5.0 / 12.0) - (55.0 / 1000.0); return c * 255.0; } -double -sRGBunmap(float fc) +double sRGBunmap(float fc) { double c = (double)fc; double result; @@ -74,18 +70,17 @@ sRGBunmap(float fc) uint32_t get_format_type_size(const cl_image_format *format) { - return get_channel_data_type_size( format->image_channel_data_type ); + return get_channel_data_type_size(format->image_channel_data_type); } uint32_t get_channel_data_type_size(cl_channel_type channelType) { - switch( channelType ) + switch (channelType) { case CL_SNORM_INT8: case CL_UNORM_INT8: case CL_SIGNED_INT8: - case CL_UNSIGNED_INT8: - return 1; + case CL_UNSIGNED_INT8: return 1; case CL_SNORM_INT16: case CL_UNORM_INT16: @@ -95,11 +90,10 @@ uint32_t get_channel_data_type_size(cl_channel_type channelType) #ifdef CL_SFIXED14_APPLE case CL_SFIXED14_APPLE: #endif - return sizeof( cl_short ); + return sizeof(cl_short); case CL_SIGNED_INT32: - case CL_UNSIGNED_INT32: - return sizeof( cl_int ); + case CL_UNSIGNED_INT32: return sizeof(cl_int); case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: @@ -111,8 +105,7 @@ uint32_t get_channel_data_type_size(cl_channel_type channelType) #ifdef OBSOLETE_FORAMT case CL_UNORM_INT_8888: - case CL_UNORM_INT_8888_REV: - return 4; + case CL_UNORM_INT_8888_REV: return 4; #endif case CL_UNORM_INT_101010: @@ -121,22 +114,20 @@ uint32_t get_channel_data_type_size(cl_channel_type channelType) #endif return 4; - case CL_FLOAT: - return sizeof( cl_float ); + case CL_FLOAT: return sizeof(cl_float); - default: - return 0; + default: return 0; } } uint32_t get_format_channel_count(const cl_image_format *format) { - return get_channel_order_channel_count( format->image_channel_order ); + return get_channel_order_channel_count(format->image_channel_order); } uint32_t get_channel_order_channel_count(cl_channel_order order) { - switch( order ) + switch (order) { case CL_R: case CL_A: @@ -144,19 +135,16 @@ uint32_t get_channel_order_channel_count(cl_channel_order order) case CL_INTENSITY: case CL_LUMINANCE: case CL_DEPTH: - case CL_DEPTH_STENCIL: - return 1; + case CL_DEPTH_STENCIL: return 1; case CL_RG: case CL_RA: - case CL_RGx: - return 2; + case CL_RGx: return 2; case CL_RGB: case CL_RGBx: case CL_sRGB: - case CL_sRGBx: - return 3; + case CL_sRGBx: return 3; case CL_RGBA: case CL_ARGB: @@ -173,56 +161,56 @@ uint32_t get_channel_order_channel_count(cl_channel_order order) #ifdef CL_ABGR_APPLE case CL_ABGR_APPLE: #endif - return 4; + return 4; default: - log_error("%s does not support 0x%x\n",__FUNCTION__,order); - return 0; + log_error("%s does not support 0x%x\n", __FUNCTION__, order); + return 0; } } -cl_channel_type get_channel_type_from_name( const char *name ) +cl_channel_type get_channel_type_from_name(const char *name) { - struct { + struct + { cl_channel_type type; const char *name; - } typeNames[] = { - { CL_SNORM_INT8, "CL_SNORM_INT8" }, - { CL_SNORM_INT16, "CL_SNORM_INT16" }, - { CL_UNORM_INT8, "CL_UNORM_INT8" }, - { CL_UNORM_INT16, "CL_UNORM_INT16" }, - { CL_UNORM_INT24, "CL_UNORM_INT24" }, - { CL_UNORM_SHORT_565, "CL_UNORM_SHORT_565" }, - { CL_UNORM_SHORT_555, "CL_UNORM_SHORT_555" }, - { CL_UNORM_INT_101010, "CL_UNORM_INT_101010" }, - { CL_SIGNED_INT8, "CL_SIGNED_INT8" }, - { CL_SIGNED_INT16, "CL_SIGNED_INT16" }, - { CL_SIGNED_INT32, "CL_SIGNED_INT32" }, - { CL_UNSIGNED_INT8, "CL_UNSIGNED_INT8" }, - { CL_UNSIGNED_INT16, "CL_UNSIGNED_INT16" }, - { CL_UNSIGNED_INT32, "CL_UNSIGNED_INT32" }, - { CL_HALF_FLOAT, "CL_HALF_FLOAT" }, - { CL_FLOAT, "CL_FLOAT" }, + } typeNames[] = { { CL_SNORM_INT8, "CL_SNORM_INT8" }, + { CL_SNORM_INT16, "CL_SNORM_INT16" }, + { CL_UNORM_INT8, "CL_UNORM_INT8" }, + { CL_UNORM_INT16, "CL_UNORM_INT16" }, + { CL_UNORM_INT24, "CL_UNORM_INT24" }, + { CL_UNORM_SHORT_565, "CL_UNORM_SHORT_565" }, + { CL_UNORM_SHORT_555, "CL_UNORM_SHORT_555" }, + { CL_UNORM_INT_101010, "CL_UNORM_INT_101010" }, + { CL_SIGNED_INT8, "CL_SIGNED_INT8" }, + { CL_SIGNED_INT16, "CL_SIGNED_INT16" }, + { CL_SIGNED_INT32, "CL_SIGNED_INT32" }, + { CL_UNSIGNED_INT8, "CL_UNSIGNED_INT8" }, + { CL_UNSIGNED_INT16, "CL_UNSIGNED_INT16" }, + { CL_UNSIGNED_INT32, "CL_UNSIGNED_INT32" }, + { CL_HALF_FLOAT, "CL_HALF_FLOAT" }, + { CL_FLOAT, "CL_FLOAT" }, #ifdef CL_SFIXED14_APPLE - { CL_SFIXED14_APPLE, "CL_SFIXED14_APPLE" } + { CL_SFIXED14_APPLE, "CL_SFIXED14_APPLE" } #endif }; - for( size_t i = 0; i < sizeof( typeNames ) / sizeof( typeNames[ 0 ] ); i++ ) + for (size_t i = 0; i < sizeof(typeNames) / sizeof(typeNames[0]); i++) { - if( strcmp( typeNames[ i ].name, name ) == 0 || strcmp( typeNames[ i ].name + 3, name ) == 0 ) - return typeNames[ i ].type; + if (strcmp(typeNames[i].name, name) == 0 + || strcmp(typeNames[i].name + 3, name) == 0) + return typeNames[i].type; } return (cl_channel_type)-1; } -cl_channel_order get_channel_order_from_name( const char *name ) +cl_channel_order get_channel_order_from_name(const char *name) { const struct { - cl_channel_order order; - const char *name; - }orderNames[] = - { + cl_channel_order order; + const char *name; + } orderNames[] = { { CL_R, "CL_R" }, { CL_A, "CL_A" }, { CL_Rx, "CL_Rx" }, @@ -234,8 +222,8 @@ cl_channel_order get_channel_order_from_name( const char *name ) { CL_RGBA, "CL_RGBA" }, { CL_BGRA, "CL_BGRA" }, { CL_ARGB, "CL_ARGB" }, - { CL_INTENSITY, "CL_INTENSITY"}, - { CL_LUMINANCE, "CL_LUMINANCE"}, + { CL_INTENSITY, "CL_INTENSITY" }, + { CL_LUMINANCE, "CL_LUMINANCE" }, { CL_DEPTH, "CL_DEPTH" }, { CL_DEPTH_STENCIL, "CL_DEPTH_STENCIL" }, { CL_sRGB, "CL_sRGB" }, @@ -251,18 +239,19 @@ cl_channel_order get_channel_order_from_name( const char *name ) #endif }; - for( size_t i = 0; i < sizeof( orderNames ) / sizeof( orderNames[ 0 ] ); i++ ) + for (size_t i = 0; i < sizeof(orderNames) / sizeof(orderNames[0]); i++) { - if( strcmp( orderNames[ i ].name, name ) == 0 || strcmp( orderNames[ i ].name + 3, name ) == 0 ) - return orderNames[ i ].order; + if (strcmp(orderNames[i].name, name) == 0 + || strcmp(orderNames[i].name + 3, name) == 0) + return orderNames[i].order; } return (cl_channel_order)-1; } -int is_format_signed( const cl_image_format *format ) +int is_format_signed(const cl_image_format *format) { - switch( format->image_channel_data_type ) + switch (format->image_channel_data_type) { case CL_SNORM_INT8: case CL_SIGNED_INT8: @@ -276,61 +265,57 @@ int is_format_signed( const cl_image_format *format ) #endif return 1; - default: - return 0; + default: return 0; } } uint32_t get_pixel_size(cl_image_format *format) { - switch( format->image_channel_data_type ) - { - case CL_SNORM_INT8: - case CL_UNORM_INT8: - case CL_SIGNED_INT8: - case CL_UNSIGNED_INT8: - return get_format_channel_count( format ); + switch (format->image_channel_data_type) + { + case CL_SNORM_INT8: + case CL_UNORM_INT8: + case CL_SIGNED_INT8: + case CL_UNSIGNED_INT8: return get_format_channel_count(format); - case CL_SNORM_INT16: - case CL_UNORM_INT16: - case CL_SIGNED_INT16: - case CL_UNSIGNED_INT16: - case CL_HALF_FLOAT: -#ifdef CL_SFIXED14_APPLE + case CL_SNORM_INT16: + case CL_UNORM_INT16: + case CL_SIGNED_INT16: + case CL_UNSIGNED_INT16: + case CL_HALF_FLOAT: +#ifdef CL_SFIXED14_APPLE case CL_SFIXED14_APPLE: #endif - return get_format_channel_count( format ) * sizeof( cl_ushort ); + return get_format_channel_count(format) * sizeof(cl_ushort); - case CL_SIGNED_INT32: - case CL_UNSIGNED_INT32: - return get_format_channel_count( format ) * sizeof( cl_int ); + case CL_SIGNED_INT32: + case CL_UNSIGNED_INT32: + return get_format_channel_count(format) * sizeof(cl_int); - case CL_UNORM_SHORT_565: - case CL_UNORM_SHORT_555: + case CL_UNORM_SHORT_565: + case CL_UNORM_SHORT_555: #ifdef OBSOLETE_FORAMT - case CL_UNORM_SHORT_565_REV: - case CL_UNORM_SHORT_555_REV: + case CL_UNORM_SHORT_565_REV: + case CL_UNORM_SHORT_555_REV: #endif - return 2; + return 2; #ifdef OBSOLETE_FORAMT - case CL_UNORM_INT_8888: - case CL_UNORM_INT_8888_REV: - return 4; + case CL_UNORM_INT_8888: + case CL_UNORM_INT_8888_REV: return 4; #endif - case CL_UNORM_INT_101010: + case CL_UNORM_INT_101010: #ifdef OBSOLETE_FORAMT - case CL_UNORM_INT_101010_REV: + case CL_UNORM_INT_101010_REV: #endif - return 4; + return 4; - case CL_FLOAT: - return get_format_channel_count( format ) * sizeof( cl_float ); + case CL_FLOAT: + return get_format_channel_count(format) * sizeof(cl_float); - default: - return 0; - } + default: return 0; + } } uint32_t next_power_of_two(uint32_t v) @@ -350,106 +335,128 @@ uint32_t get_pixel_alignment(cl_image_format *format) return next_power_of_two(get_pixel_size(format)); } -int get_8_bit_image_format( cl_context context, cl_mem_object_type objType, cl_mem_flags flags, size_t channelCount, cl_image_format *outFormat ) +int get_8_bit_image_format(cl_context context, cl_mem_object_type objType, + cl_mem_flags flags, size_t channelCount, + cl_image_format *outFormat) { - cl_image_format formatList[ 128 ]; + cl_image_format formatList[128]; unsigned int outFormatCount, i; int error; /* Make sure each image format is supported */ - if ((error = clGetSupportedImageFormats( context, flags, objType, 128, formatList, &outFormatCount ))) - return error; + if ((error = clGetSupportedImageFormats(context, flags, objType, 128, + formatList, &outFormatCount))) + return error; /* Look for one that is an 8-bit format */ - for( i = 0; i < outFormatCount; i++ ) + for (i = 0; i < outFormatCount; i++) { - if( formatList[ i ].image_channel_data_type == CL_SNORM_INT8 || - formatList[ i ].image_channel_data_type == CL_UNORM_INT8 || - formatList[ i ].image_channel_data_type == CL_SIGNED_INT8 || - formatList[ i ].image_channel_data_type == CL_UNSIGNED_INT8 ) + if (formatList[i].image_channel_data_type == CL_SNORM_INT8 + || formatList[i].image_channel_data_type == CL_UNORM_INT8 + || formatList[i].image_channel_data_type == CL_SIGNED_INT8 + || formatList[i].image_channel_data_type == CL_UNSIGNED_INT8) { - if ( !channelCount || ( channelCount && ( get_format_channel_count( &formatList[ i ] ) == channelCount ) ) ) - { - *outFormat = formatList[ i ]; - return 0; - } + if (!channelCount + || (channelCount + && (get_format_channel_count(&formatList[i]) + == channelCount))) + { + *outFormat = formatList[i]; + return 0; + } } } return -1; } -int get_32_bit_image_format( cl_context context, cl_mem_object_type objType, cl_mem_flags flags, size_t channelCount, cl_image_format *outFormat ) +int get_32_bit_image_format(cl_context context, cl_mem_object_type objType, + cl_mem_flags flags, size_t channelCount, + cl_image_format *outFormat) { - cl_image_format formatList[ 128 ]; + cl_image_format formatList[128]; unsigned int outFormatCount, i; int error; - /* Make sure each image format is supported */ - if ((error = clGetSupportedImageFormats( context, flags, objType, 128, formatList, &outFormatCount ))) - return error; + /* Make sure each image format is supported */ + if ((error = clGetSupportedImageFormats(context, flags, objType, 128, + formatList, &outFormatCount))) + return error; - /* Look for one that is an 8-bit format */ - for( i = 0; i < outFormatCount; i++ ) - { - if( formatList[ i ].image_channel_data_type == CL_UNORM_INT_101010 || - formatList[ i ].image_channel_data_type == CL_FLOAT || - formatList[ i ].image_channel_data_type == CL_SIGNED_INT32 || - formatList[ i ].image_channel_data_type == CL_UNSIGNED_INT32 ) + /* Look for one that is an 8-bit format */ + for (i = 0; i < outFormatCount; i++) { - if ( !channelCount || ( channelCount && ( get_format_channel_count( &formatList[ i ] ) == channelCount ) ) ) - { - *outFormat = formatList[ i ]; - return 0; - } - } + if (formatList[i].image_channel_data_type == CL_UNORM_INT_101010 + || formatList[i].image_channel_data_type == CL_FLOAT + || formatList[i].image_channel_data_type == CL_SIGNED_INT32 + || formatList[i].image_channel_data_type == CL_UNSIGNED_INT32) + { + if (!channelCount + || (channelCount + && (get_format_channel_count(&formatList[i]) + == channelCount))) + { + *outFormat = formatList[i]; + return 0; + } + } } return -1; } -int random_log_in_range( int minV, int maxV, MTdata d ) +int random_log_in_range(int minV, int maxV, MTdata d) { - double v = log2( ( (double)genrand_int32(d) / (double)0xffffffff ) + 1 ); - int iv = (int)( (float)( maxV - minV ) * v ); + double v = log2(((double)genrand_int32(d) / (double)0xffffffff) + 1); + int iv = (int)((float)(maxV - minV) * v); return iv + minV; } // Define the addressing functions -typedef int (*AddressFn)( int value, size_t maxValue ); +typedef int (*AddressFn)(int value, size_t maxValue); -int NoAddressFn( int value, size_t maxValue ) { return value; } -int RepeatAddressFn( int value, size_t maxValue ) +int NoAddressFn(int value, size_t maxValue) { return value; } +int RepeatAddressFn(int value, size_t maxValue) { - if( value < 0 ) + if (value < 0) value += (int)maxValue; - else if( value >= (int)maxValue ) + else if (value >= (int)maxValue) value -= (int)maxValue; return value; } -int MirroredRepeatAddressFn( int value, size_t maxValue ) +int MirroredRepeatAddressFn(int value, size_t maxValue) { - if( value < 0 ) - value = 0; - else if( (size_t) value >= maxValue ) - value = (int) (maxValue - 1); + if (value < 0) + value = 0; + else if ((size_t)value >= maxValue) + value = (int)(maxValue - 1); return value; } -int ClampAddressFn( int value, size_t maxValue ) { return ( value < -1 ) ? -1 : ( ( value > (cl_long) maxValue ) ? (int)maxValue : value ); } -int ClampToEdgeNearestFn( int value, size_t maxValue ) { return ( value < 0 ) ? 0 : ( ( (size_t)value > maxValue - 1 ) ? (int)maxValue - 1 : value ); } -AddressFn ClampToEdgeLinearFn = ClampToEdgeNearestFn; +int ClampAddressFn(int value, size_t maxValue) +{ + return (value < -1) ? -1 + : ((value > (cl_long)maxValue) ? (int)maxValue : value); +} +int ClampToEdgeNearestFn(int value, size_t maxValue) +{ + return (value < 0) + ? 0 + : (((size_t)value > maxValue - 1) ? (int)maxValue - 1 : value); +} +AddressFn ClampToEdgeLinearFn = ClampToEdgeNearestFn; -// Note: normalized coords get repeated in normalized space, not unnormalized space! hence the special case here +// Note: normalized coords get repeated in normalized space, not unnormalized +// space! hence the special case here volatile float gFloatHome; -float RepeatNormalizedAddressFn( float fValue, size_t maxValue ) +float RepeatNormalizedAddressFn(float fValue, size_t maxValue) { #ifndef _MSC_VER // Use original if not the VS compiler. // General computation for repeat - return (fValue - floorf( fValue )) * (float) maxValue; // Reduce to [0, 1.f] + return (fValue - floorf(fValue)) * (float)maxValue; // Reduce to [0, 1.f] #else // Otherwise, use this instead: // Home the subtraction to a float to break up the sequence of x87 // instructions emitted by the VS compiler. @@ -458,91 +465,93 @@ float RepeatNormalizedAddressFn( float fValue, size_t maxValue ) #endif } -float MirroredRepeatNormalizedAddressFn( float fValue, size_t maxValue ) +float MirroredRepeatNormalizedAddressFn(float fValue, size_t maxValue) { - // Round to nearest multiple of two - float s_prime = 2.0f * rintf( fValue * 0.5f ); // Note halfway values flip flop here due to rte, but they both end up pointing the same place at the end of the day + // Round to nearest multiple of two. + // Note halfway values flip flop here due to rte, but they both end up + // pointing the same place at the end of the day. + float s_prime = 2.0f * rintf(fValue * 0.5f); // Reduce to [-1, 1], Apply mirroring -> [0, 1] - s_prime = fabsf( fValue - s_prime ); + s_prime = fabsf(fValue - s_prime); // un-normalize - return s_prime * (float) maxValue; + return s_prime * (float)maxValue; } struct AddressingTable { AddressingTable() { - ct_assert( ( CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6 ) ); - ct_assert( CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2 ); + ct_assert((CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE < 6)); + ct_assert(CL_FILTER_NEAREST - CL_FILTER_LINEAR < 2); - mTable[ CL_ADDRESS_NONE - CL_ADDRESS_NONE ][ CL_FILTER_NEAREST - CL_FILTER_NEAREST ] = NoAddressFn; - mTable[ CL_ADDRESS_NONE - CL_ADDRESS_NONE ][ CL_FILTER_LINEAR - CL_FILTER_NEAREST ] = NoAddressFn; - mTable[ CL_ADDRESS_REPEAT - CL_ADDRESS_NONE ][ CL_FILTER_NEAREST - CL_FILTER_NEAREST ] = RepeatAddressFn; - mTable[ CL_ADDRESS_REPEAT - CL_ADDRESS_NONE ][ CL_FILTER_LINEAR - CL_FILTER_NEAREST ] = RepeatAddressFn; - mTable[ CL_ADDRESS_CLAMP_TO_EDGE - CL_ADDRESS_NONE ][ CL_FILTER_NEAREST - CL_FILTER_NEAREST ] = ClampToEdgeNearestFn; - mTable[ CL_ADDRESS_CLAMP_TO_EDGE - CL_ADDRESS_NONE ][ CL_FILTER_LINEAR - CL_FILTER_NEAREST ] = ClampToEdgeLinearFn; - mTable[ CL_ADDRESS_CLAMP - CL_ADDRESS_NONE ][ CL_FILTER_NEAREST - CL_FILTER_NEAREST ] = ClampAddressFn; - mTable[ CL_ADDRESS_CLAMP - CL_ADDRESS_NONE ][ CL_FILTER_LINEAR - CL_FILTER_NEAREST ] = ClampAddressFn; - mTable[ CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE ][ CL_FILTER_NEAREST - CL_FILTER_NEAREST ] = MirroredRepeatAddressFn; - mTable[ CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE ][ CL_FILTER_LINEAR - CL_FILTER_NEAREST ] = MirroredRepeatAddressFn; + mTable[CL_ADDRESS_NONE - CL_ADDRESS_NONE] + [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = NoAddressFn; + mTable[CL_ADDRESS_NONE - CL_ADDRESS_NONE] + [CL_FILTER_LINEAR - CL_FILTER_NEAREST] = NoAddressFn; + mTable[CL_ADDRESS_REPEAT - CL_ADDRESS_NONE] + [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = RepeatAddressFn; + mTable[CL_ADDRESS_REPEAT - CL_ADDRESS_NONE] + [CL_FILTER_LINEAR - CL_FILTER_NEAREST] = RepeatAddressFn; + mTable[CL_ADDRESS_CLAMP_TO_EDGE - CL_ADDRESS_NONE] + [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = ClampToEdgeNearestFn; + mTable[CL_ADDRESS_CLAMP_TO_EDGE - CL_ADDRESS_NONE] + [CL_FILTER_LINEAR - CL_FILTER_NEAREST] = ClampToEdgeLinearFn; + mTable[CL_ADDRESS_CLAMP - CL_ADDRESS_NONE] + [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = ClampAddressFn; + mTable[CL_ADDRESS_CLAMP - CL_ADDRESS_NONE] + [CL_FILTER_LINEAR - CL_FILTER_NEAREST] = ClampAddressFn; + mTable[CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE] + [CL_FILTER_NEAREST - CL_FILTER_NEAREST] = MirroredRepeatAddressFn; + mTable[CL_ADDRESS_MIRRORED_REPEAT - CL_ADDRESS_NONE] + [CL_FILTER_LINEAR - CL_FILTER_NEAREST] = MirroredRepeatAddressFn; } - AddressFn operator[]( image_sampler_data *sampler ) + AddressFn operator[](image_sampler_data *sampler) { - return mTable[ (int)sampler->addressing_mode - CL_ADDRESS_NONE ][ (int)sampler->filter_mode - CL_FILTER_NEAREST ]; + return mTable[(int)sampler->addressing_mode - CL_ADDRESS_NONE] + [(int)sampler->filter_mode - CL_FILTER_NEAREST]; } - AddressFn mTable[ 6 ][ 2 ]; + AddressFn mTable[6][2]; }; -static AddressingTable sAddressingTable; +static AddressingTable sAddressingTable; -bool is_sRGBA_order(cl_channel_order image_channel_order){ - switch (image_channel_order) { +bool is_sRGBA_order(cl_channel_order image_channel_order) +{ + switch (image_channel_order) + { case CL_sRGB: case CL_sRGBx: case CL_sRGBA: - case CL_sBGRA: - return true; - default: - return false; + case CL_sBGRA: return true; + default: return false; } } // Format helpers -int has_alpha(cl_image_format *format) { - switch (format->image_channel_order) { - case CL_R: - return 0; - case CL_A: - return 1; - case CL_Rx: - return 0; - case CL_RG: - return 0; - case CL_RA: - return 1; - case CL_RGx: - return 0; +int has_alpha(cl_image_format *format) +{ + switch (format->image_channel_order) + { + case CL_R: return 0; + case CL_A: return 1; + case CL_Rx: return 0; + case CL_RG: return 0; + case CL_RA: return 1; + case CL_RGx: return 0; case CL_RGB: - case CL_sRGB: - return 0; + case CL_sRGB: return 0; case CL_RGBx: - case CL_sRGBx: - return 0; - case CL_RGBA: - return 1; - case CL_BGRA: - return 1; - case CL_ARGB: - return 1; - case CL_INTENSITY: - return 1; - case CL_LUMINANCE: - return 0; + case CL_sRGBx: return 0; + case CL_RGBA: return 1; + case CL_BGRA: return 1; + case CL_ARGB: return 1; + case CL_INTENSITY: return 1; + case CL_LUMINANCE: return 0; #ifdef CL_BGR1_APPLE case CL_BGR1_APPLE: return 1; #endif @@ -550,235 +559,278 @@ int has_alpha(cl_image_format *format) { case CL_1RGB_APPLE: return 1; #endif case CL_sRGBA: - case CL_sBGRA: - return 1; - case CL_DEPTH: - return 0; + case CL_sBGRA: return 1; + case CL_DEPTH: return 0; default: - log_error("Invalid image channel order: %d\n", format->image_channel_order); + log_error("Invalid image channel order: %d\n", + format->image_channel_order); return 0; } - } #define PRINT_MAX_SIZE_LOGIC 0 -#define SWAP( _a, _b ) do{ _a ^= _b; _b ^= _a; _a ^= _b; }while(0) +#define SWAP(_a, _b) \ + do \ + { \ + _a ^= _b; \ + _b ^= _a; \ + _a ^= _b; \ + } while (0) #ifndef MAX - #define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) +#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) #endif -void get_max_sizes(size_t *numberOfSizes, const int maxNumberOfSizes, - size_t sizes[][3], size_t maxWidth, size_t maxHeight, size_t maxDepth, size_t maxArraySize, - const cl_ulong maxIndividualAllocSize, // CL_DEVICE_MAX_MEM_ALLOC_SIZE - const cl_ulong maxTotalAllocSize, // CL_DEVICE_GLOBAL_MEM_SIZE - cl_mem_object_type image_type, cl_image_format *format, int usingMaxPixelSizeBuffer) { +void get_max_sizes( + size_t *numberOfSizes, const int maxNumberOfSizes, size_t sizes[][3], + size_t maxWidth, size_t maxHeight, size_t maxDepth, size_t maxArraySize, + const cl_ulong maxIndividualAllocSize, // CL_DEVICE_MAX_MEM_ALLOC_SIZE + const cl_ulong maxTotalAllocSize, // CL_DEVICE_GLOBAL_MEM_SIZE + cl_mem_object_type image_type, cl_image_format *format, + int usingMaxPixelSizeBuffer) +{ bool is3D = (image_type == CL_MEM_OBJECT_IMAGE3D); - bool isArray = (image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY || image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY); + bool isArray = (image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY + || image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY); // Validate we have a reasonable max depth for 3D - if (is3D && maxDepth < 2) { - log_error("ERROR: Requesting max image sizes for 3D images when max depth is < 2.\n"); + if (is3D && maxDepth < 2) + { + log_error("ERROR: Requesting max image sizes for 3D images when max " + "depth is < 2.\n"); *numberOfSizes = 0; return; } // Validate we have a reasonable max array size for 1D & 2D image arrays - if (isArray && maxArraySize < 2) { - log_error("ERROR: Requesting max image sizes for an image array when max array size is < 1.\n"); + if (isArray && maxArraySize < 2) + { + log_error("ERROR: Requesting max image sizes for an image array when " + "max array size is < 1.\n"); *numberOfSizes = 0; return; } - // Reduce the maximum because we are trying to test the max image dimensions, not the memory allocation + // Reduce the maximum because we are trying to test the max image + // dimensions, not the memory allocation cl_ulong adjustedMaxTotalAllocSize = maxTotalAllocSize / 4; cl_ulong adjustedMaxIndividualAllocSize = maxIndividualAllocSize / 4; - log_info("Note: max individual allocation adjusted down from %gMB to %gMB and max total allocation adjusted down from %gMB to %gMB.\n", - maxIndividualAllocSize/(1024.0*1024.0), adjustedMaxIndividualAllocSize/(1024.0*1024.0), - maxTotalAllocSize/(1024.0*1024.0), adjustedMaxTotalAllocSize/(1024.0*1024.0)); + log_info("Note: max individual allocation adjusted down from %gMB to %gMB " + "and max total allocation adjusted down from %gMB to %gMB.\n", + maxIndividualAllocSize / (1024.0 * 1024.0), + adjustedMaxIndividualAllocSize / (1024.0 * 1024.0), + maxTotalAllocSize / (1024.0 * 1024.0), + adjustedMaxTotalAllocSize / (1024.0 * 1024.0)); // Cap our max allocation to 1.0GB. - // FIXME -- why? In the interest of not taking a long time? We should still test this stuff... - if (adjustedMaxTotalAllocSize > (cl_ulong)1024*1024*1024) { - adjustedMaxTotalAllocSize = (cl_ulong)1024*1024*1024; - log_info("Limiting max total allocation size to %gMB (down from %gMB) for test.\n", - adjustedMaxTotalAllocSize/(1024.0*1024.0), maxTotalAllocSize/(1024.0*1024.0)); + // FIXME -- why? In the interest of not taking a long time? We should + // still test this stuff... + if (adjustedMaxTotalAllocSize > (cl_ulong)1024 * 1024 * 1024) + { + adjustedMaxTotalAllocSize = (cl_ulong)1024 * 1024 * 1024; + log_info("Limiting max total allocation size to %gMB (down from %gMB) " + "for test.\n", + adjustedMaxTotalAllocSize / (1024.0 * 1024.0), + maxTotalAllocSize / (1024.0 * 1024.0)); } cl_ulong maxAllocSize = adjustedMaxIndividualAllocSize; - if (adjustedMaxTotalAllocSize < adjustedMaxIndividualAllocSize*2) - maxAllocSize = adjustedMaxTotalAllocSize/2; + if (adjustedMaxTotalAllocSize < adjustedMaxIndividualAllocSize * 2) + maxAllocSize = adjustedMaxTotalAllocSize / 2; size_t raw_pixel_size = get_pixel_size(format); - // If the test will be creating input (src) buffer of type int4 or float4, number of pixels will be - // governed by sizeof(int4 or float4) and not sizeof(dest fomat) - // Also if pixel size is 12 bytes i.e. RGB or RGBx, we adjust it to 16 bytes as GPUs has no concept - // of 3 channel images. GPUs expand these to four channel RGBA. - if(usingMaxPixelSizeBuffer || raw_pixel_size == 12) - raw_pixel_size = 16; + // If the test will be creating input (src) buffer of type int4 or float4, + // number of pixels will be governed by sizeof(int4 or float4) and not + // sizeof(dest fomat) Also if pixel size is 12 bytes i.e. RGB or RGBx, we + // adjust it to 16 bytes as GPUs has no concept of 3 channel images. GPUs + // expand these to four channel RGBA. + if (usingMaxPixelSizeBuffer || raw_pixel_size == 12) raw_pixel_size = 16; size_t max_pixels = (size_t)maxAllocSize / raw_pixel_size; - log_info("Maximums: [%ld x %ld x %ld], raw pixel size %lu bytes, per-allocation limit %gMB.\n", - maxWidth, maxHeight, isArray ? maxArraySize : maxDepth, raw_pixel_size, (maxAllocSize/(1024.0*1024.0))); + log_info("Maximums: [%ld x %ld x %ld], raw pixel size %lu bytes, " + "per-allocation limit %gMB.\n", + maxWidth, maxHeight, isArray ? maxArraySize : maxDepth, + raw_pixel_size, (maxAllocSize / (1024.0 * 1024.0))); - // Keep track of the maximum sizes for each dimension - size_t maximum_sizes[] = { maxWidth, maxHeight, maxDepth }; + // Keep track of the maximum sizes for each dimension + size_t maximum_sizes[] = { maxWidth, maxHeight, maxDepth }; - switch (image_type) { - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - maximum_sizes[1] = maxArraySize; - maximum_sizes[2] = 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - maximum_sizes[2] = maxArraySize; - break; - } + switch (image_type) + { + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + maximum_sizes[1] = maxArraySize; + maximum_sizes[2] = 1; + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + maximum_sizes[2] = maxArraySize; + break; + } - // Given one fixed sized dimension, this code finds one or two other dimensions, - // both with very small size, such that the size does not exceed the maximum - // passed to this function + // Given one fixed sized dimension, this code finds one or two other + // dimensions, both with very small size, such that the size does not + // exceed the maximum passed to this function -#if defined(__x86_64) || defined (__arm64__) || defined (__ppc64__) - size_t other_sizes[] = { 2, 3, 5, 6, 7, 9, 10, 11, 13, 15}; +#if defined(__x86_64) || defined(__arm64__) || defined(__ppc64__) + size_t other_sizes[] = { 2, 3, 5, 6, 7, 9, 10, 11, 13, 15 }; #else - size_t other_sizes[] = { 2, 3, 5, 6, 7, 9, 11, 13}; + size_t other_sizes[] = { 2, 3, 5, 6, 7, 9, 11, 13 }; #endif - static size_t other_size = 0; - enum { num_other_sizes = sizeof(other_sizes)/sizeof(size_t) }; + static size_t other_size = 0; + enum + { + num_other_sizes = sizeof(other_sizes) / sizeof(size_t) + }; - (*numberOfSizes) = 0; + (*numberOfSizes) = 0; - if (image_type == CL_MEM_OBJECT_IMAGE1D) { + if (image_type == CL_MEM_OBJECT_IMAGE1D) + { - double M = maximum_sizes[0]; + double M = maximum_sizes[0]; - // Store the size - sizes[(*numberOfSizes)][0] = (size_t)M; - sizes[(*numberOfSizes)][1] = 1; - sizes[(*numberOfSizes)][2] = 1; - ++(*numberOfSizes); - } - - else if (image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY || image_type == CL_MEM_OBJECT_IMAGE2D) { - - for (int fixed_dim=0;fixed_dim<2;++fixed_dim) { - - // Determine the size of the fixed dimension - double M = maximum_sizes[fixed_dim]; - double A = max_pixels; - - int x0_dim = !fixed_dim; - double x0 = fmin(fmin(other_sizes[(other_size++)%num_other_sizes],A/M), maximum_sizes[x0_dim]); - - // Store the size - sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; - sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; - sizes[(*numberOfSizes)][2] = 1; - ++(*numberOfSizes); + // Store the size + sizes[(*numberOfSizes)][0] = (size_t)M; + sizes[(*numberOfSizes)][1] = 1; + sizes[(*numberOfSizes)][2] = 1; + ++(*numberOfSizes); } - } - else if (image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY || image_type == CL_MEM_OBJECT_IMAGE3D) { + else if (image_type == CL_MEM_OBJECT_IMAGE1D_ARRAY + || image_type == CL_MEM_OBJECT_IMAGE2D) + { - // Iterate over dimensions, finding sizes for the non-fixed dimension - for (int fixed_dim=0;fixed_dim<3;++fixed_dim) { + for (int fixed_dim = 0; fixed_dim < 2; ++fixed_dim) + { - // Determine the size of the fixed dimension - double M = maximum_sizes[fixed_dim]; - double A = max_pixels; + // Determine the size of the fixed dimension + double M = maximum_sizes[fixed_dim]; + double A = max_pixels; - // Find two other dimensions, x0 and x1 - int x0_dim = (fixed_dim == 0) ? 1 : 0; - int x1_dim = (fixed_dim == 2) ? 1 : 2; + int x0_dim = !fixed_dim; + double x0 = + fmin(fmin(other_sizes[(other_size++) % num_other_sizes], A / M), + maximum_sizes[x0_dim]); - // Choose two other sizes for these dimensions - double x0 = fmin(fmin(A/M,maximum_sizes[x0_dim]),other_sizes[(other_size++)%num_other_sizes]); - // GPUs have certain restrictions on minimum width (row alignment) of images which has given us issues - // testing small widths in this test (say we set width to 3 for testing, and compute size based on this width and decide - // it fits within vram ... but GPU driver decides that, due to row alignment requirements, it has to use - // width of 16 which doesnt fit in vram). For this purpose we are not testing width < 16 for this test. - if(x0_dim == 0 && x0 < 16) - x0 = 16; - double x1 = fmin(fmin(A/M/x0,maximum_sizes[x1_dim]),other_sizes[(other_size++)%num_other_sizes]); - - // Valid image sizes cannot be below 1. Due to the workaround for the xo_dim where x0 is overidden to 16 - // there might not be enough space left for x1 dimension. This could be a fractional 0.x size that when cast to - // integer would result in a value 0. In these cases we clamp the size to a minimum of 1. - if ( x1 < 1 ) - x1 = 1; - - // M and x0 cannot be '0' as they derive from clDeviceInfo calls - assert(x0 > 0 && M > 0); - - // Store the size - sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; - sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; - sizes[(*numberOfSizes)][x1_dim] = (size_t)x1; - ++(*numberOfSizes); + // Store the size + sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; + sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; + sizes[(*numberOfSizes)][2] = 1; + ++(*numberOfSizes); + } } - } - // Log the results - for (int j=0; j<(int)(*numberOfSizes); j++) { - switch (image_type) { - case CL_MEM_OBJECT_IMAGE1D: - log_info(" size[%d] = [%ld] (%g MB image)\n", - j, sizes[j][0], raw_pixel_size*sizes[j][0]*sizes[j][1]*sizes[j][2]/(1024.0*1024.0)); - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE2D: - log_info(" size[%d] = [%ld %ld] (%g MB image)\n", - j, sizes[j][0], sizes[j][1], raw_pixel_size*sizes[j][0]*sizes[j][1]*sizes[j][2]/(1024.0*1024.0)); - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - case CL_MEM_OBJECT_IMAGE3D: - log_info(" size[%d] = [%ld %ld %ld] (%g MB image)\n", - j, sizes[j][0], sizes[j][1], sizes[j][2], raw_pixel_size*sizes[j][0]*sizes[j][1]*sizes[j][2]/(1024.0*1024.0)); - break; + else if (image_type == CL_MEM_OBJECT_IMAGE2D_ARRAY + || image_type == CL_MEM_OBJECT_IMAGE3D) + { + + // Iterate over dimensions, finding sizes for the non-fixed dimension + for (int fixed_dim = 0; fixed_dim < 3; ++fixed_dim) + { + + // Determine the size of the fixed dimension + double M = maximum_sizes[fixed_dim]; + double A = max_pixels; + + // Find two other dimensions, x0 and x1 + int x0_dim = (fixed_dim == 0) ? 1 : 0; + int x1_dim = (fixed_dim == 2) ? 1 : 2; + + // Choose two other sizes for these dimensions + double x0 = fmin(fmin(A / M, maximum_sizes[x0_dim]), + other_sizes[(other_size++) % num_other_sizes]); + // GPUs have certain restrictions on minimum width (row alignment) + // of images which has given us issues testing small widths in this + // test (say we set width to 3 for testing, and compute size based + // on this width and decide it fits within vram ... but GPU driver + // decides that, due to row alignment requirements, it has to use + // width of 16 which doesnt fit in vram). For this purpose we are + // not testing width < 16 for this test. + if (x0_dim == 0 && x0 < 16) x0 = 16; + double x1 = fmin(fmin(A / M / x0, maximum_sizes[x1_dim]), + other_sizes[(other_size++) % num_other_sizes]); + + // Valid image sizes cannot be below 1. Due to the workaround for + // the xo_dim where x0 is overidden to 16 there might not be enough + // space left for x1 dimension. This could be a fractional 0.x size + // that when cast to integer would result in a value 0. In these + // cases we clamp the size to a minimum of 1. + if (x1 < 1) x1 = 1; + + // M and x0 cannot be '0' as they derive from clDeviceInfo calls + assert(x0 > 0 && M > 0); + + // Store the size + sizes[(*numberOfSizes)][fixed_dim] = (size_t)M; + sizes[(*numberOfSizes)][x0_dim] = (size_t)x0; + sizes[(*numberOfSizes)][x1_dim] = (size_t)x1; + ++(*numberOfSizes); + } } - } -} -float get_max_absolute_error( cl_image_format *format, image_sampler_data *sampler) { - if (sampler->filter_mode == CL_FILTER_NEAREST) - return 0.0f; - - switch (format->image_channel_data_type) { - case CL_SNORM_INT8: - return 1.0f/127.0f; - case CL_UNORM_INT8: - return 1.0f/255.0f; - case CL_UNORM_INT16: - return 1.0f/65535.0f; - case CL_SNORM_INT16: - return 1.0f/32767.0f; - case CL_FLOAT: - return CL_FLT_MIN; -#ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - return 0x1.0p-14f; -#endif - default: - return 0.0f; + // Log the results + for (int j = 0; j < (int)(*numberOfSizes); j++) + { + switch (image_type) + { + case CL_MEM_OBJECT_IMAGE1D: + log_info(" size[%d] = [%ld] (%g MB image)\n", j, sizes[j][0], + raw_pixel_size * sizes[j][0] * sizes[j][1] + * sizes[j][2] / (1024.0 * 1024.0)); + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + case CL_MEM_OBJECT_IMAGE2D: + log_info(" size[%d] = [%ld %ld] (%g MB image)\n", j, + sizes[j][0], sizes[j][1], + raw_pixel_size * sizes[j][0] * sizes[j][1] + * sizes[j][2] / (1024.0 * 1024.0)); + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + case CL_MEM_OBJECT_IMAGE3D: + log_info(" size[%d] = [%ld %ld %ld] (%g MB image)\n", j, + sizes[j][0], sizes[j][1], sizes[j][2], + raw_pixel_size * sizes[j][0] * sizes[j][1] + * sizes[j][2] / (1024.0 * 1024.0)); + break; + } } } -float get_max_relative_error( cl_image_format *format, image_sampler_data *sampler, int is3D, int isLinearFilter ) +float get_max_absolute_error(cl_image_format *format, + image_sampler_data *sampler) +{ + if (sampler->filter_mode == CL_FILTER_NEAREST) return 0.0f; + + switch (format->image_channel_data_type) + { + case CL_SNORM_INT8: return 1.0f / 127.0f; + case CL_UNORM_INT8: return 1.0f / 255.0f; + case CL_UNORM_INT16: return 1.0f / 65535.0f; + case CL_SNORM_INT16: return 1.0f / 32767.0f; + case CL_FLOAT: return CL_FLT_MIN; +#ifdef CL_SFIXED14_APPLE + case CL_SFIXED14_APPLE: return 0x1.0p-14f; +#endif + default: return 0.0f; + } +} + +float get_max_relative_error(cl_image_format *format, + image_sampler_data *sampler, int is3D, + int isLinearFilter) { float maxError = 0.0f; float sampleCount = 1.0f; - if( isLinearFilter ) - sampleCount = is3D ? 8.0f : 4.0f; + if (isLinearFilter) sampleCount = is3D ? 8.0f : 4.0f; - // Note that the ULP is defined here as the unit in the last place of the maximum - // magnitude sample used for filtering. + // Note that the ULP is defined here as the unit in the last place of the + // maximum magnitude sample used for filtering. // Section 8.3 - switch( format->image_channel_data_type ) + switch (format->image_channel_data_type) { - // The spec allows 2 ulps of error for normalized formats + // The spec allows 2 ulps of error for normalized formats case CL_SNORM_INT8: case CL_UNORM_INT8: case CL_SNORM_INT16: @@ -786,34 +838,42 @@ float get_max_relative_error( cl_image_format *format, image_sampler_data *sampl case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: case CL_UNORM_INT_101010: - maxError = 2*FLT_EPSILON*sampleCount; // Maximum sampling error for round to zero normalization based on multiplication - // by reciprocal (using reciprocal generated in round to +inf mode, so that 1.0 matches spec) + // Maximum sampling error for round to zero normalization based on + // multiplication by reciprocal (using reciprocal generated in + // round to +inf mode, so that 1.0 matches spec) + maxError = 2 * FLT_EPSILON * sampleCount; break; - // If the implementation supports these formats then it will have to allow rounding error here too, - // because not all 32-bit ints are exactly representable in float + // If the implementation supports these formats then it will have to + // allow rounding error here too, because not all 32-bit ints are + // exactly representable in float case CL_SIGNED_INT32: - case CL_UNSIGNED_INT32: - maxError = 1*FLT_EPSILON; - break; + case CL_UNSIGNED_INT32: maxError = 1 * FLT_EPSILON; break; } // Section 8.2 - if( sampler->addressing_mode == CL_ADDRESS_REPEAT || sampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT || sampler->filter_mode != CL_FILTER_NEAREST || sampler->normalized_coords ) -#if defined( __APPLE__ ) + if (sampler->addressing_mode == CL_ADDRESS_REPEAT + || sampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT + || sampler->filter_mode != CL_FILTER_NEAREST + || sampler->normalized_coords) +#if defined(__APPLE__) { - if( sampler->filter_mode != CL_FILTER_NEAREST ) + if (sampler->filter_mode != CL_FILTER_NEAREST) { // The maximum - if( gDeviceType == CL_DEVICE_TYPE_GPU ) - maxError += MAKE_HEX_FLOAT(0x1.0p-4f, 0x1L, -4); // Some GPUs ain't so accurate + if (gDeviceType == CL_DEVICE_TYPE_GPU) + // Some GPUs ain't so accurate + maxError += MAKE_HEX_FLOAT(0x1.0p-4f, 0x1L, -4); else - // The standard method of 2d linear filtering delivers 4.0 ulps of error in round to nearest (8 in rtz). + // The standard method of 2d linear filtering delivers 4.0 ulps + // of error in round to nearest (8 in rtz). maxError += 4.0f * FLT_EPSILON; } else - maxError += 4.0f * FLT_EPSILON; // normalized coordinates will introduce some error into the fractional part of the address, affecting results + // normalized coordinates will introduce some error into the + // fractional part of the address, affecting results + maxError += 4.0f * FLT_EPSILON; } #else { @@ -839,445 +899,424 @@ float get_max_relative_error( cl_image_format *format, image_sampler_data *sampl return maxError; } -size_t get_format_max_int( cl_image_format *format ) +size_t get_format_max_int(cl_image_format *format) { - switch( format->image_channel_data_type ) + switch (format->image_channel_data_type) { case CL_SNORM_INT8: - case CL_SIGNED_INT8: - return 127; + case CL_SIGNED_INT8: return 127; case CL_UNORM_INT8: - case CL_UNSIGNED_INT8: - return 255; + case CL_UNSIGNED_INT8: return 255; case CL_SNORM_INT16: - case CL_SIGNED_INT16: - return 32767; + case CL_SIGNED_INT16: return 32767; case CL_UNORM_INT16: - case CL_UNSIGNED_INT16: - return 65535; + case CL_UNSIGNED_INT16: return 65535; - case CL_SIGNED_INT32: - return 2147483647L; + case CL_SIGNED_INT32: return 2147483647L; - case CL_UNSIGNED_INT32: - return 4294967295LL; + case CL_UNSIGNED_INT32: return 4294967295LL; case CL_UNORM_SHORT_565: - case CL_UNORM_SHORT_555: - return 31; + case CL_UNORM_SHORT_555: return 31; - case CL_UNORM_INT_101010: - return 1023; + case CL_UNORM_INT_101010: return 1023; - case CL_HALF_FLOAT: - return 1<<10; + case CL_HALF_FLOAT: return 1 << 10; #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - return 16384; + case CL_SFIXED14_APPLE: return 16384; #endif - default: - return 0; + default: return 0; } } -int get_format_min_int( cl_image_format *format ) +int get_format_min_int(cl_image_format *format) { - switch( format->image_channel_data_type ) + switch (format->image_channel_data_type) { case CL_SNORM_INT8: - case CL_SIGNED_INT8: - return -128; + case CL_SIGNED_INT8: return -128; case CL_UNORM_INT8: - case CL_UNSIGNED_INT8: - return 0; + case CL_UNSIGNED_INT8: return 0; case CL_SNORM_INT16: - case CL_SIGNED_INT16: - return -32768; + case CL_SIGNED_INT16: return -32768; case CL_UNORM_INT16: - case CL_UNSIGNED_INT16: - return 0; + case CL_UNSIGNED_INT16: return 0; - case CL_SIGNED_INT32: - return -2147483648LL; + case CL_SIGNED_INT32: return -2147483648LL; - case CL_UNSIGNED_INT32: - return 0; + case CL_UNSIGNED_INT32: return 0; case CL_UNORM_SHORT_565: case CL_UNORM_SHORT_555: - case CL_UNORM_INT_101010: - return 0; + case CL_UNORM_INT_101010: return 0; case CL_HALF_FLOAT: return -(1 << 10); #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - return -16384; + case CL_SFIXED14_APPLE: return -16384; #endif - default: - return 0; + default: return 0; } } cl_half convert_float_to_half(float f) { - switch( gFloatToHalfRoundingMode ) + switch (gFloatToHalfRoundingMode) { case kRoundToNearestEven: return cl_half_from_float(f, CL_HALF_RTE); case kRoundTowardZero: return cl_half_from_float(f, CL_HALF_RTZ); default: - log_error( "ERROR: Test internal error -- unhandled or unknown float->half rounding mode.\n" ); + log_error("ERROR: Test internal error -- unhandled or unknown " + "float->half rounding mode.\n"); exit(-1); return 0xffff; } - } -cl_ulong get_image_size( image_descriptor const *imageInfo ) +cl_ulong get_image_size(image_descriptor const *imageInfo) { cl_ulong imageSize; // Assumes rowPitch and slicePitch are always correctly defined - if ( /*gTestMipmaps*/ imageInfo->num_mip_levels > 1 ) + if (/*gTestMipmaps*/ imageInfo->num_mip_levels > 1) { - imageSize = (size_t) compute_mipmapped_image_size(*imageInfo); + imageSize = (size_t)compute_mipmapped_image_size(*imageInfo); } else { - switch (imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE1D: - imageSize = imageInfo->rowPitch; - break; - case CL_MEM_OBJECT_IMAGE2D: - imageSize = imageInfo->height * imageInfo->rowPitch; - break; - case CL_MEM_OBJECT_IMAGE3D: - imageSize = imageInfo->depth * imageInfo->slicePitch; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - imageSize = imageInfo->arraySize * imageInfo->slicePitch; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - imageSize = imageInfo->arraySize * imageInfo->slicePitch; - break; - default: - log_error("ERROR: Cannot identify image type %x\n", imageInfo->type); - abort(); - } + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE1D: imageSize = imageInfo->rowPitch; break; + case CL_MEM_OBJECT_IMAGE2D: + imageSize = imageInfo->height * imageInfo->rowPitch; + break; + case CL_MEM_OBJECT_IMAGE3D: + imageSize = imageInfo->depth * imageInfo->slicePitch; + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + imageSize = imageInfo->arraySize * imageInfo->slicePitch; + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + imageSize = imageInfo->arraySize * imageInfo->slicePitch; + break; + default: + log_error("ERROR: Cannot identify image type %x\n", + imageInfo->type); + abort(); + } } return imageSize; } -// Calculate image size in megabytes (strictly, mebibytes). Result is rounded up. -cl_ulong get_image_size_mb( image_descriptor const *imageInfo ) +// Calculate image size in megabytes (strictly, mebibytes). Result is rounded +// up. +cl_ulong get_image_size_mb(image_descriptor const *imageInfo) { - cl_ulong imageSize = get_image_size( imageInfo ); - cl_ulong mb = imageSize / ( 1024 * 1024 ); - if ( imageSize % ( 1024 * 1024 ) > 0 ) + cl_ulong imageSize = get_image_size(imageInfo); + cl_ulong mb = imageSize / (1024 * 1024); + if (imageSize % (1024 * 1024) > 0) { mb += 1; } - return mb; + return mb; } uint64_t gRoundingStartValue = 0; -void escape_inf_nan_values( char* data, size_t allocSize ) { +void escape_inf_nan_values(char *data, size_t allocSize) +{ // filter values with 8 not-quite-highest bits unsigned int *intPtr = (unsigned int *)data; - for( size_t i = 0; i < allocSize >> 2; i++ ) + for (size_t i = 0; i> 2; i++) { - if( ( intPtr[ i ] & 0x7F800000 ) == 0x7F800000 ) - intPtr[ i ] ^= 0x40000000; + if ((intPtr[i] & 0x7F800000) == 0x7F800000) intPtr[i] ^= 0x40000000; } - // Ditto with half floats (16-bit numbers with the 5 not-quite-highest bits = 0x7C00 are special) + // Ditto with half floats (16-bit numbers with the 5 not-quite-highest bits + // = 0x7C00 are special) unsigned short *shortPtr = (unsigned short *)data; - for( size_t i = 0; i < allocSize >> 1; i++ ) + for (size_t i = 0; i> 1; i++) { - if( ( shortPtr[ i ] & 0x7C00 ) == 0x7C00 ) - shortPtr[ i ] ^= 0x4000; + if ((shortPtr[i] & 0x7C00) == 0x7C00) shortPtr[i] ^= 0x4000; } } -char * generate_random_image_data( image_descriptor *imageInfo, BufferOwningPtr &P, MTdata d ) +char *generate_random_image_data(image_descriptor *imageInfo, + BufferOwningPtr &P, MTdata d) { - size_t allocSize = get_image_size( imageInfo ); - size_t pixelRowBytes = imageInfo->width * get_pixel_size( imageInfo->format ); + size_t allocSize = get_image_size(imageInfo); + size_t pixelRowBytes = imageInfo->width * get_pixel_size(imageInfo->format); size_t i; if (imageInfo->num_mip_levels > 1) - allocSize = compute_mipmapped_image_size(*imageInfo); + allocSize = compute_mipmapped_image_size(*imageInfo); -#if defined (__APPLE__ ) +#if defined(__APPLE__) char *data = NULL; - if (gDeviceType == CL_DEVICE_TYPE_CPU) { + if (gDeviceType == CL_DEVICE_TYPE_CPU) + { size_t mapSize = ((allocSize + 4095L) & -4096L) + 8192; - void *map = mmap(0, mapSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); + void *map = mmap(0, mapSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); intptr_t data_end = (intptr_t)map + mapSize - 4096; data = (char *)(data_end - (intptr_t)allocSize); mprotect(map, 4096, PROT_NONE); mprotect((void *)((char *)map + mapSize - 4096), 4096, PROT_NONE); - P.reset(data, map, mapSize,allocSize); - } else { + P.reset(data, map, mapSize, allocSize); + } + else + { data = (char *)malloc(allocSize); - P.reset(data,NULL,0,allocSize); + P.reset(data, NULL, 0, allocSize); } #else - P.reset( NULL ); // Free already allocated memory first, then try to allocate new block. + P.reset(NULL); // Free already allocated memory first, then try to allocate + // new block. char *data = (char *)align_malloc(allocSize, get_pixel_alignment(imageInfo->format)); - P.reset(data,NULL,0,allocSize, true); + P.reset(data, NULL, 0, allocSize, true); #endif - if (data == NULL) { - log_error( "ERROR: Unable to malloc %lu bytes for generate_random_image_data\n", allocSize ); - return 0; + if (data == NULL) + { + log_error("ERROR: Unable to malloc %lu bytes for " + "generate_random_image_data\n", + allocSize); + return 0; } - if( gTestRounding ) + if (gTestRounding) { // Special case: fill with a ramp from 0 to the size of the type - size_t typeSize = get_format_type_size( imageInfo->format ); - switch( typeSize ) + size_t typeSize = get_format_type_size(imageInfo->format); + switch (typeSize) { - case 1: - { + case 1: { char *ptr = data; - for( i = 0; i < allocSize; i++ ) - ptr[i] = (cl_char) (i + gRoundingStartValue); + for (i = 0; i < allocSize; i++) + ptr[i] = (cl_char)(i + gRoundingStartValue); } - break; - case 2: - { - cl_short *ptr = (cl_short*) data; - for( i = 0; i < allocSize / 2; i++ ) - ptr[i] = (cl_short) (i + gRoundingStartValue); + break; + case 2: { + cl_short *ptr = (cl_short *)data; + for (i = 0; i < allocSize / 2; i++) + ptr[i] = (cl_short)(i + gRoundingStartValue); } - break; - case 4: - { - cl_int *ptr = (cl_int*) data; - for( i = 0; i < allocSize / 4; i++ ) - ptr[i] = (cl_int) (i + gRoundingStartValue); + break; + case 4: { + cl_int *ptr = (cl_int *)data; + for (i = 0; i < allocSize / 4; i++) + ptr[i] = (cl_int)(i + gRoundingStartValue); } - break; + break; } - // Note: inf or nan float values would cause problems, although we don't know this will - // actually be a float, so we just know what to look for - escape_inf_nan_values( data, allocSize ); + // Note: inf or nan float values would cause problems, although we don't + // know this will actually be a float, so we just know what to look for + escape_inf_nan_values(data, allocSize); return data; } // Otherwise, we should be able to just fill with random bits no matter what - cl_uint *p = (cl_uint*) data; - for( i = 0; i + 4 <= allocSize; i += 4 ) - p[ i / 4 ] = genrand_int32(d); + cl_uint *p = (cl_uint *)data; + for (i = 0; i + 4 <= allocSize; i += 4) p[i / 4] = genrand_int32(d); - for( ; i < allocSize; i++ ) - data[i] = genrand_int32(d); + for (; i < allocSize; i++) data[i] = genrand_int32(d); - // Note: inf or nan float values would cause problems, although we don't know this will - // actually be a float, so we just know what to look for - escape_inf_nan_values( data, allocSize ); + // Note: inf or nan float values would cause problems, although we don't + // know this will actually be a float, so we just know what to look for + escape_inf_nan_values(data, allocSize); - if ( /*!gTestMipmaps*/ imageInfo->num_mip_levels < 2 ) + if (/*!gTestMipmaps*/ imageInfo->num_mip_levels < 2) { - // Fill unused edges with -1, NaN for float - if (imageInfo->rowPitch > pixelRowBytes) - { - size_t height = 0; + // Fill unused edges with -1, NaN for float + if (imageInfo->rowPitch > pixelRowBytes) + { + size_t height = 0; - switch (imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE2D: - case CL_MEM_OBJECT_IMAGE3D: - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - height = imageInfo->height; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - height = imageInfo->arraySize; - break; + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE3D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + height = imageInfo->height; + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + height = imageInfo->arraySize; + break; } // Fill in the row padding regions - for( i = 0; i < height; i++ ) + for (i = 0; i < height; i++) { size_t offset = i * imageInfo->rowPitch + pixelRowBytes; size_t length = imageInfo->rowPitch - pixelRowBytes; - memset( data + offset, 0xff, length ); + memset(data + offset, 0xff, length); } - } + } - // Fill in the slice padding regions, if necessary: + // Fill in the slice padding regions, if necessary: - size_t slice_dimension = imageInfo->height; - if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) { - slice_dimension = imageInfo->arraySize; - } + size_t slice_dimension = imageInfo->height; + if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + { + slice_dimension = imageInfo->arraySize; + } - if (imageInfo->slicePitch > slice_dimension*imageInfo->rowPitch) - { - size_t depth = 0; - switch (imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE2D: - case CL_MEM_OBJECT_IMAGE3D: - depth = imageInfo->depth; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - depth = imageInfo->arraySize; - break; - } + if (imageInfo->slicePitch > slice_dimension * imageInfo->rowPitch) + { + size_t depth = 0; + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE3D: depth = imageInfo->depth; break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + depth = imageInfo->arraySize; + break; + } - for( i = 0; i < depth; i++ ) - { - size_t offset = i * imageInfo->slicePitch + slice_dimension*imageInfo->rowPitch; - size_t length = imageInfo->slicePitch - slice_dimension*imageInfo->rowPitch; - memset( data + offset, 0xff, length ); - } - } + for (i = 0; i < depth; i++) + { + size_t offset = i * imageInfo->slicePitch + + slice_dimension * imageInfo->rowPitch; + size_t length = imageInfo->slicePitch + - slice_dimension * imageInfo->rowPitch; + memset(data + offset, 0xff, length); + } + } } return data; } -#define CLAMP_FLOAT( v ) ( fmaxf( fminf( v, 1.f ), -1.f ) ) +#define CLAMP_FLOAT(v) (fmaxf(fminf(v, 1.f), -1.f)) -void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, - int x, int y, int z, float *outData, int lod ) +void read_image_pixel_float(void *imageData, image_descriptor *imageInfo, int x, + int y, int z, float *outData, int lod) { - size_t width_lod = imageInfo->width, height_lod = imageInfo->height, depth_lod = imageInfo->depth; + size_t width_lod = imageInfo->width, height_lod = imageInfo->height, + depth_lod = imageInfo->depth; size_t slice_pitch_lod = 0, row_pitch_lod = 0; - if ( imageInfo->num_mip_levels > 1 ) + if (imageInfo->num_mip_levels > 1) { - switch(imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE3D : - depth_lod = ( imageInfo->depth >> lod ) ? ( imageInfo->depth >> lod ) : 1; - case CL_MEM_OBJECT_IMAGE2D : - case CL_MEM_OBJECT_IMAGE2D_ARRAY : - height_lod = ( imageInfo->height >> lod ) ? ( imageInfo->height >> lod ) : 1; - default : - width_lod = ( imageInfo->width >> lod ) ? ( imageInfo->width >> lod ) : 1; - } - row_pitch_lod = width_lod * get_pixel_size(imageInfo->format); - if ( imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY ) - slice_pitch_lod = row_pitch_lod; - else if ( imageInfo->type == CL_MEM_OBJECT_IMAGE3D || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) - slice_pitch_lod = row_pitch_lod * height_lod; + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE3D: + depth_lod = + (imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1; + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + height_lod = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; + default: + width_lod = + (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + } + row_pitch_lod = width_lod * get_pixel_size(imageInfo->format); + if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + slice_pitch_lod = row_pitch_lod; + else if (imageInfo->type == CL_MEM_OBJECT_IMAGE3D + || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) + slice_pitch_lod = row_pitch_lod * height_lod; } else { - row_pitch_lod = imageInfo->rowPitch; - slice_pitch_lod = imageInfo->slicePitch; + row_pitch_lod = imageInfo->rowPitch; + slice_pitch_lod = imageInfo->slicePitch; } - if ( x < 0 || y < 0 || z < 0 || x >= (int)width_lod - || ( height_lod != 0 && y >= (int)height_lod ) - || ( depth_lod != 0 && z >= (int)depth_lod ) - || ( imageInfo->arraySize != 0 && z >= (int)imageInfo->arraySize ) ) + if (x < 0 || y < 0 || z < 0 || x >= (int)width_lod + || (height_lod != 0 && y >= (int)height_lod) + || (depth_lod != 0 && z >= (int)depth_lod) + || (imageInfo->arraySize != 0 && z >= (int)imageInfo->arraySize)) { - outData[ 0 ] = outData[ 1 ] = outData[ 2 ] = outData[ 3 ] = 0; - if (!has_alpha(imageInfo->format)) - outData[3] = 1; + outData[0] = outData[1] = outData[2] = outData[3] = 0; + if (!has_alpha(imageInfo->format)) outData[3] = 1; return; } cl_image_format *format = imageInfo->format; unsigned int i; - float tempData[ 4 ]; + float tempData[4]; // Advance to the right spot char *ptr = (char *)imageData; - size_t pixelSize = get_pixel_size( format ); + size_t pixelSize = get_pixel_size(format); ptr += z * slice_pitch_lod + y * row_pitch_lod + x * pixelSize; // OpenCL only supports reading floats from certain formats - size_t channelCount = get_format_channel_count( format ); - switch( format->image_channel_data_type ) + size_t channelCount = get_format_channel_count(format); + switch (format->image_channel_data_type) { - case CL_SNORM_INT8: - { + case CL_SNORM_INT8: { cl_char *dPtr = (cl_char *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = CLAMP_FLOAT( (float)dPtr[ i ] / 127.0f ); + for (i = 0; i < channelCount; i++) + tempData[i] = CLAMP_FLOAT((float)dPtr[i] / 127.0f); break; } - case CL_UNORM_INT8: - { + case CL_UNORM_INT8: { unsigned char *dPtr = (unsigned char *)ptr; - for( i = 0; i < channelCount; i++ ) { - if((is_sRGBA_order(imageInfo->format->image_channel_order)) && i<3) // only RGB need to be converted for sRGBA - tempData[ i ] = (float)sRGBunmap((float)dPtr[ i ] / 255.0f) ; + for (i = 0; i < channelCount; i++) + { + if ((is_sRGBA_order(imageInfo->format->image_channel_order)) + && i < 3) // only RGB need to be converted for sRGBA + tempData[i] = (float)sRGBunmap((float)dPtr[i] / 255.0f); else - tempData[ i ] = (float)dPtr[ i ] / 255.0f; + tempData[i] = (float)dPtr[i] / 255.0f; } break; } - case CL_SIGNED_INT8: - { + case CL_SIGNED_INT8: { cl_char *dPtr = (cl_char *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } - case CL_UNSIGNED_INT8: - { + case CL_UNSIGNED_INT8: { cl_uchar *dPtr = (cl_uchar *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float) dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } - case CL_SNORM_INT16: - { + case CL_SNORM_INT16: { cl_short *dPtr = (cl_short *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = CLAMP_FLOAT( (float)dPtr[ i ] / 32767.0f ); + for (i = 0; i < channelCount; i++) + tempData[i] = CLAMP_FLOAT((float)dPtr[i] / 32767.0f); break; } - case CL_UNORM_INT16: - { + case CL_UNORM_INT16: { cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ] / 65535.0f; + for (i = 0; i < channelCount; i++) + tempData[i] = (float)dPtr[i] / 65535.0f; break; } - case CL_SIGNED_INT16: - { + case CL_SIGNED_INT16: { cl_short *dPtr = (cl_short *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } - case CL_UNSIGNED_INT16: - { + case CL_UNSIGNED_INT16: { cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float) dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } @@ -1288,152 +1327,136 @@ void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, break; } - case CL_SIGNED_INT32: - { + case CL_SIGNED_INT32: { cl_int *dPtr = (cl_int *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } - case CL_UNSIGNED_INT32: - { + case CL_UNSIGNED_INT32: { cl_uint *dPtr = (cl_uint *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } - case CL_UNORM_SHORT_565: - { + case CL_UNORM_SHORT_565: { cl_ushort *dPtr = (cl_ushort *)ptr; - tempData[ 0 ] = (float)( dPtr[ 0 ] >> 11 ) / (float)31; - tempData[ 1 ] = (float)( ( dPtr[ 0 ] >> 5 ) & 63 ) / (float)63; - tempData[ 2 ] = (float)( dPtr[ 0 ] & 31 ) / (float)31; + tempData[0] = (float)(dPtr[0] >> 11) / (float)31; + tempData[1] = (float)((dPtr[0] >> 5) & 63) / (float)63; + tempData[2] = (float)(dPtr[0] & 31) / (float)31; break; } - case CL_UNORM_SHORT_555: - { + case CL_UNORM_SHORT_555: { cl_ushort *dPtr = (cl_ushort *)ptr; - tempData[ 0 ] = (float)( ( dPtr[ 0 ] >> 10 ) & 31 ) / (float)31; - tempData[ 1 ] = (float)( ( dPtr[ 0 ] >> 5 ) & 31 ) / (float)31; - tempData[ 2 ] = (float)( dPtr[ 0 ] & 31 ) / (float)31; + tempData[0] = (float)((dPtr[0] >> 10) & 31) / (float)31; + tempData[1] = (float)((dPtr[0] >> 5) & 31) / (float)31; + tempData[2] = (float)(dPtr[0] & 31) / (float)31; break; } - case CL_UNORM_INT_101010: - { + case CL_UNORM_INT_101010: { cl_uint *dPtr = (cl_uint *)ptr; - tempData[ 0 ] = (float)( ( dPtr[ 0 ] >> 20 ) & 0x3ff ) / (float)1023; - tempData[ 1 ] = (float)( ( dPtr[ 0 ] >> 10 ) & 0x3ff ) / (float)1023; - tempData[ 2 ] = (float)( dPtr[ 0 ] & 0x3ff ) / (float)1023; + tempData[0] = (float)((dPtr[0] >> 20) & 0x3ff) / (float)1023; + tempData[1] = (float)((dPtr[0] >> 10) & 0x3ff) / (float)1023; + tempData[2] = (float)(dPtr[0] & 0x3ff) / (float)1023; break; } - case CL_FLOAT: - { + case CL_FLOAT: { float *dPtr = (float *)ptr; - for( i = 0; i < channelCount; i++ ) - tempData[ i ] = (float)dPtr[ i ]; + for (i = 0; i < channelCount; i++) tempData[i] = (float)dPtr[i]; break; } -#ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - { - cl_ushort *dPtr = (cl_ushort*) ptr; - for( i = 0; i < channelCount; i++ ) - tempData[i] = ((int) dPtr[i] - 16384) * 0x1.0p-14f; +#ifdef CL_SFIXED14_APPLE + case CL_SFIXED14_APPLE: { + cl_ushort *dPtr = (cl_ushort *)ptr; + for (i = 0; i < channelCount; i++) + tempData[i] = ((int)dPtr[i] - 16384) * 0x1.0p-14f; break; } #endif } - outData[ 0 ] = outData[ 1 ] = outData[ 2 ] = 0; - outData[ 3 ] = 1; + outData[0] = outData[1] = outData[2] = 0; + outData[3] = 1; - switch( format->image_channel_order ) + switch (format->image_channel_order) { - case CL_A: - outData[ 3 ] = tempData[ 0 ]; - break; + case CL_A: outData[3] = tempData[0]; break; case CL_R: - case CL_Rx: - outData[ 0 ] = tempData[ 0 ]; - break; + case CL_Rx: outData[0] = tempData[0]; break; case CL_RA: - outData[ 0 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 1 ]; + outData[0] = tempData[0]; + outData[3] = tempData[1]; break; case CL_RG: case CL_RGx: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; break; case CL_RGB: case CL_RGBx: case CL_sRGB: case CL_sRGBx: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; break; case CL_RGBA: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; - outData[ 3 ] = tempData[ 3 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; + outData[3] = tempData[3]; break; case CL_ARGB: - outData[ 0 ] = tempData[ 1 ]; - outData[ 1 ] = tempData[ 2 ]; - outData[ 2 ] = tempData[ 3 ]; - outData[ 3 ] = tempData[ 0 ]; + outData[0] = tempData[1]; + outData[1] = tempData[2]; + outData[2] = tempData[3]; + outData[3] = tempData[0]; break; case CL_BGRA: case CL_sBGRA: - outData[ 0 ] = tempData[ 2 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 3 ]; + outData[0] = tempData[2]; + outData[1] = tempData[1]; + outData[2] = tempData[0]; + outData[3] = tempData[3]; break; case CL_INTENSITY: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 0 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 0 ]; + outData[0] = tempData[0]; + outData[1] = tempData[0]; + outData[2] = tempData[0]; + outData[3] = tempData[0]; break; case CL_LUMINANCE: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 0 ]; - outData[ 2 ] = tempData[ 0 ]; + outData[0] = tempData[0]; + outData[1] = tempData[0]; + outData[2] = tempData[0]; break; #ifdef CL_1RGB_APPLE case CL_1RGB_APPLE: - outData[ 0 ] = tempData[ 1 ]; - outData[ 1 ] = tempData[ 2 ]; - outData[ 2 ] = tempData[ 3 ]; - outData[ 3 ] = 1.0f; + outData[0] = tempData[1]; + outData[1] = tempData[2]; + outData[2] = tempData[3]; + outData[3] = 1.0f; break; #endif #ifdef CL_BGR1_APPLE case CL_BGR1_APPLE: - outData[ 0 ] = tempData[ 2 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = 1.0f; + outData[0] = tempData[2]; + outData[1] = tempData[1]; + outData[2] = tempData[0]; + outData[3] = 1.0f; break; #endif case CL_sRGBA: - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; - outData[ 3 ] = tempData[ 3 ]; - break; - case CL_DEPTH: - outData[ 0 ] = tempData[ 0 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; + outData[3] = tempData[3]; break; + case CL_DEPTH: outData[0] = tempData[0]; break; default: log_error("Invalid format:"); print_header(format, true); @@ -1441,105 +1464,122 @@ void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, } } -void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, - int x, int y, int z, float *outData ) +void read_image_pixel_float(void *imageData, image_descriptor *imageInfo, int x, + int y, int z, float *outData) { - read_image_pixel_float( imageData, imageInfo, x, y, z, outData, 0 ); + read_image_pixel_float(imageData, imageInfo, x, y, z, outData, 0); } -bool get_integer_coords( float x, float y, float z, size_t width, size_t height, size_t depth, image_sampler_data *imageSampler, image_descriptor *imageInfo, int &outX, int &outY, int &outZ ) { - return get_integer_coords_offset(x, y, z, 0.0f, 0.0f, 0.0f, width, height, depth, imageSampler, imageInfo, outX, outY, outZ); +bool get_integer_coords(float x, float y, float z, size_t width, size_t height, + size_t depth, image_sampler_data *imageSampler, + image_descriptor *imageInfo, int &outX, int &outY, + int &outZ) +{ + return get_integer_coords_offset(x, y, z, 0.0f, 0.0f, 0.0f, width, height, + depth, imageSampler, imageInfo, outX, outY, + outZ); } -bool get_integer_coords_offset( float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - size_t width, size_t height, size_t depth, image_sampler_data *imageSampler, image_descriptor *imageInfo, int &outX, int &outY, int &outZ ) +bool get_integer_coords_offset(float x, float y, float z, float xAddressOffset, + float yAddressOffset, float zAddressOffset, + size_t width, size_t height, size_t depth, + image_sampler_data *imageSampler, + image_descriptor *imageInfo, int &outX, + int &outY, int &outZ) { - AddressFn adFn = sAddressingTable[ imageSampler ]; + AddressFn adFn = sAddressingTable[imageSampler]; - float refX = floorf( x ), refY = floorf( y ), refZ = floorf( z ); + float refX = floorf(x), refY = floorf(y), refZ = floorf(z); // Handle sampler-directed coordinate normalization + clamping. Note that // the array coordinate for image array types is expected to be // unnormalized, and is clamped to 0..arraySize-1. - if( imageSampler->normalized_coords ) + if (imageSampler->normalized_coords) { switch (imageSampler->addressing_mode) { case CL_ADDRESS_REPEAT: - x = RepeatNormalizedAddressFn( x, width ); - if (height != 0) { + x = RepeatNormalizedAddressFn(x, width); + if (height != 0) + { if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) - y = RepeatNormalizedAddressFn( y, height ); + y = RepeatNormalizedAddressFn(y, height); } - if (depth != 0) { + if (depth != 0) + { if (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY) - z = RepeatNormalizedAddressFn( z, depth ); + z = RepeatNormalizedAddressFn(z, depth); } - if (xAddressOffset != 0.0) { + if (xAddressOffset != 0.0) + { // Add in the offset x += xAddressOffset; // Handle wrapping - if (x > width) - x -= (float)width; - if (x < 0) - x += (float)width; + if (x > width) x -= (float)width; + if (x < 0) x += (float)width; } - if ( (yAddressOffset != 0.0) && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) ) { + if ((yAddressOffset != 0.0) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY)) + { // Add in the offset y += yAddressOffset; // Handle wrapping - if (y > height) - y -= (float)height; - if (y < 0) - y += (float)height; + if (y > height) y -= (float)height; + if (y < 0) y += (float)height; } - if ( (zAddressOffset != 0.0) && (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY) ) { + if ((zAddressOffset != 0.0) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY)) + { // Add in the offset z += zAddressOffset; // Handle wrapping - if (z > depth) - z -= (float)depth; - if (z < 0) - z += (float)depth; + if (z > depth) z -= (float)depth; + if (z < 0) z += (float)depth; } break; case CL_ADDRESS_MIRRORED_REPEAT: - x = MirroredRepeatNormalizedAddressFn( x, width ); - if (height != 0) { + x = MirroredRepeatNormalizedAddressFn(x, width); + if (height != 0) + { if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) - y = MirroredRepeatNormalizedAddressFn( y, height ); + y = MirroredRepeatNormalizedAddressFn(y, height); } - if (depth != 0) { + if (depth != 0) + { if (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY) - z = MirroredRepeatNormalizedAddressFn( z, depth ); + z = MirroredRepeatNormalizedAddressFn(z, depth); } if (xAddressOffset != 0.0) { float temp = x + xAddressOffset; - if( temp > (float) width ) - temp = (float) width - (temp - (float) width ); - x = fabsf( temp ); + if (temp > (float)width) + temp = (float)width - (temp - (float)width); + x = fabsf(temp); } - if ( (yAddressOffset != 0.0) && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) ) { + if ((yAddressOffset != 0.0) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY)) + { float temp = y + yAddressOffset; - if( temp > (float) height ) - temp = (float) height - (temp - (float) height ); - y = fabsf( temp ); + if (temp > (float)height) + temp = (float)height - (temp - (float)height); + y = fabsf(temp); } - if ( (zAddressOffset != 0.0) && (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY) ) { + if ((zAddressOffset != 0.0) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE2D_ARRAY)) + { float temp = z + zAddressOffset; - if( temp > (float) depth ) - temp = (float) depth - (temp - (float) depth ); - z = fabsf( temp ); + if (temp > (float)depth) + temp = (float)depth - (temp - (float)depth); + z = fabsf(temp); } break; default: - // Also, remultiply to the original coords. This simulates any truncation in - // the pass to OpenCL + // Also, remultiply to the original coords. This simulates any + // truncation in the pass to OpenCL x *= (float)width; x += xAddressOffset; @@ -1560,59 +1600,54 @@ bool get_integer_coords_offset( float x, float y, float z, float xAddressOffset, // At this point, we're dealing with non-normalized coordinates. - outX = adFn( floorf( x ), width ); + outX = adFn(floorf(x), width); // 1D and 2D arrays require special care for the index coordinate: - switch (imageInfo->type) { + switch (imageInfo->type) + { case CL_MEM_OBJECT_IMAGE1D_ARRAY: outY = calculate_array_index(y, (float)imageInfo->arraySize - 1.0f); outZ = 0.0f; /* don't care! */ break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - outY = adFn( floorf( y ), height ); + outY = adFn(floorf(y), height); outZ = calculate_array_index(z, (float)imageInfo->arraySize - 1.0f); break; default: // legacy path: - if (height != 0) - outY = adFn( floorf( y ), height ); - if( depth != 0 ) - outZ = adFn( floorf( z ), depth ); + if (height != 0) outY = adFn(floorf(y), height); + if (depth != 0) outZ = adFn(floorf(z), depth); } - return !( (int)refX == outX && (int)refY == outY && (int)refZ == outZ ); + return !((int)refX == outX && (int)refY == outY && (int)refZ == outZ); } -static float frac(float a) { - return a - floorf(a); -} +static float frac(float a) { return a - floorf(a); } -static inline void pixelMax( const float a[4], const float b[4], float *results ); -static inline void pixelMax( const float a[4], const float b[4], float *results ) +static inline void pixelMax(const float a[4], const float b[4], float *results); +static inline void pixelMax(const float a[4], const float b[4], float *results) { - for( int i = 0; i < 4; i++ ) - results[i] = errMax( fabsf(a[i]), fabsf(b[i]) ); + for (int i = 0; i < 4; i++) results[i] = errMax(fabsf(a[i]), fabsf(b[i])); } // If containsDenorms is NULL, flush denorms to zero // if containsDenorms is not NULL, record whether there are any denorms -static inline void check_for_denorms(float a[4], int *containsDenorms ); -static inline void check_for_denorms(float a[4], int *containsDenorms ) +static inline void check_for_denorms(float a[4], int *containsDenorms); +static inline void check_for_denorms(float a[4], int *containsDenorms) { - if( NULL == containsDenorms ) + if (NULL == containsDenorms) { - for( int i = 0; i < 4; i++ ) + for (int i = 0; i < 4; i++) { - if( IsFloatSubnormal( a[i] ) ) - a[i] = copysignf( 0.0f, a[i] ); + if (IsFloatSubnormal(a[i])) a[i] = copysignf(0.0f, a[i]); } } else { - for( int i = 0; i < 4; i++ ) + for (int i = 0; i < 4; i++) { - if( IsFloatSubnormal( a[i] ) ) + if (IsFloatSubnormal(a[i])) { *containsDenorms = 1; break; @@ -1621,13 +1656,14 @@ static inline void check_for_denorms(float a[4], int *containsDenorms ) } } -inline float calculate_array_index( float coord, float extent ) { +inline float calculate_array_index(float coord, float extent) +{ // from Section 8.4 of the 1.2 Spec 'Selecting an Image from an Image Array' // // given coordinate 'w' that represents an index: // layer_index = clamp( rint(w), 0, image_array_size - 1) - float ret = rintf( coord ); + float ret = rintf(coord); ret = ret > extent ? extent : ret; ret = ret < 0.0f ? 0.0f : ret; @@ -1642,49 +1678,60 @@ inline float calculate_array_index( float coord, float extent ) { * offset - an addressing offset to be added to the coordinate * extent - the max value for this coordinate (e.g. width for x) */ -static float unnormalize_coordinate( const char* name, float coord, - float offset, float extent, cl_addressing_mode addressing_mode, int verbose ) +static float unnormalize_coordinate(const char *name, float coord, float offset, + float extent, + cl_addressing_mode addressing_mode, + int verbose) { float ret = 0.0f; - switch (addressing_mode) { + switch (addressing_mode) + { case CL_ADDRESS_REPEAT: - ret = RepeatNormalizedAddressFn( coord, extent ); + ret = RepeatNormalizedAddressFn(coord, extent); - if ( verbose ) { - log_info( "\tRepeat filter denormalizes %s (%f) to %f\n", - name, coord, ret ); + if (verbose) + { + log_info("\tRepeat filter denormalizes %s (%f) to %f\n", name, + coord, ret); } - if (offset != 0.0) { + if (offset != 0.0) + { // Add in the offset, and handle wrapping. ret += offset; if (ret > extent) ret -= extent; if (ret < 0.0) ret += extent; } - if (verbose && offset != 0.0f) { - log_info( "\tAddress offset of %f added to get %f\n", offset, ret ); + if (verbose && offset != 0.0f) + { + log_info("\tAddress offset of %f added to get %f\n", offset, + ret); } break; case CL_ADDRESS_MIRRORED_REPEAT: - ret = MirroredRepeatNormalizedAddressFn( coord, extent ); + ret = MirroredRepeatNormalizedAddressFn(coord, extent); - if ( verbose ) { - log_info( "\tMirrored repeat filter denormalizes %s (%f) to %f\n", - name, coord, ret ); + if (verbose) + { + log_info( + "\tMirrored repeat filter denormalizes %s (%f) to %f\n", + name, coord, ret); } - if (offset != 0.0) { + if (offset != 0.0) + { float temp = ret + offset; - if( temp > extent ) - temp = extent - (temp - extent ); - ret = fabsf( temp ); + if (temp > extent) temp = extent - (temp - extent); + ret = fabsf(temp); } - if (verbose && offset != 0.0f) { - log_info( "\tAddress offset of %f added to get %f\n", offset, ret ); + if (verbose && offset != 0.0f) + { + log_info("\tAddress offset of %f added to get %f\n", offset, + ret); } break; @@ -1692,107 +1739,134 @@ static float unnormalize_coordinate( const char* name, float coord, ret = coord * extent; - if ( verbose ) { - log_info( "\tFilter denormalizes %s to %f (%f * %f)\n", - name, ret, coord, extent); + if (verbose) + { + log_info("\tFilter denormalizes %s to %f (%f * %f)\n", name, + ret, coord, extent); } ret += offset; - if (verbose && offset != 0.0f) { - log_info( "\tAddress offset of %f added to get %f\n", offset, ret ); + if (verbose && offset != 0.0f) + { + log_info("\tAddress offset of %f added to get %f\n", offset, + ret); } } return ret; } -FloatPixel sample_image_pixel_float( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms ) { - return sample_image_pixel_float_offset(imageData, imageInfo, x, y, z, 0.0f, 0.0f, 0.0f, imageSampler, outData, verbose, containsDenorms); +FloatPixel +sample_image_pixel_float(void *imageData, image_descriptor *imageInfo, float x, + float y, float z, image_sampler_data *imageSampler, + float *outData, int verbose, int *containsDenorms) +{ + return sample_image_pixel_float_offset(imageData, imageInfo, x, y, z, 0.0f, + 0.0f, 0.0f, imageSampler, outData, + verbose, containsDenorms); } // returns max pixel value of the pixels touched -FloatPixel sample_image_pixel_float( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms , int lod) { - return sample_image_pixel_float_offset(imageData, imageInfo, x, y, z, 0.0f, 0.0f, 0.0f, imageSampler, outData, verbose, containsDenorms, lod); -} -FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms , int lod) +FloatPixel sample_image_pixel_float(void *imageData, + image_descriptor *imageInfo, float x, + float y, float z, + image_sampler_data *imageSampler, + float *outData, int verbose, + int *containsDenorms, int lod) { - AddressFn adFn = sAddressingTable[ imageSampler ]; + return sample_image_pixel_float_offset(imageData, imageInfo, x, y, z, 0.0f, + 0.0f, 0.0f, imageSampler, outData, + verbose, containsDenorms, lod); +} +FloatPixel sample_image_pixel_float_offset( + void *imageData, image_descriptor *imageInfo, float x, float y, float z, + float xAddressOffset, float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, float *outData, int verbose, + int *containsDenorms, int lod) +{ + AddressFn adFn = sAddressingTable[imageSampler]; FloatPixel returnVal; - size_t width_lod = imageInfo->width, height_lod = imageInfo->height, depth_lod = imageInfo->depth; + size_t width_lod = imageInfo->width, height_lod = imageInfo->height, + depth_lod = imageInfo->depth; size_t slice_pitch_lod = 0, row_pitch_lod = 0; - if ( imageInfo->num_mip_levels > 1 ) + if (imageInfo->num_mip_levels > 1) { - switch(imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE3D : - depth_lod = ( imageInfo->depth >> lod ) ? ( imageInfo->depth >> lod ) : 1; - case CL_MEM_OBJECT_IMAGE2D : - case CL_MEM_OBJECT_IMAGE2D_ARRAY : - height_lod = ( imageInfo->height >> lod ) ? ( imageInfo->height >> lod ) : 1; - default : - width_lod = ( imageInfo->width >> lod ) ? ( imageInfo->width >> lod ) : 1; - } - row_pitch_lod = width_lod * get_pixel_size(imageInfo->format); - if ( imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY ) - slice_pitch_lod = row_pitch_lod; - else if ( imageInfo->type == CL_MEM_OBJECT_IMAGE3D || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) - slice_pitch_lod = row_pitch_lod * height_lod; + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE3D: + depth_lod = + (imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1; + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + height_lod = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; + default: + width_lod = + (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + } + row_pitch_lod = width_lod * get_pixel_size(imageInfo->format); + if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + slice_pitch_lod = row_pitch_lod; + else if (imageInfo->type == CL_MEM_OBJECT_IMAGE3D + || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) + slice_pitch_lod = row_pitch_lod * height_lod; } else { - slice_pitch_lod = imageInfo->slicePitch; - row_pitch_lod = imageInfo->rowPitch; + slice_pitch_lod = imageInfo->slicePitch; + row_pitch_lod = imageInfo->rowPitch; } - if( containsDenorms ) - *containsDenorms = 0; + if (containsDenorms) *containsDenorms = 0; - if( imageSampler->normalized_coords ) { + if (imageSampler->normalized_coords) + { // We need to unnormalize our coordinates differently depending on // the image type, but 'x' is always processed the same way. x = unnormalize_coordinate("x", x, xAddressOffset, (float)width_lod, - imageSampler->addressing_mode, verbose); + imageSampler->addressing_mode, verbose); - switch (imageInfo->type) { + switch (imageInfo->type) + { - // The image array types require special care: + // The image array types require special care: case CL_MEM_OBJECT_IMAGE1D_ARRAY: z = 0; // don't care -- unused for 1D arrays break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - y = unnormalize_coordinate("y", y, yAddressOffset, (float)height_lod, + y = unnormalize_coordinate( + "y", y, yAddressOffset, (float)height_lod, imageSampler->addressing_mode, verbose); break; - // Everybody else: + // Everybody else: default: - y = unnormalize_coordinate("y", y, yAddressOffset, (float)height_lod, + y = unnormalize_coordinate( + "y", y, yAddressOffset, (float)height_lod, imageSampler->addressing_mode, verbose); - z = unnormalize_coordinate("z", z, zAddressOffset, (float)depth_lod, + z = unnormalize_coordinate( + "z", z, zAddressOffset, (float)depth_lod, imageSampler->addressing_mode, verbose); } + } + else if (verbose) + { - } else if ( verbose ) { - - switch (imageInfo->type) { + switch (imageInfo->type) + { case CL_MEM_OBJECT_IMAGE1D_ARRAY: log_info("Starting coordinate: %f, array index %f\n", x, y); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - log_info("Starting coordinate: %f, %f, array index %f\n", x, y, z); + log_info("Starting coordinate: %f, %f, array index %f\n", x, y, + z); break; case CL_MEM_OBJECT_IMAGE1D: case CL_MEM_OBJECT_IMAGE1D_BUFFER: @@ -1802,14 +1876,13 @@ FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *i log_info("Starting coordinate: %f, %f\n", x, y); break; case CL_MEM_OBJECT_IMAGE3D: - default: - log_info("Starting coordinate: %f, %f, %f\n", x, y, z); + default: log_info("Starting coordinate: %f, %f, %f\n", x, y, z); } } // At this point, we have unnormalized coordinates. - if( imageSampler->filter_mode == CL_FILTER_NEAREST ) + if (imageSampler->filter_mode == CL_FILTER_NEAREST) { int ix, iy, iz; @@ -1817,42 +1890,50 @@ FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *i // coordinates. Note that the array cases again require special // care, per section 8.4 in the OpenCL 1.2 Specification. - ix = adFn( floorf( x ), width_lod ); + ix = adFn(floorf(x), width_lod); - switch (imageInfo->type) { + switch (imageInfo->type) + { case CL_MEM_OBJECT_IMAGE1D_ARRAY: - iy = calculate_array_index( y, (float)(imageInfo->arraySize - 1) ); + iy = + calculate_array_index(y, (float)(imageInfo->arraySize - 1)); iz = 0; - if( verbose ) { - log_info("\tArray index %f evaluates to %d\n",y, iy ); + if (verbose) + { + log_info("\tArray index %f evaluates to %d\n", y, iy); } break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - iy = adFn( floorf( y ), height_lod ); - iz = calculate_array_index( z, (float)(imageInfo->arraySize - 1) ); - if( verbose ) { - log_info("\tArray index %f evaluates to %d\n",z, iz ); + iy = adFn(floorf(y), height_lod); + iz = + calculate_array_index(z, (float)(imageInfo->arraySize - 1)); + if (verbose) + { + log_info("\tArray index %f evaluates to %d\n", z, iz); } break; default: - iy = adFn( floorf( y ), height_lod ); - if( depth_lod != 0 ) - iz = adFn( floorf( z ), depth_lod ); + iy = adFn(floorf(y), height_lod); + if (depth_lod != 0) + iz = adFn(floorf(z), depth_lod); else iz = 0; } - if( verbose ) { - if( iz ) - log_info( "\tReference integer coords calculated: { %d, %d, %d }\n", ix, iy, iz ); + if (verbose) + { + if (iz) + log_info( + "\tReference integer coords calculated: { %d, %d, %d }\n", + ix, iy, iz); else - log_info( "\tReference integer coords calculated: { %d, %d }\n", ix, iy ); + log_info("\tReference integer coords calculated: { %d, %d }\n", + ix, iy); } - read_image_pixel_float( imageData, imageInfo, ix, iy, iz, outData, lod ); - check_for_denorms( outData, containsDenorms ); - for( int i = 0; i < 4; i++ ) - returnVal.p[i] = fabsf( outData[i] ); + read_image_pixel_float(imageData, imageInfo, ix, iy, iz, outData, lod); + check_for_denorms(outData, containsDenorms); + for (int i = 0; i < 4; i++) returnVal.p[i] = fabsf(outData[i]); return returnVal; } else @@ -1864,19 +1945,23 @@ FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *i // Image arrays can use 2D filtering, but require us to walk into the // image a certain number of slices before reading. - if( depth == 0 || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY || - imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + if (depth == 0 || imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY + || imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) { float array_index = 0; size_t layer_offset = 0; - if (imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) { - array_index = calculate_array_index(z, (float)(imageInfo->arraySize - 1)); + if (imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) + { + array_index = + calculate_array_index(z, (float)(imageInfo->arraySize - 1)); layer_offset = slice_pitch_lod * (size_t)array_index; } - else if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) { - array_index = calculate_array_index(y, (float)(imageInfo->arraySize - 1)); + else if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY) + { + array_index = + calculate_array_index(y, (float)(imageInfo->arraySize - 1)); layer_offset = slice_pitch_lod * (size_t)array_index; // Set up y and height so that the filtering below is correct @@ -1884,213 +1969,253 @@ FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *i height = 1; } - int x1 = adFn( floorf( x - 0.5f ), width ); + int x1 = adFn(floorf(x - 0.5f), width); int y1 = 0; - int x2 = adFn( floorf( x - 0.5f ) + 1, width ); + int x2 = adFn(floorf(x - 0.5f) + 1, width); int y2 = 0; - if ((imageInfo->type != CL_MEM_OBJECT_IMAGE1D) && - (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) && - (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)) { - y1 = adFn( floorf( y - 0.5f ), height ); - y2 = adFn( floorf( y - 0.5f ) + 1, height ); - } else { - y = 0.5f; + if ((imageInfo->type != CL_MEM_OBJECT_IMAGE1D) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY) + && (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_BUFFER)) + { + y1 = adFn(floorf(y - 0.5f), height); + y2 = adFn(floorf(y - 0.5f) + 1, height); + } + else + { + y = 0.5f; } - if( verbose ) { - log_info( "\tActual integer coords used (i = floor(x-.5)): i0:{ %d, %d } and i1:{ %d, %d }\n", x1, y1, x2, y2 ); - log_info( "\tArray coordinate is %f\n", array_index); + if (verbose) + { + log_info("\tActual integer coords used (i = floor(x-.5)): i0:{ " + "%d, %d } and i1:{ %d, %d }\n", + x1, y1, x2, y2); + log_info("\tArray coordinate is %f\n", array_index); } // Walk to beginning of the 'correct' slice, if needed. - char* imgPtr = ((char*)imageData) + layer_offset; + char *imgPtr = ((char *)imageData) + layer_offset; - float upLeft[ 4 ], upRight[ 4 ], lowLeft[ 4 ], lowRight[ 4 ]; + float upLeft[4], upRight[4], lowLeft[4], lowRight[4]; float maxUp[4], maxLow[4]; - read_image_pixel_float( imgPtr, imageInfo, x1, y1, 0, upLeft, lod ); - read_image_pixel_float( imgPtr, imageInfo, x2, y1, 0, upRight, lod ); - check_for_denorms( upLeft, containsDenorms ); - check_for_denorms( upRight, containsDenorms ); - pixelMax( upLeft, upRight, maxUp ); - read_image_pixel_float( imgPtr, imageInfo, x1, y2, 0, lowLeft, lod ); - read_image_pixel_float( imgPtr, imageInfo, x2, y2, 0, lowRight, lod ); - check_for_denorms( lowLeft, containsDenorms ); - check_for_denorms( lowRight, containsDenorms ); - pixelMax( lowLeft, lowRight, maxLow ); - pixelMax( maxUp, maxLow, returnVal.p ); + read_image_pixel_float(imgPtr, imageInfo, x1, y1, 0, upLeft, lod); + read_image_pixel_float(imgPtr, imageInfo, x2, y1, 0, upRight, lod); + check_for_denorms(upLeft, containsDenorms); + check_for_denorms(upRight, containsDenorms); + pixelMax(upLeft, upRight, maxUp); + read_image_pixel_float(imgPtr, imageInfo, x1, y2, 0, lowLeft, lod); + read_image_pixel_float(imgPtr, imageInfo, x2, y2, 0, lowRight, lod); + check_for_denorms(lowLeft, containsDenorms); + check_for_denorms(lowRight, containsDenorms); + pixelMax(lowLeft, lowRight, maxLow); + pixelMax(maxUp, maxLow, returnVal.p); - if( verbose ) + if (verbose) { - if( NULL == containsDenorms ) - log_info( "\tSampled pixels (rgba order, denorms flushed to zero):\n" ); + if (NULL == containsDenorms) + log_info("\tSampled pixels (rgba order, denorms flushed to " + "zero):\n"); else - log_info( "\tSampled pixels (rgba order):\n" ); - log_info( "\t\tp00: %f, %f, %f, %f\n", upLeft[0], upLeft[1], upLeft[2], upLeft[3] ); - log_info( "\t\tp01: %f, %f, %f, %f\n", upRight[0], upRight[1], upRight[2], upRight[3] ); - log_info( "\t\tp10: %f, %f, %f, %f\n", lowLeft[0], lowLeft[1], lowLeft[2], lowLeft[3] ); - log_info( "\t\tp11: %f, %f, %f, %f\n", lowRight[0], lowRight[1], lowRight[2], lowRight[3] ); + log_info("\tSampled pixels (rgba order):\n"); + log_info("\t\tp00: %f, %f, %f, %f\n", upLeft[0], upLeft[1], + upLeft[2], upLeft[3]); + log_info("\t\tp01: %f, %f, %f, %f\n", upRight[0], upRight[1], + upRight[2], upRight[3]); + log_info("\t\tp10: %f, %f, %f, %f\n", lowLeft[0], lowLeft[1], + lowLeft[2], lowLeft[3]); + log_info("\t\tp11: %f, %f, %f, %f\n", lowRight[0], lowRight[1], + lowRight[2], lowRight[3]); } bool printMe = false; - if( x1 <= 0 || x2 <= 0 || x1 >= (int)width-1 || x2 >= (int)width-1 ) + if (x1 <= 0 || x2 <= 0 || x1 >= (int)width - 1 + || x2 >= (int)width - 1) printMe = true; - if( y1 <= 0 || y2 <= 0 || y1 >= (int)height-1 || y2 >= (int)height-1 ) + if (y1 <= 0 || y2 <= 0 || y1 >= (int)height - 1 + || y2 >= (int)height - 1) printMe = true; - double weights[ 2 ][ 2 ]; + double weights[2][2]; - weights[ 0 ][ 0 ] = weights[ 0 ][ 1 ] = 1.0 - frac( x - 0.5f ); - weights[ 1 ][ 0 ] = weights[ 1 ][ 1 ] = frac( x - 0.5f ); - weights[ 0 ][ 0 ] *= 1.0 - frac( y - 0.5f ); - weights[ 1 ][ 0 ] *= 1.0 - frac( y - 0.5f ); - weights[ 0 ][ 1 ] *= frac( y - 0.5f ); - weights[ 1 ][ 1 ] *= frac( y - 0.5f ); + weights[0][0] = weights[0][1] = 1.0 - frac(x - 0.5f); + weights[1][0] = weights[1][1] = frac(x - 0.5f); + weights[0][0] *= 1.0 - frac(y - 0.5f); + weights[1][0] *= 1.0 - frac(y - 0.5f); + weights[0][1] *= frac(y - 0.5f); + weights[1][1] *= frac(y - 0.5f); - if( verbose ) - log_info( "\tfrac( x - 0.5f ) = %f, frac( y - 0.5f ) = %f\n", frac( x - 0.5f ), frac( y - 0.5f ) ); + if (verbose) + log_info("\tfrac( x - 0.5f ) = %f, frac( y - 0.5f ) = %f\n", + frac(x - 0.5f), frac(y - 0.5f)); - for( int i = 0; i < 3; i++ ) + for (int i = 0; i < 3; i++) { - outData[ i ] = (float)( ( upLeft[ i ] * weights[ 0 ][ 0 ] ) + - ( upRight[ i ] * weights[ 1 ][ 0 ] ) + - ( lowLeft[ i ] * weights[ 0 ][ 1 ] ) + - ( lowRight[ i ] * weights[ 1 ][ 1 ] )); + outData[i] = (float)((upLeft[i] * weights[0][0]) + + (upRight[i] * weights[1][0]) + + (lowLeft[i] * weights[0][1]) + + (lowRight[i] * weights[1][1])); // flush subnormal results to zero if necessary - if( NULL == containsDenorms && fabs(outData[i]) < FLT_MIN ) - outData[i] = copysignf( 0.0f, outData[i] ); + if (NULL == containsDenorms && fabs(outData[i]) < FLT_MIN) + outData[i] = copysignf(0.0f, outData[i]); } - outData[ 3 ] = (float)( ( upLeft[ 3 ] * weights[ 0 ][ 0 ] ) + - ( upRight[ 3 ] * weights[ 1 ][ 0 ] ) + - ( lowLeft[ 3 ] * weights[ 0 ][ 1 ] ) + - ( lowRight[ 3 ] * weights[ 1 ][ 1 ] )); + outData[3] = (float)((upLeft[3] * weights[0][0]) + + (upRight[3] * weights[1][0]) + + (lowLeft[3] * weights[0][1]) + + (lowRight[3] * weights[1][1])); // flush subnormal results to zero if necessary - if( NULL == containsDenorms && fabs(outData[3]) < FLT_MIN ) - outData[3] = copysignf( 0.0f, outData[3] ); + if (NULL == containsDenorms && fabs(outData[3]) < FLT_MIN) + outData[3] = copysignf(0.0f, outData[3]); } else { // 3D linear filtering - int x1 = adFn( floorf( x - 0.5f ), width_lod ); - int y1 = adFn( floorf( y - 0.5f ), height_lod ); - int z1 = adFn( floorf( z - 0.5f ), depth_lod ); - int x2 = adFn( floorf( x - 0.5f ) + 1, width_lod ); - int y2 = adFn( floorf( y - 0.5f ) + 1, height_lod ); - int z2 = adFn( floorf( z - 0.5f ) + 1, depth_lod ); + int x1 = adFn(floorf(x - 0.5f), width_lod); + int y1 = adFn(floorf(y - 0.5f), height_lod); + int z1 = adFn(floorf(z - 0.5f), depth_lod); + int x2 = adFn(floorf(x - 0.5f) + 1, width_lod); + int y2 = adFn(floorf(y - 0.5f) + 1, height_lod); + int z2 = adFn(floorf(z - 0.5f) + 1, depth_lod); - if( verbose ) - log_info( "\tActual integer coords used (i = floor(x-.5)): i0:{%d, %d, %d} and i1:{%d, %d, %d}\n", x1, y1, z1, x2, y2, z2 ); + if (verbose) + log_info("\tActual integer coords used (i = floor(x-.5)): " + "i0:{%d, %d, %d} and i1:{%d, %d, %d}\n", + x1, y1, z1, x2, y2, z2); - float upLeftA[ 4 ], upRightA[ 4 ], lowLeftA[ 4 ], lowRightA[ 4 ]; - float upLeftB[ 4 ], upRightB[ 4 ], lowLeftB[ 4 ], lowRightB[ 4 ]; + float upLeftA[4], upRightA[4], lowLeftA[4], lowRightA[4]; + float upLeftB[4], upRightB[4], lowLeftB[4], lowRightB[4]; float pixelMaxA[4], pixelMaxB[4]; - read_image_pixel_float( imageData, imageInfo, x1, y1, z1, upLeftA, lod ); - read_image_pixel_float( imageData, imageInfo, x2, y1, z1, upRightA, lod ); - check_for_denorms( upLeftA, containsDenorms ); - check_for_denorms( upRightA, containsDenorms ); - pixelMax( upLeftA, upRightA, pixelMaxA ); - read_image_pixel_float( imageData, imageInfo, x1, y2, z1, lowLeftA, lod ); - read_image_pixel_float( imageData, imageInfo, x2, y2, z1, lowRightA, lod ); - check_for_denorms( lowLeftA, containsDenorms ); - check_for_denorms( lowRightA, containsDenorms ); - pixelMax( lowLeftA, lowRightA, pixelMaxB ); - pixelMax( pixelMaxA, pixelMaxB, returnVal.p); - read_image_pixel_float( imageData, imageInfo, x1, y1, z2, upLeftB, lod ); - read_image_pixel_float( imageData, imageInfo, x2, y1, z2, upRightB, lod ); - check_for_denorms( upLeftB, containsDenorms ); - check_for_denorms( upRightB, containsDenorms ); - pixelMax( upLeftB, upRightB, pixelMaxA ); - read_image_pixel_float( imageData, imageInfo, x1, y2, z2, lowLeftB, lod ); - read_image_pixel_float( imageData, imageInfo, x2, y2, z2, lowRightB, lod ); - check_for_denorms( lowLeftB, containsDenorms ); - check_for_denorms( lowRightB, containsDenorms ); - pixelMax( lowLeftB, lowRightB, pixelMaxB ); - pixelMax( pixelMaxA, pixelMaxB, pixelMaxA); - pixelMax( pixelMaxA, returnVal.p, returnVal.p ); + read_image_pixel_float(imageData, imageInfo, x1, y1, z1, upLeftA, + lod); + read_image_pixel_float(imageData, imageInfo, x2, y1, z1, upRightA, + lod); + check_for_denorms(upLeftA, containsDenorms); + check_for_denorms(upRightA, containsDenorms); + pixelMax(upLeftA, upRightA, pixelMaxA); + read_image_pixel_float(imageData, imageInfo, x1, y2, z1, lowLeftA, + lod); + read_image_pixel_float(imageData, imageInfo, x2, y2, z1, lowRightA, + lod); + check_for_denorms(lowLeftA, containsDenorms); + check_for_denorms(lowRightA, containsDenorms); + pixelMax(lowLeftA, lowRightA, pixelMaxB); + pixelMax(pixelMaxA, pixelMaxB, returnVal.p); + read_image_pixel_float(imageData, imageInfo, x1, y1, z2, upLeftB, + lod); + read_image_pixel_float(imageData, imageInfo, x2, y1, z2, upRightB, + lod); + check_for_denorms(upLeftB, containsDenorms); + check_for_denorms(upRightB, containsDenorms); + pixelMax(upLeftB, upRightB, pixelMaxA); + read_image_pixel_float(imageData, imageInfo, x1, y2, z2, lowLeftB, + lod); + read_image_pixel_float(imageData, imageInfo, x2, y2, z2, lowRightB, + lod); + check_for_denorms(lowLeftB, containsDenorms); + check_for_denorms(lowRightB, containsDenorms); + pixelMax(lowLeftB, lowRightB, pixelMaxB); + pixelMax(pixelMaxA, pixelMaxB, pixelMaxA); + pixelMax(pixelMaxA, returnVal.p, returnVal.p); - if( verbose ) + if (verbose) { - if( NULL == containsDenorms ) - log_info( "\tSampled pixels (rgba order, denorms flushed to zero):\n" ); + if (NULL == containsDenorms) + log_info("\tSampled pixels (rgba order, denorms flushed to " + "zero):\n"); else - log_info( "\tSampled pixels (rgba order):\n" ); - log_info( "\t\tp000: %f, %f, %f, %f\n", upLeftA[0], upLeftA[1], upLeftA[2], upLeftA[3] ); - log_info( "\t\tp001: %f, %f, %f, %f\n", upRightA[0], upRightA[1], upRightA[2], upRightA[3] ); - log_info( "\t\tp010: %f, %f, %f, %f\n", lowLeftA[0], lowLeftA[1], lowLeftA[2], lowLeftA[3] ); - log_info( "\t\tp011: %f, %f, %f, %f\n\n", lowRightA[0], lowRightA[1], lowRightA[2], lowRightA[3] ); - log_info( "\t\tp100: %f, %f, %f, %f\n", upLeftB[0], upLeftB[1], upLeftB[2], upLeftB[3] ); - log_info( "\t\tp101: %f, %f, %f, %f\n", upRightB[0], upRightB[1], upRightB[2], upRightB[3] ); - log_info( "\t\tp110: %f, %f, %f, %f\n", lowLeftB[0], lowLeftB[1], lowLeftB[2], lowLeftB[3] ); - log_info( "\t\tp111: %f, %f, %f, %f\n", lowRightB[0], lowRightB[1], lowRightB[2], lowRightB[3] ); + log_info("\tSampled pixels (rgba order):\n"); + log_info("\t\tp000: %f, %f, %f, %f\n", upLeftA[0], upLeftA[1], + upLeftA[2], upLeftA[3]); + log_info("\t\tp001: %f, %f, %f, %f\n", upRightA[0], upRightA[1], + upRightA[2], upRightA[3]); + log_info("\t\tp010: %f, %f, %f, %f\n", lowLeftA[0], lowLeftA[1], + lowLeftA[2], lowLeftA[3]); + log_info("\t\tp011: %f, %f, %f, %f\n\n", lowRightA[0], + lowRightA[1], lowRightA[2], lowRightA[3]); + log_info("\t\tp100: %f, %f, %f, %f\n", upLeftB[0], upLeftB[1], + upLeftB[2], upLeftB[3]); + log_info("\t\tp101: %f, %f, %f, %f\n", upRightB[0], upRightB[1], + upRightB[2], upRightB[3]); + log_info("\t\tp110: %f, %f, %f, %f\n", lowLeftB[0], lowLeftB[1], + lowLeftB[2], lowLeftB[3]); + log_info("\t\tp111: %f, %f, %f, %f\n", lowRightB[0], + lowRightB[1], lowRightB[2], lowRightB[3]); } - double weights[ 2 ][ 2 ][ 2 ]; + double weights[2][2][2]; - float a = frac( x - 0.5f ), b = frac( y - 0.5f ), c = frac( z - 0.5f ); - weights[ 0 ][ 0 ][ 0 ] = weights[ 0 ][ 1 ][ 0 ] = weights[ 0 ][ 0 ][ 1 ] = weights[ 0 ][ 1 ][ 1 ] = 1.f - a; - weights[ 1 ][ 0 ][ 0 ] = weights[ 1 ][ 1 ][ 0 ] = weights[ 1 ][ 0 ][ 1 ] = weights[ 1 ][ 1 ][ 1 ] = a; - weights[ 0 ][ 0 ][ 0 ] *= 1.f - b; - weights[ 1 ][ 0 ][ 0 ] *= 1.f - b; - weights[ 0 ][ 0 ][ 1 ] *= 1.f - b; - weights[ 1 ][ 0 ][ 1 ] *= 1.f - b; - weights[ 0 ][ 1 ][ 0 ] *= b; - weights[ 1 ][ 1 ][ 0 ] *= b; - weights[ 0 ][ 1 ][ 1 ] *= b; - weights[ 1 ][ 1 ][ 1 ] *= b; - weights[ 0 ][ 0 ][ 0 ] *= 1.f - c; - weights[ 0 ][ 1 ][ 0 ] *= 1.f - c; - weights[ 1 ][ 0 ][ 0 ] *= 1.f - c; - weights[ 1 ][ 1 ][ 0 ] *= 1.f - c; - weights[ 0 ][ 0 ][ 1 ] *= c; - weights[ 0 ][ 1 ][ 1 ] *= c; - weights[ 1 ][ 0 ][ 1 ] *= c; - weights[ 1 ][ 1 ][ 1 ] *= c; + float a = frac(x - 0.5f), b = frac(y - 0.5f), c = frac(z - 0.5f); + weights[0][0][0] = weights[0][1][0] = weights[0][0][1] = + weights[0][1][1] = 1.f - a; + weights[1][0][0] = weights[1][1][0] = weights[1][0][1] = + weights[1][1][1] = a; + weights[0][0][0] *= 1.f - b; + weights[1][0][0] *= 1.f - b; + weights[0][0][1] *= 1.f - b; + weights[1][0][1] *= 1.f - b; + weights[0][1][0] *= b; + weights[1][1][0] *= b; + weights[0][1][1] *= b; + weights[1][1][1] *= b; + weights[0][0][0] *= 1.f - c; + weights[0][1][0] *= 1.f - c; + weights[1][0][0] *= 1.f - c; + weights[1][1][0] *= 1.f - c; + weights[0][0][1] *= c; + weights[0][1][1] *= c; + weights[1][0][1] *= c; + weights[1][1][1] *= c; - if( verbose ) - log_info( "\tfrac( x - 0.5f ) = %f, frac( y - 0.5f ) = %f, frac( z - 0.5f ) = %f\n", - frac( x - 0.5f ), frac( y - 0.5f ), frac( z - 0.5f ) ); + if (verbose) + log_info("\tfrac( x - 0.5f ) = %f, frac( y - 0.5f ) = %f, " + "frac( z - 0.5f ) = %f\n", + frac(x - 0.5f), frac(y - 0.5f), frac(z - 0.5f)); - for( int i = 0; i < 3; i++ ) + for (int i = 0; i < 3; i++) { - outData[ i ] = (float)( ( upLeftA[ i ] * weights[ 0 ][ 0 ][ 0 ] ) + - ( upRightA[ i ] * weights[ 1 ][ 0 ][ 0 ] ) + - ( lowLeftA[ i ] * weights[ 0 ][ 1 ][ 0 ] ) + - ( lowRightA[ i ] * weights[ 1 ][ 1 ][ 0 ] ) + - ( upLeftB[ i ] * weights[ 0 ][ 0 ][ 1 ] ) + - ( upRightB[ i ] * weights[ 1 ][ 0 ][ 1 ] ) + - ( lowLeftB[ i ] * weights[ 0 ][ 1 ][ 1 ] ) + - ( lowRightB[ i ] * weights[ 1 ][ 1 ][ 1 ] )); + outData[i] = (float)((upLeftA[i] * weights[0][0][0]) + + (upRightA[i] * weights[1][0][0]) + + (lowLeftA[i] * weights[0][1][0]) + + (lowRightA[i] * weights[1][1][0]) + + (upLeftB[i] * weights[0][0][1]) + + (upRightB[i] * weights[1][0][1]) + + (lowLeftB[i] * weights[0][1][1]) + + (lowRightB[i] * weights[1][1][1])); // flush subnormal results to zero if necessary - if( NULL == containsDenorms && fabs(outData[i]) < FLT_MIN ) - outData[i] = copysignf( 0.0f, outData[i] ); + if (NULL == containsDenorms && fabs(outData[i]) < FLT_MIN) + outData[i] = copysignf(0.0f, outData[i]); } - outData[ 3 ] = (float)( ( upLeftA[ 3 ] * weights[ 0 ][ 0 ][ 0 ] ) + - ( upRightA[ 3 ] * weights[ 1 ][ 0 ][ 0 ] ) + - ( lowLeftA[ 3 ] * weights[ 0 ][ 1 ][ 0 ] ) + - ( lowRightA[ 3 ] * weights[ 1 ][ 1 ][ 0 ] ) + - ( upLeftB[ 3 ] * weights[ 0 ][ 0 ][ 1 ] ) + - ( upRightB[ 3 ] * weights[ 1 ][ 0 ][ 1 ] ) + - ( lowLeftB[ 3 ] * weights[ 0 ][ 1 ][ 1 ] ) + - ( lowRightB[ 3 ] * weights[ 1 ][ 1 ][ 1 ] )); + outData[3] = (float)((upLeftA[3] * weights[0][0][0]) + + (upRightA[3] * weights[1][0][0]) + + (lowLeftA[3] * weights[0][1][0]) + + (lowRightA[3] * weights[1][1][0]) + + (upLeftB[3] * weights[0][0][1]) + + (upRightB[3] * weights[1][0][1]) + + (lowLeftB[3] * weights[0][1][1]) + + (lowRightB[3] * weights[1][1][1])); // flush subnormal results to zero if necessary - if( NULL == containsDenorms && fabs(outData[3]) < FLT_MIN ) - outData[3] = copysignf( 0.0f, outData[3] ); + if (NULL == containsDenorms && fabs(outData[3]) < FLT_MIN) + outData[3] = copysignf(0.0f, outData[3]); } return returnVal; } } -FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms ) +FloatPixel sample_image_pixel_float_offset( + void *imageData, image_descriptor *imageInfo, float x, float y, float z, + float xAddressOffset, float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, float *outData, int verbose, + int *containsDenorms) { - return sample_image_pixel_float_offset( imageData, imageInfo, x, y, z, xAddressOffset, yAddressOffset, zAddressOffset, - imageSampler, outData, verbose, containsDenorms, 0); + return sample_image_pixel_float_offset( + imageData, imageInfo, x, y, z, xAddressOffset, yAddressOffset, + zAddressOffset, imageSampler, outData, verbose, containsDenorms, 0); } -int debug_find_vector_in_image( void *imagePtr, image_descriptor *imageInfo, - void *vectorToFind, size_t vectorSize, int *outX, int *outY, int *outZ, size_t lod ) +int debug_find_vector_in_image(void *imagePtr, image_descriptor *imageInfo, + void *vectorToFind, size_t vectorSize, int *outX, + int *outY, int *outZ, size_t lod) { int foundCount = 0; char *iPtr = (char *)imagePtr; @@ -2102,151 +2227,159 @@ int debug_find_vector_in_image( void *imagePtr, image_descriptor *imageInfo, switch (imageInfo->type) { - case CL_MEM_OBJECT_IMAGE1D: - width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - height = 1; - depth = 1; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - height = 1; - depth = imageInfo->arraySize; - break; - case CL_MEM_OBJECT_IMAGE2D: - width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - height = (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; - depth = 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - height = (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; - depth = imageInfo->arraySize; - break; - case CL_MEM_OBJECT_IMAGE3D: - width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - height = (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; - depth = (imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1; - break; + case CL_MEM_OBJECT_IMAGE1D: + width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + height = 1; + depth = 1; + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + height = 1; + depth = imageInfo->arraySize; + break; + case CL_MEM_OBJECT_IMAGE2D: + width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + height = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; + depth = 1; + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + height = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; + depth = imageInfo->arraySize; + break; + case CL_MEM_OBJECT_IMAGE3D: + width = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; + height = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; + depth = (imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1; + break; } - row_pitch = width * get_pixel_size( imageInfo->format ); + row_pitch = width * get_pixel_size(imageInfo->format); slice_pitch = row_pitch * height; - for( size_t z = 0; z < depth; z++ ) + for (size_t z = 0; z < depth; z++) { - for( size_t y = 0; y < height; y++ ) + for (size_t y = 0; y < height; y++) { - for( size_t x = 0; x < width; x++) + for (size_t x = 0; x < width; x++) { - if( memcmp( iPtr, vectorToFind, vectorSize ) == 0 ) + if (memcmp(iPtr, vectorToFind, vectorSize) == 0) { - if( foundCount == 0 ) + if (foundCount == 0) { *outX = (int)x; - if (outY != NULL) - *outY = (int)y; - if( outZ != NULL ) - *outZ = (int)z; + if (outY != NULL) *outY = (int)y; + if (outZ != NULL) *outZ = (int)z; } foundCount++; } iPtr += vectorSize; } - iPtr += row_pitch - ( width * vectorSize ); + iPtr += row_pitch - (width * vectorSize); } - iPtr += slice_pitch - ( height * row_pitch ); + iPtr += slice_pitch - (height * row_pitch); } return foundCount; } -int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - unsigned int *valuesToFind, int *outX, int *outY, int *outZ, int lod ) +int debug_find_pixel_in_image(void *imagePtr, image_descriptor *imageInfo, + unsigned int *valuesToFind, int *outX, int *outY, + int *outZ, int lod) { - char vectorToFind[ 4 * 4 ]; - size_t vectorSize = get_format_channel_count( imageInfo->format ); + char vectorToFind[4 * 4]; + size_t vectorSize = get_format_channel_count(imageInfo->format); - if( imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT8 ) + if (imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT8) { unsigned char *p = (unsigned char *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (unsigned char)valuesToFind[i]; } - else if( imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT16 ) + else if (imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT16) { unsigned short *p = (unsigned short *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (unsigned short)valuesToFind[i]; vectorSize *= 2; } - else if( imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT32 ) + else if (imageInfo->format->image_channel_data_type == CL_UNSIGNED_INT32) { unsigned int *p = (unsigned int *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (unsigned int)valuesToFind[i]; vectorSize *= 4; } else { - log_info( "WARNING: Unable to search for debug pixel: invalid image format\n" ); + log_info("WARNING: Unable to search for debug pixel: invalid image " + "format\n"); return false; } - return debug_find_vector_in_image( imagePtr, imageInfo, vectorToFind, vectorSize, outX, outY, outZ, lod ); + return debug_find_vector_in_image(imagePtr, imageInfo, vectorToFind, + vectorSize, outX, outY, outZ, lod); } -int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - int *valuesToFind, int *outX, int *outY, int *outZ, int lod ) +int debug_find_pixel_in_image(void *imagePtr, image_descriptor *imageInfo, + int *valuesToFind, int *outX, int *outY, + int *outZ, int lod) { - char vectorToFind[ 4 * 4 ]; - size_t vectorSize = get_format_channel_count( imageInfo->format ); + char vectorToFind[4 * 4]; + size_t vectorSize = get_format_channel_count(imageInfo->format); - if( imageInfo->format->image_channel_data_type == CL_SIGNED_INT8 ) + if (imageInfo->format->image_channel_data_type == CL_SIGNED_INT8) { char *p = (char *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (char)valuesToFind[i]; } - else if( imageInfo->format->image_channel_data_type == CL_SIGNED_INT16 ) + else if (imageInfo->format->image_channel_data_type == CL_SIGNED_INT16) { short *p = (short *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (short)valuesToFind[i]; vectorSize *= 2; } - else if( imageInfo->format->image_channel_data_type == CL_SIGNED_INT32 ) + else if (imageInfo->format->image_channel_data_type == CL_SIGNED_INT32) { int *p = (int *)vectorToFind; - for( unsigned int i = 0; i < vectorSize; i++ ) + for (unsigned int i = 0; i < vectorSize; i++) p[i] = (int)valuesToFind[i]; vectorSize *= 4; } else { - log_info( "WARNING: Unable to search for debug pixel: invalid image format\n" ); + log_info("WARNING: Unable to search for debug pixel: invalid image " + "format\n"); return false; } - return debug_find_vector_in_image( imagePtr, imageInfo, vectorToFind, vectorSize, outX, outY, outZ, lod ); + return debug_find_vector_in_image(imagePtr, imageInfo, vectorToFind, + vectorSize, outX, outY, outZ, lod); } -int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - float *valuesToFind, int *outX, int *outY, int *outZ, int lod ) +int debug_find_pixel_in_image(void *imagePtr, image_descriptor *imageInfo, + float *valuesToFind, int *outX, int *outY, + int *outZ, int lod) { - char vectorToFind[ 4 * 4 ]; + char vectorToFind[4 * 4]; float swizzled[4]; - memcpy( swizzled, valuesToFind, sizeof( swizzled ) ); - size_t vectorSize = get_pixel_size( imageInfo->format ); - pack_image_pixel( swizzled, imageInfo->format, vectorToFind ); - return debug_find_vector_in_image( imagePtr, imageInfo, vectorToFind, vectorSize, outX, outY, outZ, lod ); + memcpy(swizzled, valuesToFind, sizeof(swizzled)); + size_t vectorSize = get_pixel_size(imageInfo->format); + pack_image_pixel(swizzled, imageInfo->format, vectorToFind); + return debug_find_vector_in_image(imagePtr, imageInfo, vectorToFind, + vectorSize, outX, outY, outZ, lod); } -template void swizzle_vector_for_image( T *srcVector, const cl_image_format *imageFormat ) +template +void swizzle_vector_for_image(T *srcVector, const cl_image_format *imageFormat) { T temp; - switch( imageFormat->image_channel_order ) + switch (imageFormat->image_channel_order) { - case CL_A: - srcVector[ 0 ] = srcVector[ 3 ]; - break; + case CL_A: srcVector[0] = srcVector[3]; break; case CL_R: case CL_Rx: case CL_RG: @@ -2256,459 +2389,467 @@ template void swizzle_vector_for_image( T *srcVector, const cl_image_f case CL_RGBA: case CL_sRGB: case CL_sRGBx: - case CL_sRGBA: - break; - case CL_RA: - srcVector[ 1 ] = srcVector[ 3 ]; - break; + case CL_sRGBA: break; + case CL_RA: srcVector[1] = srcVector[3]; break; case CL_ARGB: - temp = srcVector[ 3 ]; - srcVector[ 3 ] = srcVector[ 2 ]; - srcVector[ 2 ] = srcVector[ 1 ]; - srcVector[ 1 ] = srcVector[ 0 ]; - srcVector[ 0 ] = temp; + temp = srcVector[3]; + srcVector[3] = srcVector[2]; + srcVector[2] = srcVector[1]; + srcVector[1] = srcVector[0]; + srcVector[0] = temp; break; case CL_BGRA: case CL_sBGRA: - temp = srcVector[ 0 ]; - srcVector[ 0 ] = srcVector[ 2 ]; - srcVector[ 2 ] = temp; + temp = srcVector[0]; + srcVector[0] = srcVector[2]; + srcVector[2] = temp; break; case CL_INTENSITY: - srcVector[ 3 ] = srcVector[ 0 ]; - srcVector[ 2 ] = srcVector[ 0 ]; - srcVector[ 1 ] = srcVector[ 0 ]; + srcVector[3] = srcVector[0]; + srcVector[2] = srcVector[0]; + srcVector[1] = srcVector[0]; break; case CL_LUMINANCE: - srcVector[ 2 ] = srcVector[ 0 ]; - srcVector[ 1 ] = srcVector[ 0 ]; + srcVector[2] = srcVector[0]; + srcVector[1] = srcVector[0]; break; #ifdef CL_1RGB_APPLE case CL_1RGB_APPLE: - temp = srcVector[ 3 ]; - srcVector[ 3 ] = srcVector[ 2 ]; - srcVector[ 2 ] = srcVector[ 1 ]; - srcVector[ 1 ] = srcVector[ 0 ]; - srcVector[ 0 ] = temp; + temp = srcVector[3]; + srcVector[3] = srcVector[2]; + srcVector[2] = srcVector[1]; + srcVector[1] = srcVector[0]; + srcVector[0] = temp; break; #endif #ifdef CL_BGR1_APPLE case CL_BGR1_APPLE: - temp = srcVector[ 0 ]; - srcVector[ 0 ] = srcVector[ 2 ]; - srcVector[ 2 ] = temp; + temp = srcVector[0]; + srcVector[0] = srcVector[2]; + srcVector[2] = temp; break; #endif } } -#define SATURATE( v, min, max ) ( v < min ? min : ( v > max ? max : v ) ) +#define SATURATE(v, min, max) (v < min ? min : (v > max ? max : v)) -void pack_image_pixel( unsigned int *srcVector, const cl_image_format *imageFormat, void *outData ) +void pack_image_pixel(unsigned int *srcVector, + const cl_image_format *imageFormat, void *outData) { - swizzle_vector_for_image( srcVector, imageFormat ); - size_t channelCount = get_format_channel_count( imageFormat ); + swizzle_vector_for_image(srcVector, imageFormat); + size_t channelCount = get_format_channel_count(imageFormat); - switch( imageFormat->image_channel_data_type ) + switch (imageFormat->image_channel_data_type) { - case CL_UNSIGNED_INT8: - { + case CL_UNSIGNED_INT8: { unsigned char *ptr = (unsigned char *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (unsigned char)SATURATE( srcVector[ i ], 0, 255 ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (unsigned char)SATURATE(srcVector[i], 0, 255); break; } - case CL_UNSIGNED_INT16: - { + case CL_UNSIGNED_INT16: { unsigned short *ptr = (unsigned short *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (unsigned short)SATURATE( srcVector[ i ], 0, 65535 ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (unsigned short)SATURATE(srcVector[i], 0, 65535); break; } - case CL_UNSIGNED_INT32: - { + case CL_UNSIGNED_INT32: { unsigned int *ptr = (unsigned int *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (unsigned int)srcVector[ i ]; + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (unsigned int)srcVector[i]; break; } - default: - break; + default: break; } } -void pack_image_pixel( int *srcVector, const cl_image_format *imageFormat, void *outData ) +void pack_image_pixel(int *srcVector, const cl_image_format *imageFormat, + void *outData) { - swizzle_vector_for_image( srcVector, imageFormat ); - size_t chanelCount = get_format_channel_count( imageFormat ); + swizzle_vector_for_image(srcVector, imageFormat); + size_t chanelCount = get_format_channel_count(imageFormat); - switch( imageFormat->image_channel_data_type ) + switch (imageFormat->image_channel_data_type) { - case CL_SIGNED_INT8: - { + case CL_SIGNED_INT8: { char *ptr = (char *)outData; - for( unsigned int i = 0; i < chanelCount; i++ ) - ptr[ i ] = (char)SATURATE( srcVector[ i ], -128, 127 ); + for (unsigned int i = 0; i < chanelCount; i++) + ptr[i] = (char)SATURATE(srcVector[i], -128, 127); break; } - case CL_SIGNED_INT16: - { + case CL_SIGNED_INT16: { short *ptr = (short *)outData; - for( unsigned int i = 0; i < chanelCount; i++ ) - ptr[ i ] = (short)SATURATE( srcVector[ i ], -32768, 32767 ); + for (unsigned int i = 0; i < chanelCount; i++) + ptr[i] = (short)SATURATE(srcVector[i], -32768, 32767); break; } - case CL_SIGNED_INT32: - { + case CL_SIGNED_INT32: { int *ptr = (int *)outData; - for( unsigned int i = 0; i < chanelCount; i++ ) - ptr[ i ] = (int)srcVector[ i ]; + for (unsigned int i = 0; i < chanelCount; i++) + ptr[i] = (int)srcVector[i]; break; } - default: - break; + default: break; } } -int round_to_even( float v ) +int round_to_even(float v) { // clamp overflow - if( v >= - (float) INT_MIN ) - return INT_MAX; - if( v <= (float) INT_MIN ) - return INT_MIN; + if (v >= -(float)INT_MIN) return INT_MAX; + if (v <= (float)INT_MIN) return INT_MIN; // round fractional values to integer value - if( fabsf(v) < MAKE_HEX_FLOAT(0x1.0p23f, 0x1L, 23) ) + if (fabsf(v) < MAKE_HEX_FLOAT(0x1.0p23f, 0x1L, 23)) { - static const float magic[2] = { MAKE_HEX_FLOAT(0x1.0p23f, 0x1L, 23), MAKE_HEX_FLOAT(-0x1.0p23f, -0x1L, 23) }; - float magicVal = magic[ v < 0.0f ]; + static const float magic[2] = { MAKE_HEX_FLOAT(0x1.0p23f, 0x1L, 23), + MAKE_HEX_FLOAT(-0x1.0p23f, -0x1L, 23) }; + float magicVal = magic[v < 0.0f]; v += magicVal; v -= magicVal; } - return (int) v; + return (int)v; } -void pack_image_pixel( float *srcVector, const cl_image_format *imageFormat, void *outData ) +void pack_image_pixel(float *srcVector, const cl_image_format *imageFormat, + void *outData) { - swizzle_vector_for_image( srcVector, imageFormat ); - size_t channelCount = get_format_channel_count( imageFormat ); - switch( imageFormat->image_channel_data_type ) + swizzle_vector_for_image(srcVector, imageFormat); + size_t channelCount = get_format_channel_count(imageFormat); + switch (imageFormat->image_channel_data_type) { case CL_HALF_FLOAT: { cl_half *ptr = (cl_half *)outData; - switch( gFloatToHalfRoundingMode ) + switch (gFloatToHalfRoundingMode) { case kRoundToNearestEven: - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[i] = cl_half_from_float(srcVector[i], CL_HALF_RTE); - break; + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = cl_half_from_float(srcVector[i], CL_HALF_RTE); + break; case kRoundTowardZero: - for( unsigned int i = 0; i < channelCount; i++ ) + for (unsigned int i = 0; i < channelCount; i++) ptr[i] = cl_half_from_float(srcVector[i], CL_HALF_RTZ); break; default: - log_error( "ERROR: Test internal error -- unhandled or unknown float->half rounding mode.\n" ); + log_error("ERROR: Test internal error -- unhandled or " + "unknown float->half rounding mode.\n"); exit(-1); break; - } + } break; } - case CL_FLOAT: - { + case CL_FLOAT: { cl_float *ptr = (cl_float *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = srcVector[ i ]; + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = srcVector[i]; break; } - case CL_SNORM_INT8: - { + case CL_SNORM_INT8: { cl_char *ptr = (cl_char *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (cl_char)NORMALIZE_SIGNED( srcVector[ i ], -127.0f, 127.f ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = + (cl_char)NORMALIZE_SIGNED(srcVector[i], -127.0f, 127.f); break; } - case CL_SNORM_INT16: - { + case CL_SNORM_INT16: { cl_short *ptr = (cl_short *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (short)NORMALIZE_SIGNED( srcVector[ i ], -32767.f, 32767.f ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = + (short)NORMALIZE_SIGNED(srcVector[i], -32767.f, 32767.f); break; } - case CL_UNORM_INT8: - { + case CL_UNORM_INT8: { cl_uchar *ptr = (cl_uchar *)outData; - if ( is_sRGBA_order(imageFormat->image_channel_order) ) + if (is_sRGBA_order(imageFormat->image_channel_order)) { - ptr[ 0 ] = (unsigned char)( sRGBmap( srcVector[ 0 ] ) + 0.5 ); - ptr[ 1 ] = (unsigned char)( sRGBmap( srcVector[ 1 ] ) + 0.5 ); - ptr[ 2 ] = (unsigned char)( sRGBmap( srcVector[ 2 ] ) + 0.5 ); + ptr[0] = (unsigned char)(sRGBmap(srcVector[0]) + 0.5); + ptr[1] = (unsigned char)(sRGBmap(srcVector[1]) + 0.5); + ptr[2] = (unsigned char)(sRGBmap(srcVector[2]) + 0.5); if (channelCount == 4) - ptr[ 3 ] = (unsigned char)NORMALIZE( srcVector[ 3 ], 255.f ); + ptr[3] = (unsigned char)NORMALIZE(srcVector[3], 255.f); } else { - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (unsigned char)NORMALIZE( srcVector[ i ], 255.f ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (unsigned char)NORMALIZE(srcVector[i], 255.f); } #ifdef CL_1RGB_APPLE - if( imageFormat->image_channel_order == CL_1RGB_APPLE ) + if (imageFormat->image_channel_order == CL_1RGB_APPLE) ptr[0] = 255.0f; #endif #ifdef CL_BGR1_APPLE - if( imageFormat->image_channel_order == CL_BGR1_APPLE ) + if (imageFormat->image_channel_order == CL_BGR1_APPLE) ptr[3] = 255.0f; #endif break; } - case CL_UNORM_INT16: - { + case CL_UNORM_INT16: { cl_ushort *ptr = (cl_ushort *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (unsigned short)NORMALIZE( srcVector[ i ], 65535.f ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (unsigned short)NORMALIZE(srcVector[i], 65535.f); break; } - case CL_UNORM_SHORT_555: - { + case CL_UNORM_SHORT_555: { cl_ushort *ptr = (cl_ushort *)outData; - ptr[ 0 ] = ( ( (unsigned short)NORMALIZE( srcVector[ 0 ], 31.f ) & 31 ) << 10 ) | - ( ( (unsigned short)NORMALIZE( srcVector[ 1 ], 31.f ) & 31 ) << 5 ) | - ( ( (unsigned short)NORMALIZE( srcVector[ 2 ], 31.f ) & 31 ) << 0 ); + ptr[0] = + (((unsigned short)NORMALIZE(srcVector[0], 31.f) & 31) << 10) + | (((unsigned short)NORMALIZE(srcVector[1], 31.f) & 31) << 5) + | (((unsigned short)NORMALIZE(srcVector[2], 31.f) & 31) << 0); break; } - case CL_UNORM_SHORT_565: - { + case CL_UNORM_SHORT_565: { cl_ushort *ptr = (cl_ushort *)outData; - ptr[ 0 ] = ( ( (unsigned short)NORMALIZE( srcVector[ 0 ], 31.f ) & 31 ) << 11 ) | - ( ( (unsigned short)NORMALIZE( srcVector[ 1 ], 63.f ) & 63 ) << 5 ) | - ( ( (unsigned short)NORMALIZE( srcVector[ 2 ], 31.f ) & 31 ) << 0 ); + ptr[0] = + (((unsigned short)NORMALIZE(srcVector[0], 31.f) & 31) << 11) + | (((unsigned short)NORMALIZE(srcVector[1], 63.f) & 63) << 5) + | (((unsigned short)NORMALIZE(srcVector[2], 31.f) & 31) << 0); break; } - case CL_UNORM_INT_101010: - { + case CL_UNORM_INT_101010: { cl_uint *ptr = (cl_uint *)outData; - ptr[ 0 ] = ( ( (unsigned int)NORMALIZE( srcVector[ 0 ], 1023.f ) & 1023 ) << 20 ) | - ( ( (unsigned int)NORMALIZE( srcVector[ 1 ], 1023.f ) & 1023 ) << 10 ) | - ( ( (unsigned int)NORMALIZE( srcVector[ 2 ], 1023.f ) & 1023 ) << 0 ); + ptr[0] = + (((unsigned int)NORMALIZE(srcVector[0], 1023.f) & 1023) << 20) + | (((unsigned int)NORMALIZE(srcVector[1], 1023.f) & 1023) << 10) + | (((unsigned int)NORMALIZE(srcVector[2], 1023.f) & 1023) << 0); break; } - case CL_SIGNED_INT8: - { + case CL_SIGNED_INT8: { cl_char *ptr = (cl_char *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (cl_char)CONVERT_INT( srcVector[ i ], -127.0f, 127.f, 127 ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = + (cl_char)CONVERT_INT(srcVector[i], -127.0f, 127.f, 127); break; } - case CL_SIGNED_INT16: - { + case CL_SIGNED_INT16: { cl_short *ptr = (cl_short *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (short)CONVERT_INT( srcVector[ i ], -32767.f, 32767.f, 32767 ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = + (short)CONVERT_INT(srcVector[i], -32767.f, 32767.f, 32767); break; } - case CL_SIGNED_INT32: - { + case CL_SIGNED_INT32: { cl_int *ptr = (cl_int *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (int)CONVERT_INT( srcVector[ i ], MAKE_HEX_FLOAT( -0x1.0p31f, -1, 31), MAKE_HEX_FLOAT( 0x1.fffffep30f, 0x1fffffe, 30-23), CL_INT_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (int)CONVERT_INT( + srcVector[i], MAKE_HEX_FLOAT(-0x1.0p31f, -1, 31), + MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffe, 30 - 23), + CL_INT_MAX); break; } - case CL_UNSIGNED_INT8: - { + case CL_UNSIGNED_INT8: { cl_uchar *ptr = (cl_uchar *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (cl_uchar)CONVERT_UINT( srcVector[ i ], 255.f, CL_UCHAR_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = + (cl_uchar)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX); break; } - case CL_UNSIGNED_INT16: - { + case CL_UNSIGNED_INT16: { cl_ushort *ptr = (cl_ushort *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (cl_ushort)CONVERT_UINT( srcVector[ i ], 32767.f, CL_USHRT_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (cl_ushort)CONVERT_UINT(srcVector[i], 32767.f, + CL_USHRT_MAX); break; } - case CL_UNSIGNED_INT32: - { + case CL_UNSIGNED_INT32: { cl_uint *ptr = (cl_uint *)outData; - for( unsigned int i = 0; i < channelCount; i++ ) - ptr[ i ] = (cl_uint)CONVERT_UINT( srcVector[ i ], MAKE_HEX_FLOAT( 0x1.fffffep31f, 0x1fffffe, 31-23), CL_UINT_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + ptr[i] = (cl_uint)CONVERT_UINT( + srcVector[i], + MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffe, 31 - 23), + CL_UINT_MAX); break; } #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - { - cl_ushort *ptr = (cl_ushort*)outData; - for( unsigned int i = 0; i < channelCount; i++ ) + case CL_SFIXED14_APPLE: { + cl_ushort *ptr = (cl_ushort *)outData; + for (unsigned int i = 0; i < channelCount; i++) { - cl_float f = fmaxf( srcVector[i], -1.0f ); - f = fminf( f, 3.0f ); + cl_float f = fmaxf(srcVector[i], -1.0f); + f = fminf(f, 3.0f); cl_int d = rintf(f * 0x1.0p14f); d += 16384; - if( d > CL_USHRT_MAX ) - d = CL_USHRT_MAX; + if (d > CL_USHRT_MAX) d = CL_USHRT_MAX; ptr[i] = d; } break; } #endif default: - log_error( "INTERNAL ERROR: unknown format (%d)\n", imageFormat->image_channel_data_type); + log_error("INTERNAL ERROR: unknown format (%d)\n", + imageFormat->image_channel_data_type); exit(-1); break; } } -void pack_image_pixel_error( const float *srcVector, const cl_image_format *imageFormat, const void *results, float *errors ) +void pack_image_pixel_error(const float *srcVector, + const cl_image_format *imageFormat, + const void *results, float *errors) { - size_t channelCount = get_format_channel_count( imageFormat ); - switch( imageFormat->image_channel_data_type ) + size_t channelCount = get_format_channel_count(imageFormat); + switch (imageFormat->image_channel_data_type) { 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] ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = Ulp_Error_Half(ptr[i], srcVector[i]); break; } - case CL_FLOAT: - { + case CL_FLOAT: { const cl_ushort *ptr = (const cl_ushort *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = Ulp_Error( ptr[i], srcVector[i] ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = Ulp_Error(ptr[i], srcVector[i]); break; } - case CL_SNORM_INT8: - { + case CL_SNORM_INT8: { const cl_char *ptr = (const cl_char *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[i] - NORMALIZE_SIGNED_UNROUNDED( srcVector[ i ], -127.0f, 127.f ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] + - NORMALIZE_SIGNED_UNROUNDED(srcVector[i], -127.0f, 127.f); break; } - case CL_SNORM_INT16: - { + case CL_SNORM_INT16: { const cl_short *ptr = (const cl_short *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[i] - NORMALIZE_SIGNED_UNROUNDED( srcVector[ i ], -32767.f, 32767.f ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] + - NORMALIZE_SIGNED_UNROUNDED(srcVector[i], -32767.f, + 32767.f); break; } - case CL_UNORM_INT8: - { + case CL_UNORM_INT8: { const cl_uchar *ptr = (const cl_uchar *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[i] - NORMALIZE_UNROUNDED( srcVector[ i ], 255.f ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] - NORMALIZE_UNROUNDED(srcVector[i], 255.f); break; } - case CL_UNORM_INT16: - { + case CL_UNORM_INT16: { const cl_ushort *ptr = (const cl_ushort *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[i] - NORMALIZE_UNROUNDED( srcVector[ i ], 65535.f ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] - NORMALIZE_UNROUNDED(srcVector[i], 65535.f); break; } - case CL_UNORM_SHORT_555: - { + case CL_UNORM_SHORT_555: { const cl_ushort *ptr = (const cl_ushort *)results; - errors[0] = ((ptr[0] >> 10) & 31) - NORMALIZE_UNROUNDED( srcVector[ 0 ], 31.f ); - errors[1] = ((ptr[0] >> 5) & 31) - NORMALIZE_UNROUNDED( srcVector[ 1 ], 31.f ); - errors[2] = ((ptr[0] >> 0) & 31) - NORMALIZE_UNROUNDED( srcVector[ 2 ], 31.f ); + errors[0] = + ((ptr[0] >> 10) & 31) - NORMALIZE_UNROUNDED(srcVector[0], 31.f); + errors[1] = + ((ptr[0] >> 5) & 31) - NORMALIZE_UNROUNDED(srcVector[1], 31.f); + errors[2] = + ((ptr[0] >> 0) & 31) - NORMALIZE_UNROUNDED(srcVector[2], 31.f); break; } - case CL_UNORM_SHORT_565: - { + case CL_UNORM_SHORT_565: { const cl_ushort *ptr = (const cl_ushort *)results; - errors[0] = ((ptr[0] >> 11) & 31) - NORMALIZE_UNROUNDED( srcVector[ 0 ], 31.f ); - errors[1] = ((ptr[0] >> 5) & 63) - NORMALIZE_UNROUNDED( srcVector[ 1 ], 63.f ); - errors[2] = ((ptr[0] >> 0) & 31) - NORMALIZE_UNROUNDED( srcVector[ 2 ], 31.f ); + errors[0] = + ((ptr[0] >> 11) & 31) - NORMALIZE_UNROUNDED(srcVector[0], 31.f); + errors[1] = + ((ptr[0] >> 5) & 63) - NORMALIZE_UNROUNDED(srcVector[1], 63.f); + errors[2] = + ((ptr[0] >> 0) & 31) - NORMALIZE_UNROUNDED(srcVector[2], 31.f); break; } - case CL_UNORM_INT_101010: - { + case CL_UNORM_INT_101010: { const cl_uint *ptr = (const cl_uint *)results; - errors[0] = ((ptr[0] >> 20) & 1023) - NORMALIZE_UNROUNDED( srcVector[ 0 ], 1023.f ); - errors[1] = ((ptr[0] >> 10) & 1023) - NORMALIZE_UNROUNDED( srcVector[ 1 ], 1023.f ); - errors[2] = ((ptr[0] >> 0) & 1023) - NORMALIZE_UNROUNDED( srcVector[ 2 ], 1023.f ); + errors[0] = ((ptr[0] >> 20) & 1023) + - NORMALIZE_UNROUNDED(srcVector[0], 1023.f); + errors[1] = ((ptr[0] >> 10) & 1023) + - NORMALIZE_UNROUNDED(srcVector[1], 1023.f); + errors[2] = ((ptr[0] >> 0) & 1023) + - NORMALIZE_UNROUNDED(srcVector[2], 1023.f); break; } - case CL_SIGNED_INT8: - { + case CL_SIGNED_INT8: { const cl_char *ptr = (const cl_char *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[ i ] = ptr[i] - CONVERT_INT( srcVector[ i ], -127.0f, 127.f, 127 ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = + ptr[i] - CONVERT_INT(srcVector[i], -127.0f, 127.f, 127); break; } - case CL_SIGNED_INT16: - { + case CL_SIGNED_INT16: { const cl_short *ptr = (const cl_short *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[ i ] - CONVERT_INT( srcVector[ i ], -32767.f, 32767.f, 32767 ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] + - CONVERT_INT(srcVector[i], -32767.f, 32767.f, 32767); break; } - case CL_SIGNED_INT32: - { + case CL_SIGNED_INT32: { const cl_int *ptr = (const cl_int *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = (cl_float)((cl_long) ptr[ i ] - (cl_long) CONVERT_INT( srcVector[ i ], MAKE_HEX_FLOAT( -0x1.0p31f, -1, 31), MAKE_HEX_FLOAT( 0x1.fffffep30f, 0x1fffffe, 30-23), CL_INT_MAX )); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = (cl_float)( + (cl_long)ptr[i] + - (cl_long)CONVERT_INT( + srcVector[i], MAKE_HEX_FLOAT(-0x1.0p31f, -1, 31), + MAKE_HEX_FLOAT(0x1.fffffep30f, 0x1fffffe, 30 - 23), + CL_INT_MAX)); break; } - case CL_UNSIGNED_INT8: - { + case CL_UNSIGNED_INT8: { const cl_uchar *ptr = (const cl_uchar *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = (cl_int) ptr[ i ] - (cl_int) CONVERT_UINT( srcVector[ i ], 255.f, CL_UCHAR_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = (cl_int)ptr[i] + - (cl_int)CONVERT_UINT(srcVector[i], 255.f, CL_UCHAR_MAX); break; } - case CL_UNSIGNED_INT16: - { + case CL_UNSIGNED_INT16: { const cl_ushort *ptr = (const cl_ushort *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = (cl_int) ptr[ i ] - (cl_int) CONVERT_UINT( srcVector[ i ], 32767.f, CL_USHRT_MAX ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = (cl_int)ptr[i] + - (cl_int)CONVERT_UINT(srcVector[i], 32767.f, CL_USHRT_MAX); break; } - case CL_UNSIGNED_INT32: - { + case CL_UNSIGNED_INT32: { const cl_uint *ptr = (const cl_uint *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = (cl_float)((cl_long) ptr[ i ] - (cl_long)CONVERT_UINT( srcVector[ i ], MAKE_HEX_FLOAT( 0x1.fffffep31f, 0x1fffffe, 31-23), CL_UINT_MAX )); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = (cl_float)( + (cl_long)ptr[i] + - (cl_long)CONVERT_UINT( + srcVector[i], + MAKE_HEX_FLOAT(0x1.fffffep31f, 0x1fffffe, 31 - 23), + CL_UINT_MAX)); break; } #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - { + case CL_SFIXED14_APPLE: { const cl_ushort *ptr = (const cl_ushort *)results; - for( unsigned int i = 0; i < channelCount; i++ ) - errors[i] = ptr[i] - NORMALIZE_SIGNED_UNROUNDED( ((int) srcVector[ i ] - 16384), -16384.f, 49151.f ); + for (unsigned int i = 0; i < channelCount; i++) + errors[i] = ptr[i] + - NORMALIZE_SIGNED_UNROUNDED(((int)srcVector[i] - 16384), + -16384.f, 49151.f); break; } #endif default: - log_error( "INTERNAL ERROR: unknown format (%d)\n", imageFormat->image_channel_data_type); + log_error("INTERNAL ERROR: unknown format (%d)\n", + imageFormat->image_channel_data_type); exit(-1); break; } @@ -2717,121 +2858,159 @@ void pack_image_pixel_error( const float *srcVector, const cl_image_format *imag // // Autodetect which rounding mode is used for image writes to CL_HALF_FLOAT -// This should be called lazily before attempting to verify image writes, otherwise an error will occur. +// This should be called lazily before attempting to verify image writes, +// otherwise an error will occur. // -int DetectFloatToHalfRoundingMode( cl_command_queue q ) // Returns CL_SUCCESS on success +int DetectFloatToHalfRoundingMode( + cl_command_queue q) // Returns CL_SUCCESS on success { cl_int err = CL_SUCCESS; - if( gFloatToHalfRoundingMode == kDefaultRoundingMode ) + if (gFloatToHalfRoundingMode == kDefaultRoundingMode) { - // Some numbers near 0.5f, that we look at to see how the values are rounded. - static const cl_uint inData[4*4] = { 0x3f000fffU, 0x3f001000U, 0x3f001001U, 0U, 0x3f001fffU, 0x3f002000U, 0x3f002001U, 0U, - 0x3f002fffU, 0x3f003000U, 0x3f003001U, 0U, 0x3f003fffU, 0x3f004000U, 0x3f004001U, 0U }; - static const size_t count = sizeof( inData ) / (4*sizeof( inData[0] )); - const float *inp = (const float*) inData; + // Some numbers near 0.5f, that we look at to see how the values are + // rounded. + static const cl_uint inData[4 * 4] = { + 0x3f000fffU, 0x3f001000U, 0x3f001001U, 0U, + 0x3f001fffU, 0x3f002000U, 0x3f002001U, 0U, + 0x3f002fffU, 0x3f003000U, 0x3f003001U, 0U, + 0x3f003fffU, 0x3f004000U, 0x3f004001U, 0U + }; + static const size_t count = sizeof(inData) / (4 * sizeof(inData[0])); + const float *inp = (const float *)inData; cl_context context = NULL; - // Create an input buffer - err = clGetCommandQueueInfo( q, CL_QUEUE_CONTEXT, sizeof(context), &context, NULL ); - if( err ) + // Create an input buffer + err = clGetCommandQueueInfo(q, CL_QUEUE_CONTEXT, sizeof(context), + &context, NULL); + if (err) { - log_error( "Error: could not get context from command queue in DetectFloatToHalfRoundingMode (%d)", err ); + log_error("Error: could not get context from command queue in " + "DetectFloatToHalfRoundingMode (%d)", + err); return err; } - cl_mem inBuf = clCreateBuffer( context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR | CL_MEM_ALLOC_HOST_PTR, sizeof( inData ), (void*) inData, &err ); - if( NULL == inBuf || err ) + cl_mem inBuf = clCreateBuffer(context, + CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR + | CL_MEM_ALLOC_HOST_PTR, + sizeof(inData), (void *)inData, &err); + if (NULL == inBuf || err) { - log_error( "Error: could not create input buffer in DetectFloatToHalfRoundingMode (err: %d)", err ); + log_error("Error: could not create input buffer in " + "DetectFloatToHalfRoundingMode (err: %d)", + err); return err; } - // Create a small output image + // Create a small output image cl_image_format fmt = { CL_RGBA, CL_HALF_FLOAT }; - cl_mem outImage = create_image_2d( context, CL_MEM_WRITE_ONLY, &fmt, count, 1, 0, NULL, &err ); - if( NULL == outImage || err ) + cl_mem outImage = create_image_2d(context, CL_MEM_WRITE_ONLY, &fmt, + count, 1, 0, NULL, &err); + if (NULL == outImage || err) { - log_error( "Error: could not create half float out image in DetectFloatToHalfRoundingMode (err: %d)", err ); - clReleaseMemObject( inBuf ); + log_error("Error: could not create half float out image in " + "DetectFloatToHalfRoundingMode (err: %d)", + err); + clReleaseMemObject(inBuf); return err; } - // Create our program, and a kernel + // Create our program, and a kernel const char *kernel[1] = { - "kernel void detect_round( global float4 *in, write_only image2d_t out )\n" + "kernel void detect_round( global float4 *in, write_only image2d_t " + "out )\n" "{\n" - " write_imagef( out, (int2)(get_global_id(0),0), in[get_global_id(0)] );\n" - "}\n" }; + " write_imagef( out, (int2)(get_global_id(0),0), " + "in[get_global_id(0)] );\n" + "}\n" + }; clProgramWrapper program; - err = create_single_kernel_helper_create_program(context, &program, 1, kernel); + err = create_single_kernel_helper_create_program(context, &program, 1, + kernel); - if( NULL == program || err ) + if (NULL == program || err) { - log_error( "Error: could not create program in DetectFloatToHalfRoundingMode (err: %d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); + log_error("Error: could not create program in " + "DetectFloatToHalfRoundingMode (err: %d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); return err; } cl_device_id device = NULL; - err = clGetCommandQueueInfo( q, CL_QUEUE_DEVICE, sizeof(device), &device, NULL ); - if( err ) + err = clGetCommandQueueInfo(q, CL_QUEUE_DEVICE, sizeof(device), &device, + NULL); + if (err) { - log_error( "Error: could not get device from command queue in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); + log_error("Error: could not get device from command queue in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); return err; } - err = clBuildProgram( program, 1, &device, "", NULL, NULL ); - if( err ) + err = clBuildProgram(program, 1, &device, "", NULL, NULL); + if (err) { - log_error( "Error: could not build program in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); + log_error("Error: could not build program in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); return err; } - cl_kernel k = clCreateKernel( program, "detect_round", &err ); - if( NULL == k || err ) + cl_kernel k = clCreateKernel(program, "detect_round", &err); + if (NULL == k || err) { - log_error( "Error: could not create kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); + log_error("Error: could not create kernel in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); return err; } - err = clSetKernelArg( k, 0, sizeof( cl_mem ), &inBuf ); - if( err ) + err = clSetKernelArg(k, 0, sizeof(cl_mem), &inBuf); + if (err) { - log_error( "Error: could not set argument 0 of kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseKernel( k ); + log_error("Error: could not set argument 0 of kernel in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); + clReleaseKernel(k); return err; } - err = clSetKernelArg( k, 1, sizeof( cl_mem ), &outImage ); - if( err ) + err = clSetKernelArg(k, 1, sizeof(cl_mem), &outImage); + if (err) { - log_error( "Error: could not set argument 1 of kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseKernel( k ); + log_error("Error: could not set argument 1 of kernel in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); + clReleaseKernel(k); return err; } - // Run the kernel + // Run the kernel size_t global_work_size = count; - err = clEnqueueNDRangeKernel( q, k, 1, NULL, &global_work_size, NULL, 0, NULL, NULL ); - if( err ) + err = clEnqueueNDRangeKernel(q, k, 1, NULL, &global_work_size, NULL, 0, + NULL, NULL); + if (err) { - log_error( "Error: could not enqueue kernel in DetectFloatToHalfRoundingMode (%d)", err ); - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseKernel( k ); + log_error("Error: could not enqueue kernel in " + "DetectFloatToHalfRoundingMode (%d)", + err); + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); + clReleaseKernel(k); return err; } @@ -2862,66 +3041,81 @@ int DetectFloatToHalfRoundingMode( cl_command_queue q ) // Returns CL_SUCCESS rtz_ref[i] = cl_half_from_float(inp[i], CL_HALF_RTZ); } - // Verify that we got something in either rtz or rte mode - if( 0 == memcmp( rte_ref, outBuf, sizeof( rte_ref )) ) + // Verify that we got something in either rtz or rte mode + if (0 == memcmp(rte_ref, outBuf, sizeof(rte_ref))) { - log_info( "Autodetected float->half rounding mode to be rte\n" ); + log_info("Autodetected float->half rounding mode to be rte\n"); gFloatToHalfRoundingMode = kRoundToNearestEven; } - else if ( 0 == memcmp( rtz_ref, outBuf, sizeof( rtz_ref )) ) + else if (0 == memcmp(rtz_ref, outBuf, sizeof(rtz_ref))) { - log_info( "Autodetected float->half rounding mode to be rtz\n" ); + log_info("Autodetected float->half rounding mode to be rtz\n"); gFloatToHalfRoundingMode = kRoundTowardZero; } else { - log_error( "ERROR: float to half conversions proceed with invalid rounding mode!\n" ); - log_info( "\nfor:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {%a, %a, %a, %a},", inp[4*i], inp[4*i+1], inp[4*i+2], inp[4*i+3] ); - log_info( "\ngot:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", outBuf[4*i], outBuf[4*i+1], outBuf[4*i+2], outBuf[4*i+3] ); - log_info( "\nrte:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", rte_ref[4*i], rte_ref[4*i+1], rte_ref[4*i+2], rte_ref[4*i+3] ); - log_info( "\nrtz:" ); - for( size_t i = 0; i < count; i++ ) - log_info( " {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", rtz_ref[4*i], rtz_ref[4*i+1], rtz_ref[4*i+2], rtz_ref[4*i+3] ); - log_info( "\n" ); + log_error("ERROR: float to half conversions proceed with invalid " + "rounding mode!\n"); + log_info("\nfor:"); + for (size_t i = 0; i < count; i++) + log_info(" {%a, %a, %a, %a},", inp[4 * i], inp[4 * i + 1], + inp[4 * i + 2], inp[4 * i + 3]); + log_info("\ngot:"); + for (size_t i = 0; i < count; i++) + log_info(" {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", + outBuf[4 * i], outBuf[4 * i + 1], outBuf[4 * i + 2], + outBuf[4 * i + 3]); + log_info("\nrte:"); + for (size_t i = 0; i < count; i++) + log_info(" {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", + rte_ref[4 * i], rte_ref[4 * i + 1], rte_ref[4 * i + 2], + rte_ref[4 * i + 3]); + log_info("\nrtz:"); + for (size_t i = 0; i < count; i++) + log_info(" {0x%4.4x, 0x%4.4x, 0x%4.4x, 0x%4.4x},", + rtz_ref[4 * i], rtz_ref[4 * i + 1], rtz_ref[4 * i + 2], + rtz_ref[4 * i + 3]); + log_info("\n"); err = -1; - gFloatToHalfRoundingMode = kRoundingModeCount; // illegal value + gFloatToHalfRoundingMode = kRoundingModeCount; // illegal value } - // clean up - clReleaseMemObject( inBuf ); - clReleaseMemObject( outImage ); - clReleaseKernel( k ); + // clean up + clReleaseMemObject(inBuf); + clReleaseMemObject(outImage); + clReleaseKernel(k); return err; } - // Make sure that the rounding mode was successfully detected, if we checked earlier - if( gFloatToHalfRoundingMode != kRoundToNearestEven && gFloatToHalfRoundingMode != kRoundTowardZero) + // Make sure that the rounding mode was successfully detected, if we checked + // earlier + if (gFloatToHalfRoundingMode != kRoundToNearestEven + && gFloatToHalfRoundingMode != kRoundTowardZero) return -2; return err; } -char *create_random_image_data( ExplicitType dataType, image_descriptor *imageInfo, BufferOwningPtr &P, MTdata d, bool image2DFromBuffer ) +char *create_random_image_data(ExplicitType dataType, + image_descriptor *imageInfo, + BufferOwningPtr &P, MTdata d, + bool image2DFromBuffer) { - size_t allocSize, numPixels; - if ( /*gTestMipmaps*/ imageInfo->num_mip_levels > 1 ) - { - allocSize = (size_t) (compute_mipmapped_image_size(*imageInfo) * 4 * get_explicit_type_size( dataType ))/get_pixel_size(imageInfo->format); - numPixels = allocSize / (get_explicit_type_size( dataType ) * 4); - } - else - { - numPixels = (image2DFromBuffer? imageInfo->rowPitch: imageInfo->width) * imageInfo->height - * (imageInfo->depth ? imageInfo->depth : 1) - * (imageInfo->arraySize ? imageInfo->arraySize : 1); - allocSize = numPixels * 4 * get_explicit_type_size( dataType ); - } + size_t allocSize, numPixels; + if (/*gTestMipmaps*/ imageInfo->num_mip_levels > 1) + { + allocSize = (size_t)(compute_mipmapped_image_size(*imageInfo) * 4 + * get_explicit_type_size(dataType)) + / get_pixel_size(imageInfo->format); + numPixels = allocSize / (get_explicit_type_size(dataType) * 4); + } + else + { + numPixels = (image2DFromBuffer ? imageInfo->rowPitch : imageInfo->width) + * imageInfo->height * (imageInfo->depth ? imageInfo->depth : 1) + * (imageInfo->arraySize ? imageInfo->arraySize : 1); + allocSize = numPixels * 4 * get_explicit_type_size(dataType); + } #if 0 // DEBUG { @@ -2938,200 +3132,201 @@ char *create_random_image_data( ExplicitType dataType, image_descriptor *imageIn } #endif -#if defined( __APPLE__ ) +#if defined(__APPLE__) char *data = NULL; - if (gDeviceType == CL_DEVICE_TYPE_CPU) { - size_t mapSize = ((allocSize + 4095L) & -4096L) + 8192; // alloc two extra pages. + if (gDeviceType == CL_DEVICE_TYPE_CPU) + { + size_t mapSize = + ((allocSize + 4095L) & -4096L) + 8192; // alloc two extra pages. - void *map = mmap(0, mapSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); - if (map == MAP_FAILED) - { - perror("create_random_image_data: mmap"); - log_error("%s:%d: mmap failed, mapSize = %zu\n",__FILE__,__LINE__,mapSize); - } - intptr_t data_end = (intptr_t)map + mapSize - 4096; - data = (char *)(data_end - (intptr_t)allocSize); + void *map = mmap(0, mapSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); + if (map == MAP_FAILED) + { + perror("create_random_image_data: mmap"); + log_error("%s:%d: mmap failed, mapSize = %zu\n", __FILE__, __LINE__, + mapSize); + } + intptr_t data_end = (intptr_t)map + mapSize - 4096; + data = (char *)(data_end - (intptr_t)allocSize); - mprotect(map, 4096, PROT_NONE); - mprotect((void *)((char *)map + mapSize - 4096), 4096, PROT_NONE); - P.reset(data, map, mapSize); - } else { - data = (char *)malloc(allocSize); - P.reset(data); + mprotect(map, 4096, PROT_NONE); + mprotect((void *)((char *)map + mapSize - 4096), 4096, PROT_NONE); + P.reset(data, map, mapSize); + } + else + { + data = (char *)malloc(allocSize); + P.reset(data); } #else - char *data = - (char *)align_malloc(allocSize, get_pixel_alignment(imageInfo->format)); - P.reset(data, NULL, 0, allocSize, true); + char *data = + (char *)align_malloc(allocSize, get_pixel_alignment(imageInfo->format)); + P.reset(data, NULL, 0, allocSize, true); #endif - if (data == NULL) { - log_error( "ERROR: Unable to malloc %lu bytes for create_random_image_data\n", allocSize ); + if (data == NULL) + { + log_error( + "ERROR: Unable to malloc %lu bytes for create_random_image_data\n", + allocSize); return NULL; } - switch( dataType ) + switch (dataType) { - case kFloat: - { + case kFloat: { float *inputValues = (float *)data; switch (imageInfo->format->image_channel_data_type) { - case CL_HALF_FLOAT: - { - // Generate data that is (mostly) inside the range of a half float - // const float HALF_MIN = 5.96046448e-08f; - const float HALF_MAX = 65504.0f; + case CL_HALF_FLOAT: { + // Generate data that is (mostly) inside the range of a half + // float const float HALF_MIN = 5.96046448e-08f; + const float HALF_MAX = 65504.0f; - size_t i = 0; - inputValues[ i++ ] = 0.f; - inputValues[ i++ ] = 1.f; - inputValues[ i++ ] = -1.f; - inputValues[ i++ ] = 2.f; - for( ; i < numPixels * 4; i++ ) - inputValues[ i ] = get_random_float( -HALF_MAX - 2.f, HALF_MAX + 2.f, d ); - } - break; + size_t i = 0; + inputValues[i++] = 0.f; + inputValues[i++] = 1.f; + inputValues[i++] = -1.f; + inputValues[i++] = 2.f; + for (; i < numPixels * 4; i++) + inputValues[i] = get_random_float(-HALF_MAX - 2.f, + HALF_MAX + 2.f, d); + } + break; #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: + case CL_SFIXED14_APPLE: { + size_t i = 0; + if (numPixels * 4 >= 8) { - size_t i = 0; - if( numPixels * 4 >= 8 ) - { - inputValues[ i++ ] = INFINITY; - inputValues[ i++ ] = 0x1.0p14f; - inputValues[ i++ ] = 0x1.0p31f; - inputValues[ i++ ] = 0x1.0p32f; - inputValues[ i++ ] = -INFINITY; - inputValues[ i++ ] = -0x1.0p14f; - inputValues[ i++ ] = -0x1.0p31f; - inputValues[ i++ ] = -0x1.1p31f; - } - for( ; i < numPixels * 4; i++ ) - inputValues[ i ] = get_random_float( -1.1f, 3.1f, d ); + inputValues[i++] = INFINITY; + inputValues[i++] = 0x1.0p14f; + inputValues[i++] = 0x1.0p31f; + inputValues[i++] = 0x1.0p32f; + inputValues[i++] = -INFINITY; + inputValues[i++] = -0x1.0p14f; + inputValues[i++] = -0x1.0p31f; + inputValues[i++] = -0x1.1p31f; } - break; + for (; i < numPixels * 4; i++) + inputValues[i] = get_random_float(-1.1f, 3.1f, d); + } + break; #endif - case CL_FLOAT: - { - size_t i = 0; - inputValues[ i++ ] = INFINITY; - inputValues[ i++ ] = -INFINITY; - inputValues[ i++ ] = 0.0f; - inputValues[ i++ ] = 0.0f; - cl_uint *p = (cl_uint *)data; - for( ; i < numPixels * 4; i++ ) - p[ i ] = genrand_int32(d); - } - break; + case CL_FLOAT: { + size_t i = 0; + inputValues[i++] = INFINITY; + inputValues[i++] = -INFINITY; + inputValues[i++] = 0.0f; + inputValues[i++] = 0.0f; + cl_uint *p = (cl_uint *)data; + for (; i < numPixels * 4; i++) p[i] = genrand_int32(d); + } + break; default: size_t i = 0; - if( numPixels * 4 >= 36 ) + if (numPixels * 4 >= 36) { - inputValues[ i++ ] = 0.0f; - inputValues[ i++ ] = 0.5f; - inputValues[ i++ ] = 31.5f; - inputValues[ i++ ] = 32.0f; - inputValues[ i++ ] = 127.5f; - inputValues[ i++ ] = 128.0f; - inputValues[ i++ ] = 255.5f; - inputValues[ i++ ] = 256.0f; - inputValues[ i++ ] = 1023.5f; - inputValues[ i++ ] = 1024.0f; - inputValues[ i++ ] = 32767.5f; - inputValues[ i++ ] = 32768.0f; - inputValues[ i++ ] = 65535.5f; - inputValues[ i++ ] = 65536.0f; - inputValues[ i++ ] = 2147483648.0f; - inputValues[ i++ ] = 4294967296.0f; - inputValues[ i++ ] = MAKE_HEX_FLOAT( 0x1.0p63f, 1, 63 ); - inputValues[ i++ ] = MAKE_HEX_FLOAT( 0x1.0p64f, 1, 64 ); - inputValues[ i++ ] = -0.0f; - inputValues[ i++ ] = -0.5f; - inputValues[ i++ ] = -31.5f; - inputValues[ i++ ] = -32.0f; - inputValues[ i++ ] = -127.5f; - inputValues[ i++ ] = -128.0f; - inputValues[ i++ ] = -255.5f; - inputValues[ i++ ] = -256.0f; - inputValues[ i++ ] = -1023.5f; - inputValues[ i++ ] = -1024.0f; - inputValues[ i++ ] = -32767.5f; - inputValues[ i++ ] = -32768.0f; - inputValues[ i++ ] = -65535.5f; - inputValues[ i++ ] = -65536.0f; - inputValues[ i++ ] = -2147483648.0f; - inputValues[ i++ ] = -4294967296.0f; - inputValues[ i++ ] = -MAKE_HEX_FLOAT( 0x1.0p63f, 1, 63 ); - inputValues[ i++ ] = -MAKE_HEX_FLOAT( 0x1.0p64f, 1, 64 ); + inputValues[i++] = 0.0f; + inputValues[i++] = 0.5f; + inputValues[i++] = 31.5f; + inputValues[i++] = 32.0f; + inputValues[i++] = 127.5f; + inputValues[i++] = 128.0f; + inputValues[i++] = 255.5f; + inputValues[i++] = 256.0f; + inputValues[i++] = 1023.5f; + inputValues[i++] = 1024.0f; + inputValues[i++] = 32767.5f; + inputValues[i++] = 32768.0f; + inputValues[i++] = 65535.5f; + inputValues[i++] = 65536.0f; + inputValues[i++] = 2147483648.0f; + inputValues[i++] = 4294967296.0f; + inputValues[i++] = MAKE_HEX_FLOAT(0x1.0p63f, 1, 63); + inputValues[i++] = MAKE_HEX_FLOAT(0x1.0p64f, 1, 64); + inputValues[i++] = -0.0f; + inputValues[i++] = -0.5f; + inputValues[i++] = -31.5f; + inputValues[i++] = -32.0f; + inputValues[i++] = -127.5f; + inputValues[i++] = -128.0f; + inputValues[i++] = -255.5f; + inputValues[i++] = -256.0f; + inputValues[i++] = -1023.5f; + inputValues[i++] = -1024.0f; + inputValues[i++] = -32767.5f; + inputValues[i++] = -32768.0f; + inputValues[i++] = -65535.5f; + inputValues[i++] = -65536.0f; + inputValues[i++] = -2147483648.0f; + inputValues[i++] = -4294967296.0f; + inputValues[i++] = -MAKE_HEX_FLOAT(0x1.0p63f, 1, 63); + inputValues[i++] = -MAKE_HEX_FLOAT(0x1.0p64f, 1, 64); } - if( is_format_signed(imageInfo->format) ) + if (is_format_signed(imageInfo->format)) { - for( ; i < numPixels * 4; i++ ) - inputValues[ i ] = get_random_float( -1.1f, 1.1f, d ); + for (; i < numPixels * 4; i++) + inputValues[i] = get_random_float(-1.1f, 1.1f, d); } else { - for( ; i < numPixels * 4; i++ ) - inputValues[ i ] = get_random_float( -0.1f, 1.1f, d ); + for (; i < numPixels * 4; i++) + inputValues[i] = get_random_float(-0.1f, 1.1f, d); } break; } break; } - case kInt: - { + case kInt: { int *imageData = (int *)data; // We want to generate ints (mostly) in range of the target format - int formatMin = get_format_min_int( imageInfo->format ); - size_t formatMax = get_format_max_int( imageInfo->format ); - if( formatMin == 0 ) + int formatMin = get_format_min_int(imageInfo->format); + size_t formatMax = get_format_max_int(imageInfo->format); + if (formatMin == 0) { - // Unsigned values, but we are only an int, so cap the actual max at the max of signed ints - if( formatMax > 2147483647L ) - formatMax = 2147483647L; + // Unsigned values, but we are only an int, so cap the actual + // max at the max of signed ints + if (formatMax > 2147483647L) formatMax = 2147483647L; } - // If the final format is small enough, give us a bit of room for out-of-range values to test - if( formatMax < 2147483647L ) - formatMax += 2; - if( formatMin > -2147483648LL ) - formatMin -= 2; + // If the final format is small enough, give us a bit of room for + // out-of-range values to test + if (formatMax < 2147483647L) formatMax += 2; + if (formatMin > -2147483648LL) formatMin -= 2; // Now gen - for( size_t i = 0; i < numPixels * 4; i++ ) + for (size_t i = 0; i < numPixels * 4; i++) { - imageData[ i ] = random_in_range( formatMin, (int)formatMax, d ); + imageData[i] = random_in_range(formatMin, (int)formatMax, d); } break; } case kUInt: - case kUnsignedInt: - { + case kUnsignedInt: { unsigned int *imageData = (unsigned int *)data; // We want to generate ints (mostly) in range of the target format - int formatMin = get_format_min_int( imageInfo->format ); - size_t formatMax = get_format_max_int( imageInfo->format ); - if( formatMin < 0 ) - formatMin = 0; - // If the final format is small enough, give us a bit of room for out-of-range values to test - if( formatMax < 4294967295LL ) - formatMax += 2; + int formatMin = get_format_min_int(imageInfo->format); + size_t formatMax = get_format_max_int(imageInfo->format); + if (formatMin < 0) formatMin = 0; + // If the final format is small enough, give us a bit of room for + // out-of-range values to test + if (formatMax < 4294967295LL) formatMax += 2; // Now gen - for( size_t i = 0; i < numPixels * 4; i++ ) + for (size_t i = 0; i < numPixels * 4; i++) { - imageData[ i ] = random_in_range( formatMin, (int)formatMax, d ); + imageData[i] = random_in_range(formatMin, (int)formatMax, d); } break; } default: // Unsupported source format - delete [] data; + delete[] data; return NULL; } @@ -3140,7 +3335,8 @@ char *create_random_image_data( ExplicitType dataType, image_descriptor *imageIn /* deprecated -bool clamp_image_coord( image_sampler_data *imageSampler, float value, size_t max, int &outValue ) +bool clamp_image_coord( image_sampler_data *imageSampler, float value, size_t +max, int &outValue ) { int v = (int)value; @@ -3160,8 +3356,8 @@ bool clamp_image_coord( image_sampler_data *imageSampler, float value, size_t ma return false; case CL_ADDRESS_MIRRORED_REPEAT: - log_info( "ERROR: unimplemented for CL_ADDRESS_MIRRORED_REPEAT. Do we ever use this? - exit(-1); + log_info( "ERROR: unimplemented for CL_ADDRESS_MIRRORED_REPEAT. Do +we ever use this? exit(-1); default: if( v < 0 ) @@ -3181,170 +3377,203 @@ bool clamp_image_coord( image_sampler_data *imageSampler, float value, size_t ma } */ -void get_sampler_kernel_code( image_sampler_data *imageSampler, char *outLine ) +void get_sampler_kernel_code(image_sampler_data *imageSampler, char *outLine) { const char *normalized; const char *addressMode; const char *filterMode; - if( imageSampler->addressing_mode == CL_ADDRESS_CLAMP ) + if (imageSampler->addressing_mode == CL_ADDRESS_CLAMP) addressMode = "CLK_ADDRESS_CLAMP"; - else if( imageSampler->addressing_mode == CL_ADDRESS_CLAMP_TO_EDGE ) + else if (imageSampler->addressing_mode == CL_ADDRESS_CLAMP_TO_EDGE) addressMode = "CLK_ADDRESS_CLAMP_TO_EDGE"; - else if( imageSampler->addressing_mode == CL_ADDRESS_REPEAT ) + else if (imageSampler->addressing_mode == CL_ADDRESS_REPEAT) addressMode = "CLK_ADDRESS_REPEAT"; - else if( imageSampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT ) + else if (imageSampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT) addressMode = "CLK_ADDRESS_MIRRORED_REPEAT"; - else if( imageSampler->addressing_mode == CL_ADDRESS_NONE ) + else if (imageSampler->addressing_mode == CL_ADDRESS_NONE) addressMode = "CLK_ADDRESS_NONE"; else { - log_error( "**Error: Unknown addressing mode! Aborting...\n" ); + log_error("**Error: Unknown addressing mode! Aborting...\n"); abort(); } - if( imageSampler->normalized_coords ) + if (imageSampler->normalized_coords) normalized = "CLK_NORMALIZED_COORDS_TRUE"; else normalized = "CLK_NORMALIZED_COORDS_FALSE"; - if( imageSampler->filter_mode == CL_FILTER_LINEAR ) + if (imageSampler->filter_mode == CL_FILTER_LINEAR) filterMode = "CLK_FILTER_LINEAR"; else filterMode = "CLK_FILTER_NEAREST"; - sprintf( outLine, " const sampler_t imageSampler = %s | %s | %s;\n", addressMode, filterMode, normalized ); + sprintf(outLine, " const sampler_t imageSampler = %s | %s | %s;\n", + addressMode, filterMode, normalized); } -void copy_image_data( image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, void *imageValues, void *destImageValues, - const size_t sourcePos[], const size_t destPos[], const size_t regionSize[] ) +void copy_image_data(image_descriptor *srcImageInfo, + image_descriptor *dstImageInfo, void *imageValues, + void *destImageValues, const size_t sourcePos[], + const size_t destPos[], const size_t regionSize[]) { - // assert( srcImageInfo->format == dstImageInfo->format ); + // assert( srcImageInfo->format == dstImageInfo->format ); - size_t src_mip_level_offset = 0, dst_mip_level_offset = 0; - size_t sourcePos_lod[3], destPos_lod[3], src_lod, dst_lod; - size_t src_row_pitch_lod, src_slice_pitch_lod; - size_t dst_row_pitch_lod, dst_slice_pitch_lod; + size_t src_mip_level_offset = 0, dst_mip_level_offset = 0; + size_t sourcePos_lod[3], destPos_lod[3], src_lod, dst_lod; + size_t src_row_pitch_lod, src_slice_pitch_lod; + size_t dst_row_pitch_lod, dst_slice_pitch_lod; - size_t pixelSize = get_pixel_size( srcImageInfo->format ); + size_t pixelSize = get_pixel_size(srcImageInfo->format); - sourcePos_lod[0] = sourcePos[0]; - sourcePos_lod[1] = sourcePos[1]; - sourcePos_lod[2] = sourcePos[2]; - destPos_lod[0] = destPos[0]; - destPos_lod[1] = destPos[1]; - destPos_lod[2] = destPos[2]; - src_row_pitch_lod = srcImageInfo->rowPitch; - dst_row_pitch_lod = dstImageInfo->rowPitch; - src_slice_pitch_lod = srcImageInfo->slicePitch; - dst_slice_pitch_lod = dstImageInfo->slicePitch; + sourcePos_lod[0] = sourcePos[0]; + sourcePos_lod[1] = sourcePos[1]; + sourcePos_lod[2] = sourcePos[2]; + destPos_lod[0] = destPos[0]; + destPos_lod[1] = destPos[1]; + destPos_lod[2] = destPos[2]; + src_row_pitch_lod = srcImageInfo->rowPitch; + dst_row_pitch_lod = dstImageInfo->rowPitch; + src_slice_pitch_lod = srcImageInfo->slicePitch; + dst_slice_pitch_lod = dstImageInfo->slicePitch; - if( srcImageInfo->num_mip_levels > 1) - { - size_t src_width_lod = 1/*srcImageInfo->width*/; - size_t src_height_lod = 1/*srcImageInfo->height*/; - size_t src_depth_lod = 1/*srcImageInfo->depth*/; - - switch( srcImageInfo->type ) + if (srcImageInfo->num_mip_levels > 1) { - case CL_MEM_OBJECT_IMAGE1D: - src_lod = sourcePos[1]; - sourcePos_lod[1] = sourcePos_lod[2] = 0; - src_width_lod = (srcImageInfo->width >> src_lod ) ? ( srcImageInfo->width >> src_lod ): 1; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE2D: - src_lod = sourcePos[2]; - sourcePos_lod[1] = sourcePos[1]; - sourcePos_lod[2] = 0; - src_width_lod = (srcImageInfo->width >> src_lod ) ? ( srcImageInfo->width >> src_lod ): 1; - if( srcImageInfo->type == CL_MEM_OBJECT_IMAGE2D ) - src_height_lod = (srcImageInfo->height >> src_lod ) ? ( srcImageInfo->height >> src_lod ): 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - case CL_MEM_OBJECT_IMAGE3D: - src_lod = sourcePos[3]; - sourcePos_lod[1] = sourcePos[1]; - sourcePos_lod[2] = sourcePos[2]; - src_width_lod = (srcImageInfo->width >> src_lod ) ? ( srcImageInfo->width >> src_lod ): 1; - src_height_lod = (srcImageInfo->height >> src_lod ) ? ( srcImageInfo->height >> src_lod ): 1; - if( srcImageInfo->type == CL_MEM_OBJECT_IMAGE3D ) - src_depth_lod = (srcImageInfo->depth >> src_lod ) ? ( srcImageInfo->depth >> src_lod ): 1; - break; + size_t src_width_lod = 1 /*srcImageInfo->width*/; + size_t src_height_lod = 1 /*srcImageInfo->height*/; + size_t src_depth_lod = 1 /*srcImageInfo->depth*/; - } - src_mip_level_offset = compute_mip_level_offset( srcImageInfo, src_lod ); - src_row_pitch_lod = src_width_lod * get_pixel_size( srcImageInfo->format ); - src_slice_pitch_lod = src_row_pitch_lod * src_height_lod; - } - - if( dstImageInfo->num_mip_levels > 1) - { - size_t dst_width_lod = 1/*dstImageInfo->width*/; - size_t dst_height_lod = 1/*dstImageInfo->height*/; - size_t dst_depth_lod = 1 /*dstImageInfo->depth*/; - switch( dstImageInfo->type ) - { - case CL_MEM_OBJECT_IMAGE1D: - dst_lod = destPos[1]; - destPos_lod[1] = destPos_lod[2] = 0; - dst_width_lod = (dstImageInfo->width >> dst_lod ) ? ( dstImageInfo->width >> dst_lod ): 1; - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE2D: - dst_lod = destPos[2]; - destPos_lod[1] = destPos[1]; - destPos_lod[2] = 0; - dst_width_lod = (dstImageInfo->width >> dst_lod ) ? ( dstImageInfo->width >> dst_lod ): 1; - if( dstImageInfo->type == CL_MEM_OBJECT_IMAGE2D ) - dst_height_lod = (dstImageInfo->height >> dst_lod ) ? ( dstImageInfo->height >> dst_lod ): 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - case CL_MEM_OBJECT_IMAGE3D: - dst_lod = destPos[3]; - destPos_lod[1] = destPos[1]; - destPos_lod[2] = destPos[2]; - dst_width_lod = (dstImageInfo->width >> dst_lod ) ? ( dstImageInfo->width >> dst_lod ): 1; - dst_height_lod = (dstImageInfo->height >> dst_lod ) ? ( dstImageInfo->height >> dst_lod ): 1; - if( dstImageInfo->type == CL_MEM_OBJECT_IMAGE3D ) - dst_depth_lod = (dstImageInfo->depth >> dst_lod ) ? ( dstImageInfo->depth >> dst_lod ): 1; - break; - - } - dst_mip_level_offset = compute_mip_level_offset( dstImageInfo, dst_lod ); - dst_row_pitch_lod = dst_width_lod * get_pixel_size( dstImageInfo->format); - dst_slice_pitch_lod = dst_row_pitch_lod * dst_height_lod; - } - - // Get initial pointers - char *sourcePtr = (char *)imageValues + sourcePos_lod[ 2 ] * src_slice_pitch_lod + sourcePos_lod[ 1 ] * src_row_pitch_lod + pixelSize * sourcePos_lod[ 0 ] + src_mip_level_offset; - char *destPtr = (char *)destImageValues + destPos_lod[ 2 ] * dst_slice_pitch_lod + destPos_lod[ 1 ] * dst_row_pitch_lod + pixelSize * destPos_lod[ 0 ] + dst_mip_level_offset; - - for( size_t z = 0; z < ( regionSize[ 2 ] > 0 ? regionSize[ 2 ] : 1 ); z++ ) - { - char *rowSourcePtr = sourcePtr; - char *rowDestPtr = destPtr; - for( size_t y = 0; y < regionSize[ 1 ]; y++ ) - { - memcpy( rowDestPtr, rowSourcePtr, pixelSize * regionSize[ 0 ] ); - rowSourcePtr += src_row_pitch_lod; - rowDestPtr += dst_row_pitch_lod; + switch (srcImageInfo->type) + { + case CL_MEM_OBJECT_IMAGE1D: + src_lod = sourcePos[1]; + sourcePos_lod[1] = sourcePos_lod[2] = 0; + src_width_lod = (srcImageInfo->width >> src_lod) + ? (srcImageInfo->width >> src_lod) + : 1; + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + case CL_MEM_OBJECT_IMAGE2D: + src_lod = sourcePos[2]; + sourcePos_lod[1] = sourcePos[1]; + sourcePos_lod[2] = 0; + src_width_lod = (srcImageInfo->width >> src_lod) + ? (srcImageInfo->width >> src_lod) + : 1; + if (srcImageInfo->type == CL_MEM_OBJECT_IMAGE2D) + src_height_lod = (srcImageInfo->height >> src_lod) + ? (srcImageInfo->height >> src_lod) + : 1; + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + case CL_MEM_OBJECT_IMAGE3D: + src_lod = sourcePos[3]; + sourcePos_lod[1] = sourcePos[1]; + sourcePos_lod[2] = sourcePos[2]; + src_width_lod = (srcImageInfo->width >> src_lod) + ? (srcImageInfo->width >> src_lod) + : 1; + src_height_lod = (srcImageInfo->height >> src_lod) + ? (srcImageInfo->height >> src_lod) + : 1; + if (srcImageInfo->type == CL_MEM_OBJECT_IMAGE3D) + src_depth_lod = (srcImageInfo->depth >> src_lod) + ? (srcImageInfo->depth >> src_lod) + : 1; + break; + } + src_mip_level_offset = compute_mip_level_offset(srcImageInfo, src_lod); + src_row_pitch_lod = + src_width_lod * get_pixel_size(srcImageInfo->format); + src_slice_pitch_lod = src_row_pitch_lod * src_height_lod; } - sourcePtr += src_slice_pitch_lod; - destPtr += dst_slice_pitch_lod; - } + if (dstImageInfo->num_mip_levels > 1) + { + size_t dst_width_lod = 1 /*dstImageInfo->width*/; + size_t dst_height_lod = 1 /*dstImageInfo->height*/; + size_t dst_depth_lod = 1 /*dstImageInfo->depth*/; + switch (dstImageInfo->type) + { + case CL_MEM_OBJECT_IMAGE1D: + dst_lod = destPos[1]; + destPos_lod[1] = destPos_lod[2] = 0; + dst_width_lod = (dstImageInfo->width >> dst_lod) + ? (dstImageInfo->width >> dst_lod) + : 1; + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + case CL_MEM_OBJECT_IMAGE2D: + dst_lod = destPos[2]; + destPos_lod[1] = destPos[1]; + destPos_lod[2] = 0; + dst_width_lod = (dstImageInfo->width >> dst_lod) + ? (dstImageInfo->width >> dst_lod) + : 1; + if (dstImageInfo->type == CL_MEM_OBJECT_IMAGE2D) + dst_height_lod = (dstImageInfo->height >> dst_lod) + ? (dstImageInfo->height >> dst_lod) + : 1; + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + case CL_MEM_OBJECT_IMAGE3D: + dst_lod = destPos[3]; + destPos_lod[1] = destPos[1]; + destPos_lod[2] = destPos[2]; + dst_width_lod = (dstImageInfo->width >> dst_lod) + ? (dstImageInfo->width >> dst_lod) + : 1; + dst_height_lod = (dstImageInfo->height >> dst_lod) + ? (dstImageInfo->height >> dst_lod) + : 1; + if (dstImageInfo->type == CL_MEM_OBJECT_IMAGE3D) + dst_depth_lod = (dstImageInfo->depth >> dst_lod) + ? (dstImageInfo->depth >> dst_lod) + : 1; + break; + } + dst_mip_level_offset = compute_mip_level_offset(dstImageInfo, dst_lod); + dst_row_pitch_lod = + dst_width_lod * get_pixel_size(dstImageInfo->format); + dst_slice_pitch_lod = dst_row_pitch_lod * dst_height_lod; + } + + // Get initial pointers + char *sourcePtr = (char *)imageValues + + sourcePos_lod[2] * src_slice_pitch_lod + + sourcePos_lod[1] * src_row_pitch_lod + pixelSize * sourcePos_lod[0] + + src_mip_level_offset; + char *destPtr = (char *)destImageValues + + destPos_lod[2] * dst_slice_pitch_lod + + destPos_lod[1] * dst_row_pitch_lod + pixelSize * destPos_lod[0] + + dst_mip_level_offset; + + for (size_t z = 0; z < (regionSize[2] > 0 ? regionSize[2] : 1); z++) + { + char *rowSourcePtr = sourcePtr; + char *rowDestPtr = destPtr; + for (size_t y = 0; y < regionSize[1]; y++) + { + memcpy(rowDestPtr, rowSourcePtr, pixelSize * regionSize[0]); + rowSourcePtr += src_row_pitch_lod; + rowDestPtr += dst_row_pitch_lod; + } + + sourcePtr += src_slice_pitch_lod; + destPtr += dst_slice_pitch_lod; + } } float random_float(float low, float high, MTdata d) { - float t = (float) genrand_real1(d); + float t = (float)genrand_real1(d); return (1.0f - t) * low + t * high; } -CoordWalker::CoordWalker( void * coords, bool useFloats, size_t vecSize ) +CoordWalker::CoordWalker(void *coords, bool useFloats, size_t vecSize) { - if( useFloats ) + if (useFloats) { mFloatCoords = (cl_float *)coords; mIntCoords = NULL; @@ -3357,106 +3586,126 @@ CoordWalker::CoordWalker( void * coords, bool useFloats, size_t vecSize ) mVecSize = vecSize; } -CoordWalker::~CoordWalker() -{ -} +CoordWalker::~CoordWalker() {} -cl_float CoordWalker::Get( size_t idx, size_t el ) +cl_float CoordWalker::Get(size_t idx, size_t el) { - if( mIntCoords != NULL ) - return (cl_float)mIntCoords[ idx * mVecSize + el ]; + if (mIntCoords != NULL) + return (cl_float)mIntCoords[idx * mVecSize + el]; else - return mFloatCoords[ idx * mVecSize + el ]; + return mFloatCoords[idx * mVecSize + el]; } -void print_read_header( cl_image_format *format, image_sampler_data *sampler, bool err, int t ) +void print_read_header(cl_image_format *format, image_sampler_data *sampler, + bool err, int t) { const char *addressMode = NULL; const char *normalizedNames[2] = { "UNNORMALIZED", "NORMALIZED" }; - if( sampler->addressing_mode == CL_ADDRESS_CLAMP ) + if (sampler->addressing_mode == CL_ADDRESS_CLAMP) addressMode = "CL_ADDRESS_CLAMP"; - else if( sampler->addressing_mode == CL_ADDRESS_CLAMP_TO_EDGE ) + else if (sampler->addressing_mode == CL_ADDRESS_CLAMP_TO_EDGE) addressMode = "CL_ADDRESS_CLAMP_TO_EDGE"; - else if( sampler->addressing_mode == CL_ADDRESS_REPEAT ) + else if (sampler->addressing_mode == CL_ADDRESS_REPEAT) addressMode = "CL_ADDRESS_REPEAT"; - else if( sampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT ) + else if (sampler->addressing_mode == CL_ADDRESS_MIRRORED_REPEAT) addressMode = "CL_ADDRESS_MIRRORED_REPEAT"; else addressMode = "CL_ADDRESS_NONE"; - if( t ) + if (t) { - if( err ) - log_error( "[%-7s %-24s %d] - %s - %s - %s - %s\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ), - sampler->filter_mode == CL_FILTER_NEAREST ? "CL_FILTER_NEAREST" : "CL_FILTER_LINEAR", + if (err) + log_error("[%-7s %-24s %d] - %s - %s - %s - %s\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format), + sampler->filter_mode == CL_FILTER_NEAREST + ? "CL_FILTER_NEAREST" + : "CL_FILTER_LINEAR", addressMode, normalizedNames[sampler->normalized_coords ? 1 : 0], - t == 1 ? "TRANSPOSED" : "NON-TRANSPOSED" ); + t == 1 ? "TRANSPOSED" : "NON-TRANSPOSED"); else - log_info( "[%-7s %-24s %d] - %s - %s - %s - %s\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ), - sampler->filter_mode == CL_FILTER_NEAREST ? "CL_FILTER_NEAREST" : "CL_FILTER_LINEAR", + log_info("[%-7s %-24s %d] - %s - %s - %s - %s\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format), + sampler->filter_mode == CL_FILTER_NEAREST + ? "CL_FILTER_NEAREST" + : "CL_FILTER_LINEAR", addressMode, normalizedNames[sampler->normalized_coords ? 1 : 0], - t == 1 ? "TRANSPOSED" : "NON-TRANSPOSED" ); + t == 1 ? "TRANSPOSED" : "NON-TRANSPOSED"); } else { - if( err ) - log_error( "[%-7s %-24s %d] - %s - %s - %s\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ), - sampler->filter_mode == CL_FILTER_NEAREST ? "CL_FILTER_NEAREST" : "CL_FILTER_LINEAR", + if (err) + log_error("[%-7s %-24s %d] - %s - %s - %s\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format), + sampler->filter_mode == CL_FILTER_NEAREST + ? "CL_FILTER_NEAREST" + : "CL_FILTER_LINEAR", addressMode, - normalizedNames[sampler->normalized_coords ? 1 : 0] ); + normalizedNames[sampler->normalized_coords ? 1 : 0]); else - log_info( "[%-7s %-24s %d] - %s - %s - %s\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ), - sampler->filter_mode == CL_FILTER_NEAREST ? "CL_FILTER_NEAREST" : "CL_FILTER_LINEAR", + log_info("[%-7s %-24s %d] - %s - %s - %s\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format), + sampler->filter_mode == CL_FILTER_NEAREST + ? "CL_FILTER_NEAREST" + : "CL_FILTER_LINEAR", addressMode, - normalizedNames[sampler->normalized_coords ? 1 : 0] ); + normalizedNames[sampler->normalized_coords ? 1 : 0]); } - } -void print_write_header( cl_image_format *format, bool err = false) +void print_write_header(cl_image_format *format, bool err = false) { - if( err ) - log_error( "[%-7s %-24s %d]\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ) ); + if (err) + log_error("[%-7s %-24s %d]\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format)); else - log_info( "[%-7s %-24s %d]\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ) ); + log_info("[%-7s %-24s %d]\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format)); } -void print_header( cl_image_format *format, bool err = false ) +void print_header(cl_image_format *format, bool err = false) { - if (err) { - log_error( "[%-7s %-24s %d]\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ) ); - } else { - log_info( "[%-7s %-24s %d]\n", GetChannelOrderName( format->image_channel_order ), - GetChannelTypeName( format->image_channel_data_type ), - (int)get_format_channel_count( format ) ); + if (err) + { + log_error("[%-7s %-24s %d]\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format)); + } + else + { + log_info("[%-7s %-24s %d]\n", + GetChannelOrderName(format->image_channel_order), + GetChannelTypeName(format->image_channel_data_type), + (int)get_format_channel_count(format)); } } -bool find_format( cl_image_format *formatList, unsigned int numFormats, cl_image_format *formatToFind ) +bool find_format(cl_image_format *formatList, unsigned int numFormats, + cl_image_format *formatToFind) { - for( unsigned int i = 0; i < numFormats; i++ ) + for (unsigned int i = 0; i < numFormats; i++) { - if( formatList[ i ].image_channel_order == formatToFind->image_channel_order && - formatList[ i ].image_channel_data_type == formatToFind->image_channel_data_type ) + if (formatList[i].image_channel_order + == formatToFind->image_channel_order + && formatList[i].image_channel_data_type + == formatToFind->image_channel_data_type) return true; } return false; @@ -3657,131 +3906,138 @@ void build_required_image_formats( } } -bool is_image_format_required(cl_image_format format, - cl_mem_flags flags, +bool is_image_format_required(cl_image_format format, cl_mem_flags flags, cl_mem_object_type image_type, cl_device_id device) { - std::vector formatsToSupport; - build_required_image_formats(flags, image_type, device, formatsToSupport); + std::vector formatsToSupport; + build_required_image_formats(flags, image_type, device, formatsToSupport); - for (auto &formatItr: formatsToSupport) - { - if (formatItr.image_channel_order == format.image_channel_order && - formatItr.image_channel_data_type == format.image_channel_data_type) - { - return true; - } - } + for (auto &formatItr : formatsToSupport) + { + if (formatItr.image_channel_order == format.image_channel_order + && formatItr.image_channel_data_type + == format.image_channel_data_type) + { + return true; + } + } - return false; + return false; } -cl_uint compute_max_mip_levels( size_t width, size_t height, size_t depth) +cl_uint compute_max_mip_levels(size_t width, size_t height, size_t depth) { - cl_uint retMaxMipLevels=0, max_dim = 0; + cl_uint retMaxMipLevels = 0, max_dim = 0; - max_dim = width; - max_dim = height > max_dim ? height : max_dim; - max_dim = depth > max_dim ? depth : max_dim; + max_dim = width; + max_dim = height > max_dim ? height : max_dim; + max_dim = depth > max_dim ? depth : max_dim; - while(max_dim) { - retMaxMipLevels++; - max_dim >>= 1; - } - return retMaxMipLevels; + while (max_dim) + { + retMaxMipLevels++; + max_dim >>= 1; + } + return retMaxMipLevels; } -cl_ulong compute_mipmapped_image_size( image_descriptor imageInfo) +cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo) { - cl_ulong retSize = 0; - size_t curr_width, curr_height, curr_depth, curr_array_size; - curr_width = imageInfo.width; - curr_height = imageInfo.height; - curr_depth = imageInfo.depth; - curr_array_size = imageInfo.arraySize; + cl_ulong retSize = 0; + size_t curr_width, curr_height, curr_depth, curr_array_size; + curr_width = imageInfo.width; + curr_height = imageInfo.height; + curr_depth = imageInfo.depth; + curr_array_size = imageInfo.arraySize; - for (int i=0; i < (int) imageInfo.num_mip_levels; i++) - { - switch ( imageInfo.type ) + for (int i = 0; i < (int)imageInfo.num_mip_levels; i++) { - case CL_MEM_OBJECT_IMAGE3D : - retSize += (cl_ulong)curr_width * curr_height * curr_depth * get_pixel_size(imageInfo.format); - break; - case CL_MEM_OBJECT_IMAGE2D : - retSize += (cl_ulong)curr_width * curr_height * get_pixel_size(imageInfo.format); - break; - case CL_MEM_OBJECT_IMAGE1D : - retSize += (cl_ulong)curr_width * get_pixel_size(imageInfo.format); - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY : - retSize += (cl_ulong)curr_width * curr_array_size * get_pixel_size(imageInfo.format); - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY : - retSize += (cl_ulong)curr_width * curr_height * curr_array_size * get_pixel_size(imageInfo.format); - break; + switch (imageInfo.type) + { + case CL_MEM_OBJECT_IMAGE3D: + retSize += (cl_ulong)curr_width * curr_height * curr_depth + * get_pixel_size(imageInfo.format); + break; + case CL_MEM_OBJECT_IMAGE2D: + retSize += (cl_ulong)curr_width * curr_height + * get_pixel_size(imageInfo.format); + break; + case CL_MEM_OBJECT_IMAGE1D: + retSize += + (cl_ulong)curr_width * get_pixel_size(imageInfo.format); + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + retSize += (cl_ulong)curr_width * curr_array_size + * get_pixel_size(imageInfo.format); + break; + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + retSize += (cl_ulong)curr_width * curr_height * curr_array_size + * get_pixel_size(imageInfo.format); + break; + } + + switch (imageInfo.type) + { + case CL_MEM_OBJECT_IMAGE3D: + curr_depth = curr_depth >> 1 ? curr_depth >> 1 : 1; + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + curr_height = curr_height >> 1 ? curr_height >> 1 : 1; + case CL_MEM_OBJECT_IMAGE1D: + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + curr_width = curr_width >> 1 ? curr_width >> 1 : 1; + } } - switch ( imageInfo.type ) - { - case CL_MEM_OBJECT_IMAGE3D : - curr_depth = curr_depth >> 1 ? curr_depth >> 1: 1; - case CL_MEM_OBJECT_IMAGE2D : - case CL_MEM_OBJECT_IMAGE2D_ARRAY : - curr_height = curr_height >> 1? curr_height >> 1 : 1; - case CL_MEM_OBJECT_IMAGE1D : - case CL_MEM_OBJECT_IMAGE1D_ARRAY : - curr_width = curr_width >> 1? curr_width >> 1 : 1; - } - } - - return retSize; + return retSize; } -size_t compute_mip_level_offset( image_descriptor * imageInfo , size_t lod) +size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod) { - size_t retOffset = 0; - size_t width, height, depth; - width = imageInfo->width; - height = imageInfo->height; - depth = imageInfo->depth; + size_t retOffset = 0; + size_t width, height, depth; + width = imageInfo->width; + height = imageInfo->height; + depth = imageInfo->depth; - for(size_t i=0; i < lod; i++) - { - switch(imageInfo->type) + for (size_t i = 0; i < lod; i++) { - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - retOffset += (size_t) width * height * imageInfo->arraySize * get_pixel_size( imageInfo->format ); - break; - case CL_MEM_OBJECT_IMAGE3D: - retOffset += (size_t) width * height * depth * get_pixel_size( imageInfo->format ); - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - retOffset += (size_t) width * imageInfo->arraySize * get_pixel_size( imageInfo->format ); - break; - case CL_MEM_OBJECT_IMAGE2D: - retOffset += (size_t) width * height * get_pixel_size( imageInfo->format ); - break; - case CL_MEM_OBJECT_IMAGE1D: - retOffset += (size_t) width * get_pixel_size( imageInfo->format ); - break; - } + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + retOffset += (size_t)width * height * imageInfo->arraySize + * get_pixel_size(imageInfo->format); + break; + case CL_MEM_OBJECT_IMAGE3D: + retOffset += (size_t)width * height * depth + * get_pixel_size(imageInfo->format); + break; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + retOffset += (size_t)width * imageInfo->arraySize + * get_pixel_size(imageInfo->format); + break; + case CL_MEM_OBJECT_IMAGE2D: + retOffset += + (size_t)width * height * get_pixel_size(imageInfo->format); + break; + case CL_MEM_OBJECT_IMAGE1D: + retOffset += (size_t)width * get_pixel_size(imageInfo->format); + break; + } - // Compute next lod dimensions - switch(imageInfo->type) - { - case CL_MEM_OBJECT_IMAGE3D: - depth = ( depth >> 1 ) ? ( depth >> 1 ) : 1; - case CL_MEM_OBJECT_IMAGE2D: - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - height = ( height >> 1 ) ? ( height >> 1 ) : 1; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - case CL_MEM_OBJECT_IMAGE1D: - width = ( width >> 1 ) ? ( width >> 1 ) : 1; + // Compute next lod dimensions + switch (imageInfo->type) + { + case CL_MEM_OBJECT_IMAGE3D: depth = (depth >> 1) ? (depth >> 1) : 1; + case CL_MEM_OBJECT_IMAGE2D: + case CL_MEM_OBJECT_IMAGE2D_ARRAY: + height = (height >> 1) ? (height >> 1) : 1; + case CL_MEM_OBJECT_IMAGE1D_ARRAY: + case CL_MEM_OBJECT_IMAGE1D: width = (width >> 1) ? (width >> 1) : 1; + } } - - } - return retOffset; + return retOffset; } const char *convert_image_type_to_string(cl_mem_object_type image_type) diff --git a/test_common/harness/imageHelpers.h b/test_common/harness/imageHelpers.h index ca335d7d..87595094 100644 --- a/test_common/harness/imageHelpers.h +++ b/test_common/harness/imageHelpers.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 @@ -46,7 +46,8 @@ extern cl_device_type gDeviceType; extern bool gTestRounding; -// Number of iterations per image format to test if not testing max images, rounding, or small images +// Number of iterations per image format to test if not testing max images, +// rounding, or small images #define NUM_IMAGE_ITERATIONS 3 @@ -55,51 +56,64 @@ extern bool gTestRounding; #define MAX_lRGB_TO_sRGB_CONVERSION_ERROR 0.6 // Definition for our own sampler type, to mirror the cl_sampler internals -typedef struct { - cl_addressing_mode addressing_mode; - cl_filter_mode filter_mode; - bool normalized_coords; +typedef struct +{ + cl_addressing_mode addressing_mode; + cl_filter_mode filter_mode; + bool normalized_coords; } image_sampler_data; -int round_to_even( float v ); +int round_to_even(float v); -#define NORMALIZE( v, max ) ( v < 0 ? 0 : ( v > 1.f ? max : round_to_even( v * max ) ) ) -#define NORMALIZE_UNROUNDED( v, max ) ( v < 0 ? 0 : ( v > 1.f ? max : v * max ) ) -#define NORMALIZE_SIGNED( v, min, max ) ( v < -1.0f ? min : ( v > 1.f ? max : round_to_even( v * max ) ) ) -#define NORMALIZE_SIGNED_UNROUNDED( v, min, max ) ( v < -1.0f ? min : ( v > 1.f ? max : v * max ) ) -#define CONVERT_INT( v, min, max, max_val) ( v < min ? min : ( v > max ? max_val : round_to_even( v ) ) ) -#define CONVERT_UINT( v, max, max_val) ( v < 0 ? 0 : ( v > max ? max_val : round_to_even( v ) ) ) +#define NORMALIZE(v, max) (v < 0 ? 0 : (v > 1.f ? max : round_to_even(v * max))) +#define NORMALIZE_UNROUNDED(v, max) (v < 0 ? 0 : (v > 1.f ? max : v * max)) +#define NORMALIZE_SIGNED(v, min, max) \ + (v < -1.0f ? min : (v > 1.f ? max : round_to_even(v * max))) +#define NORMALIZE_SIGNED_UNROUNDED(v, min, max) \ + (v < -1.0f ? min : (v > 1.f ? max : v * max)) +#define CONVERT_INT(v, min, max, max_val) \ + (v < min ? min : (v > max ? max_val : round_to_even(v))) +#define CONVERT_UINT(v, max, max_val) \ + (v < 0 ? 0 : (v > max ? max_val : round_to_even(v))) -extern void print_read_header( cl_image_format *format, image_sampler_data *sampler, bool err = false, int t = 0 ); -extern void print_write_header( cl_image_format *format, bool err); -extern void print_header( cl_image_format *format, bool err ); -extern bool find_format( cl_image_format *formatList, unsigned int numFormats, cl_image_format *formatToFind ); -extern bool is_image_format_required(cl_image_format format, - cl_mem_flags flags, +extern void print_read_header(cl_image_format *format, + image_sampler_data *sampler, bool err = false, + int t = 0); +extern void print_write_header(cl_image_format *format, bool err); +extern void print_header(cl_image_format *format, bool err); +extern bool find_format(cl_image_format *formatList, unsigned int numFormats, + cl_image_format *formatToFind); +extern bool is_image_format_required(cl_image_format format, cl_mem_flags flags, cl_mem_object_type image_type, cl_device_id device); -extern void build_required_image_formats(cl_mem_flags flags, - cl_mem_object_type image_type, - cl_device_id device, - std::vector& formatsToSupport); +extern void +build_required_image_formats(cl_mem_flags flags, cl_mem_object_type image_type, + cl_device_id device, + std::vector &formatsToSupport); extern uint32_t get_format_type_size(const cl_image_format *format); extern uint32_t get_channel_data_type_size(cl_channel_type channelType); extern uint32_t get_format_channel_count(const cl_image_format *format); extern uint32_t get_channel_order_channel_count(cl_channel_order order); -cl_channel_type get_channel_type_from_name( const char *name ); -cl_channel_order get_channel_order_from_name( const char *name ); -extern int is_format_signed( const cl_image_format *format ); +cl_channel_type get_channel_type_from_name(const char *name); +cl_channel_order get_channel_order_from_name(const char *name); +extern int is_format_signed(const cl_image_format *format); extern uint32_t get_pixel_size(cl_image_format *format); /* Helper to get any ol image format as long as it is 8-bits-per-channel */ -extern int get_8_bit_image_format( cl_context context, cl_mem_object_type objType, cl_mem_flags flags, size_t channelCount, cl_image_format *outFormat ); +extern int get_8_bit_image_format(cl_context context, + cl_mem_object_type objType, + cl_mem_flags flags, size_t channelCount, + cl_image_format *outFormat); /* Helper to get any ol image format as long as it is 32-bits-per-channel */ -extern int get_32_bit_image_format( cl_context context, cl_mem_object_type objType, cl_mem_flags flags, size_t channelCount, cl_image_format *outFormat ); +extern int get_32_bit_image_format(cl_context context, + cl_mem_object_type objType, + cl_mem_flags flags, size_t channelCount, + cl_image_format *outFormat); -int random_in_range( int minV, int maxV, MTdata d ); -int random_log_in_range( int minV, int maxV, MTdata d ); +int random_in_range(int minV, int maxV, MTdata d); +int random_log_in_range(int minV, int maxV, MTdata d); typedef struct { @@ -118,81 +132,110 @@ typedef struct typedef struct { float p[4]; -}FloatPixel; +} FloatPixel; void get_max_sizes(size_t *numberOfSizes, const int maxNumberOfSizes, - size_t sizes[][3], size_t maxWidth, size_t maxHeight, size_t maxDepth, size_t maxArraySize, - const cl_ulong maxIndividualAllocSize, const cl_ulong maxTotalAllocSize, cl_mem_object_type image_type, cl_image_format *format, int usingMaxPixelSize=0); -extern size_t get_format_max_int( cl_image_format *format ); + size_t sizes[][3], size_t maxWidth, size_t maxHeight, + size_t maxDepth, size_t maxArraySize, + const cl_ulong maxIndividualAllocSize, + const cl_ulong maxTotalAllocSize, + cl_mem_object_type image_type, cl_image_format *format, + int usingMaxPixelSize = 0); +extern size_t get_format_max_int(cl_image_format *format); -extern cl_ulong get_image_size( image_descriptor const *imageInfo ); -extern cl_ulong get_image_size_mb( image_descriptor const *imageInfo ); +extern cl_ulong get_image_size(image_descriptor const *imageInfo); +extern cl_ulong get_image_size_mb(image_descriptor const *imageInfo); -extern char * generate_random_image_data( image_descriptor *imageInfo, BufferOwningPtr &Owner, MTdata d ); +extern char *generate_random_image_data(image_descriptor *imageInfo, + BufferOwningPtr &Owner, MTdata d); -extern int debug_find_vector_in_image( void *imagePtr, image_descriptor *imageInfo, - void *vectorToFind, size_t vectorSize, int *outX, int *outY, int *outZ, size_t lod = 0 ); +extern int debug_find_vector_in_image(void *imagePtr, + image_descriptor *imageInfo, + void *vectorToFind, size_t vectorSize, + int *outX, int *outY, int *outZ, + size_t lod = 0); -extern int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - unsigned int *valuesToFind, int *outX, int *outY, int *outZ, int lod = 0 ); -extern int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - int *valuesToFind, int *outX, int *outY, int *outZ, int lod = 0 ); -extern int debug_find_pixel_in_image( void *imagePtr, image_descriptor *imageInfo, - float *valuesToFind, int *outX, int *outY, int *outZ, int lod = 0 ); +extern int debug_find_pixel_in_image(void *imagePtr, + image_descriptor *imageInfo, + unsigned int *valuesToFind, int *outX, + int *outY, int *outZ, int lod = 0); +extern int debug_find_pixel_in_image(void *imagePtr, + image_descriptor *imageInfo, + int *valuesToFind, int *outX, int *outY, + int *outZ, int lod = 0); +extern int debug_find_pixel_in_image(void *imagePtr, + image_descriptor *imageInfo, + float *valuesToFind, int *outX, int *outY, + int *outZ, int lod = 0); -extern void copy_image_data( image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, void *imageValues, void *destImageValues, - const size_t sourcePos[], const size_t destPos[], const size_t regionSize[] ); +extern void copy_image_data(image_descriptor *srcImageInfo, + image_descriptor *dstImageInfo, void *imageValues, + void *destImageValues, const size_t sourcePos[], + const size_t destPos[], const size_t regionSize[]); int has_alpha(cl_image_format *format); extern bool is_sRGBA_order(cl_channel_order image_channel_order); -inline float calculate_array_index( float coord, float extent ); +inline float calculate_array_index(float coord, float extent); -cl_uint compute_max_mip_levels( size_t width, size_t height, size_t depth); -cl_ulong compute_mipmapped_image_size( image_descriptor imageInfo); -size_t compute_mip_level_offset( image_descriptor * imageInfo , size_t lod); +cl_uint compute_max_mip_levels(size_t width, size_t height, size_t depth); +cl_ulong compute_mipmapped_image_size(image_descriptor imageInfo); +size_t compute_mip_level_offset(image_descriptor *imageInfo, size_t lod); -template void read_image_pixel( void *imageData, image_descriptor *imageInfo, - int x, int y, int z, T *outData, int lod ) +template +void read_image_pixel(void *imageData, image_descriptor *imageInfo, int x, + int y, int z, T *outData, int lod) { - size_t width_lod = imageInfo->width, height_lod = imageInfo->height, depth_lod = imageInfo->depth, slice_pitch_lod = 0/*imageInfo->slicePitch*/ , row_pitch_lod = 0/*imageInfo->rowPitch*/; - width_lod = ( imageInfo->width >> lod) ?( imageInfo->width >> lod):1; + size_t width_lod = imageInfo->width, height_lod = imageInfo->height, + depth_lod = imageInfo->depth, + slice_pitch_lod = 0 /*imageInfo->slicePitch*/, + row_pitch_lod = 0 /*imageInfo->rowPitch*/; + width_lod = (imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1; - if ( imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY && imageInfo->type != CL_MEM_OBJECT_IMAGE1D) - height_lod = ( imageInfo->height >> lod) ?( imageInfo->height >> lod):1; + if (imageInfo->type != CL_MEM_OBJECT_IMAGE1D_ARRAY + && imageInfo->type != CL_MEM_OBJECT_IMAGE1D) + height_lod = + (imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1; - if(imageInfo->type == CL_MEM_OBJECT_IMAGE3D) - depth_lod = ( imageInfo->depth >> lod) ? ( imageInfo->depth >> lod) : 1; - row_pitch_lod = (imageInfo->num_mip_levels > 0)? (width_lod * get_pixel_size( imageInfo->format )): imageInfo->rowPitch; - slice_pitch_lod = (imageInfo->num_mip_levels > 0)? (row_pitch_lod * height_lod): imageInfo->slicePitch; + if (imageInfo->type == CL_MEM_OBJECT_IMAGE3D) + depth_lod = (imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1; + row_pitch_lod = (imageInfo->num_mip_levels > 0) + ? (width_lod * get_pixel_size(imageInfo->format)) + : imageInfo->rowPitch; + slice_pitch_lod = (imageInfo->num_mip_levels > 0) + ? (row_pitch_lod * height_lod) + : imageInfo->slicePitch; // correct depth_lod and height_lod for array image types in order to avoid // return - if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY && height_lod == 1 && depth_lod == 1) { - depth_lod = 0; - height_lod = 0; - + if (imageInfo->type == CL_MEM_OBJECT_IMAGE1D_ARRAY && height_lod == 1 + && depth_lod == 1) + { + depth_lod = 0; + height_lod = 0; } - if (imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY && depth_lod == 1) { - depth_lod = 0; + if (imageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY && depth_lod == 1) + { + depth_lod = 0; } - if ( x < 0 || x >= (int)width_lod - || ( height_lod != 0 && ( y < 0 || y >= (int)height_lod ) ) - || ( depth_lod != 0 && ( z < 0 || z >= (int)depth_lod ) ) - || ( imageInfo->arraySize != 0 && ( z < 0 || z >= (int)imageInfo->arraySize ) ) ) + if (x < 0 || x >= (int)width_lod + || (height_lod != 0 && (y < 0 || y >= (int)height_lod)) + || (depth_lod != 0 && (z < 0 || z >= (int)depth_lod)) + || (imageInfo->arraySize != 0 + && (z < 0 || z >= (int)imageInfo->arraySize))) { // Border color if (imageInfo->format->image_channel_order == CL_DEPTH) { - outData[ 0 ] = 1; + outData[0] = 1; } - else { - outData[ 0 ] = outData[ 1 ] = outData[ 2 ] = outData[ 3 ] = 0; - if (!has_alpha(imageInfo->format)) - outData[3] = 1; + else + { + outData[0] = outData[1] = outData[2] = outData[3] = 0; + if (!has_alpha(imageInfo->format)) outData[3] = 1; } return; } @@ -200,78 +243,70 @@ template void read_image_pixel( void *imageData, image_descriptor *ima cl_image_format *format = imageInfo->format; unsigned int i; - T tempData[ 4 ]; + T tempData[4]; // Advance to the right spot char *ptr = (char *)imageData; - size_t pixelSize = get_pixel_size( format ); + size_t pixelSize = get_pixel_size(format); ptr += z * slice_pitch_lod + y * row_pitch_lod + x * pixelSize; // OpenCL only supports reading floats from certain formats - switch( format->image_channel_data_type ) + switch (format->image_channel_data_type) { - case CL_SNORM_INT8: - { + case CL_SNORM_INT8: { cl_char *dPtr = (cl_char *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNORM_INT8: - { + case CL_UNORM_INT8: { cl_uchar *dPtr = (cl_uchar *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_SIGNED_INT8: - { + case CL_SIGNED_INT8: { cl_char *dPtr = (cl_char *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNSIGNED_INT8: - { - cl_uchar *dPtr = (cl_uchar*)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + case CL_UNSIGNED_INT8: { + cl_uchar *dPtr = (cl_uchar *)ptr; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_SNORM_INT16: - { + case CL_SNORM_INT16: { cl_short *dPtr = (cl_short *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNORM_INT16: - { + case CL_UNORM_INT16: { cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_SIGNED_INT16: - { + case CL_SIGNED_INT16: { cl_short *dPtr = (cl_short *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNSIGNED_INT16: - { + case CL_UNSIGNED_INT16: { cl_ushort *dPtr = (cl_ushort *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } @@ -282,210 +317,202 @@ template void read_image_pixel( void *imageData, image_descriptor *ima break; } - case CL_SIGNED_INT32: - { + case CL_SIGNED_INT32: { cl_int *dPtr = (cl_int *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNSIGNED_INT32: - { + case CL_UNSIGNED_INT32: { cl_uint *dPtr = (cl_uint *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } - case CL_UNORM_SHORT_565: - { - cl_ushort *dPtr = (cl_ushort*)ptr; - tempData[ 0 ] = (T)( dPtr[ 0 ] >> 11 ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 5 ) & 63 ); - tempData[ 2 ] = (T)( dPtr[ 0 ] & 31 ); + case CL_UNORM_SHORT_565: { + cl_ushort *dPtr = (cl_ushort *)ptr; + tempData[0] = (T)(dPtr[0] >> 11); + tempData[1] = (T)((dPtr[0] >> 5) & 63); + tempData[2] = (T)(dPtr[0] & 31); break; } #ifdef OBSOLETE_FORMAT - case CL_UNORM_SHORT_565_REV: - { + case CL_UNORM_SHORT_565_REV: { unsigned short *dPtr = (unsigned short *)ptr; - tempData[ 2 ] = (T)( dPtr[ 0 ] >> 11 ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 5 ) & 63 ); - tempData[ 0 ] = (T)( dPtr[ 0 ] & 31 ); + tempData[2] = (T)(dPtr[0] >> 11); + tempData[1] = (T)((dPtr[0] >> 5) & 63); + tempData[0] = (T)(dPtr[0] & 31); break; } - case CL_UNORM_SHORT_555_REV: - { + case CL_UNORM_SHORT_555_REV: { unsigned short *dPtr = (unsigned short *)ptr; - tempData[ 2 ] = (T)( ( dPtr[ 0 ] >> 10 ) & 31 ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 5 ) & 31 ); - tempData[ 0 ] = (T)( dPtr[ 0 ] & 31 ); + tempData[2] = (T)((dPtr[0] >> 10) & 31); + tempData[1] = (T)((dPtr[0] >> 5) & 31); + tempData[0] = (T)(dPtr[0] & 31); break; } - case CL_UNORM_INT_8888: - { + case CL_UNORM_INT_8888: { unsigned int *dPtr = (unsigned int *)ptr; - tempData[ 3 ] = (T)( dPtr[ 0 ] >> 24 ); - tempData[ 2 ] = (T)( ( dPtr[ 0 ] >> 16 ) & 0xff ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 8 ) & 0xff ); - tempData[ 0 ] = (T)( dPtr[ 0 ] & 0xff ); + tempData[3] = (T)(dPtr[0] >> 24); + tempData[2] = (T)((dPtr[0] >> 16) & 0xff); + tempData[1] = (T)((dPtr[0] >> 8) & 0xff); + tempData[0] = (T)(dPtr[0] & 0xff); break; } - case CL_UNORM_INT_8888_REV: - { + case CL_UNORM_INT_8888_REV: { unsigned int *dPtr = (unsigned int *)ptr; - tempData[ 0 ] = (T)( dPtr[ 0 ] >> 24 ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 16 ) & 0xff ); - tempData[ 2 ] = (T)( ( dPtr[ 0 ] >> 8 ) & 0xff ); - tempData[ 3 ] = (T)( dPtr[ 0 ] & 0xff ); + tempData[0] = (T)(dPtr[0] >> 24); + tempData[1] = (T)((dPtr[0] >> 16) & 0xff); + tempData[2] = (T)((dPtr[0] >> 8) & 0xff); + tempData[3] = (T)(dPtr[0] & 0xff); break; } - case CL_UNORM_INT_101010_REV: - { + case CL_UNORM_INT_101010_REV: { unsigned int *dPtr = (unsigned int *)ptr; - tempData[ 2 ] = (T)( ( dPtr[ 0 ] >> 20 ) & 0x3ff ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 10 ) & 0x3ff ); - tempData[ 0 ] = (T)( dPtr[ 0 ] & 0x3ff ); + tempData[2] = (T)((dPtr[0] >> 20) & 0x3ff); + tempData[1] = (T)((dPtr[0] >> 10) & 0x3ff); + tempData[0] = (T)(dPtr[0] & 0x3ff); break; } #endif - case CL_UNORM_SHORT_555: - { + case CL_UNORM_SHORT_555: { cl_ushort *dPtr = (cl_ushort *)ptr; - tempData[ 0 ] = (T)( ( dPtr[ 0 ] >> 10 ) & 31 ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 5 ) & 31 ); - tempData[ 2 ] = (T)( dPtr[ 0 ] & 31 ); + tempData[0] = (T)((dPtr[0] >> 10) & 31); + tempData[1] = (T)((dPtr[0] >> 5) & 31); + tempData[2] = (T)(dPtr[0] & 31); break; } - case CL_UNORM_INT_101010: - { + case CL_UNORM_INT_101010: { cl_uint *dPtr = (cl_uint *)ptr; - tempData[ 0 ] = (T)( ( dPtr[ 0 ] >> 20 ) & 0x3ff ); - tempData[ 1 ] = (T)( ( dPtr[ 0 ] >> 10 ) & 0x3ff ); - tempData[ 2 ] = (T)( dPtr[ 0 ] & 0x3ff ); + tempData[0] = (T)((dPtr[0] >> 20) & 0x3ff); + tempData[1] = (T)((dPtr[0] >> 10) & 0x3ff); + tempData[2] = (T)(dPtr[0] & 0x3ff); break; } - case CL_FLOAT: - { + case CL_FLOAT: { cl_float *dPtr = (cl_float *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ]; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i]; break; } #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: - { + case CL_SFIXED14_APPLE: { cl_float *dPtr = (cl_float *)ptr; - for( i = 0; i < get_format_channel_count( format ); i++ ) - tempData[ i ] = (T)dPtr[ i ] + 0x4000; + for (i = 0; i < get_format_channel_count(format); i++) + tempData[i] = (T)dPtr[i] + 0x4000; break; } #endif } - outData[ 0 ] = outData[ 1 ] = outData[ 2 ] = 0; - outData[ 3 ] = 1; + outData[0] = outData[1] = outData[2] = 0; + outData[3] = 1; - if( format->image_channel_order == CL_A ) + if (format->image_channel_order == CL_A) { - outData[ 3 ] = tempData[ 0 ]; + outData[3] = tempData[0]; } - else if( format->image_channel_order == CL_R ) + else if (format->image_channel_order == CL_R) { - outData[ 0 ] = tempData[ 0 ]; + outData[0] = tempData[0]; } - else if( format->image_channel_order == CL_Rx ) + else if (format->image_channel_order == CL_Rx) { - outData[ 0 ] = tempData[ 0 ]; + outData[0] = tempData[0]; } - else if( format->image_channel_order == CL_RA ) + else if (format->image_channel_order == CL_RA) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 1 ]; + outData[0] = tempData[0]; + outData[3] = tempData[1]; } - else if( format->image_channel_order == CL_RG ) + else if (format->image_channel_order == CL_RG) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; } - else if( format->image_channel_order == CL_RGx ) + else if (format->image_channel_order == CL_RGx) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; } - else if(( format->image_channel_order == CL_RGB ) || ( format->image_channel_order == CL_sRGB )) + else if ((format->image_channel_order == CL_RGB) + || (format->image_channel_order == CL_sRGB)) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; } - else if(( format->image_channel_order == CL_RGBx ) || ( format->image_channel_order == CL_sRGBx )) + else if ((format->image_channel_order == CL_RGBx) + || (format->image_channel_order == CL_sRGBx)) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; - outData[ 3 ] = 0; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; + outData[3] = 0; } - else if(( format->image_channel_order == CL_RGBA ) || ( format->image_channel_order == CL_sRGBA )) + else if ((format->image_channel_order == CL_RGBA) + || (format->image_channel_order == CL_sRGBA)) { - outData[ 0 ] = tempData[ 0 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 2 ]; - outData[ 3 ] = tempData[ 3 ]; + outData[0] = tempData[0]; + outData[1] = tempData[1]; + outData[2] = tempData[2]; + outData[3] = tempData[3]; } - else if( format->image_channel_order == CL_ARGB ) + else if (format->image_channel_order == CL_ARGB) { - outData[ 0 ] = tempData[ 1 ]; - outData[ 1 ] = tempData[ 2 ]; - outData[ 2 ] = tempData[ 3 ]; - outData[ 3 ] = tempData[ 0 ]; + outData[0] = tempData[1]; + outData[1] = tempData[2]; + outData[2] = tempData[3]; + outData[3] = tempData[0]; } - else if(( format->image_channel_order == CL_BGRA ) || ( format->image_channel_order == CL_sBGRA )) + else if ((format->image_channel_order == CL_BGRA) + || (format->image_channel_order == CL_sBGRA)) { - outData[ 0 ] = tempData[ 2 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 3 ]; + outData[0] = tempData[2]; + outData[1] = tempData[1]; + outData[2] = tempData[0]; + outData[3] = tempData[3]; } - else if( format->image_channel_order == CL_INTENSITY ) + else if (format->image_channel_order == CL_INTENSITY) { - outData[ 1 ] = tempData[ 0 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = tempData[ 0 ]; + outData[1] = tempData[0]; + outData[2] = tempData[0]; + outData[3] = tempData[0]; } - else if( format->image_channel_order == CL_LUMINANCE ) + else if (format->image_channel_order == CL_LUMINANCE) { - outData[ 1 ] = tempData[ 0 ]; - outData[ 2 ] = tempData[ 0 ]; + outData[1] = tempData[0]; + outData[2] = tempData[0]; } - else if( format->image_channel_order == CL_DEPTH ) + else if (format->image_channel_order == CL_DEPTH) { - outData[ 0 ] = tempData[ 0 ]; + outData[0] = tempData[0]; } #ifdef CL_1RGB_APPLE - else if( format->image_channel_order == CL_1RGB_APPLE ) + else if (format->image_channel_order == CL_1RGB_APPLE) { - outData[ 0 ] = tempData[ 1 ]; - outData[ 1 ] = tempData[ 2 ]; - outData[ 2 ] = tempData[ 3 ]; - outData[ 3 ] = 0xff; + outData[0] = tempData[1]; + outData[1] = tempData[2]; + outData[2] = tempData[3]; + outData[3] = 0xff; } #endif #ifdef CL_BGR1_APPLE - else if( format->image_channel_order == CL_BGR1_APPLE ) + else if (format->image_channel_order == CL_BGR1_APPLE) { - outData[ 0 ] = tempData[ 2 ]; - outData[ 1 ] = tempData[ 1 ]; - outData[ 2 ] = tempData[ 0 ]; - outData[ 3 ] = 0xff; + outData[0] = tempData[2]; + outData[1] = tempData[1]; + outData[2] = tempData[0]; + outData[3] = 0xff; } #endif else @@ -495,27 +522,32 @@ template void read_image_pixel( void *imageData, image_descriptor *ima } } -template void read_image_pixel( void *imageData, image_descriptor *imageInfo, - int x, int y, int z, T *outData ) +template +void read_image_pixel(void *imageData, image_descriptor *imageInfo, int x, + int y, int z, T *outData) { - read_image_pixel( imageData, imageInfo, x, y, z, outData, 0); + read_image_pixel(imageData, imageInfo, x, y, z, outData, 0); } // Stupid template rules -bool get_integer_coords( float x, float y, float z, - size_t width, size_t height, size_t depth, - image_sampler_data *imageSampler, image_descriptor *imageInfo, - int &outX, int &outY, int &outZ ); -bool get_integer_coords_offset( float x, float y, float z, - float xAddressOffset, float yAddressOffset, float zAddressOffset, +bool get_integer_coords(float x, float y, float z, size_t width, size_t height, + size_t depth, image_sampler_data *imageSampler, + image_descriptor *imageInfo, int &outX, int &outY, + int &outZ); +bool get_integer_coords_offset(float x, float y, float z, float xAddressOffset, + float yAddressOffset, float zAddressOffset, size_t width, size_t height, size_t depth, - image_sampler_data *imageSampler, image_descriptor *imageInfo, - int &outX, int &outY, int &outZ ); + image_sampler_data *imageSampler, + image_descriptor *imageInfo, int &outX, + int &outY, int &outZ); -template void sample_image_pixel_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, T *outData, int lod ) +template +void sample_image_pixel_offset(void *imageData, image_descriptor *imageInfo, + float x, float y, float z, float xAddressOffset, + float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, T *outData, + int lod) { int iX = 0, iY = 0, iZ = 0; @@ -523,7 +555,8 @@ template void sample_image_pixel_offset( void *imageData, image_descri float max_h; float max_d; - switch (imageInfo->type) { + switch (imageInfo->type) + { case CL_MEM_OBJECT_IMAGE1D_ARRAY: max_h = imageInfo->arraySize; max_d = 0; @@ -538,104 +571,137 @@ template void sample_image_pixel_offset( void *imageData, image_descri break; } - if( /*gTestMipmaps*/ imageInfo->num_mip_levels > 1 ) + if (/*gTestMipmaps*/ imageInfo->num_mip_levels > 1) { - switch (imageInfo->type) { + switch (imageInfo->type) + { case CL_MEM_OBJECT_IMAGE3D: - max_d = (float)((imageInfo->depth >> lod) ? (imageInfo->depth >> lod) : 1); + max_d = (float)((imageInfo->depth >> lod) + ? (imageInfo->depth >> lod) + : 1); case CL_MEM_OBJECT_IMAGE2D: case CL_MEM_OBJECT_IMAGE2D_ARRAY: - max_h = (float)((imageInfo->height >> lod) ? (imageInfo->height >> lod) : 1); + max_h = (float)((imageInfo->height >> lod) + ? (imageInfo->height >> lod) + : 1); break; - default: - ; - + default:; } - max_w = (float)((imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1); + max_w = + (float)((imageInfo->width >> lod) ? (imageInfo->width >> lod) : 1); } - get_integer_coords_offset( x, y, z, xAddressOffset, yAddressOffset, zAddressOffset, max_w, max_h, max_d, imageSampler, imageInfo, iX, iY, iZ ); + get_integer_coords_offset(x, y, z, xAddressOffset, yAddressOffset, + zAddressOffset, max_w, max_h, max_d, imageSampler, + imageInfo, iX, iY, iZ); - read_image_pixel( imageData, imageInfo, iX, iY, iZ, outData, lod ); + read_image_pixel(imageData, imageInfo, iX, iY, iZ, outData, lod); } -template void sample_image_pixel_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, T *outData) +template +void sample_image_pixel_offset(void *imageData, image_descriptor *imageInfo, + float x, float y, float z, float xAddressOffset, + float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, T *outData) { - sample_image_pixel_offset( imageData, imageInfo, x, y, z, xAddressOffset, yAddressOffset, zAddressOffset, - imageSampler, outData, 0); + sample_image_pixel_offset(imageData, imageInfo, x, y, z, xAddressOffset, + yAddressOffset, zAddressOffset, imageSampler, + outData, 0); } -template void sample_image_pixel( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, image_sampler_data *imageSampler, T *outData ) +template +void sample_image_pixel(void *imageData, image_descriptor *imageInfo, float x, + float y, float z, image_sampler_data *imageSampler, + T *outData) { - return sample_image_pixel_offset(imageData, imageInfo, x, y, z, 0.0f, 0.0f, 0.0f, imageSampler, outData); + return sample_image_pixel_offset(imageData, imageInfo, x, y, z, 0.0f, + 0.0f, 0.0f, imageSampler, outData); } -FloatPixel sample_image_pixel_float( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms ); +FloatPixel +sample_image_pixel_float(void *imageData, image_descriptor *imageInfo, float x, + float y, float z, image_sampler_data *imageSampler, + float *outData, int verbose, int *containsDenorms); -FloatPixel sample_image_pixel_float( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms, int lod ); +FloatPixel sample_image_pixel_float(void *imageData, + image_descriptor *imageInfo, float x, + float y, float z, + image_sampler_data *imageSampler, + float *outData, int verbose, + int *containsDenorms, int lod); -FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms ); -FloatPixel sample_image_pixel_float_offset( void *imageData, image_descriptor *imageInfo, - float x, float y, float z, float xAddressOffset, float yAddressOffset, float zAddressOffset, - image_sampler_data *imageSampler, float *outData, int verbose, int *containsDenorms, int lod ); +FloatPixel sample_image_pixel_float_offset( + void *imageData, image_descriptor *imageInfo, float x, float y, float z, + float xAddressOffset, float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, float *outData, int verbose, + int *containsDenorms); +FloatPixel sample_image_pixel_float_offset( + void *imageData, image_descriptor *imageInfo, float x, float y, float z, + float xAddressOffset, float yAddressOffset, float zAddressOffset, + image_sampler_data *imageSampler, float *outData, int verbose, + int *containsDenorms, int lod); -extern void pack_image_pixel( unsigned int *srcVector, const cl_image_format *imageFormat, void *outData ); -extern void pack_image_pixel( int *srcVector, const cl_image_format *imageFormat, void *outData ); -extern void pack_image_pixel( float *srcVector, const cl_image_format *imageFormat, void *outData ); -extern void pack_image_pixel_error( const float *srcVector, const cl_image_format *imageFormat, const void *results, float *errors ); +extern void pack_image_pixel(unsigned int *srcVector, + const cl_image_format *imageFormat, void *outData); +extern void pack_image_pixel(int *srcVector, const cl_image_format *imageFormat, + void *outData); +extern void pack_image_pixel(float *srcVector, + const cl_image_format *imageFormat, void *outData); +extern void pack_image_pixel_error(const float *srcVector, + const cl_image_format *imageFormat, + const void *results, float *errors); -extern char *create_random_image_data( ExplicitType dataType, image_descriptor *imageInfo, BufferOwningPtr &P, MTdata d, bool image2DFromBuffer = false ); +extern char *create_random_image_data(ExplicitType dataType, + image_descriptor *imageInfo, + BufferOwningPtr &P, MTdata d, + bool image2DFromBuffer = false); // deprecated -//extern bool clamp_image_coord( image_sampler_data *imageSampler, float value, size_t max, int &outValue ); +// extern bool clamp_image_coord( image_sampler_data *imageSampler, float value, +// size_t max, int &outValue ); -extern void get_sampler_kernel_code( image_sampler_data *imageSampler, char *outLine ); -extern float get_max_absolute_error( cl_image_format *format, image_sampler_data *sampler); -extern float get_max_relative_error( cl_image_format *format, image_sampler_data *sampler, int is3D, int isLinearFilter ); +extern void get_sampler_kernel_code(image_sampler_data *imageSampler, + char *outLine); +extern float get_max_absolute_error(cl_image_format *format, + image_sampler_data *sampler); +extern float get_max_relative_error(cl_image_format *format, + image_sampler_data *sampler, int is3D, + int isLinearFilter); -#define errMax( _x , _y ) ( (_x) != (_x) ? (_x) : (_x) > (_y) ? (_x) : (_y) ) +#define errMax(_x, _y) ((_x) != (_x) ? (_x) : (_x) > (_y) ? (_x) : (_y)) -static inline cl_uint abs_diff_uint( cl_uint x, cl_uint y ) +static inline cl_uint abs_diff_uint(cl_uint x, cl_uint y) { return y > x ? y - x : x - y; } -static inline cl_uint abs_diff_int( cl_int x, cl_int y ) +static inline cl_uint abs_diff_int(cl_int x, cl_int y) { - return (cl_uint) (y > x ? y - x : x - y); + return (cl_uint)(y > x ? y - x : x - y); } -static inline cl_float relative_error( float test, float expected ) +static inline cl_float relative_error(float test, float expected) { // 0-0/0 is 0 in this case, not NaN - if( test == 0.0f && expected == 0.0f ) - return 0.0f; + if (test == 0.0f && expected == 0.0f) return 0.0f; return (test - expected) / expected; } extern float random_float(float low, float high); -class CoordWalker -{ +class CoordWalker { public: - CoordWalker( void * coords, bool useFloats, size_t vecSize ); + CoordWalker(void *coords, bool useFloats, size_t vecSize); ~CoordWalker(); - cl_float Get( size_t idx, size_t el ); + cl_float Get(size_t idx, size_t el); protected: - cl_float * mFloatCoords; - cl_int * mIntCoords; - size_t mVecSize; + cl_float *mFloatCoords; + cl_int *mIntCoords; + size_t mVecSize; }; extern cl_half convert_float_to_half(float f); diff --git a/test_common/harness/kernelHelpers.cpp b/test_common/harness/kernelHelpers.cpp index 3f73638c..6ccdcc6e 100644 --- a/test_common/harness/kernelHelpers.cpp +++ b/test_common/harness/kernelHelpers.cpp @@ -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 @@ -39,20 +39,21 @@ std::string slash = "/"; static std::mutex gCompilerMutex; -static cl_int get_first_device_id(const cl_context context, cl_device_id &device); +static cl_int get_first_device_id(const cl_context context, + cl_device_id &device); long get_file_size(const std::string &fileName) { std::ifstream ifs(fileName.c_str(), std::ios::binary); - if (!ifs.good()) - return 0; + if (!ifs.good()) return 0; // get length of file: ifs.seekg(0, std::ios::end); std::ios::pos_type length = ifs.tellg(); return static_cast(length); } -static std::string get_kernel_content(unsigned int numKernelLines, const char *const *kernelProgram) +static std::string get_kernel_content(unsigned int numKernelLines, + const char *const *kernelProgram) { std::string kernel; for (size_t i = 0; i < numKernelLines; ++i) @@ -76,11 +77,11 @@ std::string get_kernel_name(const std::string &source) if (pos >= 2 && source[pos - 1] == '_' && source[pos - 2] == '_') pos -= 2; - //check character before 'kernel' (white space expected) + // check character before 'kernel' (white space expected) size_t wsPos = source.find_last_of(" \t\r\n", pos); if (wsPos == std::string::npos || wsPos + 1 == pos) { - //check character after 'kernel' (white space expected) + // check character after 'kernel' (white space expected) size_t akPos = kPos + sizeof("kernel") - 1; wsPos = source.find_first_of(" \t\r\n", akPos); if (!(wsPos == akPos)) @@ -95,21 +96,19 @@ std::string get_kernel_name(const std::string &source) attributeFound = false; // find '(' after kernel name name size_t pPos = source.find("(", akPos); - if (!(pPos != std::string::npos)) - continue; + if (!(pPos != std::string::npos)) continue; // check for not empty kernel name before '(' pos = source.find_last_not_of(" \t\r\n", pPos - 1); - if (!(pos != std::string::npos && pos > akPos)) - continue; + if (!(pos != std::string::npos && pos > akPos)) continue; - //find character before kernel name + // find character before kernel name wsPos = source.find_last_of(" \t\r\n", pos); - if (!(wsPos != std::string::npos && wsPos >= akPos)) - continue; + if (!(wsPos != std::string::npos && wsPos >= akPos)) continue; - std::string name = source.substr(wsPos + 1, pos + 1 - (wsPos + 1)); - //check for kernel attribute + std::string name = + source.substr(wsPos + 1, pos + 1 - (wsPos + 1)); + // check for kernel attribute if (name == "__attribute__") { attributeFound = true; @@ -149,20 +148,17 @@ std::string get_kernel_name(const std::string &source) return oss.str(); } -static std::string get_offline_compilation_file_type_str(const CompilationMode compilationMode) +static std::string +get_offline_compilation_file_type_str(const CompilationMode compilationMode) { switch (compilationMode) { - default: - assert(0 && "Invalid compilation mode"); - abort(); + default: assert(0 && "Invalid compilation mode"); abort(); case kOnline: assert(0 && "Invalid compilation mode for offline compilation"); abort(); - case kBinary: - return "binary"; - case kSpir_v: - return "SPIR-V"; + case kBinary: return "binary"; + case kSpir_v: return "SPIR-V"; } } @@ -174,34 +170,40 @@ static std::string get_unique_filename_prefix(unsigned int numKernelLines, std::string kernelName = get_kernel_name(kernel); cl_uint kernelCrc = crc32(kernel.data(), kernel.size()); std::ostringstream oss; - oss << kernelName << std::hex << std::setfill('0') << std::setw(8) << kernelCrc; - if(buildOptions) { + oss << kernelName << std::hex << std::setfill('0') << std::setw(8) + << kernelCrc; + if (buildOptions) + { cl_uint bOptionsCrc = crc32(buildOptions, strlen(buildOptions)); - oss << '.' << std::hex << std::setfill('0') << std::setw(8) << bOptionsCrc; + oss << '.' << std::hex << std::setfill('0') << std::setw(8) + << bOptionsCrc; } return oss.str(); } -static std::string -get_cl_build_options_filename_with_path(const std::string& filePath, - const std::string& fileNamePrefix) { +static std::string +get_cl_build_options_filename_with_path(const std::string &filePath, + const std::string &fileNamePrefix) +{ return filePath + slash + fileNamePrefix + ".options"; } -static std::string -get_cl_source_filename_with_path(const std::string& filePath, - const std::string& fileNamePrefix) { +static std::string +get_cl_source_filename_with_path(const std::string &filePath, + const std::string &fileNamePrefix) +{ return filePath + slash + fileNamePrefix + ".cl"; } -static std::string -get_binary_filename_with_path(CompilationMode mode, - cl_uint deviceAddrSpaceSize, - const std::string& filePath, - const std::string& fileNamePrefix) { +static std::string +get_binary_filename_with_path(CompilationMode mode, cl_uint deviceAddrSpaceSize, + const std::string &filePath, + const std::string &fileNamePrefix) +{ std::string binaryFilename = filePath + slash + fileNamePrefix; - if(kSpir_v == mode) { + if (kSpir_v == mode) + { std::ostringstream extension; extension << ".spv" << deviceAddrSpaceSize; binaryFilename += extension.str(); @@ -209,39 +211,43 @@ get_binary_filename_with_path(CompilationMode mode, return binaryFilename; } -static bool file_exist_on_disk(const std::string& filePath, - const std::string& fileName) { +static bool file_exist_on_disk(const std::string &filePath, + const std::string &fileName) +{ std::string fileNameWithPath = filePath + slash + fileName; bool exist = false; std::ifstream ifs; ifs.open(fileNameWithPath.c_str(), std::ios::binary); - if(ifs.good()) - exist = true; + if (ifs.good()) exist = true; ifs.close(); return exist; } static bool should_save_kernel_source_to_disk(CompilationMode mode, CompilationCacheMode cacheMode, - const std::string& binaryPath, - const std::string& binaryName) + const std::string &binaryPath, + const std::string &binaryName) { bool saveToDisk = false; - if(cacheMode == kCacheModeDumpCl || - (cacheMode == kCacheModeOverwrite && mode != kOnline)) { + if (cacheMode == kCacheModeDumpCl + || (cacheMode == kCacheModeOverwrite && mode != kOnline)) + { saveToDisk = true; } - if(cacheMode == kCacheModeCompileIfAbsent && mode != kOnline) { + if (cacheMode == kCacheModeCompileIfAbsent && mode != kOnline) + { saveToDisk = !file_exist_on_disk(binaryPath, binaryName); } return saveToDisk; } -static int save_kernel_build_options_to_disk(const std::string& path, - const std::string& prefix, - const char *buildOptions) { - std::string filename = get_cl_build_options_filename_with_path(path, prefix); +static int save_kernel_build_options_to_disk(const std::string &path, + const std::string &prefix, + const char *buildOptions) +{ + std::string filename = + get_cl_build_options_filename_with_path(path, prefix); std::ofstream ofs(filename.c_str(), std::ios::binary); if (!ofs.good()) { @@ -254,9 +260,10 @@ static int save_kernel_build_options_to_disk(const std::string& path, return CL_SUCCESS; } -static int save_kernel_source_to_disk(const std::string& path, - const std::string& prefix, - const std::string& source) { +static int save_kernel_source_to_disk(const std::string &path, + const std::string &prefix, + const std::string &source) +{ std::string filename = get_cl_source_filename_with_path(path, prefix); std::ofstream ofs(filename.c_str(), std::ios::binary); if (!ofs.good()) @@ -270,55 +277,54 @@ static int save_kernel_source_to_disk(const std::string& path, return CL_SUCCESS; } -static int save_kernel_source_and_options_to_disk(unsigned int numKernelLines, - const char *const *kernelProgram, - const char *buildOptions) +static int +save_kernel_source_and_options_to_disk(unsigned int numKernelLines, + const char *const *kernelProgram, + const char *buildOptions) { int error; std::string kernel = get_kernel_content(numKernelLines, kernelProgram); - std::string kernelNamePrefix = get_unique_filename_prefix(numKernelLines, - kernelProgram, - buildOptions); + std::string kernelNamePrefix = + get_unique_filename_prefix(numKernelLines, kernelProgram, buildOptions); // save kernel source to disk - error = save_kernel_source_to_disk(gCompilationCachePath, kernelNamePrefix, kernel); - + error = save_kernel_source_to_disk(gCompilationCachePath, kernelNamePrefix, + kernel); + // save kernel build options to disk if exists if (buildOptions != NULL) - error |= save_kernel_build_options_to_disk(gCompilationCachePath, kernelNamePrefix, buildOptions); + error |= save_kernel_build_options_to_disk( + gCompilationCachePath, kernelNamePrefix, buildOptions); return error; } -static std::string get_compilation_mode_str(const CompilationMode compilationMode) +static std::string +get_compilation_mode_str(const CompilationMode compilationMode) { switch (compilationMode) { - default: - assert(0 && "Invalid compilation mode"); - abort(); - case kOnline: - return "online"; - case kBinary: - return "binary"; - case kSpir_v: - return "spir-v"; + default: assert(0 && "Invalid compilation mode"); abort(); + case kOnline: return "online"; + case kBinary: return "binary"; + case kSpir_v: return "spir-v"; } } #ifdef KHRONOS_OFFLINE_COMPILER -static std::string get_khronos_compiler_command(const cl_uint device_address_space_size, - const bool openclCXX, - const std::string &bOptions, - const std::string &sourceFilename, - const std::string &outputFilename) +static std::string +get_khronos_compiler_command(const cl_uint device_address_space_size, + const bool openclCXX, const std::string &bOptions, + const std::string &sourceFilename, + const std::string &outputFilename) { // Set compiler options // Emit SPIR-V std::string compilerOptions = " -cc1 -emit-spirv"; - // : for 32 bit SPIR-V use spir-unknown-unknown, for 64 bit SPIR-V use spir64-unknown-unknown. - if(device_address_space_size == 32) + // : for 32 bit SPIR-V use spir-unknown-unknown, for 64 bit SPIR-V + // use spir64-unknown-unknown. + if (device_address_space_size == 32) { compilerOptions += " -triple=spir-unknown-unknown"; } @@ -326,13 +332,14 @@ static std::string get_khronos_compiler_command(const cl_uint device_address_spa { compilerOptions += " -triple=spir64-unknown-unknown"; } - // Set OpenCL C++ flag required by SPIR-V-ready clang (compiler provided by Khronos) - if(openclCXX) + // Set OpenCL C++ flag required by SPIR-V-ready clang (compiler provided by + // Khronos) + if (openclCXX) { compilerOptions = compilerOptions + " -cl-std=c++"; } // Set correct includes - if(openclCXX) + if (openclCXX) { compilerOptions += " -I "; compilerOptions += STRINGIFY_VALUE(CL_LIBCLCXX_DIR); @@ -348,34 +355,41 @@ static std::string get_khronos_compiler_command(const cl_uint device_address_spa // Add build options passed to this function compilerOptions += " " + bOptions; - compilerOptions += - " " + sourceFilename + - " -o " + outputFilename; - std::string runString = STRINGIFY_VALUE(KHRONOS_OFFLINE_COMPILER) + compilerOptions; + compilerOptions += " " + sourceFilename + " -o " + outputFilename; + std::string runString = + STRINGIFY_VALUE(KHRONOS_OFFLINE_COMPILER) + compilerOptions; return runString; } #endif // KHRONOS_OFFLINE_COMPILER -static cl_int get_cl_device_info_str(const cl_device_id device, const cl_uint device_address_space_size, - const CompilationMode compilationMode, std::string &clDeviceInfo) +static cl_int get_cl_device_info_str(const cl_device_id device, + const cl_uint device_address_space_size, + const CompilationMode compilationMode, + std::string &clDeviceInfo) { std::string extensionsString = get_device_extensions_string(device); std::string versionString = get_device_version_string(device); std::ostringstream clDeviceInfoStream; - std::string file_type = get_offline_compilation_file_type_str(compilationMode); - clDeviceInfoStream << "# OpenCL device info affecting " << file_type << " offline compilation:" << std::endl - << "CL_DEVICE_ADDRESS_BITS=" << device_address_space_size << std::endl - << "CL_DEVICE_EXTENSIONS=\"" << extensionsString << "\"" << std::endl; + std::string file_type = + get_offline_compilation_file_type_str(compilationMode); + clDeviceInfoStream << "# OpenCL device info affecting " << file_type + << " offline compilation:" << std::endl + << "CL_DEVICE_ADDRESS_BITS=" << device_address_space_size + << std::endl + << "CL_DEVICE_EXTENSIONS=\"" << extensionsString << "\"" + << std::endl; /* We only need the device's supported IL version(s) when compiling IL - * that will be loaded with clCreateProgramWithIL() */ + * that will be loaded with clCreateProgramWithIL() */ if (compilationMode == kSpir_v) { std::string ilVersionString = get_device_il_version_string(device); - clDeviceInfoStream << "CL_DEVICE_IL_VERSION=\"" << ilVersionString << "\"" << std::endl; + clDeviceInfoStream << "CL_DEVICE_IL_VERSION=\"" << ilVersionString + << "\"" << std::endl; } - clDeviceInfoStream << "CL_DEVICE_VERSION=\"" << versionString << "\"" << std::endl; + clDeviceInfoStream << "CL_DEVICE_VERSION=\"" << versionString << "\"" + << std::endl; clDeviceInfoStream << "CL_DEVICE_IMAGE_SUPPORT=" << (0 == checkForImageSupport(device)) << std::endl; clDeviceInfoStream << "CL_DEVICE_NAME=\"" << get_device_name(device).c_str() @@ -386,11 +400,14 @@ static cl_int get_cl_device_info_str(const cl_device_id device, const cl_uint de return CL_SUCCESS; } -static int write_cl_device_info(const cl_device_id device, const cl_uint device_address_space_size, - const CompilationMode compilationMode, std::string &clDeviceInfoFilename) +static int write_cl_device_info(const cl_device_id device, + const cl_uint device_address_space_size, + const CompilationMode compilationMode, + std::string &clDeviceInfoFilename) { std::string clDeviceInfo; - int error = get_cl_device_info_str(device, device_address_space_size, compilationMode, clDeviceInfo); + int error = get_cl_device_info_str(device, device_address_space_size, + compilationMode, clDeviceInfo); if (error != CL_SUCCESS) { return error; @@ -399,25 +416,30 @@ static int write_cl_device_info(const cl_device_id device, const cl_uint device_ cl_uint crc = crc32(clDeviceInfo.data(), clDeviceInfo.size()); /* Get the filename for the clDeviceInfo file. - * Note: the file includes the hash on its content, so it is usually unnecessary to delete it. */ + * Note: the file includes the hash on its content, so it is usually + * unnecessary to delete it. */ std::ostringstream clDeviceInfoFilenameStream; - clDeviceInfoFilenameStream << gCompilationCachePath << slash << "clDeviceInfo-"; - clDeviceInfoFilenameStream << std::hex << std::setfill('0') << std::setw(8) << crc << ".txt"; + clDeviceInfoFilenameStream << gCompilationCachePath << slash + << "clDeviceInfo-"; + clDeviceInfoFilenameStream << std::hex << std::setfill('0') << std::setw(8) + << crc << ".txt"; clDeviceInfoFilename = clDeviceInfoFilenameStream.str(); - if ((size_t) get_file_size(clDeviceInfoFilename) == clDeviceInfo.size()) + if ((size_t)get_file_size(clDeviceInfoFilename) == clDeviceInfo.size()) { /* The CL device info file has already been created. * Nothing to do. */ return 0; } - /* The file does not exist or its length is not as expected. Create/overwrite it. */ + /* The file does not exist or its length is not as expected. + * Create/overwrite it. */ std::ofstream ofs(clDeviceInfoFilename); if (!ofs.good()) { - log_info("OfflineCompiler: can't create CL device info file: %s\n", clDeviceInfoFilename.c_str()); + log_info("OfflineCompiler: can't create CL device info file: %s\n", + clDeviceInfoFilename.c_str()); return -1; } ofs << clDeviceInfo; @@ -426,12 +448,11 @@ static int write_cl_device_info(const cl_device_id device, const cl_uint device_ return CL_SUCCESS; } -static std::string get_offline_compilation_command(const cl_uint device_address_space_size, - const CompilationMode compilationMode, - const std::string &bOptions, - const std::string &sourceFilename, - const std::string &outputFilename, - const std::string &clDeviceInfoFilename) +static std::string get_offline_compilation_command( + const cl_uint device_address_space_size, + const CompilationMode compilationMode, const std::string &bOptions, + const std::string &sourceFilename, const std::string &outputFilename, + const std::string &clDeviceInfoFilename) { std::ostringstream wrapperOptions; @@ -462,7 +483,8 @@ static int invoke_offline_compiler(const cl_device_id device, if (openclCXX) { #ifndef KHRONOS_OFFLINE_COMPILER - log_error("CL C++ compilation is not possible: KHRONOS_OFFLINE_COMPILER was not defined.\n"); + log_error("CL C++ compilation is not possible: " + "KHRONOS_OFFLINE_COMPILER was not defined.\n"); return CL_INVALID_OPERATION; #else if (compilationMode != kSpir_v) @@ -470,8 +492,9 @@ static int invoke_offline_compiler(const cl_device_id device, log_error("Compilation mode must be SPIR-V for Khronos compiler"); return -1; } - runString = get_khronos_compiler_command(device_address_space_size, openclCXX, bOptions, - sourceFilename, outputFilename); + runString = get_khronos_compiler_command( + device_address_space_size, openclCXX, bOptions, sourceFilename, + outputFilename); #endif } else @@ -483,16 +506,18 @@ static int invoke_offline_compiler(const cl_device_id device, // the internal command line interface for invoking the offline // compiler. - cl_int err = write_cl_device_info(device, device_address_space_size, compilationMode, - clDeviceInfoFilename); + cl_int err = + write_cl_device_info(device, device_address_space_size, + compilationMode, clDeviceInfoFilename); if (err != CL_SUCCESS) { log_error("Failed writing CL device info file\n"); return err; } - runString = get_offline_compilation_command(device_address_space_size, compilationMode, bOptions, - sourceFilename, outputFilename, clDeviceInfoFilename); + runString = get_offline_compilation_command( + device_address_space_size, compilationMode, bOptions, + sourceFilename, outputFilename, clDeviceInfoFilename); } // execute script @@ -508,10 +533,12 @@ static int invoke_offline_compiler(const cl_device_id device, return CL_SUCCESS; } -static cl_int get_first_device_id(const cl_context context, cl_device_id &device) +static cl_int get_first_device_id(const cl_context context, + cl_device_id &device) { cl_uint numDevices = 0; - cl_int error = clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, sizeof(cl_uint), &numDevices, NULL); + cl_int error = clGetContextInfo(context, CL_CONTEXT_NUM_DEVICES, + sizeof(cl_uint), &numDevices, NULL); test_error(error, "clGetContextInfo failed getting CL_CONTEXT_NUM_DEVICES"); if (numDevices == 0) @@ -521,55 +548,61 @@ static cl_int get_first_device_id(const cl_context context, cl_device_id &device } std::vector devices(numDevices, 0); - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, numDevices*sizeof(cl_device_id), &devices[0], NULL); + error = + clGetContextInfo(context, CL_CONTEXT_DEVICES, + numDevices * sizeof(cl_device_id), &devices[0], NULL); test_error(error, "clGetContextInfo failed getting CL_CONTEXT_DEVICES"); device = devices[0]; return CL_SUCCESS; } -static cl_int get_device_address_bits(const cl_device_id device, cl_uint &device_address_space_size) +static cl_int get_device_address_bits(const cl_device_id device, + cl_uint &device_address_space_size) { - cl_int error = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), &device_address_space_size, NULL); + cl_int error = + clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, sizeof(cl_uint), + &device_address_space_size, NULL); test_error(error, "Unable to obtain device address bits"); if (device_address_space_size != 32 && device_address_space_size != 64) { - log_error("ERROR: Unexpected number of device address bits: %u\n", device_address_space_size); + log_error("ERROR: Unexpected number of device address bits: %u\n", + device_address_space_size); return -1; } return CL_SUCCESS; } -static int get_offline_compiler_output(std::ifstream &ifs, - const cl_device_id device, - cl_uint deviceAddrSpaceSize, - const bool openclCXX, - const CompilationMode compilationMode, - const std::string &bOptions, - const std::string &kernelPath, - const std::string &kernelNamePrefix) +static int get_offline_compiler_output( + std::ifstream &ifs, const cl_device_id device, cl_uint deviceAddrSpaceSize, + const bool openclCXX, const CompilationMode compilationMode, + const std::string &bOptions, const std::string &kernelPath, + const std::string &kernelNamePrefix) { - std::string sourceFilename = get_cl_source_filename_with_path(kernelPath, kernelNamePrefix); - std::string outputFilename = get_binary_filename_with_path(compilationMode, - deviceAddrSpaceSize, - kernelPath, - kernelNamePrefix); + std::string sourceFilename = + get_cl_source_filename_with_path(kernelPath, kernelNamePrefix); + std::string outputFilename = get_binary_filename_with_path( + compilationMode, deviceAddrSpaceSize, kernelPath, kernelNamePrefix); ifs.open(outputFilename.c_str(), std::ios::binary); - if(!ifs.good()) { - std::string file_type = get_offline_compilation_file_type_str(compilationMode); - if (gCompilationCacheMode == kCacheModeForceRead) { + if (!ifs.good()) + { + std::string file_type = + get_offline_compilation_file_type_str(compilationMode); + if (gCompilationCacheMode == kCacheModeForceRead) + { log_info("OfflineCompiler: can't open cached %s file: %s\n", file_type.c_str(), outputFilename.c_str()); return -1; } - else { - int error = invoke_offline_compiler(device, deviceAddrSpaceSize, compilationMode, - bOptions, sourceFilename, outputFilename, openclCXX); - if (error != CL_SUCCESS) - return error; + else + { + int error = invoke_offline_compiler( + device, deviceAddrSpaceSize, compilationMode, bOptions, + sourceFilename, outputFilename, openclCXX); + if (error != CL_SUCCESS) return error; // read output file ifs.open(outputFilename.c_str(), std::ios::binary); @@ -579,21 +612,19 @@ static int get_offline_compiler_output(std::ifstream &ifs, file_type.c_str(), outputFilename.c_str()); return -1; } - } + } } return CL_SUCCESS; } -static int create_single_kernel_helper_create_program_offline(cl_context context, - cl_device_id device, - cl_program *outProgram, - unsigned int numKernelLines, - const char *const *kernelProgram, - const char *buildOptions, - const bool openclCXX, - CompilationMode compilationMode) +static int create_single_kernel_helper_create_program_offline( + cl_context context, cl_device_id device, cl_program *outProgram, + unsigned int numKernelLines, const char *const *kernelProgram, + const char *buildOptions, const bool openclCXX, + CompilationMode compilationMode) { - if(kCacheModeDumpCl == gCompilationCacheMode) { + if (kCacheModeDumpCl == gCompilationCacheMode) + { return -1; } @@ -606,40 +637,39 @@ static int create_single_kernel_helper_create_program_offline(cl_context context test_error(error, "Failed to get device ID for first device"); } error = get_device_address_bits(device, device_address_space_size); - if (error != CL_SUCCESS) - return error; + if (error != CL_SUCCESS) return error; // set build options std::string bOptions; bOptions += buildOptions ? std::string(buildOptions) : ""; - std::string kernelName = get_unique_filename_prefix(numKernelLines, - kernelProgram, - buildOptions); - + std::string kernelName = + get_unique_filename_prefix(numKernelLines, kernelProgram, buildOptions); std::ifstream ifs; - error = get_offline_compiler_output(ifs, device, device_address_space_size, openclCXX, compilationMode, bOptions, gCompilationCachePath, kernelName); - if (error != CL_SUCCESS) - return error; + error = get_offline_compiler_output(ifs, device, device_address_space_size, + openclCXX, compilationMode, bOptions, + gCompilationCachePath, kernelName); + if (error != CL_SUCCESS) return error; - // ----------------------------------------------------------------------------------- - // ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT ------------------ - // ----------------------------------------------------------------------------------- - // Only OpenCL C++ to SPIR-V compilation - #if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) - if(openclCXX) +// ----------------------------------------------------------------------------------- +// ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT +// ------------------ +// ----------------------------------------------------------------------------------- +// Only OpenCL C++ to SPIR-V compilation +#if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) + if (openclCXX) { return CL_SUCCESS; } - #endif +#endif ifs.seekg(0, ifs.end); int length = ifs.tellg(); ifs.seekg(0, ifs.beg); - //treat modifiedProgram as input for clCreateProgramWithBinary + // treat modifiedProgram as input for clCreateProgramWithBinary if (compilationMode == kBinary) { // read binary from file: @@ -650,15 +680,17 @@ static int create_single_kernel_helper_create_program_offline(cl_context context size_t lengths = modifiedKernelBuf.size(); const unsigned char *binaries = { &modifiedKernelBuf[0] }; - log_info("offlineCompiler: clCreateProgramWithSource replaced with clCreateProgramWithBinary\n"); - *outProgram = clCreateProgramWithBinary(context, 1, &device, &lengths, &binaries, NULL, &error); + log_info("offlineCompiler: clCreateProgramWithSource replaced with " + "clCreateProgramWithBinary\n"); + *outProgram = clCreateProgramWithBinary(context, 1, &device, &lengths, + &binaries, NULL, &error); if (*outProgram == NULL || error != CL_SUCCESS) { print_error(error, "clCreateProgramWithBinary failed"); return error; } } - //treat modifiedProgram as input for clCreateProgramWithIL + // treat modifiedProgram as input for clCreateProgramWithIL else if (compilationMode == kSpir_v) { // read spir-v from file: @@ -668,7 +700,8 @@ static int create_single_kernel_helper_create_program_offline(cl_context context ifs.close(); size_t length = modifiedKernelBuf.size(); - log_info("offlineCompiler: clCreateProgramWithSource replaced with clCreateProgramWithIL\n"); + log_info("offlineCompiler: clCreateProgramWithSource replaced with " + "clCreateProgramWithIL\n"); if (gCoreILProgram) { *outProgram = clCreateProgramWithIL(context, &modifiedKernelBuf[0], @@ -712,28 +745,25 @@ static int create_single_kernel_helper_create_program_offline(cl_context context return CL_SUCCESS; } -static int create_single_kernel_helper_create_program(cl_context context, - cl_device_id device, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions, - const bool openclCXX, - CompilationMode compilationMode) +static int create_single_kernel_helper_create_program( + cl_context context, cl_device_id device, cl_program *outProgram, + unsigned int numKernelLines, const char **kernelProgram, + const char *buildOptions, const bool openclCXX, + CompilationMode compilationMode) { std::lock_guard compiler_lock(gCompilerMutex); - std::string filePrefix = get_unique_filename_prefix(numKernelLines, - kernelProgram, - buildOptions); - bool shouldSaveToDisk = should_save_kernel_source_to_disk(compilationMode, - gCompilationCacheMode, - gCompilationCachePath, - filePrefix); + std::string filePrefix = + get_unique_filename_prefix(numKernelLines, kernelProgram, buildOptions); + bool shouldSaveToDisk = should_save_kernel_source_to_disk( + compilationMode, gCompilationCacheMode, gCompilationCachePath, + filePrefix); - if(shouldSaveToDisk) + if (shouldSaveToDisk) { - if(CL_SUCCESS != save_kernel_source_and_options_to_disk(numKernelLines, kernelProgram, buildOptions)) + if (CL_SUCCESS + != save_kernel_source_and_options_to_disk( + numKernelLines, kernelProgram, buildOptions)) { log_error("Unable to dump kernel source to disk"); return -1; @@ -744,7 +774,8 @@ static int create_single_kernel_helper_create_program(cl_context context, int error = CL_SUCCESS; /* Create the program object from source */ - *outProgram = clCreateProgramWithSource(context, numKernelLines, kernelProgram, NULL, &error); + *outProgram = clCreateProgramWithSource(context, numKernelLines, + kernelProgram, NULL, &error); if (*outProgram == NULL || error != CL_SUCCESS) { print_error(error, "clCreateProgramWithSource failed"); @@ -754,61 +785,48 @@ static int create_single_kernel_helper_create_program(cl_context context, } else { - return create_single_kernel_helper_create_program_offline(context, device, outProgram, - numKernelLines, kernelProgram, - buildOptions, openclCXX, - compilationMode); + return create_single_kernel_helper_create_program_offline( + context, device, outProgram, numKernelLines, kernelProgram, + buildOptions, openclCXX, compilationMode); } } -int create_single_kernel_helper_create_program(cl_context context, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions, - const bool openclCXX) +int create_single_kernel_helper_create_program( + cl_context context, cl_program *outProgram, unsigned int numKernelLines, + const char **kernelProgram, const char *buildOptions, const bool openclCXX) { - return create_single_kernel_helper_create_program(context, NULL, outProgram, - numKernelLines, kernelProgram, - buildOptions, openclCXX, - gCompilationMode); + return create_single_kernel_helper_create_program( + context, NULL, outProgram, numKernelLines, kernelProgram, buildOptions, + openclCXX, gCompilationMode); } -int create_single_kernel_helper_create_program_for_device(cl_context context, - cl_device_id device, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions, - const bool openclCXX) +int create_single_kernel_helper_create_program_for_device( + cl_context context, cl_device_id device, cl_program *outProgram, + unsigned int numKernelLines, const char **kernelProgram, + const char *buildOptions, const bool openclCXX) { - return create_single_kernel_helper_create_program(context, device, outProgram, - numKernelLines, kernelProgram, - buildOptions, openclCXX, - gCompilationMode); + return create_single_kernel_helper_create_program( + context, device, outProgram, numKernelLines, kernelProgram, + buildOptions, openclCXX, gCompilationMode); } -int create_single_kernel_helper_with_build_options(cl_context context, - cl_program *outProgram, - cl_kernel *outKernel, - unsigned int numKernelLines, - const char **kernelProgram, - const char *kernelName, - const char *buildOptions, - const bool openclCXX) +int create_single_kernel_helper_with_build_options( + cl_context context, cl_program *outProgram, cl_kernel *outKernel, + unsigned int numKernelLines, const char **kernelProgram, + const char *kernelName, const char *buildOptions, const bool openclCXX) { - return create_single_kernel_helper(context, outProgram, outKernel, numKernelLines, kernelProgram, kernelName, buildOptions, openclCXX); + return create_single_kernel_helper(context, outProgram, outKernel, + numKernelLines, kernelProgram, + kernelName, buildOptions, openclCXX); } // Creates and builds OpenCL C/C++ program, and creates a kernel -int create_single_kernel_helper(cl_context context, - cl_program *outProgram, +int create_single_kernel_helper(cl_context context, cl_program *outProgram, cl_kernel *outKernel, unsigned int numKernelLines, const char **kernelProgram, const char *kernelName, - const char *buildOptions, - const bool openclCXX) + const char *buildOptions, const bool openclCXX) { // For the logic that automatically adds -cl-std it is much cleaner if the // build options have RAII. This buffer will store the potentially updated @@ -849,42 +867,43 @@ int create_single_kernel_helper(cl_context context, } int error; // Create OpenCL C++ program - if(openclCXX) + if (openclCXX) { - // ----------------------------------------------------------------------------------- - // ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT ------------------ - // ----------------------------------------------------------------------------------- - // Only OpenCL C++ to SPIR-V compilation - #if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) +// ----------------------------------------------------------------------------------- +// ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT +// ------------------ +// ----------------------------------------------------------------------------------- +// Only OpenCL C++ to SPIR-V compilation +#if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) // Save global variable bool tempgCompilationCacheMode = gCompilationCacheMode; // Force OpenCL C++ -> SPIR-V compilation on every run gCompilationCacheMode = kCacheModeOverwrite; - #endif - error = create_openclcpp_program( - context, outProgram, numKernelLines, kernelProgram, buildOptions - ); +#endif + error = create_openclcpp_program(context, outProgram, numKernelLines, + kernelProgram, buildOptions); if (error != CL_SUCCESS) { log_error("Create program failed: %d, line: %d\n", error, __LINE__); return error; } - // ----------------------------------------------------------------------------------- - // ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT ------------------ - // ----------------------------------------------------------------------------------- - #if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) +// ----------------------------------------------------------------------------------- +// ------------- ONLY FOR OPENCL 22 CONFORMANCE TEST 22 DEVELOPMENT +// ------------------ +// ----------------------------------------------------------------------------------- +#if defined(DEVELOPMENT) && defined(ONLY_SPIRV_COMPILATION) // Restore global variables gCompilationCacheMode = tempgCompilationCacheMode; - log_info("WARNING: KERNEL %s WAS ONLY COMPILED TO SPIR-V\n", kernelName); + log_info("WARNING: KERNEL %s WAS ONLY COMPILED TO SPIR-V\n", + kernelName); return error; - #endif +#endif } // Create OpenCL C program else { error = create_single_kernel_helper_create_program( - context, outProgram, numKernelLines, kernelProgram, buildOptions - ); + context, outProgram, numKernelLines, kernelProgram, buildOptions); if (error != CL_SUCCESS) { log_error("Create program failed: %d, line: %d\n", error, __LINE__); @@ -897,44 +916,37 @@ int create_single_kernel_helper(cl_context context, { newBuildOptions = buildOptions; std::string offlineCompierOptions[] = { - "-cl-fp16-enable", - "-cl-fp64-enable", - "-cl-zero-init-local-mem-vars" + "-cl-fp16-enable", "-cl-fp64-enable", "-cl-zero-init-local-mem-vars" }; - for(auto& s : offlineCompierOptions) + for (auto &s : offlineCompierOptions) { std::string::size_type i = newBuildOptions.find(s); - if (i != std::string::npos) - newBuildOptions.erase(i, s.length()); + if (i != std::string::npos) newBuildOptions.erase(i, s.length()); } } // Build program and create kernel return build_program_create_kernel_helper( - context, outProgram, outKernel, numKernelLines, kernelProgram, kernelName, newBuildOptions.c_str() - ); + context, outProgram, outKernel, numKernelLines, kernelProgram, + kernelName, newBuildOptions.c_str()); } // Creates OpenCL C++ program -int create_openclcpp_program(cl_context context, - cl_program *outProgram, +int create_openclcpp_program(cl_context context, cl_program *outProgram, unsigned int numKernelLines, const char **kernelProgram, const char *buildOptions) { // Create program return create_single_kernel_helper_create_program( - context, NULL, outProgram, numKernelLines, kernelProgram, buildOptions, true, kSpir_v - ); + context, NULL, outProgram, numKernelLines, kernelProgram, buildOptions, + true, kSpir_v); } // Builds OpenCL C/C++ program and creates -int build_program_create_kernel_helper(cl_context context, - cl_program *outProgram, - cl_kernel *outKernel, - unsigned int numKernelLines, - const char **kernelProgram, - const char *kernelName, - const char *buildOptions) +int build_program_create_kernel_helper( + cl_context context, cl_program *outProgram, cl_kernel *outKernel, + unsigned int numKernelLines, const char **kernelProgram, + const char *kernelName, const char *buildOptions) { int error; /* Compile the program */ @@ -949,13 +961,13 @@ int build_program_create_kernel_helper(cl_context context, printedSource = 1; log_error("Build options: %s\n", buildOptions); log_error("Original source is: ------------\n"); - for (i = 0; i < numKernelLines; i++) - log_error("%s", kernelProgram[i]); + for (i = 0; i < numKernelLines; i++) log_error("%s", kernelProgram[i]); } // Verify the build status on all devices cl_uint deviceCount = 0; - error = clGetProgramInfo(*outProgram, CL_PROGRAM_NUM_DEVICES, sizeof(deviceCount), &deviceCount, NULL); + error = clGetProgramInfo(*outProgram, CL_PROGRAM_NUM_DEVICES, + sizeof(deviceCount), &deviceCount, NULL); if (error != CL_SUCCESS) { print_error(error, "clGetProgramInfo CL_PROGRAM_NUM_DEVICES failed"); @@ -968,13 +980,14 @@ int build_program_create_kernel_helper(cl_context context, return -1; } - cl_device_id *devices = (cl_device_id *)malloc(deviceCount * sizeof(cl_device_id)); - if (NULL == devices) - return -1; + cl_device_id *devices = + (cl_device_id *)malloc(deviceCount * sizeof(cl_device_id)); + if (NULL == devices) return -1; BufferOwningPtr devicesBuf(devices); memset(devices, 0, deviceCount * sizeof(cl_device_id)); - error = clGetProgramInfo(*outProgram, CL_PROGRAM_DEVICES, sizeof(cl_device_id) * deviceCount, devices, NULL); + error = clGetProgramInfo(*outProgram, CL_PROGRAM_DEVICES, + sizeof(cl_device_id) * deviceCount, devices, NULL); if (error != CL_SUCCESS) { print_error(error, "clGetProgramInfo CL_PROGRAM_DEVICES failed"); @@ -986,7 +999,8 @@ int build_program_create_kernel_helper(cl_context context, for (z = 0; z < deviceCount; z++) { char deviceName[4096] = ""; - error = clGetDeviceInfo(devices[z], CL_DEVICE_NAME, sizeof(deviceName), deviceName, NULL); + error = clGetDeviceInfo(devices[z], CL_DEVICE_NAME, sizeof(deviceName), + deviceName, NULL); if (error != CL_SUCCESS || deviceName[0] == '\0') { log_error("Device \"%d\" failed to return a name\n", z); @@ -994,17 +1008,22 @@ int build_program_create_kernel_helper(cl_context context, } cl_build_status buildStatus; - error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_STATUS, sizeof(buildStatus), &buildStatus, NULL); + error = clGetProgramBuildInfo(*outProgram, devices[z], + CL_PROGRAM_BUILD_STATUS, + sizeof(buildStatus), &buildStatus, NULL); if (error != CL_SUCCESS) { - print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_STATUS failed"); + print_error(error, + "clGetProgramBuildInfo CL_PROGRAM_BUILD_STATUS failed"); return error; } - if (buildStatus == CL_BUILD_SUCCESS && buildProgramFailed && deviceCount == 1) + if (buildStatus == CL_BUILD_SUCCESS && buildProgramFailed + && deviceCount == 1) { buildFailed = true; - log_error("clBuildProgram returned an error, but buildStatus is marked as CL_BUILD_SUCCESS.\n"); + log_error("clBuildProgram returned an error, but buildStatus is " + "marked as CL_BUILD_SUCCESS.\n"); } if (buildStatus != CL_BUILD_SUCCESS) @@ -1023,25 +1042,35 @@ int build_program_create_kernel_helper(cl_context context, sprintf(statusString, "UNKNOWN (%d)", buildStatus); if (buildStatus != CL_BUILD_SUCCESS) - log_error("Build not successful for device \"%s\", status: %s\n", deviceName, statusString); + log_error( + "Build not successful for device \"%s\", status: %s\n", + deviceName, statusString); size_t paramSize = 0; - error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, 0, NULL, ¶mSize); + error = clGetProgramBuildInfo(*outProgram, devices[z], + CL_PROGRAM_BUILD_LOG, 0, NULL, + ¶mSize); if (error != CL_SUCCESS) { - print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed"); + print_error( + error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed"); return error; } std::string log; log.resize(paramSize / sizeof(char)); - error = clGetProgramBuildInfo(*outProgram, devices[z], CL_PROGRAM_BUILD_LOG, paramSize, &log[0], NULL); + error = clGetProgramBuildInfo(*outProgram, devices[z], + CL_PROGRAM_BUILD_LOG, paramSize, + &log[0], NULL); if (error != CL_SUCCESS || log[0] == '\0') { - log_error("Device %d (%s) failed to return a build log\n", z, deviceName); + log_error("Device %d (%s) failed to return a build log\n", z, + deviceName); if (error) { - print_error(error, "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed"); + print_error( + error, + "clGetProgramBuildInfo CL_PROGRAM_BUILD_LOG failed"); return error; } else @@ -1059,7 +1088,8 @@ int build_program_create_kernel_helper(cl_context context, log_error("%s", kernelProgram[i]); printedSource = 1; } - log_error("Build log for device \"%s\" is: ------------\n", deviceName); + log_error("Build log for device \"%s\" is: ------------\n", + deviceName); log_error("%s\n", log.c_str()); log_error("\n----------\n"); return -1; @@ -1085,57 +1115,70 @@ int build_program_create_kernel_helper(cl_context context, return 0; } -int get_max_allowed_work_group_size( cl_context context, cl_kernel kernel, size_t *outMaxSize, size_t *outLimits ) +int get_max_allowed_work_group_size(cl_context context, cl_kernel kernel, + size_t *outMaxSize, size_t *outLimits) { cl_device_id *devices; size_t size, maxCommonSize = 0; int numDevices, i, j, error; - cl_uint numDims; + cl_uint numDims; size_t outSize; - size_t sizeLimit[]={1,1,1}; + size_t sizeLimit[] = { 1, 1, 1 }; /* Assume fewer than 16 devices will be returned */ - error = clGetContextInfo( context, CL_CONTEXT_DEVICES, 0, NULL, &outSize ); - test_error( error, "Unable to obtain list of devices size for context" ); - devices = (cl_device_id *)malloc(outSize); - BufferOwningPtr devicesBuf(devices); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, &outSize); + test_error(error, "Unable to obtain list of devices size for context"); + devices = (cl_device_id *)malloc(outSize); + BufferOwningPtr devicesBuf(devices); - error = clGetContextInfo( context, CL_CONTEXT_DEVICES, outSize, devices, NULL ); - test_error( error, "Unable to obtain list of devices for context" ); + error = + clGetContextInfo(context, CL_CONTEXT_DEVICES, outSize, devices, NULL); + test_error(error, "Unable to obtain list of devices for context"); - numDevices = (int)( outSize / sizeof( cl_device_id ) ); + numDevices = (int)(outSize / sizeof(cl_device_id)); - for( i = 0; i < numDevices; i++ ) + for (i = 0; i < numDevices; i++) { - error = clGetDeviceInfo( devices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, sizeof( size ), &size, NULL ); - test_error( error, "Unable to obtain max work group size for device" ); - if( size < maxCommonSize || maxCommonSize == 0) - maxCommonSize = size; + error = clGetDeviceInfo(devices[i], CL_DEVICE_MAX_WORK_GROUP_SIZE, + sizeof(size), &size, NULL); + test_error(error, "Unable to obtain max work group size for device"); + if (size < maxCommonSize || maxCommonSize == 0) maxCommonSize = size; - error = clGetKernelWorkGroupInfo( kernel, devices[i], CL_KERNEL_WORK_GROUP_SIZE, sizeof( size ), &size, NULL ); - test_error( error, "Unable to obtain max work group size for device and kernel combo" ); - if( size < maxCommonSize || maxCommonSize == 0) - maxCommonSize = size; + error = clGetKernelWorkGroupInfo(kernel, devices[i], + CL_KERNEL_WORK_GROUP_SIZE, + sizeof(size), &size, NULL); + test_error( + error, + "Unable to obtain max work group size for device and kernel combo"); + if (size < maxCommonSize || maxCommonSize == 0) maxCommonSize = size; - error= clGetDeviceInfo( devices[i], CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof( numDims ), &numDims, NULL); - test_error( error, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS"); - sizeLimit[0] = 1; - error= clGetDeviceInfo( devices[i], CL_DEVICE_MAX_WORK_ITEM_SIZES, numDims*sizeof(size_t), sizeLimit, NULL); - test_error( error, "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_SIZES"); + error = clGetDeviceInfo(devices[i], CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, + sizeof(numDims), &numDims, NULL); + test_error( + error, + "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS"); + sizeLimit[0] = 1; + error = clGetDeviceInfo(devices[i], CL_DEVICE_MAX_WORK_ITEM_SIZES, + numDims * sizeof(size_t), sizeLimit, NULL); + test_error(error, + "clGetDeviceInfo failed for CL_DEVICE_MAX_WORK_ITEM_SIZES"); if (outLimits != NULL) { - if (i == 0) { - for (j=0; j<3; j++) - outLimits[j] = sizeLimit[j]; - } else { - for (j=0; j<(int)numDims; j++) { - if (sizeLimit[j] < outLimits[j]) - outLimits[j] = sizeLimit[j]; + if (i == 0) + { + for (j = 0; j < 3; j++) outLimits[j] = sizeLimit[j]; + } + else + { + for (j = 0; j < (int)numDims; j++) + { + if (sizeLimit[j] < outLimits[j]) + outLimits[j] = sizeLimit[j]; + } + } } - } - } } *outMaxSize = (unsigned int)maxCommonSize; @@ -1143,204 +1186,230 @@ int get_max_allowed_work_group_size( cl_context context, cl_kernel kernel, size_ } -extern int get_max_allowed_1d_work_group_size_on_device( cl_device_id device, cl_kernel kernel, size_t *outSize ) +extern int get_max_allowed_1d_work_group_size_on_device(cl_device_id device, + cl_kernel kernel, + size_t *outSize) { - cl_uint maxDim; - size_t maxWgSize; - size_t *maxWgSizePerDim; - int error; + cl_uint maxDim; + size_t maxWgSize; + size_t *maxWgSizePerDim; + int error; - error = clGetKernelWorkGroupInfo( kernel, device, CL_KERNEL_WORK_GROUP_SIZE, sizeof( size_t ), &maxWgSize, NULL ); - test_error( error, "clGetKernelWorkGroupInfo CL_KERNEL_WORK_GROUP_SIZE failed" ); + error = clGetKernelWorkGroupInfo(kernel, device, CL_KERNEL_WORK_GROUP_SIZE, + sizeof(size_t), &maxWgSize, NULL); + test_error(error, + "clGetKernelWorkGroupInfo CL_KERNEL_WORK_GROUP_SIZE failed"); - error = clGetDeviceInfo( device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, sizeof( cl_uint ), &maxDim, NULL ); - test_error( error, "clGetDeviceInfo CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS failed" ); - maxWgSizePerDim = (size_t*)malloc( maxDim * sizeof( size_t ) ); - if( !maxWgSizePerDim ) + error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS, + sizeof(cl_uint), &maxDim, NULL); + test_error(error, + "clGetDeviceInfo CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS failed"); + maxWgSizePerDim = (size_t *)malloc(maxDim * sizeof(size_t)); + if (!maxWgSizePerDim) { - log_error( "Unable to allocate maxWgSizePerDim\n" ); + log_error("Unable to allocate maxWgSizePerDim\n"); return -1; } - error = clGetDeviceInfo( device, CL_DEVICE_MAX_WORK_ITEM_SIZES, maxDim * sizeof( size_t ), maxWgSizePerDim, NULL ); - if( error != CL_SUCCESS) + error = clGetDeviceInfo(device, CL_DEVICE_MAX_WORK_ITEM_SIZES, + maxDim * sizeof(size_t), maxWgSizePerDim, NULL); + if (error != CL_SUCCESS) { - log_error( "clGetDeviceInfo CL_DEVICE_MAX_WORK_ITEM_SIZES failed\n" ); - free( maxWgSizePerDim ); + log_error("clGetDeviceInfo CL_DEVICE_MAX_WORK_ITEM_SIZES failed\n"); + free(maxWgSizePerDim); return error; } // "maxWgSize" is limited to that of the first dimension. - if( maxWgSize > maxWgSizePerDim[0] ) + if (maxWgSize > maxWgSizePerDim[0]) { maxWgSize = maxWgSizePerDim[0]; } - free( maxWgSizePerDim ); + free(maxWgSizePerDim); *outSize = maxWgSize; return 0; } -int get_max_common_work_group_size( cl_context context, cl_kernel kernel, - size_t globalThreadSize, size_t *outMaxSize ) +int get_max_common_work_group_size(cl_context context, cl_kernel kernel, + size_t globalThreadSize, size_t *outMaxSize) { - size_t sizeLimit[3]; - int error = get_max_allowed_work_group_size( context, kernel, outMaxSize, sizeLimit ); - if( error != 0 ) - return error; + size_t sizeLimit[3]; + int error = + get_max_allowed_work_group_size(context, kernel, outMaxSize, sizeLimit); + if (error != 0) return error; - /* Now find the largest factor of globalThreadSize that is <= maxCommonSize */ - /* Note for speed, we don't need to check the range of maxCommonSize, b/c once it gets to 1, - the modulo test will succeed and break the loop anyway */ - for( ; ( globalThreadSize % *outMaxSize ) != 0 || (*outMaxSize > sizeLimit[0]); (*outMaxSize)-- ) + /* Now find the largest factor of globalThreadSize that is <= maxCommonSize + */ + /* Note for speed, we don't need to check the range of maxCommonSize, b/c + once it gets to 1, the modulo test will succeed and break the loop anyway + */ + for (; + (globalThreadSize % *outMaxSize) != 0 || (*outMaxSize > sizeLimit[0]); + (*outMaxSize)--) ; return 0; } -int get_max_common_2D_work_group_size( cl_context context, cl_kernel kernel, - size_t *globalThreadSizes, size_t *outMaxSizes ) +int get_max_common_2D_work_group_size(cl_context context, cl_kernel kernel, + size_t *globalThreadSizes, + size_t *outMaxSizes) { - size_t sizeLimit[3]; + size_t sizeLimit[3]; size_t maxSize; - int error = get_max_allowed_work_group_size( context, kernel, &maxSize, sizeLimit ); - if( error != 0 ) - return error; + int error = + get_max_allowed_work_group_size(context, kernel, &maxSize, sizeLimit); + if (error != 0) return error; - /* Now find a set of factors, multiplied together less than maxSize, but each a factor of the global - sizes */ + /* Now find a set of factors, multiplied together less than maxSize, but + each a factor of the global sizes */ /* Simple case */ - if( globalThreadSizes[ 0 ] * globalThreadSizes[ 1 ] <= maxSize ) + if (globalThreadSizes[0] * globalThreadSizes[1] <= maxSize) { - if (globalThreadSizes[ 0 ] <= sizeLimit[0] && globalThreadSizes[ 1 ] <= sizeLimit[1]) { - outMaxSizes[ 0 ] = globalThreadSizes[ 0 ]; - outMaxSizes[ 1 ] = globalThreadSizes[ 1 ]; - return 0; - } + if (globalThreadSizes[0] <= sizeLimit[0] + && globalThreadSizes[1] <= sizeLimit[1]) + { + outMaxSizes[0] = globalThreadSizes[0]; + outMaxSizes[1] = globalThreadSizes[1]; + return 0; + } } - size_t remainingSize, sizeForThisOne; - remainingSize = maxSize; - int i, j; - for (i=0 ; i<2; i++) { - if (globalThreadSizes[i] > remainingSize) - sizeForThisOne = remainingSize; - else - sizeForThisOne = globalThreadSizes[i]; - for (; (globalThreadSizes[i] % sizeForThisOne) != 0 || (sizeForThisOne > sizeLimit[i]); sizeForThisOne--) ; - outMaxSizes[i] = sizeForThisOne; + size_t remainingSize, sizeForThisOne; remainingSize = maxSize; - for (j=0; j<=i; j++) - remainingSize /=outMaxSizes[j]; - } + int i, j; + for (i = 0; i < 2; i++) + { + if (globalThreadSizes[i] > remainingSize) + sizeForThisOne = remainingSize; + else + sizeForThisOne = globalThreadSizes[i]; + for (; (globalThreadSizes[i] % sizeForThisOne) != 0 + || (sizeForThisOne > sizeLimit[i]); + sizeForThisOne--) + ; + outMaxSizes[i] = sizeForThisOne; + remainingSize = maxSize; + for (j = 0; j <= i; j++) remainingSize /= outMaxSizes[j]; + } return 0; } -int get_max_common_3D_work_group_size( cl_context context, cl_kernel kernel, - size_t *globalThreadSizes, size_t *outMaxSizes ) +int get_max_common_3D_work_group_size(cl_context context, cl_kernel kernel, + size_t *globalThreadSizes, + size_t *outMaxSizes) { - size_t sizeLimit[3]; + size_t sizeLimit[3]; size_t maxSize; - int error = get_max_allowed_work_group_size( context, kernel, &maxSize, sizeLimit ); - if( error != 0 ) - return error; - /* Now find a set of factors, multiplied together less than maxSize, but each a factor of the global - sizes */ + int error = + get_max_allowed_work_group_size(context, kernel, &maxSize, sizeLimit); + if (error != 0) return error; + /* Now find a set of factors, multiplied together less than maxSize, but + each a factor of the global sizes */ /* Simple case */ - if( globalThreadSizes[ 0 ] * globalThreadSizes[ 1 ] * globalThreadSizes[ 2 ] <= maxSize ) + if (globalThreadSizes[0] * globalThreadSizes[1] * globalThreadSizes[2] + <= maxSize) { - if (globalThreadSizes[ 0 ] <= sizeLimit[0] && globalThreadSizes[ 1 ] <= sizeLimit[1] && globalThreadSizes[ 2 ] <= sizeLimit[2]) { - outMaxSizes[ 0 ] = globalThreadSizes[ 0 ]; - outMaxSizes[ 1 ] = globalThreadSizes[ 1 ]; - outMaxSizes[ 2 ] = globalThreadSizes[ 2 ]; - return 0; - } + if (globalThreadSizes[0] <= sizeLimit[0] + && globalThreadSizes[1] <= sizeLimit[1] + && globalThreadSizes[2] <= sizeLimit[2]) + { + outMaxSizes[0] = globalThreadSizes[0]; + outMaxSizes[1] = globalThreadSizes[1]; + outMaxSizes[2] = globalThreadSizes[2]; + return 0; + } } - size_t remainingSize, sizeForThisOne; - remainingSize = maxSize; - int i, j; - for (i=0 ; i<3; i++) { - if (globalThreadSizes[i] > remainingSize) - sizeForThisOne = remainingSize; - else - sizeForThisOne = globalThreadSizes[i]; - for (; (globalThreadSizes[i] % sizeForThisOne) != 0 || (sizeForThisOne > sizeLimit[i]); sizeForThisOne--) ; - outMaxSizes[i] = sizeForThisOne; + size_t remainingSize, sizeForThisOne; remainingSize = maxSize; - for (j=0; j<=i; j++) - remainingSize /=outMaxSizes[j]; - } + int i, j; + for (i = 0; i < 3; i++) + { + if (globalThreadSizes[i] > remainingSize) + sizeForThisOne = remainingSize; + else + sizeForThisOne = globalThreadSizes[i]; + for (; (globalThreadSizes[i] % sizeForThisOne) != 0 + || (sizeForThisOne > sizeLimit[i]); + sizeForThisOne--) + ; + outMaxSizes[i] = sizeForThisOne; + remainingSize = maxSize; + for (j = 0; j <= i; j++) remainingSize /= outMaxSizes[j]; + } return 0; } /* Helper to determine if a device supports an image format */ -int is_image_format_supported( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, const cl_image_format *fmt ) +int is_image_format_supported(cl_context context, cl_mem_flags flags, + cl_mem_object_type image_type, + const cl_image_format *fmt) { cl_image_format *list; cl_uint count = 0; - cl_int err = clGetSupportedImageFormats( context, flags, image_type, 128, NULL, &count ); - if( count == 0 ) - return 0; + cl_int err = clGetSupportedImageFormats(context, flags, image_type, 128, + NULL, &count); + if (count == 0) return 0; - list = (cl_image_format*) malloc( count * sizeof( cl_image_format ) ); - if( NULL == list ) + list = (cl_image_format *)malloc(count * sizeof(cl_image_format)); + if (NULL == list) { - log_error( "Error: unable to allocate %ld byte buffer for image format list at %s:%d (err = %d)\n", count * sizeof( cl_image_format ), __FILE__, __LINE__, err ); + log_error("Error: unable to allocate %ld byte buffer for image format " + "list at %s:%d (err = %d)\n", + count * sizeof(cl_image_format), __FILE__, __LINE__, err); return 0; } BufferOwningPtr listBuf(list); - cl_int error = clGetSupportedImageFormats( context, flags, image_type, count, list, NULL ); - if( error ) + cl_int error = clGetSupportedImageFormats(context, flags, image_type, count, + list, NULL); + if (error) { - log_error( "Error: failed to obtain supported image type list at %s:%d (err = %d)\n", __FILE__, __LINE__, err ); + log_error("Error: failed to obtain supported image type list at %s:%d " + "(err = %d)\n", + __FILE__, __LINE__, err); return 0; } // iterate looking for a match. cl_uint i; - for( i = 0; i < count; i++ ) + for (i = 0; i < count; i++) { - if( fmt->image_channel_data_type == list[ i ].image_channel_data_type && - fmt->image_channel_order == list[ i ].image_channel_order ) + if (fmt->image_channel_data_type == list[i].image_channel_data_type + && fmt->image_channel_order == list[i].image_channel_order) break; } - return ( i < count ) ? 1 : 0; + return (i < count) ? 1 : 0; } -size_t get_pixel_bytes( const cl_image_format *fmt ); -size_t get_pixel_bytes( const cl_image_format *fmt ) +size_t get_pixel_bytes(const cl_image_format *fmt); +size_t get_pixel_bytes(const cl_image_format *fmt) { size_t chanCount; - switch( fmt->image_channel_order ) + switch (fmt->image_channel_order) { case CL_R: case CL_A: case CL_Rx: case CL_INTENSITY: case CL_LUMINANCE: - case CL_DEPTH: - chanCount = 1; - break; + case CL_DEPTH: chanCount = 1; break; case CL_RG: case CL_RA: - case CL_RGx: - chanCount = 2; - break; + case CL_RGx: chanCount = 2; break; case CL_RGB: case CL_RGBx: case CL_sRGB: - case CL_sRGBx: - chanCount = 3; - break; + case CL_sRGBx: chanCount = 3; break; case CL_RGBA: case CL_ARGB: case CL_BGRA: @@ -1355,74 +1424,73 @@ size_t get_pixel_bytes( const cl_image_format *fmt ) chanCount = 4; break; default: - log_error("Unknown channel order at %s:%d!\n", __FILE__, __LINE__ ); + log_error("Unknown channel order at %s:%d!\n", __FILE__, __LINE__); abort(); break; } - switch( fmt->image_channel_data_type ) + switch (fmt->image_channel_data_type) { - case CL_UNORM_SHORT_565: - case CL_UNORM_SHORT_555: - return 2; + case CL_UNORM_SHORT_565: + case CL_UNORM_SHORT_555: return 2; - case CL_UNORM_INT_101010: - return 4; + case CL_UNORM_INT_101010: return 4; - case CL_SNORM_INT8: - case CL_UNORM_INT8: - case CL_SIGNED_INT8: - case CL_UNSIGNED_INT8: - return chanCount; + case CL_SNORM_INT8: + case CL_UNORM_INT8: + case CL_SIGNED_INT8: + case CL_UNSIGNED_INT8: return chanCount; - case CL_SNORM_INT16: - case CL_UNORM_INT16: - case CL_HALF_FLOAT: - case CL_SIGNED_INT16: - case CL_UNSIGNED_INT16: + case CL_SNORM_INT16: + case CL_UNORM_INT16: + case CL_HALF_FLOAT: + case CL_SIGNED_INT16: + case CL_UNSIGNED_INT16: #ifdef CL_SFIXED14_APPLE - case CL_SFIXED14_APPLE: + case CL_SFIXED14_APPLE: #endif return chanCount * 2; - case CL_SIGNED_INT32: - case CL_UNSIGNED_INT32: - case CL_FLOAT: - return chanCount * 4; + case CL_SIGNED_INT32: + case CL_UNSIGNED_INT32: + case CL_FLOAT: return chanCount * 4; default: - log_error("Unknown channel data type at %s:%d!\n", __FILE__, __LINE__ ); + log_error("Unknown channel data type at %s:%d!\n", __FILE__, + __LINE__); abort(); } return 0; } -test_status verifyImageSupport( cl_device_id device ) +test_status verifyImageSupport(cl_device_id device) { - int result = checkForImageSupport( device ); - if( result == 0 ) + int result = checkForImageSupport(device); + if (result == 0) { return TEST_PASS; } - if( result == CL_IMAGE_FORMAT_NOT_SUPPORTED ) + if (result == CL_IMAGE_FORMAT_NOT_SUPPORTED) { - log_error( "SKIPPED: Device does not supported images as required by this test!\n" ); + log_error("SKIPPED: Device does not supported images as required by " + "this test!\n"); return TEST_SKIP; } return TEST_FAIL; } -int checkForImageSupport( cl_device_id device ) +int checkForImageSupport(cl_device_id device) { cl_uint i; int error; /* Check the device props to see if images are supported at all first */ - error = clGetDeviceInfo( device, CL_DEVICE_IMAGE_SUPPORT, sizeof( i ), &i, NULL ); - test_error( error, "Unable to query device for image support" ); - if( i == 0 ) + error = + clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT, sizeof(i), &i, NULL); + test_error(error, "Unable to query device for image support"); + if (i == 0) { return CL_IMAGE_FORMAT_NOT_SUPPORTED; } @@ -1431,36 +1499,40 @@ int checkForImageSupport( cl_device_id device ) return 0; } -int checkFor3DImageSupport( cl_device_id device ) +int checkFor3DImageSupport(cl_device_id device) { cl_uint i; int error; /* Check the device props to see if images are supported at all first */ - error = clGetDeviceInfo( device, CL_DEVICE_IMAGE_SUPPORT, sizeof( i ), &i, NULL ); - test_error( error, "Unable to query device for image support" ); - if( i == 0 ) + error = + clGetDeviceInfo(device, CL_DEVICE_IMAGE_SUPPORT, sizeof(i), &i, NULL); + test_error(error, "Unable to query device for image support"); + if (i == 0) { return CL_IMAGE_FORMAT_NOT_SUPPORTED; } char profile[128]; - error = clGetDeviceInfo( device, CL_DEVICE_PROFILE, sizeof(profile ), profile, NULL ); - test_error( error, "Unable to query device for CL_DEVICE_PROFILE" ); - if( 0 == strcmp( profile, "EMBEDDED_PROFILE" ) ) + error = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile), profile, + NULL); + test_error(error, "Unable to query device for CL_DEVICE_PROFILE"); + if (0 == strcmp(profile, "EMBEDDED_PROFILE")) { size_t width = -1L; size_t height = -1L; size_t depth = -1L; - error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_WIDTH, sizeof(width), &width, NULL ); - test_error( error, "Unable to get CL_DEVICE_IMAGE3D_MAX_WIDTH" ); - error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, sizeof(height), &height, NULL ); - test_error( error, "Unable to get CL_DEVICE_IMAGE3D_MAX_HEIGHT" ); - error = clGetDeviceInfo( device, CL_DEVICE_IMAGE3D_MAX_DEPTH, sizeof(depth), &depth, NULL ); - test_error( error, "Unable to get CL_DEVICE_IMAGE3D_MAX_DEPTH" ); + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_WIDTH, + sizeof(width), &width, NULL); + test_error(error, "Unable to get CL_DEVICE_IMAGE3D_MAX_WIDTH"); + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_HEIGHT, + sizeof(height), &height, NULL); + test_error(error, "Unable to get CL_DEVICE_IMAGE3D_MAX_HEIGHT"); + error = clGetDeviceInfo(device, CL_DEVICE_IMAGE3D_MAX_DEPTH, + sizeof(depth), &depth, NULL); + test_error(error, "Unable to get CL_DEVICE_IMAGE3D_MAX_DEPTH"); - if( 0 == (height | width | depth )) - return CL_IMAGE_FORMAT_NOT_SUPPORTED; + if (0 == (height | width | depth)) return CL_IMAGE_FORMAT_NOT_SUPPORTED; } /* So our support is good */ @@ -1508,51 +1580,43 @@ size_t get_min_alignment(cl_context context) { static cl_uint align_size = 0; - if( 0 == align_size ) + if (0 == align_size) { - cl_device_id * devices; + cl_device_id *devices; size_t devices_size = 0; cl_uint result = 0; cl_int error; int i; - error = clGetContextInfo (context, - CL_CONTEXT_DEVICES, - 0, - NULL, - &devices_size); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, 0, NULL, + &devices_size); test_error_ret(error, "clGetContextInfo failed", 0); - devices = (cl_device_id*)malloc(devices_size); - if (devices == NULL) { - print_error( error, "malloc failed" ); + devices = (cl_device_id *)malloc(devices_size); + if (devices == NULL) + { + print_error(error, "malloc failed"); return 0; } - error = clGetContextInfo (context, - CL_CONTEXT_DEVICES, - devices_size, - (void*)devices, - NULL); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, devices_size, + (void *)devices, NULL); test_error_ret(error, "clGetContextInfo failed", 0); - for (i = 0; i < (int)(devices_size/sizeof(cl_device_id)); i++) + for (i = 0; i < (int)(devices_size / sizeof(cl_device_id)); i++) { cl_uint alignment = 0; - error = clGetDeviceInfo (devices[i], - CL_DEVICE_MEM_BASE_ADDR_ALIGN, - sizeof(cl_uint), - (void*)&alignment, - NULL); + error = clGetDeviceInfo(devices[i], CL_DEVICE_MEM_BASE_ADDR_ALIGN, + sizeof(cl_uint), (void *)&alignment, NULL); if (error == CL_SUCCESS) { - alignment >>= 3; // convert bits to bytes + alignment >>= 3; // convert bits to bytes result = (alignment > result) ? alignment : result; } else - print_error( error, "clGetDeviceInfo failed" ); + print_error(error, "clGetDeviceInfo failed"); } align_size = result; @@ -1562,59 +1626,76 @@ size_t get_min_alignment(cl_context context) return align_size; } -cl_device_fp_config get_default_rounding_mode( cl_device_id device ) +cl_device_fp_config get_default_rounding_mode(cl_device_id device) { char profileStr[128] = ""; cl_device_fp_config single = 0; - int error = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( single ), &single, NULL ); - if( error ) - test_error_ret( error, "Unable to get device CL_DEVICE_SINGLE_FP_CONFIG", 0 ); + int error = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, + sizeof(single), &single, NULL); + if (error) + test_error_ret(error, "Unable to get device CL_DEVICE_SINGLE_FP_CONFIG", + 0); - if( single & CL_FP_ROUND_TO_NEAREST ) - return CL_FP_ROUND_TO_NEAREST; + if (single & CL_FP_ROUND_TO_NEAREST) return CL_FP_ROUND_TO_NEAREST; - if( 0 == (single & CL_FP_ROUND_TO_ZERO) ) - test_error_ret( -1, "FAILURE: device must support either CL_DEVICE_SINGLE_FP_CONFIG or CL_FP_ROUND_TO_NEAREST", 0 ); + if (0 == (single & CL_FP_ROUND_TO_ZERO)) + test_error_ret(-1, + "FAILURE: device must support either " + "CL_DEVICE_SINGLE_FP_CONFIG or CL_FP_ROUND_TO_NEAREST", + 0); // Make sure we are an embedded device before allowing a pass - if( (error = clGetDeviceInfo( device, CL_DEVICE_PROFILE, sizeof( profileStr ), &profileStr, NULL ) )) - test_error_ret( error, "FAILURE: Unable to get CL_DEVICE_PROFILE", 0 ); + if ((error = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profileStr), + &profileStr, NULL))) + test_error_ret(error, "FAILURE: Unable to get CL_DEVICE_PROFILE", 0); - if( strcmp( profileStr, "EMBEDDED_PROFILE" ) ) - test_error_ret( error, "FAILURE: non-EMBEDDED_PROFILE devices must support CL_FP_ROUND_TO_NEAREST", 0 ); + if (strcmp(profileStr, "EMBEDDED_PROFILE")) + test_error_ret(error, + "FAILURE: non-EMBEDDED_PROFILE devices must support " + "CL_FP_ROUND_TO_NEAREST", + 0); return CL_FP_ROUND_TO_ZERO; } -int checkDeviceForQueueSupport( cl_device_id device, cl_command_queue_properties prop ) +int checkDeviceForQueueSupport(cl_device_id device, + cl_command_queue_properties prop) { cl_command_queue_properties realProps; - cl_int error = clGetDeviceInfo( device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, sizeof( realProps ), &realProps, NULL ); - test_error_ret( error, "FAILURE: Unable to get device queue properties", 0 ); + cl_int error = clGetDeviceInfo(device, CL_DEVICE_QUEUE_ON_HOST_PROPERTIES, + sizeof(realProps), &realProps, NULL); + test_error_ret(error, "FAILURE: Unable to get device queue properties", 0); - return ( realProps & prop ) ? 1 : 0; + return (realProps & prop) ? 1 : 0; } -int printDeviceHeader( cl_device_id device ) +int printDeviceHeader(cl_device_id device) { - char deviceName[ 512 ], deviceVendor[ 512 ], deviceVersion[ 512 ], cLangVersion[ 512 ]; + char deviceName[512], deviceVendor[512], deviceVersion[512], + cLangVersion[512]; int error; - error = clGetDeviceInfo( device, CL_DEVICE_NAME, sizeof( deviceName ), deviceName, NULL ); - test_error( error, "Unable to get CL_DEVICE_NAME for device" ); + error = clGetDeviceInfo(device, CL_DEVICE_NAME, sizeof(deviceName), + deviceName, NULL); + test_error(error, "Unable to get CL_DEVICE_NAME for device"); - error = clGetDeviceInfo( device, CL_DEVICE_VENDOR, sizeof( deviceVendor ), deviceVendor, NULL ); - test_error( error, "Unable to get CL_DEVICE_VENDOR for device" ); + error = clGetDeviceInfo(device, CL_DEVICE_VENDOR, sizeof(deviceVendor), + deviceVendor, NULL); + test_error(error, "Unable to get CL_DEVICE_VENDOR for device"); - error = clGetDeviceInfo( device, CL_DEVICE_VERSION, sizeof( deviceVersion ), deviceVersion, NULL ); - test_error( error, "Unable to get CL_DEVICE_VERSION for device" ); + error = clGetDeviceInfo(device, CL_DEVICE_VERSION, sizeof(deviceVersion), + deviceVersion, NULL); + test_error(error, "Unable to get CL_DEVICE_VERSION for device"); - error = clGetDeviceInfo( device, CL_DEVICE_OPENCL_C_VERSION, sizeof( cLangVersion ), cLangVersion, NULL ); - test_error( error, "Unable to get CL_DEVICE_OPENCL_C_VERSION for device" ); + error = clGetDeviceInfo(device, CL_DEVICE_OPENCL_C_VERSION, + sizeof(cLangVersion), cLangVersion, NULL); + test_error(error, "Unable to get CL_DEVICE_OPENCL_C_VERSION for device"); - log_info("Compute Device Name = %s, Compute Device Vendor = %s, Compute Device Version = %s%s%s\n", - deviceName, deviceVendor, deviceVersion, ( error == CL_SUCCESS ) ? ", CL C Version = " : "", - ( error == CL_SUCCESS ) ? cLangVersion : "" ); + log_info("Compute Device Name = %s, Compute Device Vendor = %s, Compute " + "Device Version = %s%s%s\n", + 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)) diff --git a/test_common/harness/kernelHelpers.h b/test_common/harness/kernelHelpers.h index 4b1462e5..d10d44ed 100644 --- a/test_common/harness/kernelHelpers.h +++ b/test_common/harness/kernelHelpers.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 @@ -25,16 +25,16 @@ #include #include -#if defined (__MINGW32__) +#if defined(__MINGW32__) #include #endif #include #ifdef __APPLE__ - #include +#include #else - #include +#include #endif #include "deviceInfo.h" @@ -43,7 +43,8 @@ #include /* - * The below code is intended to be used at the top of kernels that appear inline in files to set line and file info for the kernel: + * The below code is intended to be used at the top of kernels that appear + * inline in files to set line and file info for the kernel: * * const char *source = { * INIT_OPENCL_DEBUG_INFO @@ -53,104 +54,115 @@ * "}\n" * }; */ -#define INIT_OPENCL_DEBUG_INFO SET_OPENCL_LINE_INFO( __LINE__, __FILE__ ) -#define SET_OPENCL_LINE_INFO(_line, _file) "#line " STRINGIFY(_line) " " STRINGIFY(_file) "\n" +#define INIT_OPENCL_DEBUG_INFO SET_OPENCL_LINE_INFO(__LINE__, __FILE__) +#define SET_OPENCL_LINE_INFO(_line, _file) \ + "#line " STRINGIFY(_line) " " STRINGIFY(_file) "\n" #ifndef STRINGIFY_VALUE - #define STRINGIFY_VALUE(_x) STRINGIFY(_x) +#define STRINGIFY_VALUE(_x) STRINGIFY(_x) #endif #ifndef STRINGIFY - #define STRINGIFY(_x) #_x +#define STRINGIFY(_x) #_x #endif const int MAX_LEN_FOR_KERNEL_LIST = 20; -/* Helper that creates a single program and kernel from a single-kernel program source */ -extern int create_single_kernel_helper(cl_context context, - cl_program *outProgram, - cl_kernel *outKernel, - unsigned int numKernelLines, - const char **kernelProgram, - const char *kernelName, - const char *buildOptions = NULL, - const bool openclCXX = false); +/* Helper that creates a single program and kernel from a single-kernel program + * source */ +extern int +create_single_kernel_helper(cl_context context, cl_program *outProgram, + cl_kernel *outKernel, unsigned int numKernelLines, + const char **kernelProgram, const char *kernelName, + const char *buildOptions = NULL, + const bool openclCXX = false); -extern int create_single_kernel_helper_with_build_options(cl_context context, - cl_program *outProgram, - cl_kernel *outKernel, - unsigned int numKernelLines, - const char **kernelProgram, - const char *kernelName, - const char *buildOptions, - const bool openclCXX = false); +extern int create_single_kernel_helper_with_build_options( + cl_context context, cl_program *outProgram, cl_kernel *outKernel, + unsigned int numKernelLines, const char **kernelProgram, + const char *kernelName, const char *buildOptions, + const bool openclCXX = false); -extern int create_single_kernel_helper_create_program(cl_context context, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions = NULL, - const bool openclCXX = false); - -extern int create_single_kernel_helper_create_program_for_device(cl_context context, - cl_device_id device, - cl_program *outProgram, - unsigned int numKernelLines, - const char **kernelProgram, - const char *buildOptions = NULL, - const bool openclCXX = false); +extern int create_single_kernel_helper_create_program( + cl_context context, cl_program *outProgram, unsigned int numKernelLines, + const char **kernelProgram, const char *buildOptions = NULL, + const bool openclCXX = false); -/* Creates OpenCL C++ program. This one must be used for creating OpenCL C++ program. */ -extern int create_openclcpp_program(cl_context context, - cl_program *outProgram, +extern int create_single_kernel_helper_create_program_for_device( + cl_context context, cl_device_id device, cl_program *outProgram, + unsigned int numKernelLines, const char **kernelProgram, + const char *buildOptions = NULL, const bool openclCXX = false); + +/* Creates OpenCL C++ program. This one must be used for creating OpenCL C++ + * program. */ +extern int create_openclcpp_program(cl_context context, cl_program *outProgram, unsigned int numKernelLines, const char **kernelProgram, const char *buildOptions = NULL); /* Builds program (outProgram) and creates one kernel */ -int build_program_create_kernel_helper(cl_context context, - cl_program *outProgram, - cl_kernel *outKernel, - unsigned int numKernelLines, - const char **kernelProgram, - const char *kernelName, - const char *buildOptions = NULL); +int build_program_create_kernel_helper( + cl_context context, cl_program *outProgram, cl_kernel *outKernel, + unsigned int numKernelLines, const char **kernelProgram, + const char *kernelName, const char *buildOptions = NULL); -/* Helper to obtain the biggest fit work group size for all the devices in a given group and for the given global thread size */ -extern int get_max_common_work_group_size( cl_context context, cl_kernel kernel, size_t globalThreadSize, size_t *outSize ); +/* Helper to obtain the biggest fit work group size for all the devices in a + * given group and for the given global thread size */ +extern int get_max_common_work_group_size(cl_context context, cl_kernel kernel, + size_t globalThreadSize, + size_t *outSize); -/* Helper to obtain the biggest fit work group size for all the devices in a given group and for the given global thread size */ -extern int get_max_common_2D_work_group_size( cl_context context, cl_kernel kernel, size_t *globalThreadSize, size_t *outSizes ); +/* Helper to obtain the biggest fit work group size for all the devices in a + * given group and for the given global thread size */ +extern int get_max_common_2D_work_group_size(cl_context context, + cl_kernel kernel, + size_t *globalThreadSize, + size_t *outSizes); -/* Helper to obtain the biggest fit work group size for all the devices in a given group and for the given global thread size */ -extern int get_max_common_3D_work_group_size( cl_context context, cl_kernel kernel, size_t *globalThreadSize, size_t *outSizes ); +/* Helper to obtain the biggest fit work group size for all the devices in a + * given group and for the given global thread size */ +extern int get_max_common_3D_work_group_size(cl_context context, + cl_kernel kernel, + size_t *globalThreadSize, + size_t *outSizes); -/* Helper to obtain the biggest allowed work group size for all the devices in a given group */ -extern int get_max_allowed_work_group_size( cl_context context, cl_kernel kernel, size_t *outSize, size_t *outLimits ); +/* Helper to obtain the biggest allowed work group size for all the devices in a + * given group */ +extern int get_max_allowed_work_group_size(cl_context context, cl_kernel kernel, + size_t *outSize, size_t *outLimits); /* Helper to obtain the biggest allowed 1D work group size on a given device */ -extern int get_max_allowed_1d_work_group_size_on_device( cl_device_id device, cl_kernel kernel, size_t *outSize ); +extern int get_max_allowed_1d_work_group_size_on_device(cl_device_id device, + cl_kernel kernel, + size_t *outSize); /* Helper to determine if a device supports an image format */ -extern int is_image_format_supported( cl_context context, cl_mem_flags flags, cl_mem_object_type image_type, const cl_image_format *fmt ); +extern int is_image_format_supported(cl_context context, cl_mem_flags flags, + cl_mem_object_type image_type, + const cl_image_format *fmt); /* Helper to get pixel size for a pixel format */ -size_t get_pixel_bytes( const cl_image_format *fmt ); +size_t get_pixel_bytes(const cl_image_format *fmt); /* Verify the given device supports images. */ -extern test_status verifyImageSupport( cl_device_id device ); +extern test_status verifyImageSupport(cl_device_id device); -/* Checks that the given device supports images. Same as verify, but doesn't print an error */ -extern int checkForImageSupport( cl_device_id device ); -extern int checkFor3DImageSupport( cl_device_id device ); +/* Checks that the given device supports images. Same as verify, but doesn't + * print an error */ +extern int checkForImageSupport(cl_device_id device); +extern int checkFor3DImageSupport(cl_device_id device); extern int checkForReadWriteImageSupport(cl_device_id device); -/* Checks that a given queue property is supported on the specified device. Returns 1 if supported, 0 if not or an error. */ -extern int checkDeviceForQueueSupport( cl_device_id device, cl_command_queue_properties prop ); +/* Checks that a given queue property is supported on the specified device. + * Returns 1 if supported, 0 if not or an error. */ +extern int checkDeviceForQueueSupport(cl_device_id device, + cl_command_queue_properties prop); -/* Helper to obtain the min alignment for a given context, i.e the max of all min alignments for devices attached to the context*/ +/* Helper to obtain the min alignment for a given context, i.e the max of all + * min alignments for devices attached to the context*/ 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 ); +/* 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)) \ @@ -176,8 +188,9 @@ cl_device_fp_config get_default_rounding_mode( cl_device_id device ); 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 ); +/* 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. diff --git a/test_common/harness/mingw_compat.c b/test_common/harness/mingw_compat.c index 54c44635..5b384721 100644 --- a/test_common/harness/mingw_compat.c +++ b/test_common/harness/mingw_compat.c @@ -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 @@ -19,41 +19,44 @@ #include #include -//This function is unavailable on various mingw compilers, -//especially 64 bit so implementing it here -const char *basename_dot="."; -char* -basename(char *path) +// This function is unavailable on various mingw compilers, +// especially 64 bit so implementing it here +const char *basename_dot = "."; +char *basename(char *path) { char *p = path, *b = NULL; int len = strlen(path); - if (path == NULL) { - return (char*)basename_dot; + if (path == NULL) + { + return (char *)basename_dot; } // Not absolute path on windows - if (path[1] != ':') { + if (path[1] != ':') + { return path; } // Trim trailing path seperators - if (path[len - 1] == '\\' || - path[len - 1] == '/' ) { + if (path[len - 1] == '\\' || path[len - 1] == '/') + { len--; path[len] = '\0'; } - while (len) { - while((*p != '\\' || *p != '/') && len) { + while (len) + { + while ((*p != '\\' || *p != '/') && len) + { p++; len--; } p++; b = p; - } + } - return b; + return b; } #endif \ No newline at end of file diff --git a/test_common/harness/mingw_compat.h b/test_common/harness/mingw_compat.h index ab28f398..a509c753 100644 --- a/test_common/harness/mingw_compat.h +++ b/test_common/harness/mingw_compat.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 @@ -21,7 +21,7 @@ char *basename(char *path); #include #if defined(__MINGW64__) -//mingw-w64 doesnot have __mingw_aligned_malloc, instead it has _aligned_malloc +// mingw-w64 doesnot have __mingw_aligned_malloc, instead it has _aligned_malloc #define __mingw_aligned_malloc _aligned_malloc #define __mingw_aligned_free _aligned_free #include diff --git a/test_common/harness/msvc9.c b/test_common/harness/msvc9.c index 1c0cf2b9..29b45d65 100644 --- a/test_common/harness/msvc9.c +++ b/test_common/harness/msvc9.c @@ -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 @@ -15,7 +15,7 @@ // #include "compat.h" -#if defined ( _MSC_VER ) +#if defined(_MSC_VER) #include #include @@ -24,7 +24,7 @@ #include -#if _MSC_VER < 1900 && ! defined( __INTEL_COMPILER ) +#if _MSC_VER < 1900 && !defined(__INTEL_COMPILER) /////////////////////////////////////////////////////////////////// // @@ -32,9 +32,12 @@ // /////////////////////////////////////////////////////////////////// -float copysignf( float x, float y ) +float copysignf(float x, float y) { - union{ cl_uint u; float f; }ux, uy; + union { + cl_uint u; + float f; + } ux, uy; ux.f = x; uy.f = y; @@ -44,9 +47,12 @@ float copysignf( float x, float y ) return ux.f; } -double copysign( double x, double y ) +double copysign(double x, double y) { - union{ cl_ulong u; double f; }ux, uy; + union { + cl_ulong u; + double f; + } ux, uy; ux.f = x; uy.f = y; @@ -56,13 +62,16 @@ double copysign( double x, double y ) return ux.f; } -long double copysignl( long double x, long double y ) +long double copysignl(long double x, long double y) { - union - { + union { long double f; - struct{ cl_ulong m; cl_ushort sexp; }u; - }ux, uy; + struct + { + cl_ulong m; + cl_ushort sexp; + } u; + } ux, uy; ux.f = x; uy.f = y; @@ -76,12 +85,12 @@ float rintf(float x) { float absx = fabsf(x); - if( absx < 8388608.0f /* 0x1.0p23f */ ) + if (absx < 8388608.0f /* 0x1.0p23f */) { - float magic = copysignf( 8388608.0f /* 0x1.0p23f */, x ); + float magic = copysignf(8388608.0f /* 0x1.0p23f */, x); float rounded = x + magic; rounded -= magic; - x = copysignf( rounded, x ); + x = copysignf(rounded, x); } return x; @@ -91,12 +100,12 @@ double rint(double x) { double absx = fabs(x); - if( absx < 4503599627370496.0 /* 0x1.0p52f */ ) + if (absx < 4503599627370496.0 /* 0x1.0p52f */) { - double magic = copysign( 4503599627370496.0 /* 0x1.0p52 */, x ); + double magic = copysign(4503599627370496.0 /* 0x1.0p52 */, x); double rounded = x + magic; rounded -= magic; - x = copysign( rounded, x ); + x = copysign(rounded, x); } return x; @@ -106,12 +115,13 @@ long double rintl(long double x) { double absx = fabs(x); - if( absx < 9223372036854775808.0L /* 0x1.0p64f */ ) + if (absx < 9223372036854775808.0L /* 0x1.0p64f */) { - long double magic = copysignl( 9223372036854775808.0L /* 0x1.0p63L */, x ); + long double magic = + copysignl(9223372036854775808.0L /* 0x1.0p63L */, x); long double rounded = x + magic; rounded -= magic; - x = copysignl( rounded, x ); + x = copysignl(rounded, x); } return x; @@ -125,30 +135,31 @@ long double rintl(long double x) // /////////////////////////////////////////////////////////////////// #ifndef FP_ILOGB0 - #define FP_ILOGB0 INT_MIN +#define FP_ILOGB0 INT_MIN #endif #ifndef FP_ILOGBNAN - #define FP_ILOGBNAN INT_MIN +#define FP_ILOGBNAN INT_MIN #endif -int ilogb (double x) +int ilogb(double x) { - union{ double f; cl_ulong u;} u; + union { + double f; + cl_ulong u; + } u; u.f = x; cl_ulong absx = u.u & CL_LONG_MAX; - if( absx - 0x0001000000000000ULL >= 0x7ff0000000000000ULL - 0x0001000000000000ULL) + if (absx - 0x0001000000000000ULL + >= 0x7ff0000000000000ULL - 0x0001000000000000ULL) { - switch( absx ) + switch (absx) { - case 0: - return FP_ILOGB0; - case 0x7ff0000000000000ULL: - return INT_MAX; + case 0: return FP_ILOGB0; + case 0x7ff0000000000000ULL: return INT_MAX; default: - if( absx > 0x7ff0000000000000ULL ) - return FP_ILOGBNAN; + if (absx > 0x7ff0000000000000ULL) return FP_ILOGBNAN; // subnormal u.u = absx | 0x3ff0000000000000ULL; @@ -161,23 +172,23 @@ int ilogb (double x) } -int ilogbf (float x) +int ilogbf(float x) { - union{ float f; cl_uint u;} u; + union { + float f; + cl_uint u; + } u; u.f = x; cl_uint absx = u.u & 0x7fffffff; - if( absx - 0x00800000U >= 0x7f800000U - 0x00800000U) + if (absx - 0x00800000U >= 0x7f800000U - 0x00800000U) { - switch( absx ) + switch (absx) { - case 0: - return FP_ILOGB0; - case 0x7f800000U: - return INT_MAX; + case 0: return FP_ILOGB0; + case 0x7f800000U: return INT_MAX; default: - if( absx > 0x7f800000 ) - return FP_ILOGBNAN; + if (absx > 0x7f800000) return FP_ILOGBNAN; // subnormal u.u = absx | 0x3f800000U; @@ -189,32 +200,33 @@ int ilogbf (float x) return (absx >> 23) - 127; } -int ilogbl (long double x) +int ilogbl(long double x) { - union - { + union { long double f; - struct{ cl_ulong m; cl_ushort sexp; }u; + struct + { + cl_ulong m; + cl_ushort sexp; + } u; } u; u.f = x; int exp = u.u.sexp & 0x7fff; - if( 0 == exp ) + if (0 == exp) { - if( 0 == u.u.m ) - return FP_ILOGB0; + if (0 == u.u.m) return FP_ILOGB0; - //subnormal + // subnormal u.u.sexp = 0x3fff; u.f -= 1.0f; exp = u.u.sexp & 0x7fff; return exp - (0x3fff + 0x3ffe); } - else if( 0x7fff == exp ) + else if (0x7fff == exp) { - if( u.u.m & CL_LONG_MAX ) - return FP_ILOGBNAN; + if (u.u.m & CL_LONG_MAX) return FP_ILOGBNAN; return INT_MAX; } @@ -232,7 +244,10 @@ int ilogbl (long double x) static void GET_BITS_SP32(float fx, unsigned int* ux) { - volatile union {float f; unsigned int u;} _bitsy; + volatile union { + float f; + unsigned int u; + } _bitsy; _bitsy.f = (fx); *ux = _bitsy.u; } @@ -244,7 +259,10 @@ static void GET_BITS_SP32(float fx, unsigned int* ux) /* } */ static void PUT_BITS_SP32(unsigned int ux, float* fx) { - volatile union {float f; unsigned int u;} _bitsy; + volatile union { + float f; + unsigned int u; + } _bitsy; _bitsy.u = (ux); *fx = _bitsy.f; } @@ -256,13 +274,19 @@ static void PUT_BITS_SP32(unsigned int ux, float* fx) /* } */ static void GET_BITS_DP64(double dx, unsigned __int64* lx) { - volatile union {double d; unsigned __int64 l;} _bitsy; + volatile union { + double d; + unsigned __int64 l; + } _bitsy; _bitsy.d = (dx); *lx = _bitsy.l; } static void PUT_BITS_DP64(unsigned __int64 lx, double* dx) { - volatile union {double d; unsigned __int64 l;} _bitsy; + volatile union { + double d; + unsigned __int64 l; + } _bitsy; _bitsy.l = (lx); *dx = _bitsy.d; } @@ -287,8 +311,7 @@ int SIGNBIT_DP64(double x ) that x is NaN; gcc does. */ double fmax(double x, double y) { - if( isnan(y) ) - return x; + if (isnan(y)) return x; return x >= y ? x : y; } @@ -301,17 +324,15 @@ double fmax(double x, double y) double fmin(double x, double y) { - if( isnan(y) ) - return x; + if (isnan(y)) return x; return x <= y ? x : y; } -float fmaxf( float x, float y ) +float fmaxf(float x, float y) { - if( isnan(y) ) - return x; + if (isnan(y)) return x; return x >= y ? x : y; } @@ -323,31 +344,31 @@ float fmaxf( float x, float y ) float fminf(float x, float y) { - if( isnan(y) ) - return x; + if (isnan(y)) return x; return x <= y ? x : y; } long double scalblnl(long double x, long n) { - union - { + union { long double d; - struct{ cl_ulong m; cl_ushort sexp;}u; - }u; + struct + { + cl_ulong m; + cl_ushort sexp; + } u; + } u; u.u.m = CL_LONG_MIN; - if( x == 0.0L || n < -2200) - return copysignl( 0.0L, x ); + if (x == 0.0L || n < -2200) return copysignl(0.0L, x); - if( n > 2200 ) - return INFINITY; + if (n > 2200) return INFINITY; - if( n < 0 ) + if (n < 0) { u.u.sexp = 0x3fff - 1022; - while( n <= -1022 ) + while (n <= -1022) { x *= u.d; n += 1022; @@ -357,10 +378,10 @@ long double scalblnl(long double x, long n) return x; } - if( n > 0 ) + if (n > 0) { u.u.sexp = 0x3fff + 1023; - while( n >= 1023 ) + while (n >= 1023) { x *= u.d; n -= 1023; @@ -378,15 +399,12 @@ long double scalblnl(long double x, long n) // log2 // /////////////////////////////////////////////////////////////////// -const static cl_double log_e_base2 = 1.4426950408889634074; -const static cl_double log_10_base2 = 3.3219280948873623478; +const static cl_double log_e_base2 = 1.4426950408889634074; +const static cl_double log_10_base2 = 3.3219280948873623478; -//double log10(double x); +// double log10(double x); -double log2(double x) -{ - return 1.44269504088896340735992468100189214 * log(x); -} +double log2(double x) { return 1.44269504088896340735992468100189214 * log(x); } long double log2l(long double x) { @@ -397,23 +415,23 @@ double trunc(double x) { double absx = fabs(x); - if( absx < 4503599627370496.0 /* 0x1.0p52f */ ) + if (absx < 4503599627370496.0 /* 0x1.0p52f */) { cl_long rounded = x; - x = copysign( (double) rounded, x ); + x = copysign((double)rounded, x); } return x; } -float truncf(float x) +float truncf(float x) { float absx = fabsf(x); - if( absx < 8388608.0f /* 0x1.0p23f */ ) + if (absx < 8388608.0f /* 0x1.0p23f */) { cl_int rounded = x; - x = copysignf( (float) rounded, x ); + x = copysignf((float)rounded, x); } return x; @@ -423,75 +441,69 @@ long lround(double x) { double absx = fabs(x); - if( absx < 0.5 ) - return 0; + if (absx < 0.5) return 0; - if( absx < 4503599627370496.0 /* 0x1.0p52 */) + if (absx < 4503599627370496.0 /* 0x1.0p52 */) { absx += 0.5; cl_long rounded = absx; absx = rounded; - x = copysign( absx, x ); + x = copysign(absx, x); } - if( x >= (double) LONG_MAX ) - return LONG_MAX; + if (x >= (double)LONG_MAX) return LONG_MAX; - return (long) x; + return (long)x; } long lroundf(float x) { float absx = fabsf(x); - if( absx < 0.5f ) - return 0; + if (absx < 0.5f) return 0; - if( absx < 8388608.0f ) + if (absx < 8388608.0f) { absx += 0.5f; cl_int rounded = absx; absx = rounded; - x = copysignf( absx, x ); + x = copysignf(absx, x); } - if( x >= (float) LONG_MAX ) - return LONG_MAX; + if (x >= (float)LONG_MAX) return LONG_MAX; - return (long) x; + return (long)x; } double round(double x) { double absx = fabs(x); - if( absx < 0.5 ) - return copysign( 0.0, x); + if (absx < 0.5) return copysign(0.0, x); - if( absx < 4503599627370496.0 /* 0x1.0p52 */) + if (absx < 4503599627370496.0 /* 0x1.0p52 */) { absx += 0.5; cl_long rounded = absx; absx = rounded; - x = copysign( absx, x ); + x = copysign(absx, x); } return x; } -float roundf(float x) +float roundf(float x) { float absx = fabsf(x); - if( absx < 0.5f ) - return copysignf( 0.0f, x); + if (absx < 0.5f) return copysignf(0.0f, x); - if( absx < 8388608.0f ) + if (absx < 8388608.0f) { absx += 0.5f; cl_int rounded = absx; absx = rounded; - x = copysignf( absx, x ); + x = copysignf(absx, x); } return x; @@ -501,65 +513,59 @@ long double roundl(long double x) { long double absx = fabsl(x); - if( absx < 0.5L ) - return copysignl( 0.0L, x); + if (absx < 0.5L) return copysignl(0.0L, x); - if( absx < 9223372036854775808.0L /*0x1.0p63L*/ ) + if (absx < 9223372036854775808.0L /*0x1.0p63L*/) { absx += 0.5L; cl_ulong rounded = absx; absx = rounded; - x = copysignl( absx, x ); + x = copysignl(absx, x); } return x; } -float cbrtf( float x ) +float cbrtf(float x) { - float z = pow( fabs((double) x), 1.0 / 3.0 ); - return copysignf( z, x ); + float z = pow(fabs((double)x), 1.0 / 3.0); + return copysignf(z, x); } -double cbrt( double x ) -{ - return copysign( pow( fabs( x ), 1.0 / 3.0 ), x ); -} +double cbrt(double x) { return copysign(pow(fabs(x), 1.0 / 3.0), x); } -long int lrint (double x) +long int lrint(double x) { double absx = fabs(x); - if( x >= (double) LONG_MAX ) - return LONG_MAX; + if (x >= (double)LONG_MAX) return LONG_MAX; - if( absx < 4503599627370496.0 /* 0x1.0p52 */ ) + if (absx < 4503599627370496.0 /* 0x1.0p52 */) { - double magic = copysign( 4503599627370496.0 /* 0x1.0p52 */, x ); + double magic = copysign(4503599627370496.0 /* 0x1.0p52 */, x); double rounded = x + magic; rounded -= magic; - return (long int) rounded; + return (long int)rounded; } - return (long int) x; + return (long int)x; } -long int lrintf (float x) +long int lrintf(float x) { float absx = fabsf(x); - if( x >= (float) LONG_MAX ) - return LONG_MAX; + if (x >= (float)LONG_MAX) return LONG_MAX; - if( absx < 8388608.0f /* 0x1.0p23f */ ) + if (absx < 8388608.0f /* 0x1.0p23f */) { - float magic = copysignf( 8388608.0f /* 0x1.0p23f */, x ); + float magic = copysignf(8388608.0f /* 0x1.0p23f */, x); float rounded = x + magic; rounded -= magic; - return (long int) rounded; + return (long int)rounded; } - return (long int) x; + return (long int)x; } #endif // _MSC_VER < 1900 @@ -574,13 +580,12 @@ long int lrintf (float x) int fetestexcept(int excepts) { unsigned int status = _statusfp(); - return excepts & ( - ((status & _SW_INEXACT) ? FE_INEXACT : 0) | - ((status & _SW_UNDERFLOW) ? FE_UNDERFLOW : 0) | - ((status & _SW_OVERFLOW) ? FE_OVERFLOW : 0) | - ((status & _SW_ZERODIVIDE) ? FE_DIVBYZERO : 0) | - ((status & _SW_INVALID) ? FE_INVALID : 0) - ); + return excepts + & (((status & _SW_INEXACT) ? FE_INEXACT : 0) + | ((status & _SW_UNDERFLOW) ? FE_UNDERFLOW : 0) + | ((status & _SW_OVERFLOW) ? FE_OVERFLOW : 0) + | ((status & _SW_ZERODIVIDE) ? FE_DIVBYZERO : 0) + | ((status & _SW_INVALID) ? FE_INVALID : 0)); } int feclearexcept(int excepts) @@ -592,33 +597,36 @@ int feclearexcept(int excepts) #endif // __INTEL_COMPILER -#if _MSC_VER < 1900 && ( ! defined( __INTEL_COMPILER ) || __INTEL_COMPILER < 1300 ) +#if _MSC_VER < 1900 && (!defined(__INTEL_COMPILER) || __INTEL_COMPILER < 1300) -float nanf( const char* str) +float nanf(const char* str) { - cl_uint u = atoi( str ); + cl_uint u = atoi(str); u |= 0x7fc00000U; - return *( float*)(&u); + return *(float*)(&u); } -double nan( const char* str) +double nan(const char* str) { - cl_ulong u = atoi( str ); + cl_ulong u = atoi(str); u |= 0x7ff8000000000000ULL; - return *( double*)(&u); + return *(double*)(&u); } // double check this implementatation -long double nanl( const char* str) +long double nanl(const char* str) { - union - { + union { long double f; - struct { cl_ulong m; cl_ushort sexp; }u; - }u; + struct + { + cl_ulong m; + cl_ushort sexp; + } u; + } u; u.u.sexp = 0x7fff; - u.u.m = 0x8000000000000000ULL | atoi( str ); + u.u.m = 0x8000000000000000ULL | atoi(str); return u.f; } @@ -632,32 +640,35 @@ long double nanl( const char* str) /////////////////////////////////////////////////////////////////// /* -// This function is commented out because the Windows implementation should never call munmap. +// This function is commented out because the Windows implementation should +never call munmap. // If it is calling it, we have a bug. Please file a bugzilla. int munmap(void *addr, size_t len) { -// FIXME: this is not correct. munmap is like free() http://www.opengroup.org/onlinepubs/7990989775/xsh/munmap.html +// FIXME: this is not correct. munmap is like free() +// http://www.opengroup.org/onlinepubs/7990989775/xsh/munmap.html return (int)VirtualAlloc( (LPVOID)addr, len, MEM_COMMIT|MEM_RESERVE, PAGE_NOACCESS ); } */ -uint64_t ReadTime( void ) +uint64_t ReadTime(void) { LARGE_INTEGER current; QueryPerformanceCounter(¤t); return (uint64_t)current.QuadPart; } -double SubtractTime( uint64_t endTime, uint64_t startTime ) +double SubtractTime(uint64_t endTime, uint64_t startTime) { static double PerformanceFrequency = 0.0; - if (PerformanceFrequency == 0.0) { + if (PerformanceFrequency == 0.0) + { LARGE_INTEGER frequency; QueryPerformanceFrequency(&frequency); - PerformanceFrequency = (double) frequency.QuadPart; + PerformanceFrequency = (double)frequency.QuadPart; } return (double)(endTime - startTime) / PerformanceFrequency * 1e9; @@ -665,40 +676,38 @@ double SubtractTime( uint64_t endTime, uint64_t startTime ) int cf_signbit(double x) { - union - { + union { double f; cl_ulong u; - }u; + } u; u.f = x; return u.u >> 63; } int cf_signbitf(float x) { - union - { + union { float f; cl_uint u; - }u; + } u; u.f = x; return u.u >> 31; } -float int2float (int32_t ix) +float int2float(int32_t ix) { union { - float f; + float f; int32_t i; } u; u.i = ix; return u.f; } -int32_t float2int (float fx) +int32_t float2int(float fx) { union { - float f; + float f; int32_t i; } u; u.f = fx; @@ -722,27 +731,50 @@ int __builtin_clz(unsigned int pattern) return 31 - res; #endif unsigned long index; - unsigned char res = _BitScanReverse( &index, pattern); - if (res) { - return 8*sizeof(int) - 1 - index; - } else { - return 8*sizeof(int); + unsigned char res = _BitScanReverse(&index, pattern); + if (res) + { + return 8 * sizeof(int) - 1 - index; + } + else + { + return 8 * sizeof(int); } } #else int __builtin_clz(unsigned int pattern) { - int count; - if (pattern == 0u) { - return 32; - } - count = 31; - if (pattern >= 1u<<16) { pattern >>= 16; count -= 16; } - if (pattern >= 1u<<8) { pattern >>= 8; count -= 8; } - if (pattern >= 1u<<4) { pattern >>= 4; count -= 4; } - if (pattern >= 1u<<2) { pattern >>= 2; count -= 2; } - if (pattern >= 1u<<1) { count -= 1; } - return count; + int count; + if (pattern == 0u) + { + return 32; + } + count = 31; + if (pattern >= 1u << 16) + { + pattern >>= 16; + count -= 16; + } + if (pattern >= 1u << 8) + { + pattern >>= 8; + count -= 8; + } + if (pattern >= 1u << 4) + { + pattern >>= 4; + count -= 4; + } + if (pattern >= 1u << 2) + { + pattern >>= 2; + count -= 2; + } + if (pattern >= 1u << 1) + { + count -= 1; + } + return count; } #endif // !defined(_WIN64) @@ -756,9 +788,9 @@ int usleep(int usec) return 0; } -unsigned int sleep( unsigned int sec ) +unsigned int sleep(unsigned int sec) { - Sleep( sec * 1000 ); + Sleep(sec * 1000); return 0; } diff --git a/test_common/harness/mt19937.cpp b/test_common/harness/mt19937.cpp index a4fbf591..c32d9bac 100644 --- a/test_common/harness/mt19937.cpp +++ b/test_common/harness/mt19937.cpp @@ -26,8 +26,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -51,15 +51,15 @@ #include "harness/alloc.h" #ifdef __SSE2__ - #include +#include #endif /* Period parameters */ -#define N 624 /* vector code requires multiple of 4 here */ +#define N 624 /* vector code requires multiple of 4 here */ #define M 397 -#define MATRIX_A (cl_uint) 0x9908b0dfUL /* constant vector a */ -#define UPPER_MASK (cl_uint) 0x80000000UL /* most significant w-r bits */ -#define LOWER_MASK (cl_uint) 0x7fffffffUL /* least significant r bits */ +#define MATRIX_A (cl_uint)0x9908b0dfUL /* constant vector a */ +#define UPPER_MASK (cl_uint)0x80000000UL /* most significant w-r bits */ +#define LOWER_MASK (cl_uint)0x7fffffffUL /* least significant r bits */ typedef struct _MTdata { @@ -67,26 +67,27 @@ typedef struct _MTdata #ifdef __SSE2__ cl_uint cache[N]; #endif - cl_int mti; -}_MTdata; + cl_int mti; +} _MTdata; /* initializes mt[N] with a seed */ MTdata init_genrand(cl_uint s) { - MTdata r = (MTdata) align_malloc( sizeof( _MTdata ), 16 ); - if( NULL != r ) + MTdata r = (MTdata)align_malloc(sizeof(_MTdata), 16); + if (NULL != r) { cl_uint *mt = r->mt; int mti = 0; - mt[0]= s; // & 0xffffffffUL; - for (mti=1; mti> 30)) + mti); + mt[0] = s; // & 0xffffffffUL; + for (mti = 1; mti < N; mti++) + { + mt[mti] = (cl_uint)( + 1812433253UL * (mt[mti - 1] ^ (mt[mti - 1] >> 30)) + mti); /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ /* In the previous versions, MSBs of the seed affect */ /* only MSBs of the array mt[]. */ /* 2002/01/09 modified by Makoto Matsumoto */ - // mt[mti] &= 0xffffffffUL; + // mt[mti] &= 0xffffffffUL; /* for >32 bit machines */ } r->mti = mti; @@ -95,20 +96,22 @@ MTdata init_genrand(cl_uint s) return r; } -void free_mtdata( MTdata d ) +void free_mtdata(MTdata d) { - if(d) - align_free(d); + if (d) align_free(d); } /* generates a random number on [0,0xffffffff]-interval */ -cl_uint genrand_int32( MTdata d) +cl_uint genrand_int32(MTdata d) { /* mag01[x] = x * MATRIX_A for x=0,1 */ - static const cl_uint mag01[2]={0x0UL, MATRIX_A}; + static const cl_uint mag01[2] = { 0x0UL, MATRIX_A }; #ifdef __SSE2__ static volatile int init = 0; - static union{ __m128i v; cl_uint s[4]; } upper_mask, lower_mask, one, matrix_a, c0, c1; + static union { + __m128i v; + cl_uint s[4]; + } upper_mask, lower_mask, one, matrix_a, c0, c1; #endif @@ -120,14 +123,17 @@ cl_uint genrand_int32( MTdata d) int kk; #ifdef __SSE2__ - if( 0 == init ) + if (0 == init) { - upper_mask.s[0] = upper_mask.s[1] = upper_mask.s[2] = upper_mask.s[3] = UPPER_MASK; - lower_mask.s[0] = lower_mask.s[1] = lower_mask.s[2] = lower_mask.s[3] = LOWER_MASK; + upper_mask.s[0] = upper_mask.s[1] = upper_mask.s[2] = + upper_mask.s[3] = UPPER_MASK; + lower_mask.s[0] = lower_mask.s[1] = lower_mask.s[2] = + lower_mask.s[3] = LOWER_MASK; one.s[0] = one.s[1] = one.s[2] = one.s[3] = 1; - matrix_a.s[0] = matrix_a.s[1] = matrix_a.s[2] = matrix_a.s[3] = MATRIX_A; - c0.s[0] = c0.s[1] = c0.s[2] = c0.s[3] = (cl_uint) 0x9d2c5680UL; - c1.s[0] = c1.s[1] = c1.s[2] = c1.s[3] = (cl_uint) 0xefc60000UL; + matrix_a.s[0] = matrix_a.s[1] = matrix_a.s[2] = matrix_a.s[3] = + MATRIX_A; + c0.s[0] = c0.s[1] = c0.s[2] = c0.s[3] = (cl_uint)0x9d2c5680UL; + c1.s[0] = c1.s[1] = c1.s[2] = c1.s[3] = (cl_uint)0xefc60000UL; init = 1; } #endif @@ -135,61 +141,89 @@ cl_uint genrand_int32( MTdata d) kk = 0; #ifdef __SSE2__ // vector loop - for( ; kk + 4 <= N-M; kk += 4 ) + for (; kk + 4 <= N - M; kk += 4) { - __m128i vy = _mm_or_si128( _mm_and_si128( _mm_load_si128( (__m128i*)(mt + kk) ), upper_mask.v ), - _mm_and_si128( _mm_loadu_si128( (__m128i*)(mt + kk + 1) ), lower_mask.v )); // ((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK)) + // ((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK)) + __m128i vy = _mm_or_si128( + _mm_and_si128(_mm_load_si128((__m128i *)(mt + kk)), + upper_mask.v), + _mm_and_si128(_mm_loadu_si128((__m128i *)(mt + kk + 1)), + lower_mask.v)); - __m128i mask = _mm_cmpeq_epi32( _mm_and_si128( vy, one.v), one.v ); // y & 1 ? -1 : 0 - __m128i vmag01 = _mm_and_si128( mask, matrix_a.v ); // y & 1 ? MATRIX_A, 0 = mag01[y & (cl_uint) 0x1UL] - __m128i vr = _mm_xor_si128( _mm_loadu_si128( (__m128i*)(mt + kk + M)), (__m128i) _mm_srli_epi32( vy, 1 ) ); // mt[kk+M] ^ (y >> 1) - vr = _mm_xor_si128( vr, vmag01 ); // mt[kk+M] ^ (y >> 1) ^ mag01[y & (cl_uint) 0x1UL] - _mm_store_si128( (__m128i*) (mt + kk ), vr ); + // y & 1 ? -1 : 0 + __m128i mask = _mm_cmpeq_epi32(_mm_and_si128(vy, one.v), one.v); + // y & 1 ? MATRIX_A, 0 = mag01[y & (cl_uint) 0x1UL] + __m128i vmag01 = _mm_and_si128(mask, matrix_a.v); + // mt[kk+M] ^ (y >> 1) + __m128i vr = + _mm_xor_si128(_mm_loadu_si128((__m128i *)(mt + kk + M)), + (__m128i)_mm_srli_epi32(vy, 1)); + // mt[kk+M] ^ (y >> 1) ^ mag01[y & (cl_uint) 0x1UL] + vr = _mm_xor_si128(vr, vmag01); + _mm_store_si128((__m128i *)(mt + kk), vr); } #endif - for ( ;kk> 1) ^ mag01[y & (cl_uint) 0x1UL]; + for (; kk < N - M; kk++) + { + y = (cl_uint)((mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK)); + mt[kk] = mt[kk + M] ^ (y >> 1) ^ mag01[y & (cl_uint)0x1UL]; } #ifdef __SSE2__ // advance to next aligned location - for (;kk> 1) ^ mag01[y & (cl_uint) 0x1UL]; + for (; kk < N - 1 && (kk & 3); kk++) + { + y = (cl_uint)((mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK)); + mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ mag01[y & (cl_uint)0x1UL]; } // vector loop - for( ; kk + 4 <= N-1; kk += 4 ) + for (; kk + 4 <= N - 1; kk += 4) { - __m128i vy = _mm_or_si128( _mm_and_si128( _mm_load_si128( (__m128i*)(mt + kk) ), upper_mask.v ), - _mm_and_si128( _mm_loadu_si128( (__m128i*)(mt + kk + 1) ), lower_mask.v )); // ((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK)) + __m128i vy = _mm_or_si128( + _mm_and_si128(_mm_load_si128((__m128i *)(mt + kk)), + upper_mask.v), + // ((mt[kk]&UPPER_MASK)|(mt[kk+1]&LOWER_MASK)) + _mm_and_si128(_mm_loadu_si128((__m128i *)(mt + kk + 1)), + lower_mask.v)); - __m128i mask = _mm_cmpeq_epi32( _mm_and_si128( vy, one.v), one.v ); // y & 1 ? -1 : 0 - __m128i vmag01 = _mm_and_si128( mask, matrix_a.v ); // y & 1 ? MATRIX_A, 0 = mag01[y & (cl_uint) 0x1UL] - __m128i vr = _mm_xor_si128( _mm_loadu_si128( (__m128i*)(mt + kk + M - N)), _mm_srli_epi32( vy, 1 ) ); // mt[kk+M-N] ^ (y >> 1) - vr = _mm_xor_si128( vr, vmag01 ); // mt[kk+M] ^ (y >> 1) ^ mag01[y & (cl_uint) 0x1UL] - _mm_store_si128( (__m128i*) (mt + kk ), vr ); + // y & 1 ? -1 : 0 + __m128i mask = _mm_cmpeq_epi32(_mm_and_si128(vy, one.v), one.v); + // y & 1 ? MATRIX_A, 0 = mag01[y & (cl_uint) 0x1UL] + __m128i vmag01 = _mm_and_si128(mask, matrix_a.v); + // mt[kk+M-N] ^ (y >> 1) + __m128i vr = + _mm_xor_si128(_mm_loadu_si128((__m128i *)(mt + kk + M - N)), + _mm_srli_epi32(vy, 1)); + // mt[kk+M] ^ (y >> 1) ^ mag01[y & (cl_uint) 0x1UL] + vr = _mm_xor_si128(vr, vmag01); + _mm_store_si128((__m128i *)(mt + kk), vr); } #endif - for (;kk> 1) ^ mag01[y & (cl_uint) 0x1UL]; + for (; kk < N - 1; kk++) + { + y = (cl_uint)((mt[kk] & UPPER_MASK) | (mt[kk + 1] & LOWER_MASK)); + mt[kk] = mt[kk + (M - N)] ^ (y >> 1) ^ mag01[y & (cl_uint)0x1UL]; } - y = (cl_uint)((mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK)); - mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & (cl_uint) 0x1UL]; + y = (cl_uint)((mt[N - 1] & UPPER_MASK) | (mt[0] & LOWER_MASK)); + mt[N - 1] = mt[M - 1] ^ (y >> 1) ^ mag01[y & (cl_uint)0x1UL]; #ifdef __SSE2__ // Do the tempering ahead of time in vector code - for( kk = 0; kk + 4 <= N; kk += 4 ) + for (kk = 0; kk + 4 <= N; kk += 4) { - __m128i vy = _mm_load_si128( (__m128i*)(mt + kk ) ); // y = mt[k]; - vy = _mm_xor_si128( vy, _mm_srli_epi32( vy, 11 ) ); // y ^= (y >> 11); - vy = _mm_xor_si128( vy, _mm_and_si128( _mm_slli_epi32( vy, 7 ), c0.v) ); // y ^= (y << 7) & (cl_uint) 0x9d2c5680UL; - vy = _mm_xor_si128( vy, _mm_and_si128( _mm_slli_epi32( vy, 15 ), c1.v) ); // y ^= (y << 15) & (cl_uint) 0xefc60000UL; - vy = _mm_xor_si128( vy, _mm_srli_epi32( vy, 18 ) ); // y ^= (y >> 18); - _mm_store_si128( (__m128i*)(d->cache+kk), vy ); + // y = mt[k]; + __m128i vy = _mm_load_si128((__m128i *)(mt + kk)); + // y ^= (y >> 11); + vy = _mm_xor_si128(vy, _mm_srli_epi32(vy, 11)); + // y ^= (y << 7) & (cl_uint) 0x9d2c5680UL; + vy = _mm_xor_si128(vy, _mm_and_si128(_mm_slli_epi32(vy, 7), c0.v)); + // y ^= (y << 15) & (cl_uint) 0xefc60000UL; + vy = _mm_xor_si128(vy, _mm_and_si128(_mm_slli_epi32(vy, 15), c1.v)); + // y ^= (y >> 18); + vy = _mm_xor_si128(vy, _mm_srli_epi32(vy, 18)); + _mm_store_si128((__m128i *)(d->cache + kk), vy); } #endif @@ -202,8 +236,8 @@ cl_uint genrand_int32( MTdata d) /* Tempering */ y ^= (y >> 11); - y ^= (y << 7) & (cl_uint) 0x9d2c5680UL; - y ^= (y << 15) & (cl_uint) 0xefc60000UL; + y ^= (y << 7) & (cl_uint)0x9d2c5680UL; + y ^= (y << 15) & (cl_uint)0xefc60000UL; y ^= (y >> 18); #endif @@ -211,35 +245,35 @@ cl_uint genrand_int32( MTdata d) return y; } -cl_ulong genrand_int64( MTdata d) +cl_ulong genrand_int64(MTdata d) { - return ((cl_ulong) genrand_int32(d) << 32) | (cl_uint) genrand_int32(d); + return ((cl_ulong)genrand_int32(d) << 32) | (cl_uint)genrand_int32(d); } /* generates a random number on [0,1]-real-interval */ double genrand_real1(MTdata d) { - return genrand_int32(d)*(1.0/4294967295.0); + return genrand_int32(d) * (1.0 / 4294967295.0); /* divided by 2^32-1 */ } /* generates a random number on [0,1)-real-interval */ double genrand_real2(MTdata d) { - return genrand_int32(d)*(1.0/4294967296.0); + return genrand_int32(d) * (1.0 / 4294967296.0); /* divided by 2^32 */ } /* generates a random number on (0,1)-real-interval */ double genrand_real3(MTdata d) { - return (((double)genrand_int32(d)) + 0.5)*(1.0/4294967296.0); + return (((double)genrand_int32(d)) + 0.5) * (1.0 / 4294967296.0); /* divided by 2^32 */ } /* generates a random number on [0,1) with 53-bit resolution*/ double genrand_res53(MTdata d) { - unsigned long a=genrand_int32(d)>>5, b=genrand_int32(d)>>6; - return(a*67108864.0+b)*(1.0/9007199254740992.0); + unsigned long a = genrand_int32(d) >> 5, b = genrand_int32(d) >> 6; + return (a * 67108864.0 + b) * (1.0 / 9007199254740992.0); } diff --git a/test_common/harness/mt19937.h b/test_common/harness/mt19937.h index 85786e7b..35c84933 100644 --- a/test_common/harness/mt19937.h +++ b/test_common/harness/mt19937.h @@ -31,8 +31,8 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER + OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF @@ -47,12 +47,12 @@ */ #ifndef MT19937_H -#define MT19937_H 1 +#define MT19937_H 1 -#if defined( __APPLE__ ) - #include +#if defined(__APPLE__) +#include #else - #include +#include #endif /* @@ -61,52 +61,50 @@ * on each thread. */ -typedef struct _MTdata *MTdata; +typedef struct _MTdata *MTdata; /* Create the random number generator with seed */ -MTdata init_genrand( cl_uint /*seed*/ ); +MTdata init_genrand(cl_uint /*seed*/); /* release memory used by a MTdata private data */ -void free_mtdata( MTdata /*data*/ ); +void free_mtdata(MTdata /*data*/); /* generates a random number on [0,0xffffffff]-interval */ -cl_uint genrand_int32( MTdata /*data*/); +cl_uint genrand_int32(MTdata /*data*/); /* generates a random number on [0,0xffffffffffffffffULL]-interval */ -cl_ulong genrand_int64( MTdata /*data*/); +cl_ulong genrand_int64(MTdata /*data*/); /* generates a random number on [0,1]-real-interval */ -double genrand_real1( MTdata /*data*/); +double genrand_real1(MTdata /*data*/); /* generates a random number on [0,1)-real-interval */ -double genrand_real2( MTdata /*data*/); +double genrand_real2(MTdata /*data*/); /* generates a random number on (0,1)-real-interval */ -double genrand_real3( MTdata /*data*/); +double genrand_real3(MTdata /*data*/); /* generates a random number on [0,1) with 53-bit resolution*/ -double genrand_res53( MTdata /*data*/ ); +double genrand_res53(MTdata /*data*/); #ifdef __cplusplus #include -struct MTdataHolder { - MTdataHolder(cl_uint seed) { +struct MTdataHolder +{ + MTdataHolder(cl_uint seed) + { m_mtdata = init_genrand(seed); assert(m_mtdata != nullptr); } - MTdataHolder(MTdata mtdata) : m_mtdata(mtdata) {} + MTdataHolder(MTdata mtdata): m_mtdata(mtdata) {} - ~MTdataHolder() { - free_mtdata(m_mtdata); - } + ~MTdataHolder() { free_mtdata(m_mtdata); } - operator MTdata () const { - return m_mtdata; - } + operator MTdata() const { return m_mtdata; } private: MTdata m_mtdata; @@ -114,4 +112,4 @@ private: #endif // #ifdef __cplusplus -#endif /* MT19937_H */ +#endif /* MT19937_H */ diff --git a/test_common/harness/os_helpers.cpp b/test_common/harness/os_helpers.cpp index 00e7a6b1..cd350cf8 100644 --- a/test_common/harness/os_helpers.cpp +++ b/test_common/harness/os_helpers.cpp @@ -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 @@ -20,10 +20,10 @@ // C++ interface. // ================================================================================================= -#include // errno, error constants -#include // PATH_MAX -#include // abort, _splitpath, _makepath -#include // strdup, strerror_r +#include // errno, error constants +#include // PATH_MAX +#include // abort, _splitpath, _makepath +#include // strdup, strerror_r #include #include @@ -32,131 +32,141 @@ #include #endif -#define CHECK_PTR( ptr ) \ - if ( (ptr) == NULL ) { \ - abort(); \ +#define CHECK_PTR(ptr) \ + if ((ptr) == NULL) \ + { \ + abort(); \ } -typedef std::vector< char > buffer_t; +typedef std::vector buffer_t; -#if ! defined( PATH_MAX ) - #define PATH_MAX 1000 +#if !defined(PATH_MAX) +#define PATH_MAX 1000 #endif -int const _size = PATH_MAX + 1; // Initial buffer size for path. -int const _count = 8; // How many times we will try to double buffer size. +int const _size = PATH_MAX + 1; // Initial buffer size for path. +int const _count = 8; // How many times we will try to double buffer size. // ------------------------------------------------------------------------------------------------- // MacOS X // ------------------------------------------------------------------------------------------------- -#if defined( __APPLE__ ) +#if defined(__APPLE__) - #include // _NSGetExecutablePath - #include // dirname +#include // _NSGetExecutablePath +#include // dirname - static - std::string - _err_msg( - int err, // Error number (e. g. errno). - int level // Nesting level, for avoiding infinite recursion. - ) { +static std::string +_err_msg(int err, // Error number (e. g. errno). + int level // Nesting level, for avoiding infinite recursion. +) +{ - /* - There are 3 incompatible versions of strerror_r: + /* + There are 3 incompatible versions of strerror_r: - char * strerror_r( int, char *, size_t ); // GNU version - int strerror_r( int, char *, size_t ); // BSD version - int strerror_r( int, char *, size_t ); // XSI version + char * strerror_r( int, char *, size_t ); // GNU version + int strerror_r( int, char *, size_t ); // BSD version + int strerror_r( int, char *, size_t ); // XSI version - BSD version returns error code, while XSI version returns 0 or -1 and sets errno. + BSD version returns error code, while XSI version returns 0 or -1 and + sets errno. - */ + */ - // BSD version of strerror_r. - buffer_t buffer( 100 ); - int count = _count; - for ( ; ; ) { - int rc = strerror_r( err, & buffer.front(), buffer.size() ); - if ( rc == EINVAL ) { - // Error code is not recognized, but anyway we got the message. - return & buffer.front(); - } else if ( rc == ERANGE ) { - // Buffer is not enough. - if ( count > 0 ) { - // Enlarge the buffer. - -- count; - buffer.resize( buffer.size() * 2 ); - } else { - std::stringstream ostr; - ostr - << "Error " << err << " " - << "(Getting error message failed: " - << "Buffer of " << buffer.size() << " bytes is still too small" - << ")"; - return ostr.str(); - }; // if - } else if ( rc == 0 ) { - // We got the message. - return & buffer.front(); - } else { + // BSD version of strerror_r. + buffer_t buffer(100); + int count = _count; + for (;;) + { + int rc = strerror_r(err, &buffer.front(), buffer.size()); + if (rc == EINVAL) + { + // Error code is not recognized, but anyway we got the message. + return &buffer.front(); + } + else if (rc == ERANGE) + { + // Buffer is not enough. + if (count > 0) + { + // Enlarge the buffer. + --count; + buffer.resize(buffer.size() * 2); + } + else + { std::stringstream ostr; - ostr - << "Error " << err << " " - << "(Getting error message failed: " - << ( level < 2 ? _err_msg( rc, level + 1 ) : "Oops" ) - << ")"; + ostr << "Error " << err << " " + << "(Getting error message failed: " + << "Buffer of " << buffer.size() + << " bytes is still too small" + << ")"; return ostr.str(); }; // if - }; // forever + } + else if (rc == 0) + { + // We got the message. + return &buffer.front(); + } + else + { + std::stringstream ostr; + ostr << "Error " << err << " " + << "(Getting error message failed: " + << (level < 2 ? _err_msg(rc, level + 1) : "Oops") << ")"; + return ostr.str(); + }; // if + }; // forever - } // _err_msg +} // _err_msg - std::string - dir_sep( - ) { - return "/"; - } // dir_sep +std::string dir_sep() { return "/"; } // dir_sep - std::string - exe_path( - ) { - buffer_t path( _size ); - int count = _count; - for ( ; ; ) { - uint32_t size = path.size(); - int rc = _NSGetExecutablePath( & path.front(), & size ); - if ( rc == 0 ) { - break; - }; // if - if ( count > 0 ) { - -- count; - path.resize( size ); - } else { - log_error( - "ERROR: Getting executable path failed: " - "_NSGetExecutablePath failed: Buffer of %lu bytes is still too small\n", - (unsigned long) path.size() - ); - exit( 2 ); - }; // if - }; // forever - return & path.front(); - } // exe_path +std::string exe_path() +{ + buffer_t path(_size); + int count = _count; + for (;;) + { + uint32_t size = path.size(); + int rc = _NSGetExecutablePath(&path.front(), &size); + if (rc == 0) + { + break; + }; // if + if (count > 0) + { + --count; + path.resize(size); + } + else + { + log_error("ERROR: Getting executable path failed: " + "_NSGetExecutablePath failed: Buffer of %lu bytes is " + "still too small\n", + (unsigned long)path.size()); + exit(2); + }; // if + }; // forever + return &path.front(); +} // exe_path - std::string - exe_dir( - ) { - std::string path = exe_path(); - // We cannot pass path.c_str() to `dirname' bacause `dirname' modifies its argument. - buffer_t buffer( path.c_str(), path.c_str() + path.size() + 1 ); // Copy with trailing zero. - return dirname( & buffer.front() ); - } // exe_dir +std::string exe_dir() +{ + std::string path = exe_path(); + // We cannot pass path.c_str() to `dirname' bacause `dirname' modifies its + // argument. + buffer_t buffer(path.c_str(), + path.c_str() + path.size() + 1); // Copy with trailing zero. + return dirname(&buffer.front()); +} // exe_dir #endif // __APPLE__ @@ -165,149 +175,153 @@ int const _count = 8; // How many times we will try to double buff // Linux // ------------------------------------------------------------------------------------------------- -#if defined( __linux__ ) +#if defined(__linux__) - #include // errno - #include // dirname - #include // readlink +#include // errno +#include // dirname +#include // readlink - static - std::string - _err_msg( - int err, - int level - ) { +static std::string _err_msg(int err, int level) +{ - /* - There are 3 incompatible versions of strerror_r: + /* + There are 3 incompatible versions of strerror_r: - char * strerror_r( int, char *, size_t ); // GNU version - int strerror_r( int, char *, size_t ); // BSD version - int strerror_r( int, char *, size_t ); // XSI version + char * strerror_r( int, char *, size_t ); // GNU version + int strerror_r( int, char *, size_t ); // BSD version + int strerror_r( int, char *, size_t ); // XSI version - BSD version returns error code, while XSI version returns 0 or -1 and sets errno. + BSD version returns error code, while XSI version returns 0 or -1 and + sets errno. - */ + */ - #if (defined(__ANDROID__) && __ANDROID_API__ < 23) || ( ( _POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600 ) && ! _GNU_SOURCE ) +#if (defined(__ANDROID__) && __ANDROID_API__ < 23) \ + || ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) - // XSI version of strerror_r. - #warning Not tested! - buffer_t buffer( 200 ); - int count = _count; - for ( ; ; ) { - int rc = strerror_r( err, & buffer.front(), buffer.size() ); - if ( rc == -1 ) { - int _err = errno; - if ( _err == ERANGE ) { - if ( count > 0 ) { - // Enlarge the buffer. - -- count; - buffer.resize( buffer.size() * 2 ); - } else { - std::stringstream ostr; - ostr - << "Error " << err << " " - << "(Getting error message failed: " - << "Buffer of " << buffer.size() << " bytes is still too small" - << ")"; - return ostr.str(); - }; // if - } else { - std::stringstream ostr; - ostr - << "Error " << err << " " - << "(Getting error message failed: " - << ( level < 2 ? _err_msg( _err, level + 1 ) : "Oops" ) - << ")"; - return ostr.str(); - }; // if - } else { - // We got the message. - return & buffer.front(); +// XSI version of strerror_r. +#warning Not tested! + buffer_t buffer(200); + int count = _count; + for (;;) + { + int rc = strerror_r(err, &buffer.front(), buffer.size()); + if (rc == -1) + { + int _err = errno; + if (_err == ERANGE) + { + if (count > 0) + { + // Enlarge the buffer. + --count; + buffer.resize(buffer.size() * 2); + } + else + { + std::stringstream ostr; + ostr << "Error " << err << " " + << "(Getting error message failed: " + << "Buffer of " << buffer.size() + << " bytes is still too small" + << ")"; + return ostr.str(); }; // if - }; // forever - - #else - - // GNU version of strerror_r. - char buffer[ 2000 ]; - return strerror_r( err, buffer, sizeof( buffer ) ); - - #endif - - } // _err_msg - - - std::string - dir_sep( - ) { - return "/"; - } // dir_sep - - - std::string - exe_path( - ) { - - static std::string const exe = "/proc/self/exe"; - - buffer_t path( _size ); - int count = _count; // Max number of iterations. - - for ( ; ; ) { - - ssize_t len = readlink( exe.c_str(), & path.front(), path.size() ); - - if ( len < 0 ) { - // Oops. - int err = errno; - log_error( - "ERROR: Getting executable path failed: " - "Reading symlink `%s' failed: %s\n", - exe.c_str(), err_msg( err ).c_str() - ); - exit( 2 ); + } + else + { + std::stringstream ostr; + ostr << "Error " << err << " " + << "(Getting error message failed: " + << (level < 2 ? _err_msg(_err, level + 1) : "Oops") << ")"; + return ostr.str(); }; // if + } + else + { + // We got the message. + return &buffer.front(); + }; // if + }; // forever - if ( len < path.size() ) { - // We got the path. - path.resize( len ); - break; - }; // if +#else - // Oops, buffer is too small. - if ( count > 0 ) { - -- count; - // Enlarge the buffer. - path.resize( path.size() * 2 ); - } else { - log_error( - "ERROR: Getting executable path failed: " - "Reading symlink `%s' failed: Buffer of %lu bytes is still too small\n", - exe.c_str(), - (unsigned long) path.size() - ); - exit( 2 ); - }; // if + // GNU version of strerror_r. + char buffer[2000]; + return strerror_r(err, buffer, sizeof(buffer)); - }; // forever +#endif - return std::string( & path.front(), path.size() ); - - } // exe_path +} // _err_msg - std::string - exe_dir( - ) { - std::string path = exe_path(); - // We cannot pass path.c_str() to `dirname' bacause `dirname' modifies its argument. - buffer_t buffer( path.c_str(), path.c_str() + path.size() + 1 ); // Copy with trailing zero. - return dirname( & buffer.front() ); - } // exe_dir +std::string dir_sep() { return "/"; } // dir_sep + + +std::string exe_path() +{ + + static std::string const exe = "/proc/self/exe"; + + buffer_t path(_size); + int count = _count; // Max number of iterations. + + for (;;) + { + + ssize_t len = readlink(exe.c_str(), &path.front(), path.size()); + + if (len < 0) + { + // Oops. + int err = errno; + log_error("ERROR: Getting executable path failed: " + "Reading symlink `%s' failed: %s\n", + exe.c_str(), err_msg(err).c_str()); + exit(2); + }; // if + + if (len < path.size()) + { + // We got the path. + path.resize(len); + break; + }; // if + + // Oops, buffer is too small. + if (count > 0) + { + --count; + // Enlarge the buffer. + path.resize(path.size() * 2); + } + else + { + log_error("ERROR: Getting executable path failed: " + "Reading symlink `%s' failed: Buffer of %lu bytes is " + "still too small\n", + exe.c_str(), (unsigned long)path.size()); + exit(2); + }; // if + + }; // forever + + return std::string(&path.front(), path.size()); + +} // exe_path + + +std::string exe_dir() +{ + std::string path = exe_path(); + // We cannot pass path.c_str() to `dirname' bacause `dirname' modifies its + // argument. + buffer_t buffer(path.c_str(), + path.c_str() + path.size() + 1); // Copy with trailing zero. + return dirname(&buffer.front()); +} // exe_dir #endif // __linux__ @@ -315,212 +329,196 @@ int const _count = 8; // How many times we will try to double buff // MS Windows // ------------------------------------------------------------------------------------------------- -#if defined( _WIN32 ) +#if defined(_WIN32) - #include - #if defined( max ) - #undef max - #endif +#include +#if defined(max) +#undef max +#endif - #include - #include +#include +#include - static - std::string - _err_msg( - int err, - int level - ) { +static std::string _err_msg(int err, int level) +{ - std::string msg; + std::string msg; - LPSTR buffer = NULL; - DWORD flags = - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS; + LPSTR buffer = NULL; + DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM + | FORMAT_MESSAGE_IGNORE_INSERTS; - DWORD len = - FormatMessageA( - flags, - NULL, - err, - LANG_USER_DEFAULT, - reinterpret_cast< LPSTR >( & buffer ), - 0, - NULL - ); + DWORD len = FormatMessageA(flags, NULL, err, LANG_USER_DEFAULT, + reinterpret_cast(&buffer), 0, NULL); - if ( buffer == NULL || len == 0 ) { + if (buffer == NULL || len == 0) + { - int _err = GetLastError(); - char str[1024] = { 0 }; - snprintf(str, sizeof(str), "Error 0x%08x (Getting error message failed: %s )", err, ( level < 2 ? _err_msg( _err, level + 1 ).c_str() : "Oops" )); - msg = std::string(str); + int _err = GetLastError(); + char str[1024] = { 0 }; + snprintf(str, sizeof(str), + "Error 0x%08x (Getting error message failed: %s )", err, + (level < 2 ? _err_msg(_err, level + 1).c_str() : "Oops")); + msg = std::string(str); + } + else + { - } else { + // Trim trailing whitespace (including `\r' and `\n'). + while (len > 0 && isspace(buffer[len - 1])) + { + --len; + }; // while - // Trim trailing whitespace (including `\r' and `\n'). - while ( len > 0 && isspace( buffer[ len - 1 ] ) ) { - -- len; - }; // while - - // Drop trailing full stop. - if ( len > 0 && buffer[ len - 1 ] == '.' ) { - -- len; - }; // if - - msg.assign( buffer, len ); - - }; //if - - if ( buffer != NULL ) { - LocalFree( buffer ); + // Drop trailing full stop. + if (len > 0 && buffer[len - 1] == '.') + { + --len; }; // if - return msg; + msg.assign(buffer, len); - } // _get_err_msg + }; // if + + if (buffer != NULL) + { + LocalFree(buffer); + }; // if + + return msg; + +} // _get_err_msg - std::string - dir_sep( - ) { - return "\\"; - } // dir_sep +std::string dir_sep() { return "\\"; } // dir_sep - std::string - exe_path( - ) { +std::string exe_path() +{ - buffer_t path( _size ); - int count = _count; + buffer_t path(_size); + int count = _count; - for ( ; ; ) { + for (;;) + { - DWORD len = GetModuleFileNameA( NULL, & path.front(), path.size() ); + DWORD len = GetModuleFileNameA(NULL, &path.front(), path.size()); - if ( len == 0 ) { - int err = GetLastError(); - log_error( "ERROR: Getting executable path failed: %s\n", err_msg( err ).c_str() ); - exit( 2 ); - }; // if + if (len == 0) + { + int err = GetLastError(); + log_error("ERROR: Getting executable path failed: %s\n", + err_msg(err).c_str()); + exit(2); + }; // if - if ( len < path.size() ) { - path.resize( len ); - break; - }; // if + if (len < path.size()) + { + path.resize(len); + break; + }; // if - // Buffer too small. - if ( count > 0 ) { - -- count; - path.resize( path.size() * 2 ); - } else { - log_error( - "ERROR: Getting executable path failed: " - "Buffer of %lu bytes is still too small\n", - (unsigned long) path.size() - ); - exit( 2 ); - }; // if + // Buffer too small. + if (count > 0) + { + --count; + path.resize(path.size() * 2); + } + else + { + log_error("ERROR: Getting executable path failed: " + "Buffer of %lu bytes is still too small\n", + (unsigned long)path.size()); + exit(2); + }; // if - }; // forever + }; // forever - return std::string( & path.front(), path.size() ); + return std::string(&path.front(), path.size()); - } // exe_path +} // exe_path - std::string - exe_dir( - ) { +std::string exe_dir() +{ - std::string exe = exe_path(); - int count = 0; + std::string exe = exe_path(); + int count = 0; - // Splitting path into components. - buffer_t drv( _MAX_DRIVE ); - buffer_t dir( _MAX_DIR ); - count = _count; + // Splitting path into components. + buffer_t drv(_MAX_DRIVE); + buffer_t dir(_MAX_DIR); + count = _count; #if defined(_MSC_VER) - for ( ; ; ) { - int rc = - _splitpath_s( - exe.c_str(), - & drv.front(), drv.size(), - & dir.front(), dir.size(), - NULL, 0, // We need neither name - NULL, 0 // nor extension - ); - if ( rc == 0 ) { - break; - } else if ( rc == ERANGE ) { - if ( count > 0 ) { - -- count; - // Buffer is too small, but it is not clear which one. - // So we have to enlarge all. - drv.resize( drv.size() * 2 ); - dir.resize( dir.size() * 2 ); - } else { - log_error( - "ERROR: Getting executable path failed: " - "Splitting path `%s' to components failed: " - "Buffers of %lu and %lu bytes are still too small\n", - exe.c_str(), - (unsigned long) drv.size(), - (unsigned long) dir.size() - ); - exit( 2 ); - }; // if - } else { - log_error( - "ERROR: Getting executable path failed: " - "Splitting path `%s' to components failed: %s\n", - exe.c_str(), - err_msg( rc ).c_str() - ); - exit( 2 ); + for (;;) + { + int rc = + _splitpath_s(exe.c_str(), &drv.front(), drv.size(), &dir.front(), + dir.size(), NULL, 0, // We need neither name + NULL, 0 // nor extension + ); + if (rc == 0) + { + break; + } + else if (rc == ERANGE) + { + if (count > 0) + { + --count; + // Buffer is too small, but it is not clear which one. + // So we have to enlarge all. + drv.resize(drv.size() * 2); + dir.resize(dir.size() * 2); + } + else + { + log_error("ERROR: Getting executable path failed: " + "Splitting path `%s' to components failed: " + "Buffers of %lu and %lu bytes are still too small\n", + exe.c_str(), (unsigned long)drv.size(), + (unsigned long)dir.size()); + exit(2); }; // if - }; // forever + } + else + { + log_error("ERROR: Getting executable path failed: " + "Splitting path `%s' to components failed: %s\n", + exe.c_str(), err_msg(rc).c_str()); + exit(2); + }; // if + }; // forever #else // __MINGW32__ - // MinGW does not have the "secure" _splitpath_s, use the insecure version instead. - _splitpath( - exe.c_str(), - & drv.front(), - & dir.front(), - NULL, // We need neither name - NULL // nor extension - ); + // MinGW does not have the "secure" _splitpath_s, use the insecure version + // instead. + _splitpath(exe.c_str(), &drv.front(), &dir.front(), + NULL, // We need neither name + NULL // nor extension + ); #endif // __MINGW32__ - // Combining components back to path. - // I failed with "secure" `_makepath_s'. If buffer is too small, instead of returning - // ERANGE, `_makepath_s' pops up dialog box and offers to debug the program. D'oh! - // So let us try to guess the size of result and go with insecure `_makepath'. - buffer_t path( std::max( drv.size() + dir.size(), size_t( _MAX_PATH ) ) + 10 ); - _makepath( & path.front(), & drv.front(), & dir.front(), NULL, NULL ); + // Combining components back to path. + // I failed with "secure" `_makepath_s'. If buffer is too small, instead of + // returning ERANGE, `_makepath_s' pops up dialog box and offers to debug + // the program. D'oh! So let us try to guess the size of result and go with + // insecure `_makepath'. + buffer_t path(std::max(drv.size() + dir.size(), size_t(_MAX_PATH)) + 10); + _makepath(&path.front(), &drv.front(), &dir.front(), NULL, NULL); - return & path.front(); + return &path.front(); - } // exe_dir +} // exe_dir #endif // _WIN32 -std::string -err_msg( - int err -) { - - return _err_msg( err, 0 ); - -} // err_msg +std::string err_msg(int err) { return _err_msg(err, 0); } // err_msg // ================================================================================================= @@ -528,39 +526,34 @@ err_msg( // ================================================================================================= -char * -get_err_msg( - int err -) { - char * msg = strdup( err_msg( err ).c_str() ); - CHECK_PTR( msg ); +char* get_err_msg(int err) +{ + char* msg = strdup(err_msg(err).c_str()); + CHECK_PTR(msg); return msg; } // get_err_msg -char * -get_dir_sep( -) { - char * sep = strdup( dir_sep().c_str() ); - CHECK_PTR( sep ); +char* get_dir_sep() +{ + char* sep = strdup(dir_sep().c_str()); + CHECK_PTR(sep); return sep; } // get_dir_sep -char * -get_exe_path( -) { - char * path = strdup( exe_path().c_str() ); - CHECK_PTR( path ); +char* get_exe_path() +{ + char* path = strdup(exe_path().c_str()); + CHECK_PTR(path); return path; } // get_exe_path -char * -get_exe_dir( -) { - char * dir = strdup( exe_dir().c_str() ); - CHECK_PTR( dir ); +char* get_exe_dir() +{ + char* dir = strdup(exe_dir().c_str()); + CHECK_PTR(dir); return dir; } // get_exe_dir diff --git a/test_common/harness/os_helpers.h b/test_common/harness/os_helpers.h index 7c4463f9..aa3080d9 100644 --- a/test_common/harness/os_helpers.h +++ b/test_common/harness/os_helpers.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 @@ -24,12 +24,12 @@ #ifdef __cplusplus - #include +#include - std::string err_msg( int err ); - std::string dir_sep(); - std::string exe_path(); - std::string exe_dir(); +std::string err_msg(int err); +std::string dir_sep(); +std::string exe_path(); +std::string exe_dir(); #endif // __cplusplus @@ -37,9 +37,9 @@ // C interface. // ------------------------------------------------------------------------------------------------- -char * get_err_msg( int err ); // Returns system error message. Subject to free. -char * get_dir_sep(); // Returns dir separator. Subject to free. -char * get_exe_path(); // Returns path of current executable. Subject to free. -char * get_exe_dir(); // Returns dir of current executable. Subject to free. +char* get_err_msg(int err); // Returns system error message. Subject to free. +char* get_dir_sep(); // Returns dir separator. Subject to free. +char* get_exe_path(); // Returns path of current executable. Subject to free. +char* get_exe_dir(); // Returns dir of current executable. Subject to free. #endif // __os_helpers_h__ diff --git a/test_common/harness/parseParameters.cpp b/test_common/harness/parseParameters.cpp index 1706730a..b2ab5b02 100644 --- a/test_common/harness/parseParameters.cpp +++ b/test_common/harness/parseParameters.cpp @@ -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 @@ -29,47 +29,58 @@ using namespace std; #define DEFAULT_COMPILATION_PROGRAM "cl_offline_compiler" -CompilationMode gCompilationMode = kOnline; +CompilationMode gCompilationMode = kOnline; CompilationCacheMode gCompilationCacheMode = kCacheModeCompileIfAbsent; -std::string gCompilationCachePath = "."; -std::string gCompilationProgram = DEFAULT_COMPILATION_PROGRAM; +std::string gCompilationCachePath = "."; +std::string gCompilationProgram = DEFAULT_COMPILATION_PROGRAM; -void helpInfo () +void helpInfo() { - log_info("Common options:\n" - " -h, --help This help\n" - " --compilation-mode Specify a compilation mode. Mode can be:\n" - " online Use online compilation (default)\n" - " binary Use binary offline compilation\n" - " spir-v Use SPIR-V offline compilation\n" - "\n" - " For offline compilation (binary and spir-v modes) only:\n" - " --compilation-cache-mode Specify a compilation caching mode:\n" - " compile-if-absent Read from cache if already populated, or\n" - " else perform offline compilation (default)\n" - " force-read Force reading from the cache\n" - " overwrite Disable reading from the cache\n" - " dump-cl-files Dumps the .cl and build .options files used by the test suite\n" - " --compilation-cache-path Path for offline compiler output and CL source\n" - " --compilation-program Program to use for offline compilation,\n" - " defaults to " DEFAULT_COMPILATION_PROGRAM "\n" - "\n"); + log_info( + R"(Common options: + -h, --help + This help + --compilation-mode + Specify a compilation mode. Mode can be: + online Use online compilation (default) + binary Use binary offline compilation + spir-v Use SPIR-V offline compilation + +For offline compilation (binary and spir-v modes) only: + --compilation-cache-mode + Specify a compilation caching mode: + compile-if-absent + Read from cache if already populated, or else perform + offline compilation (default) + force-read + Force reading from the cache + overwrite + Disable reading from the cache + dump-cl-files + Dumps the .cl and build .options files used by the test suite + --compilation-cache-path + Path for offline compiler output and CL source + --compilation-program + Program to use for offline compilation, defaults to: + )" DEFAULT_COMPILATION_PROGRAM "\n\n"); } -int parseCustomParam (int argc, const char *argv[], const char *ignore) +int parseCustomParam(int argc, const char *argv[], const char *ignore) { int delArg = 0; - for (int i=1; i\n"); + log_error( + "Compilation cache mode parameters are incorrect. Usage:\n" + " --compilation-cache-mode " + "\n"); return -1; } } @@ -164,7 +178,8 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore) } else { - log_error("Path argument for --compilation-cache-path was not specified.\n"); + log_error("Path argument for --compilation-cache-path was not " + "specified.\n"); return -1; } } @@ -178,34 +193,34 @@ int parseCustomParam (int argc, const char *argv[], const char *ignore) } else { - log_error("Program argument for --compilation-program was not specified.\n"); + log_error("Program argument for --compilation-program was not " + "specified.\n"); return -1; } } - //cleaning parameters from argv tab - for (int j = i; j < argc - delArg; j++) - argv[j] = argv[j + delArg]; + // cleaning parameters from argv tab + for (int j = i; j < argc - delArg; j++) argv[j] = argv[j + delArg]; argc -= delArg; i -= delArg; } - if ((gCompilationCacheMode == kCacheModeForceRead || gCompilationCacheMode == kCacheModeOverwrite) - && gCompilationMode == kOnline) + if ((gCompilationCacheMode == kCacheModeForceRead + || gCompilationCacheMode == kCacheModeOverwrite) + && gCompilationMode == kOnline) { - log_error("Compilation cache mode can only be specified when using an offline compilation mode.\n"); + log_error("Compilation cache mode can only be specified when using an " + "offline compilation mode.\n"); return -1; } return argc; } -bool is_power_of_two(int number) -{ - return number && !(number & (number - 1)); -} +bool is_power_of_two(int number) { return number && !(number & (number - 1)); } -extern void parseWimpyReductionFactor(const char *&arg, int &wimpyReductionFactor) +extern void parseWimpyReductionFactor(const char *&arg, + int &wimpyReductionFactor) { const char *arg_temp = strchr(&arg[1], ']'); if (arg_temp != 0) @@ -214,12 +229,15 @@ extern void parseWimpyReductionFactor(const char *&arg, int &wimpyReductionFacto arg = arg_temp; // Advance until ']' if (is_power_of_two(new_factor)) { - log_info("\n Wimpy reduction factor changed from %d to %d \n", wimpyReductionFactor, new_factor); + log_info("\n Wimpy reduction factor changed from %d to %d \n", + wimpyReductionFactor, new_factor); wimpyReductionFactor = new_factor; } else { - log_info("\n WARNING: Incorrect wimpy reduction factor %d, must be power of 2. The default value will be used.\n", new_factor); + log_info("\n WARNING: Incorrect wimpy reduction factor %d, must be " + "power of 2. The default value will be used.\n", + new_factor); } } } diff --git a/test_common/harness/parseParameters.h b/test_common/harness/parseParameters.h index 5dc28c51..b0f8328a 100644 --- a/test_common/harness/parseParameters.h +++ b/test_common/harness/parseParameters.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 @@ -39,8 +39,10 @@ extern CompilationCacheMode gCompilationCacheMode; extern std::string gCompilationCachePath; extern std::string gCompilationProgram; -extern int parseCustomParam (int argc, const char *argv[], const char *ignore = 0 ); +extern int parseCustomParam(int argc, const char *argv[], + const char *ignore = 0); -extern void parseWimpyReductionFactor(const char *&arg, int &wimpyReductionFactor); +extern void parseWimpyReductionFactor(const char *&arg, + int &wimpyReductionFactor); #endif // _parseParameters_h diff --git a/test_common/harness/ref_counting.h b/test_common/harness/ref_counting.h index 1a2aceee..cd6a3160 100644 --- a/test_common/harness/ref_counting.h +++ b/test_common/harness/ref_counting.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 @@ -16,34 +16,39 @@ #ifndef _ref_counting_h #define _ref_counting_h -#define MARK_REF_COUNT_BASE( c, type, bigType ) \ - cl_uint c##_refCount; \ - error = clGet##type##Info( c, CL_##bigType##_REFERENCE_COUNT, sizeof( c##_refCount ), &c##_refCount, NULL ); \ - test_error( error, "Unable to check reference count for " #type ); +#define MARK_REF_COUNT_BASE(c, type, bigType) \ + cl_uint c##_refCount; \ + error = clGet##type##Info(c, CL_##bigType##_REFERENCE_COUNT, \ + sizeof(c##_refCount), &c##_refCount, NULL); \ + test_error(error, "Unable to check reference count for " #type); -#define TEST_REF_COUNT_BASE( c, type, bigType ) \ - cl_uint c##_refCount_new; \ - error = clGet##type##Info( c, CL_##bigType##_REFERENCE_COUNT, sizeof( c##_refCount_new ), &c##_refCount_new, NULL ); \ - test_error( error, "Unable to check reference count for " #type ); \ - if( c##_refCount != c##_refCount_new ) \ - { \ - log_error( "ERROR: Reference count for " #type " changed! (was %d, now %d)\n", c##_refCount, c##_refCount_new ); \ - return -1; \ +#define TEST_REF_COUNT_BASE(c, type, bigType) \ + cl_uint c##_refCount_new; \ + error = \ + clGet##type##Info(c, CL_##bigType##_REFERENCE_COUNT, \ + sizeof(c##_refCount_new), &c##_refCount_new, NULL); \ + test_error(error, "Unable to check reference count for " #type); \ + if (c##_refCount != c##_refCount_new) \ + { \ + log_error("ERROR: Reference count for " #type \ + " changed! (was %d, now %d)\n", \ + c##_refCount, c##_refCount_new); \ + return -1; \ } -#define MARK_REF_COUNT_CONTEXT( c ) MARK_REF_COUNT_BASE( c, Context, CONTEXT ) -#define TEST_REF_COUNT_CONTEXT( c ) TEST_REF_COUNT_BASE( c, Context, CONTEXT ) +#define MARK_REF_COUNT_CONTEXT(c) MARK_REF_COUNT_BASE(c, Context, CONTEXT) +#define TEST_REF_COUNT_CONTEXT(c) TEST_REF_COUNT_BASE(c, Context, CONTEXT) -#define MARK_REF_COUNT_DEVICE( c ) MARK_REF_COUNT_BASE( c, Device, DEVICE ) -#define TEST_REF_COUNT_DEVICE( c ) TEST_REF_COUNT_BASE( c, Device, DEVICE ) +#define MARK_REF_COUNT_DEVICE(c) MARK_REF_COUNT_BASE(c, Device, DEVICE) +#define TEST_REF_COUNT_DEVICE(c) TEST_REF_COUNT_BASE(c, Device, DEVICE) -#define MARK_REF_COUNT_QUEUE( c ) MARK_REF_COUNT_BASE( c, CommandQueue, QUEUE ) -#define TEST_REF_COUNT_QUEUE( c ) TEST_REF_COUNT_BASE( c, CommandQueue, QUEUE ) +#define MARK_REF_COUNT_QUEUE(c) MARK_REF_COUNT_BASE(c, CommandQueue, QUEUE) +#define TEST_REF_COUNT_QUEUE(c) TEST_REF_COUNT_BASE(c, CommandQueue, QUEUE) -#define MARK_REF_COUNT_PROGRAM( c ) MARK_REF_COUNT_BASE( c, Program, PROGRAM ) -#define TEST_REF_COUNT_PROGRAM( c ) TEST_REF_COUNT_BASE( c, Program, PROGRAM ) +#define MARK_REF_COUNT_PROGRAM(c) MARK_REF_COUNT_BASE(c, Program, PROGRAM) +#define TEST_REF_COUNT_PROGRAM(c) TEST_REF_COUNT_BASE(c, Program, PROGRAM) -#define MARK_REF_COUNT_MEM( c ) MARK_REF_COUNT_BASE( c, MemObject, MEM ) -#define TEST_REF_COUNT_MEM( c ) TEST_REF_COUNT_BASE( c, MemObject, MEM ) +#define MARK_REF_COUNT_MEM(c) MARK_REF_COUNT_BASE(c, MemObject, MEM) +#define TEST_REF_COUNT_MEM(c) TEST_REF_COUNT_BASE(c, MemObject, MEM) #endif // _ref_counting_h diff --git a/test_common/harness/rounding_mode.cpp b/test_common/harness/rounding_mode.cpp index ff38a7e4..681ccdd8 100644 --- a/test_common/harness/rounding_mode.cpp +++ b/test_common/harness/rounding_mode.cpp @@ -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 @@ -15,46 +15,49 @@ // #include "rounding_mode.h" -#if (defined( __arm__ ) || defined(__aarch64__)) - #define FPSCR_FZ (1 << 24) // Flush-To-Zero mode - #define FPSCR_ROUND_MASK (3 << 22) // Rounding mode: +#if (defined(__arm__) || defined(__aarch64__)) +#define FPSCR_FZ (1 << 24) // Flush-To-Zero mode +#define FPSCR_ROUND_MASK (3 << 22) // Rounding mode: - #define _ARM_FE_FTZ 0x1000000 - #define _ARM_FE_NFTZ 0x0 - #if defined(__aarch64__) - #define _FPU_GETCW(cw) __asm__ ("MRS %0,FPCR" : "=r" (cw)) - #define _FPU_SETCW(cw) __asm__ ("MSR FPCR,%0" : :"ri" (cw)) - #else - #define _FPU_GETCW(cw) __asm__ ("VMRS %0,FPSCR" : "=r" (cw)) - #define _FPU_SETCW(cw) __asm__ ("VMSR FPSCR,%0" : :"ri" (cw)) - #endif +#define _ARM_FE_FTZ 0x1000000 +#define _ARM_FE_NFTZ 0x0 +#if defined(__aarch64__) +#define _FPU_GETCW(cw) __asm__("MRS %0,FPCR" : "=r"(cw)) +#define _FPU_SETCW(cw) __asm__("MSR FPCR,%0" : : "ri"(cw)) +#else +#define _FPU_GETCW(cw) __asm__("VMRS %0,FPSCR" : "=r"(cw)) +#define _FPU_SETCW(cw) __asm__("VMSR FPSCR,%0" : : "ri"(cw)) +#endif #endif -#if (defined( __arm__ ) || defined(__aarch64__)) && defined( __GNUC__ ) -#define _ARM_FE_TONEAREST 0x0 -#define _ARM_FE_UPWARD 0x400000 -#define _ARM_FE_DOWNWARD 0x800000 -#define _ARM_FE_TOWARDZERO 0xc00000 -RoundingMode set_round( RoundingMode r, Type outType ) +#if (defined(__arm__) || defined(__aarch64__)) && defined(__GNUC__) +#define _ARM_FE_TONEAREST 0x0 +#define _ARM_FE_UPWARD 0x400000 +#define _ARM_FE_DOWNWARD 0x800000 +#define _ARM_FE_TOWARDZERO 0xc00000 +RoundingMode set_round(RoundingMode r, Type outType) { - static const int flt_rounds[ kRoundingModeCount ] = { _ARM_FE_TONEAREST, - _ARM_FE_TONEAREST, _ARM_FE_UPWARD, _ARM_FE_DOWNWARD, _ARM_FE_TOWARDZERO }; - static const int int_rounds[ kRoundingModeCount ] = { _ARM_FE_TOWARDZERO, - _ARM_FE_TONEAREST, _ARM_FE_UPWARD, _ARM_FE_DOWNWARD, _ARM_FE_TOWARDZERO }; + static const int flt_rounds[kRoundingModeCount] = { + _ARM_FE_TONEAREST, _ARM_FE_TONEAREST, _ARM_FE_UPWARD, _ARM_FE_DOWNWARD, + _ARM_FE_TOWARDZERO + }; + static const int int_rounds[kRoundingModeCount] = { + _ARM_FE_TOWARDZERO, _ARM_FE_TONEAREST, _ARM_FE_UPWARD, _ARM_FE_DOWNWARD, + _ARM_FE_TOWARDZERO + }; const int *p = int_rounds; - if( outType == kfloat || outType == kdouble ) - p = flt_rounds; + if (outType == kfloat || outType == kdouble) p = flt_rounds; int fpscr = 0; RoundingMode oldRound = get_round(); _FPU_GETCW(fpscr); - _FPU_SETCW( p[r] | (fpscr & ~FPSCR_ROUND_MASK)); + _FPU_SETCW(p[r] | (fpscr & ~FPSCR_ROUND_MASK)); return oldRound; } -RoundingMode get_round( void ) +RoundingMode get_round(void) { int fpscr; int oldRound; @@ -62,180 +65,192 @@ RoundingMode get_round( void ) _FPU_GETCW(fpscr); oldRound = (fpscr & FPSCR_ROUND_MASK); - switch( oldRound ) + switch (oldRound) { - case _ARM_FE_TONEAREST: - return kRoundToNearestEven; - case _ARM_FE_UPWARD: - return kRoundUp; - case _ARM_FE_DOWNWARD: - return kRoundDown; - case _ARM_FE_TOWARDZERO: - return kRoundTowardZero; + case _ARM_FE_TONEAREST: return kRoundToNearestEven; + case _ARM_FE_UPWARD: return kRoundUp; + case _ARM_FE_DOWNWARD: return kRoundDown; + case _ARM_FE_TOWARDZERO: return kRoundTowardZero; } return kDefaultRoundingMode; } #elif !(defined(_WIN32) && defined(_MSC_VER)) -RoundingMode set_round( RoundingMode r, Type outType ) +RoundingMode set_round(RoundingMode r, Type outType) { - static const int flt_rounds[ kRoundingModeCount ] = { FE_TONEAREST, FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; - static const int int_rounds[ kRoundingModeCount ] = { FE_TOWARDZERO, FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO }; + static const int flt_rounds[kRoundingModeCount] = { + FE_TONEAREST, FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO + }; + static const int int_rounds[kRoundingModeCount] = { + FE_TOWARDZERO, FE_TONEAREST, FE_UPWARD, FE_DOWNWARD, FE_TOWARDZERO + }; const int *p = int_rounds; - if( outType == kfloat || outType == kdouble ) - p = flt_rounds; + if (outType == kfloat || outType == kdouble) p = flt_rounds; int oldRound = fegetround(); - fesetround( p[r] ); + fesetround(p[r]); - switch( oldRound ) + switch (oldRound) { - case FE_TONEAREST: - return kRoundToNearestEven; - case FE_UPWARD: - return kRoundUp; - case FE_DOWNWARD: - return kRoundDown; - case FE_TOWARDZERO: - return kRoundTowardZero; - default: - abort(); // ??! + case FE_TONEAREST: return kRoundToNearestEven; + case FE_UPWARD: return kRoundUp; + case FE_DOWNWARD: return kRoundDown; + case FE_TOWARDZERO: return kRoundTowardZero; + default: abort(); // ??! } - return kDefaultRoundingMode; //never happens + return kDefaultRoundingMode; // never happens } -RoundingMode get_round( void ) +RoundingMode get_round(void) { int oldRound = fegetround(); - switch( oldRound ) + switch (oldRound) { - case FE_TONEAREST: - return kRoundToNearestEven; - case FE_UPWARD: - return kRoundUp; - case FE_DOWNWARD: - return kRoundDown; - case FE_TOWARDZERO: - return kRoundTowardZero; + case FE_TONEAREST: return kRoundToNearestEven; + case FE_UPWARD: return kRoundUp; + case FE_DOWNWARD: return kRoundDown; + case FE_TOWARDZERO: return kRoundTowardZero; } return kDefaultRoundingMode; } #else -RoundingMode set_round( RoundingMode r, Type outType ) +RoundingMode set_round(RoundingMode r, Type outType) { - static const int flt_rounds[ kRoundingModeCount ] = { _RC_NEAR, _RC_NEAR, _RC_UP, _RC_DOWN, _RC_CHOP }; - static const int int_rounds[ kRoundingModeCount ] = { _RC_CHOP, _RC_NEAR, _RC_UP, _RC_DOWN, _RC_CHOP }; - const int *p = ( outType == kfloat || outType == kdouble )? flt_rounds : int_rounds; + static const int flt_rounds[kRoundingModeCount] = { _RC_NEAR, _RC_NEAR, + _RC_UP, _RC_DOWN, + _RC_CHOP }; + static const int int_rounds[kRoundingModeCount] = { _RC_CHOP, _RC_NEAR, + _RC_UP, _RC_DOWN, + _RC_CHOP }; + const int *p = + (outType == kfloat || outType == kdouble) ? flt_rounds : int_rounds; unsigned int oldRound; - int err = _controlfp_s(&oldRound, 0, 0); //get rounding mode into oldRound - if (err) { - vlog_error("\t\tERROR: -- cannot get rounding mode in %s:%d\n", __FILE__, __LINE__); - return kDefaultRoundingMode; //what else never happens + int err = _controlfp_s(&oldRound, 0, 0); // get rounding mode into oldRound + if (err) + { + vlog_error("\t\tERROR: -- cannot get rounding mode in %s:%d\n", + __FILE__, __LINE__); + return kDefaultRoundingMode; // what else never happens } oldRound &= _MCW_RC; - RoundingMode old = - (oldRound == _RC_NEAR)? kRoundToNearestEven : - (oldRound == _RC_UP)? kRoundUp : - (oldRound == _RC_DOWN)? kRoundDown : - (oldRound == _RC_CHOP)? kRoundTowardZero: - kDefaultRoundingMode; + RoundingMode old = (oldRound == _RC_NEAR) + ? kRoundToNearestEven + : (oldRound == _RC_UP) ? kRoundUp + : (oldRound == _RC_DOWN) + ? kRoundDown + : (oldRound == _RC_CHOP) ? kRoundTowardZero + : kDefaultRoundingMode; - _controlfp_s(&oldRound, p[r], _MCW_RC); //setting new rounding mode - return old; //returning old rounding mode + _controlfp_s(&oldRound, p[r], _MCW_RC); // setting new rounding mode + return old; // returning old rounding mode } -RoundingMode get_round( void ) +RoundingMode get_round(void) { unsigned int oldRound; - int err = _controlfp_s(&oldRound, 0, 0); //get rounding mode into oldRound + int err = _controlfp_s(&oldRound, 0, 0); // get rounding mode into oldRound oldRound &= _MCW_RC; - return - (oldRound == _RC_NEAR)? kRoundToNearestEven : - (oldRound == _RC_UP)? kRoundUp : - (oldRound == _RC_DOWN)? kRoundDown : - (oldRound == _RC_CHOP)? kRoundTowardZero: - kDefaultRoundingMode; + return (oldRound == _RC_NEAR) + ? kRoundToNearestEven + : (oldRound == _RC_UP) ? kRoundUp + : (oldRound == _RC_DOWN) + ? kRoundDown + : (oldRound == _RC_CHOP) ? kRoundTowardZero + : kDefaultRoundingMode; } #endif // -// FlushToZero() sets the host processor into ftz mode. It is intended to have a remote effect on the behavior of the code in -// basic_test_conversions.c. Some host processors may not support this mode, which case you'll need to do some clamping in -// software by testing against FLT_MIN or DBL_MIN in that file. +// FlushToZero() sets the host processor into ftz mode. It is intended to have +// a remote effect on the behavior of the code in basic_test_conversions.c. Some +// host processors may not support this mode, which case you'll need to do some +// clamping in software by testing against FLT_MIN or DBL_MIN in that file. // -// Note: IEEE-754 says conversions are basic operations. As such they do *NOT* have the behavior in section 7.5.3 of -// the OpenCL spec. They *ALWAYS* flush to zero for subnormal inputs or outputs when FTZ mode is on like other basic +// Note: IEEE-754 says conversions are basic operations. As such they do *NOT* +// have the behavior in section 7.5.3 of the OpenCL spec. They *ALWAYS* flush to +// zero for subnormal inputs or outputs when FTZ mode is on like other basic // operators do (e.g. add, subtract, multiply, divide, etc.) // // Configuring hardware to FTZ mode varies by platform. -// CAUTION: Some C implementations may also fail to behave properly in this mode. +// CAUTION: Some C implementations may also fail to behave properly in this +// mode. // // On PowerPC, it is done by setting the FPSCR into non-IEEE mode. -// On Intel, you can do this by turning on the FZ and DAZ bits in the MXCSR -- provided that SSE/SSE2 -// is used for floating point computation! If your OS uses x87, you'll need to figure out how -// to turn that off for the conversions code in basic_test_conversions.c so that they flush to -// zero properly. Otherwise, you'll need to add appropriate software clamping to basic_test_conversions.c -// in which case, these function are at liberty to do nothing. +// On Intel, you can do this by turning on the FZ and DAZ bits in the MXCSR -- +// provided that SSE/SSE2 +// is used for floating point computation! If your OS uses x87, you'll +// need to figure out how to turn that off for the conversions code in +// basic_test_conversions.c so that they flush to zero properly. +// Otherwise, you'll need to add appropriate software clamping to +// basic_test_conversions.c in which case, these function are at +// liberty to do nothing. // -#if defined( __i386__ ) || defined( __x86_64__ ) || defined (_WIN32) - #include -#elif defined( __PPC__ ) - #include +#if defined(__i386__) || defined(__x86_64__) || defined(_WIN32) +#include +#elif defined(__PPC__) +#include #endif -void *FlushToZero( void ) +void *FlushToZero(void) { -#if defined( __APPLE__ ) || defined(__linux__) || defined (_WIN32) - #if defined( __i386__ ) || defined( __x86_64__ ) || defined(_MSC_VER) - union{ int i; void *p; }u = { _mm_getcsr() }; - _mm_setcsr( u.i | 0x8040 ); - return u.p; - #elif defined( __arm__ ) || defined(__aarch64__) - int fpscr; - _FPU_GETCW(fpscr); - _FPU_SETCW(fpscr | FPSCR_FZ); - return NULL; - #elif defined( __PPC__ ) - fpu_control_t flags = 0; - _FPU_GETCW(flags); - flags |= _FPU_MASK_NI; - _FPU_SETCW(flags); - return NULL; - #else - #error Unknown arch - #endif +#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32) +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) + union { + int i; + void *p; + } u = { _mm_getcsr() }; + _mm_setcsr(u.i | 0x8040); + return u.p; +#elif defined(__arm__) || defined(__aarch64__) + int fpscr; + _FPU_GETCW(fpscr); + _FPU_SETCW(fpscr | FPSCR_FZ); + return NULL; +#elif defined(__PPC__) + fpu_control_t flags = 0; + _FPU_GETCW(flags); + flags |= _FPU_MASK_NI; + _FPU_SETCW(flags); + return NULL; #else - #error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system. +#error Unknown arch +#endif +#else +#error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system. #endif } -// Undo the effects of FlushToZero above, restoring the host to default behavior, using the information passed in p. -void UnFlushToZero( void *p) +// Undo the effects of FlushToZero above, restoring the host to default +// behavior, using the information passed in p. +void UnFlushToZero(void *p) { -#if defined( __APPLE__ ) || defined(__linux__) || defined (_WIN32) - #if defined( __i386__ ) || defined( __x86_64__ ) || defined(_MSC_VER) - union{ void *p; int i; }u = { p }; - _mm_setcsr( u.i ); - #elif defined( __arm__ ) || defined(__aarch64__) - int fpscr; - _FPU_GETCW(fpscr); - _FPU_SETCW(fpscr & ~FPSCR_FZ); - #elif defined( __PPC__) - fpu_control_t flags = 0; - _FPU_GETCW(flags); - flags &= ~_FPU_MASK_NI; - _FPU_SETCW(flags); - #else - #error Unknown arch - #endif +#if defined(__APPLE__) || defined(__linux__) || defined(_WIN32) +#if defined(__i386__) || defined(__x86_64__) || defined(_MSC_VER) + union { + void *p; + int i; + } u = { p }; + _mm_setcsr(u.i); +#elif defined(__arm__) || defined(__aarch64__) + int fpscr; + _FPU_GETCW(fpscr); + _FPU_SETCW(fpscr & ~FPSCR_FZ); +#elif defined(__PPC__) + fpu_control_t flags = 0; + _FPU_GETCW(flags); + flags &= ~_FPU_MASK_NI; + _FPU_SETCW(flags); #else - #error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system. +#error Unknown arch +#endif +#else +#error Please configure FlushToZero and UnFlushToZero to behave properly on this operating system. #endif } diff --git a/test_common/harness/rounding_mode.h b/test_common/harness/rounding_mode.h index abbb5afe..064a3a63 100644 --- a/test_common/harness/rounding_mode.h +++ b/test_common/harness/rounding_mode.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 @@ -20,7 +20,7 @@ #include "compat.h" -#if (defined(_WIN32) && defined (_MSC_VER)) +#if (defined(_WIN32) && defined(_MSC_VER)) #include "errorHelpers.h" #include "testHarness.h" #endif @@ -34,7 +34,7 @@ typedef enum kRoundTowardZero, kRoundingModeCount -}RoundingMode; +} RoundingMode; typedef enum { @@ -49,15 +49,14 @@ typedef enum kulong = 8, klong = 9, - //This goes last + // This goes last kTypeCount -}Type; - -extern RoundingMode set_round( RoundingMode r, Type outType ); -extern RoundingMode get_round( void ); -extern void *FlushToZero( void ); -extern void UnFlushToZero( void *p); +} Type; +extern RoundingMode set_round(RoundingMode r, Type outType); +extern RoundingMode get_round(void); +extern void *FlushToZero(void); +extern void UnFlushToZero(void *p); #endif /* __ROUNDING_MODE_H__ */ diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 51bbba05..f9dd1252 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -1,6 +1,6 @@ // // Copyright (c) 2017-2019 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 @@ -41,7 +41,7 @@ #include -#if !defined (__APPLE__) +#if !defined(__APPLE__) #include #endif @@ -52,28 +52,33 @@ int gTestCount; cl_uint gRandomSeed = 0; cl_uint gReSeed = 0; -int gFlushDenormsToZero = 0; -int gInfNanSupport = 1; -int gIsEmbedded = 0; -int gHasLong = 1; +int gFlushDenormsToZero = 0; +int gInfNanSupport = 1; +int gIsEmbedded = 0; +int gHasLong = 1; bool gCoreILProgram = true; -#define DEFAULT_NUM_ELEMENTS 0x4000 +#define DEFAULT_NUM_ELEMENTS 0x4000 -int runTestHarness( int argc, const char *argv[], int testNum, test_definition testList[], - int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps ) +int runTestHarness(int argc, const char *argv[], int testNum, + test_definition testList[], int imageSupportRequired, + int forceNoContextCreation, + cl_command_queue_properties queueProps) { - return runTestHarnessWithCheck( argc, argv, testNum, testList, forceNoContextCreation, queueProps, - ( imageSupportRequired ) ? verifyImageSupport : NULL ); + return runTestHarnessWithCheck( + argc, argv, testNum, testList, forceNoContextCreation, queueProps, + (imageSupportRequired) ? verifyImageSupport : NULL); } -int skip_init_info(int count) { +int skip_init_info(int count) +{ log_info("Test skipped while initialization\n"); log_info("SKIPPED %d of %d tests.\n", count, count); return EXIT_SUCCESS; } -int fail_init_info(int count) { +int fail_init_info(int count) +{ log_info("Test failed while initialization\n"); log_info("FAILED %d of %d tests.\n", count, count); return EXIT_FAILURE; @@ -86,69 +91,77 @@ void version_expected_info(const char *test_name, const char *api_name, "reports %s version %s)\n", test_name, api_name, expected_version, api_name, device_version); } -int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_definition testList[], - int forceNoContextCreation, cl_command_queue_properties queueProps, - DeviceCheckFn deviceCheckFn ) +int runTestHarnessWithCheck(int argc, const char *argv[], int testNum, + test_definition testList[], + int forceNoContextCreation, + cl_command_queue_properties queueProps, + DeviceCheckFn deviceCheckFn) { test_start(); - cl_device_type device_type = CL_DEVICE_TYPE_DEFAULT; - cl_uint num_platforms = 0; - cl_platform_id *platforms; - cl_device_id device; - int num_elements = DEFAULT_NUM_ELEMENTS; - cl_uint num_devices = 0; - cl_device_id *devices = NULL; - cl_uint choosen_device_index = 0; - cl_uint choosen_platform_index = 0; + cl_device_type device_type = CL_DEVICE_TYPE_DEFAULT; + cl_uint num_platforms = 0; + cl_platform_id *platforms; + cl_device_id device; + int num_elements = DEFAULT_NUM_ELEMENTS; + cl_uint num_devices = 0; + cl_device_id *devices = NULL; + cl_uint choosen_device_index = 0; + cl_uint choosen_platform_index = 0; - int err, ret; + int err, ret; char *endPtr; int based_on_env_var = 0; /* Check for environment variable to set device type */ - char *env_mode = getenv( "CL_DEVICE_TYPE" ); - if( env_mode != NULL ) + char *env_mode = getenv("CL_DEVICE_TYPE"); + if (env_mode != NULL) { based_on_env_var = 1; - if( strcmp( env_mode, "gpu" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_GPU" ) == 0 ) + if (strcmp(env_mode, "gpu") == 0 + || strcmp(env_mode, "CL_DEVICE_TYPE_GPU") == 0) device_type = CL_DEVICE_TYPE_GPU; - else if( strcmp( env_mode, "cpu" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_CPU" ) == 0 ) + else if (strcmp(env_mode, "cpu") == 0 + || strcmp(env_mode, "CL_DEVICE_TYPE_CPU") == 0) device_type = CL_DEVICE_TYPE_CPU; - else if( strcmp( env_mode, "accelerator" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_ACCELERATOR" ) == 0 ) + else if (strcmp(env_mode, "accelerator") == 0 + || strcmp(env_mode, "CL_DEVICE_TYPE_ACCELERATOR") == 0) device_type = CL_DEVICE_TYPE_ACCELERATOR; - else if( strcmp( env_mode, "default" ) == 0 || strcmp( env_mode, "CL_DEVICE_TYPE_DEFAULT" ) == 0 ) + else if (strcmp(env_mode, "default") == 0 + || strcmp(env_mode, "CL_DEVICE_TYPE_DEFAULT") == 0) device_type = CL_DEVICE_TYPE_DEFAULT; else { - log_error( "Unknown CL_DEVICE_TYPE env variable setting: %s.\nAborting...\n", env_mode ); + log_error("Unknown CL_DEVICE_TYPE env variable setting: " + "%s.\nAborting...\n", + env_mode); abort(); } } -#if defined( __APPLE__ ) +#if defined(__APPLE__) { // report on any unusual library search path indirection - char *libSearchPath = getenv( "DYLD_LIBRARY_PATH"); - if( libSearchPath ) - log_info( "*** DYLD_LIBRARY_PATH = \"%s\"\n", libSearchPath ); + char *libSearchPath = getenv("DYLD_LIBRARY_PATH"); + if (libSearchPath) + log_info("*** DYLD_LIBRARY_PATH = \"%s\"\n", libSearchPath); // report on any unusual framework search path indirection - char *frameworkSearchPath = getenv( "DYLD_FRAMEWORK_PATH"); - if( libSearchPath ) - log_info( "*** DYLD_FRAMEWORK_PATH = \"%s\"\n", frameworkSearchPath ); + char *frameworkSearchPath = getenv("DYLD_FRAMEWORK_PATH"); + if (libSearchPath) + log_info("*** DYLD_FRAMEWORK_PATH = \"%s\"\n", frameworkSearchPath); } #endif - env_mode = getenv( "CL_DEVICE_INDEX" ); - if( env_mode != NULL ) + env_mode = getenv("CL_DEVICE_INDEX"); + if (env_mode != NULL) { choosen_device_index = atoi(env_mode); } - env_mode = getenv( "CL_PLATFORM_INDEX" ); - if( env_mode != NULL ) + env_mode = getenv("CL_PLATFORM_INDEX"); + if (env_mode != NULL) { choosen_platform_index = atoi(env_mode); } @@ -162,34 +175,43 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def } /* Special case: just list the tests */ - if( ( argc > 1 ) && (!strcmp( argv[ 1 ], "-list" ) || !strcmp( argv[ 1 ], "-h" ) || !strcmp( argv[ 1 ], "--help" ))) + if ((argc > 1) + && (!strcmp(argv[1], "-list") || !strcmp(argv[1], "-h") + || !strcmp(argv[1], "--help"))) { char *fileName = getenv("CL_CONFORMANCE_RESULTS_FILENAME"); - log_info( "Usage: %s [*] [pid] [id] []\n", argv[0] ); - log_info( "\t\tOne or more of: (wildcard character '*') (default *)\n"); - log_info( "\tpid\tIndicates platform at index should be used (default 0).\n" ); - log_info( "\tid\t\tIndicates device at index should be used (default 0).\n" ); - log_info( "\t\tcpu|gpu|accelerator| (default CL_DEVICE_TYPE_DEFAULT)\n" ); - log_info( "\n" ); - log_info( "\tNOTE: You may pass environment variable CL_CONFORMANCE_RESULTS_FILENAME (currently '%s')\n", - fileName != NULL ? fileName : "" ); - log_info( "\t to save results to JSON file.\n" ); + log_info( + "Usage: %s [*] [pid] [id] []\n", + argv[0]); + log_info("\t\tOne or more of: (wildcard character '*') " + "(default *)\n"); + log_info("\tpid\tIndicates platform at index should be used " + "(default 0).\n"); + log_info("\tid\t\tIndicates device at index should be used " + "(default 0).\n"); + log_info("\t\tcpu|gpu|accelerator| " + "(default CL_DEVICE_TYPE_DEFAULT)\n"); + log_info("\n"); + log_info("\tNOTE: You may pass environment variable " + "CL_CONFORMANCE_RESULTS_FILENAME (currently '%s')\n", + fileName != NULL ? fileName : ""); + log_info("\t to save results to JSON file.\n"); - log_info( "\n" ); - log_info( "Test names:\n" ); - for( int i = 0; i < testNum; i++ ) + log_info("\n"); + log_info("Test names:\n"); + for (int i = 0; i < testNum; i++) { - log_info( "\t%s\n", testList[i].name ); + log_info("\t%s\n", testList[i].name); } return EXIT_SUCCESS; } /* How are we supposed to seed the random # generators? */ - if( argc > 1 && strcmp( argv[ argc - 1 ], "randomize" ) == 0 ) + if (argc > 1 && strcmp(argv[argc - 1], "randomize") == 0) { - gRandomSeed = (cl_uint) time( NULL ); - log_info( "Random seed: %u.\n", gRandomSeed ); + gRandomSeed = (cl_uint)time(NULL); + log_info("Random seed: %u.\n", gRandomSeed); gReSeed = 1; argc--; } @@ -198,39 +220,44 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def log_info(" Initializing random seed to 0.\n"); } - /* Do we have an integer to specify the number of elements to pass to tests? */ - if( argc > 1 ) + /* Do we have an integer to specify the number of elements to pass to tests? + */ + if (argc > 1) { - ret = (int)strtol( argv[ argc - 1 ], &endPtr, 10 ); - if( endPtr != argv[ argc - 1 ] && *endPtr == 0 ) + ret = (int)strtol(argv[argc - 1], &endPtr, 10); + if (endPtr != argv[argc - 1] && *endPtr == 0) { - /* By spec, this means the entire string was a valid integer, so we treat it as a num_elements spec */ + /* By spec, this means the entire string was a valid integer, so we + * treat it as a num_elements spec */ /* (hence why we stored the result in ret first) */ num_elements = ret; - log_info( "Testing with num_elements of %d\n", num_elements ); + log_info("Testing with num_elements of %d\n", num_elements); argc--; } } /* Do we have a CPU/GPU specification? */ - if( argc > 1 ) + if (argc > 1) { - if( strcmp( argv[ argc - 1 ], "gpu" ) == 0 || strcmp( argv[ argc - 1 ], "CL_DEVICE_TYPE_GPU" ) == 0 ) + if (strcmp(argv[argc - 1], "gpu") == 0 + || strcmp(argv[argc - 1], "CL_DEVICE_TYPE_GPU") == 0) { device_type = CL_DEVICE_TYPE_GPU; argc--; } - else if( strcmp( argv[ argc - 1 ], "cpu" ) == 0 || strcmp( argv[ argc - 1 ], "CL_DEVICE_TYPE_CPU" ) == 0 ) + else if (strcmp(argv[argc - 1], "cpu") == 0 + || strcmp(argv[argc - 1], "CL_DEVICE_TYPE_CPU") == 0) { device_type = CL_DEVICE_TYPE_CPU; argc--; } - else if( strcmp( argv[ argc - 1 ], "accelerator" ) == 0 || strcmp( argv[ argc - 1 ], "CL_DEVICE_TYPE_ACCELERATOR" ) == 0 ) + else if (strcmp(argv[argc - 1], "accelerator") == 0 + || strcmp(argv[argc - 1], "CL_DEVICE_TYPE_ACCELERATOR") == 0) { device_type = CL_DEVICE_TYPE_ACCELERATOR; argc--; } - else if( strcmp( argv[ argc - 1 ], "CL_DEVICE_TYPE_DEFAULT" ) == 0 ) + else if (strcmp(argv[argc - 1], "CL_DEVICE_TYPE_DEFAULT") == 0) { device_type = CL_DEVICE_TYPE_DEFAULT; argc--; @@ -238,66 +265,74 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def } /* Did we choose a specific device index? */ - if( argc > 1 ) + if (argc > 1) { - if( strlen( argv[ argc - 1 ] ) >= 3 && argv[ argc - 1 ][0] == 'i' && argv[ argc - 1 ][1] == 'd' ) + if (strlen(argv[argc - 1]) >= 3 && argv[argc - 1][0] == 'i' + && argv[argc - 1][1] == 'd') { - choosen_device_index = atoi( &(argv[ argc - 1 ][2]) ); + choosen_device_index = atoi(&(argv[argc - 1][2])); argc--; } } /* Did we choose a specific platform index? */ - if( argc > 1 ) + if (argc > 1) { - if( strlen( argv[ argc - 1 ] ) >= 3 && argv[ argc - 1 ][0] == 'p' && argv[ argc - 1 ][1] == 'i' && argv[ argc - 1 ][2] == 'd') + if (strlen(argv[argc - 1]) >= 3 && argv[argc - 1][0] == 'p' + && argv[argc - 1][1] == 'i' && argv[argc - 1][2] == 'd') { - choosen_platform_index = atoi( &(argv[ argc - 1 ][3]) ); + choosen_platform_index = atoi(&(argv[argc - 1][3])); argc--; } } + switch (device_type) + { + case CL_DEVICE_TYPE_GPU: log_info("Requesting GPU device "); break; + case CL_DEVICE_TYPE_CPU: log_info("Requesting CPU device "); break; + case CL_DEVICE_TYPE_ACCELERATOR: + log_info("Requesting Accelerator device "); + break; + case CL_DEVICE_TYPE_DEFAULT: + log_info("Requesting Default device "); + break; + default: log_error("Requesting unknown device "); return EXIT_FAILURE; + } + log_info(based_on_env_var ? "based on environment variable " + : "based on command line "); + log_info("for platform index %d and device index %d\n", + choosen_platform_index, choosen_device_index); - switch (device_type) - { - case CL_DEVICE_TYPE_GPU: log_info("Requesting GPU device "); break; - case CL_DEVICE_TYPE_CPU: log_info("Requesting CPU device "); break; - case CL_DEVICE_TYPE_ACCELERATOR: log_info("Requesting Accelerator device "); break; - case CL_DEVICE_TYPE_DEFAULT: log_info("Requesting Default device "); break; - default: log_error("Requesting unknown device "); return EXIT_FAILURE; - } - log_info(based_on_env_var ? "based on environment variable " : "based on command line "); - log_info("for platform index %d and device index %d\n", choosen_platform_index, choosen_device_index); - -#if defined( __APPLE__ ) -#if defined( __i386__ ) || defined( __x86_64__ ) -#define kHasSSE3 0x00000008 -#define kHasSupplementalSSE3 0x00000100 -#define kHasSSE4_1 0x00000400 -#define kHasSSE4_2 0x00000800 +#if defined(__APPLE__) +#if defined(__i386__) || defined(__x86_64__) +#define kHasSSE3 0x00000008 +#define kHasSupplementalSSE3 0x00000100 +#define kHasSSE4_1 0x00000400 +#define kHasSSE4_2 0x00000800 /* check our environment for a hint to disable SSE variants */ { - const char *env = getenv( "CL_MAX_SSE" ); - if( env ) + const char *env = getenv("CL_MAX_SSE"); + if (env) { extern int _cpu_capabilities; int mask = 0; - if( 0 == strcasecmp( env, "SSE4.1" ) ) + if (0 == strcasecmp(env, "SSE4.1")) mask = kHasSSE4_2; - else if( 0 == strcasecmp( env, "SSSE3" ) ) + else if (0 == strcasecmp(env, "SSSE3")) mask = kHasSSE4_2 | kHasSSE4_1; - else if( 0 == strcasecmp( env, "SSE3" ) ) + else if (0 == strcasecmp(env, "SSE3")) mask = kHasSSE4_2 | kHasSSE4_1 | kHasSupplementalSSE3; - else if( 0 == strcasecmp( env, "SSE2" ) ) - mask = kHasSSE4_2 | kHasSSE4_1 | kHasSupplementalSSE3 | kHasSSE3; + else if (0 == strcasecmp(env, "SSE2")) + mask = + kHasSSE4_2 | kHasSSE4_1 | kHasSupplementalSSE3 | kHasSSE3; else { - log_error( "Error: Unknown CL_MAX_SSE setting: %s\n", env ); + log_error("Error: Unknown CL_MAX_SSE setting: %s\n", env); return EXIT_FAILURE; } - log_info( "*** Environment: CL_MAX_SSE = %s ***\n", env ); + log_info("*** Environment: CL_MAX_SSE = %s ***\n", env); _cpu_capabilities &= ~mask; } } @@ -306,110 +341,132 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def /* Get the platform */ err = clGetPlatformIDs(0, NULL, &num_platforms); - if (err) { + if (err) + { print_error(err, "clGetPlatformIDs failed"); return EXIT_FAILURE; } - platforms = (cl_platform_id *) malloc( num_platforms * sizeof( cl_platform_id ) ); - if (!platforms || choosen_platform_index >= num_platforms) { - log_error( "platform index out of range -- choosen_platform_index (%d) >= num_platforms (%d)\n", choosen_platform_index, num_platforms ); + platforms = + (cl_platform_id *)malloc(num_platforms * sizeof(cl_platform_id)); + if (!platforms || choosen_platform_index >= num_platforms) + { + log_error("platform index out of range -- choosen_platform_index (%d) " + ">= num_platforms (%d)\n", + choosen_platform_index, num_platforms); return EXIT_FAILURE; } BufferOwningPtr platformsBuf(platforms); err = clGetPlatformIDs(num_platforms, platforms, NULL); - if (err) { + if (err) + { print_error(err, "clGetPlatformIDs failed"); return EXIT_FAILURE; } /* Get the number of requested devices */ - err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, 0, NULL, &num_devices ); - if (err) { + err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, 0, + NULL, &num_devices); + if (err) + { print_error(err, "clGetDeviceIDs failed"); return EXIT_FAILURE; } - devices = (cl_device_id *) malloc( num_devices * sizeof( cl_device_id ) ); - if (!devices || choosen_device_index >= num_devices) { - log_error( "device index out of range -- choosen_device_index (%d) >= num_devices (%d)\n", choosen_device_index, num_devices ); + devices = (cl_device_id *)malloc(num_devices * sizeof(cl_device_id)); + if (!devices || choosen_device_index >= num_devices) + { + log_error("device index out of range -- choosen_device_index (%d) >= " + "num_devices (%d)\n", + choosen_device_index, num_devices); return EXIT_FAILURE; } BufferOwningPtr devicesBuf(devices); /* Get the requested device */ - err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, num_devices, devices, NULL ); - if (err) { + err = clGetDeviceIDs(platforms[choosen_platform_index], device_type, + num_devices, devices, NULL); + if (err) + { print_error(err, "clGetDeviceIDs failed"); return EXIT_FAILURE; } device = devices[choosen_device_index]; - err = clGetDeviceInfo( device, CL_DEVICE_TYPE, sizeof(gDeviceType), &gDeviceType, NULL ); - if( err ) + err = clGetDeviceInfo(device, CL_DEVICE_TYPE, sizeof(gDeviceType), + &gDeviceType, NULL); + if (err) { - print_error( err, "Unable to get device type" ); + print_error(err, "Unable to get device type"); return TEST_FAIL; } - - if( printDeviceHeader( device ) != CL_SUCCESS ) + + if (printDeviceHeader(device) != CL_SUCCESS) { return EXIT_FAILURE; } cl_device_fp_config fpconfig = 0; - err = clGetDeviceInfo( device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof( fpconfig ), &fpconfig, NULL ); - if (err) { - print_error(err, "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed"); + err = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(fpconfig), + &fpconfig, NULL); + if (err) + { + print_error(err, + "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed"); return EXIT_FAILURE; } - gFlushDenormsToZero = ( 0 == (fpconfig & CL_FP_DENORM)); - log_info( "Supports single precision denormals: %s\n", gFlushDenormsToZero ? "NO" : "YES" ); - log_info( "sizeof( void*) = %d (host)\n", (int) sizeof( void* ) ); + gFlushDenormsToZero = (0 == (fpconfig & CL_FP_DENORM)); + log_info("Supports single precision denormals: %s\n", + gFlushDenormsToZero ? "NO" : "YES"); + log_info("sizeof( void*) = %d (host)\n", (int)sizeof(void *)); - //detect whether profile of the device is embedded + // detect whether profile of the device is embedded char profile[1024] = ""; - err = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile), profile, NULL); + err = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile), profile, + NULL); if (err) { - print_error(err, "clGetDeviceInfo for CL_DEVICE_PROFILE failed\n" ); + print_error(err, "clGetDeviceInfo for CL_DEVICE_PROFILE failed\n"); return EXIT_FAILURE; } gIsEmbedded = NULL != strstr(profile, "EMBEDDED_PROFILE"); - //detect the floating point capabilities + // detect the floating point capabilities cl_device_fp_config floatCapabilities = 0; - err = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, sizeof(floatCapabilities), &floatCapabilities, NULL); + err = clGetDeviceInfo(device, CL_DEVICE_SINGLE_FP_CONFIG, + sizeof(floatCapabilities), &floatCapabilities, NULL); if (err) { - print_error(err, "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed\n"); + print_error(err, + "clGetDeviceInfo for CL_DEVICE_SINGLE_FP_CONFIG failed\n"); return EXIT_FAILURE; } // Check for problems that only embedded will have - if( gIsEmbedded ) + if (gIsEmbedded) { - //If the device is embedded, we need to detect if the device supports Infinity and NaN - if ((floatCapabilities & CL_FP_INF_NAN) == 0) - gInfNanSupport = 0; + // If the device is embedded, we need to detect if the device supports + // Infinity and NaN + if ((floatCapabilities & CL_FP_INF_NAN) == 0) gInfNanSupport = 0; // check the extensions list to see if ulong and long are supported - if( !is_extension_available(device, "cles_khr_int64" )) - gHasLong = 0; + if (!is_extension_available(device, "cles_khr_int64")) gHasLong = 0; } cl_uint device_address_bits = 0; - if( (err = clGetDeviceInfo( device, CL_DEVICE_ADDRESS_BITS, sizeof( device_address_bits ), &device_address_bits, NULL ) )) + if ((err = clGetDeviceInfo(device, CL_DEVICE_ADDRESS_BITS, + sizeof(device_address_bits), + &device_address_bits, NULL))) { - print_error( err, "Unable to obtain device address bits" ); + print_error(err, "Unable to obtain device address bits"); return EXIT_FAILURE; } - if( device_address_bits ) - log_info( "sizeof( void*) = %d (device)\n", device_address_bits/8 ); + if (device_address_bits) + log_info("sizeof( void*) = %d (device)\n", device_address_bits / 8); else { log_error("Invalid device address bit size returned by device.\n"); @@ -430,71 +487,76 @@ int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_def } /* If we have a device checking function, run it */ - if( ( deviceCheckFn != NULL ) ) + if ((deviceCheckFn != NULL)) { - test_status status = deviceCheckFn( device ); + test_status status = deviceCheckFn(device); switch (status) { - case TEST_PASS: - break; - case TEST_FAIL: - return fail_init_info(testNum); - case TEST_SKIP: - return skip_init_info(testNum); + case TEST_PASS: break; + case TEST_FAIL: return fail_init_info(testNum); + case TEST_SKIP: return skip_init_info(testNum); } } - if (num_elements <= 0) - num_elements = DEFAULT_NUM_ELEMENTS; + if (num_elements <= 0) num_elements = DEFAULT_NUM_ELEMENTS; // On most platforms which support denorm, default is FTZ off. However, - // on some hardware where the reference is computed, default might be flush denorms to zero e.g. arm. - // This creates issues in result verification. Since spec allows the implementation to either flush or - // not flush denorms to zero, an implementation may choose not be flush i.e. return denorm result whereas - // reference result may be zero (flushed denorm). Hence we need to disable denorm flushing on host side - // where reference is being computed to make sure we get non-flushed reference result. If implementation - // returns flushed result, we correctly take care of that in verification code. + // on some hardware where the reference is computed, default might be + // flush denorms to zero e.g. arm. This creates issues in result + // verification. Since spec allows the implementation to either flush or + // not flush denorms to zero, an implementation may choose not be flush + // i.e. return denorm result whereas reference result may be zero + // (flushed denorm). Hence we need to disable denorm flushing on host + // side where reference is being computed to make sure we get + // non-flushed reference result. If implementation returns flushed + // result, we correctly take care of that in verification code. #if defined(__APPLE__) && defined(__arm__) - FPU_mode_type oldMode; - DisableFTZ( &oldMode ); + FPU_mode_type oldMode; + DisableFTZ(&oldMode); #endif - int error = parseAndCallCommandLineTests( argc, argv, device, testNum, testList, forceNoContextCreation, queueProps, num_elements ); + int error = parseAndCallCommandLineTests(argc, argv, device, testNum, + testList, forceNoContextCreation, + queueProps, num_elements); - #if defined(__APPLE__) && defined(__arm__) - // Restore the old FP mode before leaving. - RestoreFPState( &oldMode ); +#if defined(__APPLE__) && defined(__arm__) + // Restore the old FP mode before leaving. + RestoreFPState(&oldMode); #endif return (error == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } -static int find_matching_tests( test_definition testList[], unsigned char selectedTestList[], int testNum, - const char *argument, bool isWildcard ) +static int find_matching_tests(test_definition testList[], + unsigned char selectedTestList[], int testNum, + const char *argument, bool isWildcard) { int found_tests = 0; - size_t wildcard_length = strlen( argument ) - 1; /* -1 for the asterisk */ + size_t wildcard_length = strlen(argument) - 1; /* -1 for the asterisk */ - for( int i = 0; i < testNum; i++ ) + for (int i = 0; i < testNum; i++) { - if( ( !isWildcard && strcmp( testList[i].name, argument ) == 0 ) || - ( isWildcard && strncmp( testList[i].name, argument, wildcard_length ) == 0 ) ) + if ((!isWildcard && strcmp(testList[i].name, argument) == 0) + || (isWildcard + && strncmp(testList[i].name, argument, wildcard_length) == 0)) { - if( selectedTestList[i] ) + if (selectedTestList[i]) { - log_error( "ERROR: Test '%s' has already been selected.\n", testList[i].name ); + log_error("ERROR: Test '%s' has already been selected.\n", + testList[i].name); return EXIT_FAILURE; } - else if( testList[i].func == NULL ) + else if (testList[i].func == NULL) { - log_error( "ERROR: Test '%s' is missing implementation.\n", testList[i].name ); + log_error("ERROR: Test '%s' is missing implementation.\n", + testList[i].name); return EXIT_FAILURE; } else { selectedTestList[i] = 1; found_tests = 1; - if( !isWildcard ) + if (!isWildcard) { break; } @@ -502,22 +564,26 @@ static int find_matching_tests( test_definition testList[], unsigned char select } } - if( !found_tests ) + if (!found_tests) { - log_error( "ERROR: The argument '%s' did not match any test names.\n", argument ); + log_error("ERROR: The argument '%s' did not match any test names.\n", + argument); return EXIT_FAILURE; } return EXIT_SUCCESS; } -static int saveResultsToJson( const char *fileName, const char *suiteName, test_definition testList[], - unsigned char selectedTestList[], test_status resultTestList[], int testNum ) +static int saveResultsToJson(const char *fileName, const char *suiteName, + test_definition testList[], + unsigned char selectedTestList[], + test_status resultTestList[], int testNum) { - FILE *file = fopen( fileName, "w" ); - if( NULL == file ) + FILE *file = fopen(fileName, "w"); + if (NULL == file) { - log_error( "ERROR: Failed to open '%s' for writing results.\n", fileName ); + log_error("ERROR: Failed to open '%s' for writing results.\n", + fileName); return EXIT_FAILURE; } @@ -526,117 +592,126 @@ static int saveResultsToJson( const char *fileName, const char *suiteName, test_ const char *linebreak[] = { "", ",\n" }; int add_linebreak = 0; - fprintf( file, "{\n" ); - fprintf( file, "\t\"cmd\": \"%s\",\n", suiteName ); - fprintf( file, "\t\"results\": {\n" ); + fprintf(file, "{\n"); + fprintf(file, "\t\"cmd\": \"%s\",\n", suiteName); + fprintf(file, "\t\"results\": {\n"); - for( int i = 0; i < testNum; ++i ) + for (int i = 0; i < testNum; ++i) { - if( selectedTestList[i] ) + if (selectedTestList[i]) { - fprintf( file, "%s\t\t\"%s\": \"%s\"", linebreak[add_linebreak], testList[i].name, result_map[(int)resultTestList[i]] ); + fprintf(file, "%s\t\t\"%s\": \"%s\"", linebreak[add_linebreak], + testList[i].name, result_map[(int)resultTestList[i]]); add_linebreak = 1; } } - fprintf( file, "\n"); + fprintf(file, "\n"); - fprintf( file, "\t}\n" ); - fprintf( file, "}\n" ); + fprintf(file, "\t}\n"); + fprintf(file, "}\n"); - int ret = fclose( file ) ? 1 : 0; + int ret = fclose(file) ? 1 : 0; - log_info( "Saving results to %s: %s!\n", fileName, save_map[ret] ); + log_info("Saving results to %s: %s!\n", fileName, save_map[ret]); return ret; } -static void print_results( int failed, int count, const char* name ) +static void print_results(int failed, int count, const char *name) { - if( count < failed ) + if (count < failed) { count = failed; } - if( failed == 0 ) + if (failed == 0) { - if( count > 1 ) + if (count > 1) { - log_info( "PASSED %d of %d %ss.\n", count, count, name ); + log_info("PASSED %d of %d %ss.\n", count, count, name); } else { - log_info( "PASSED %s.\n", name ); + log_info("PASSED %s.\n", name); } } - else if( failed > 0 ) + else if (failed > 0) { - if( count > 1 ) + if (count > 1) { - log_error( "FAILED %d of %d %ss.\n", failed, count, name ); + log_error("FAILED %d of %d %ss.\n", failed, count, name); } else { - log_error( "FAILED %s.\n", name ); + log_error("FAILED %s.\n", name); } } } -int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, int testNum, - test_definition testList[], int forceNoContextCreation, - cl_command_queue_properties queueProps, int num_elements ) +int parseAndCallCommandLineTests(int argc, const char *argv[], + cl_device_id device, int testNum, + test_definition testList[], + int forceNoContextCreation, + cl_command_queue_properties queueProps, + int num_elements) { int ret = EXIT_SUCCESS; - unsigned char *selectedTestList = ( unsigned char* ) calloc( testNum, 1 ); + unsigned char *selectedTestList = (unsigned char *)calloc(testNum, 1); test_status *resultTestList = NULL; - if( argc == 1 ) + if (argc == 1) { /* No actual arguments, all tests will be run. */ - memset( selectedTestList, 1, testNum ); + memset(selectedTestList, 1, testNum); } else { - for( int i = 1; i < argc; i++ ) + for (int i = 1; i < argc; i++) { - if( strchr( argv[i], '*' ) != NULL ) + if (strchr(argv[i], '*') != NULL) { - ret = find_matching_tests( testList, selectedTestList, testNum, argv[i], true ); + ret = find_matching_tests(testList, selectedTestList, testNum, + argv[i], true); } else { - if( strcmp( argv[i], "all" ) == 0 ) + if (strcmp(argv[i], "all") == 0) { - memset( selectedTestList, 1, testNum ); + memset(selectedTestList, 1, testNum); break; } else { - ret = find_matching_tests( testList, selectedTestList, testNum, argv[i], false ); + ret = find_matching_tests(testList, selectedTestList, + testNum, argv[i], false); } } - if( ret == EXIT_FAILURE ) + if (ret == EXIT_FAILURE) { break; } } } - if( ret == EXIT_SUCCESS ) + if (ret == EXIT_SUCCESS) { - resultTestList = ( test_status* ) calloc( testNum, sizeof(*resultTestList) ); + resultTestList = + (test_status *)calloc(testNum, sizeof(*resultTestList)); - callTestFunctions( testList, selectedTestList, resultTestList, testNum, device, - forceNoContextCreation, num_elements, queueProps ); + callTestFunctions(testList, selectedTestList, resultTestList, testNum, + device, forceNoContextCreation, num_elements, + queueProps); - print_results( gFailCount, gTestCount, "sub-test" ); - print_results( gTestsFailed, gTestsFailed + gTestsPassed, "test" ); + print_results(gFailCount, gTestCount, "sub-test"); + print_results(gTestsFailed, gTestsFailed + gTestsPassed, "test"); - char *filename = getenv( "CL_CONFORMANCE_RESULTS_FILENAME" ); - if( filename != NULL ) + char *filename = getenv("CL_CONFORMANCE_RESULTS_FILENAME"); + if (filename != NULL) { - ret = saveResultsToJson( filename, argv[0], testList, selectedTestList, resultTestList, testNum ); + ret = saveResultsToJson(filename, argv[0], testList, + selectedTestList, resultTestList, testNum); } } @@ -653,42 +728,50 @@ int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id dev ret = EXIT_FAILURE; } - free( selectedTestList ); - free( resultTestList ); + free(selectedTestList); + free(resultTestList); return ret; } -void callTestFunctions( test_definition testList[], unsigned char selectedTestList[], test_status resultTestList[], - int testNum, cl_device_id deviceToUse, int forceNoContextCreation, int numElementsToUse, - cl_command_queue_properties queueProps ) +void callTestFunctions(test_definition testList[], + unsigned char selectedTestList[], + test_status resultTestList[], int testNum, + cl_device_id deviceToUse, int forceNoContextCreation, + int numElementsToUse, + cl_command_queue_properties queueProps) { - for( int i = 0; i < testNum; ++i ) + for (int i = 0; i < testNum; ++i) { - if( selectedTestList[i] ) + if (selectedTestList[i]) { - resultTestList[i] = callSingleTestFunction( testList[i], deviceToUse, forceNoContextCreation, - numElementsToUse, queueProps ); + resultTestList[i] = callSingleTestFunction( + testList[i], deviceToUse, forceNoContextCreation, + numElementsToUse, queueProps); } } } -void CL_CALLBACK notify_callback(const char *errinfo, const void *private_info, size_t cb, void *user_data) +void CL_CALLBACK notify_callback(const char *errinfo, const void *private_info, + size_t cb, void *user_data) { - log_info( "%s\n", errinfo ); + log_info("%s\n", errinfo); } // Actual function execution -test_status callSingleTestFunction( test_definition test, cl_device_id deviceToUse, int forceNoContextCreation, - int numElementsToUse, const cl_queue_properties queueProps ) +test_status callSingleTestFunction(test_definition test, + cl_device_id deviceToUse, + int forceNoContextCreation, + int numElementsToUse, + const cl_queue_properties queueProps) { test_status status; cl_int error; cl_context context = NULL; cl_command_queue queue = NULL; - log_info( "%s...\n", test.name ); - fflush( stdout ); + log_info("%s...\n", test.name); + fflush(stdout); const Version device_version = get_device_cl_version(deviceToUse); if (test.min_version > device_version) @@ -700,26 +783,34 @@ test_status callSingleTestFunction( test_definition test, cl_device_id deviceToU } /* Create a context to work with, unless we're told not to */ - if( !forceNoContextCreation ) + if (!forceNoContextCreation) { - context = clCreateContext(NULL, 1, &deviceToUse, notify_callback, NULL, &error ); + context = clCreateContext(NULL, 1, &deviceToUse, notify_callback, NULL, + &error); if (!context) { - print_error( error, "Unable to create testing context" ); + print_error(error, "Unable to create testing context"); return TEST_FAIL; } - if (device_version < Version(2, 0)) { - queue = clCreateCommandQueue(context, deviceToUse, queueProps, &error); - } else { - const cl_command_queue_properties cmd_queueProps = (queueProps)?CL_QUEUE_PROPERTIES:0; - cl_command_queue_properties queueCreateProps[] = {cmd_queueProps, queueProps, 0}; - queue = clCreateCommandQueueWithProperties( context, deviceToUse, &queueCreateProps[0], &error ); + if (device_version < Version(2, 0)) + { + queue = + clCreateCommandQueue(context, deviceToUse, queueProps, &error); + } + else + { + const cl_command_queue_properties cmd_queueProps = + (queueProps) ? CL_QUEUE_PROPERTIES : 0; + cl_command_queue_properties queueCreateProps[] = { cmd_queueProps, + queueProps, 0 }; + queue = clCreateCommandQueueWithProperties( + context, deviceToUse, &queueCreateProps[0], &error); } - if( queue == NULL ) + if (queue == NULL) { - print_error( error, "Unable to create testing command queue" ); + print_error(error, "Unable to create testing command queue"); return TEST_FAIL; } } @@ -728,16 +819,20 @@ test_status callSingleTestFunction( test_definition test, cl_device_id deviceToU error = check_functions_for_offline_compiler(test.name, deviceToUse); test_missing_support_offline_cmpiler(error, test.name); - if( test.func == NULL ) + if (test.func == NULL) { - // Skip unimplemented test, can happen when all of the tests are selected + // Skip unimplemented test, can happen when all of the tests are + // selected log_info("%s test currently not implemented\n", test.name); status = TEST_SKIP; } else { - int ret = test.func(deviceToUse, context, queue, numElementsToUse); //test_threaded_function( ptr_basefn_list[i], group, context, num_elements); - if( ret == TEST_NOT_IMPLEMENTED ) + int ret = test.func( + deviceToUse, context, queue, + numElementsToUse); // test_threaded_function( ptr_basefn_list[i], + // group, context, num_elements); + if (ret == TEST_NOT_IMPLEMENTED) { /* Tests can also let us know they're not implemented yet */ log_info("%s test currently not implemented\n", test.name); @@ -745,21 +840,23 @@ test_status callSingleTestFunction( test_definition test, cl_device_id deviceToU } else if (ret == TEST_SKIPPED_ITSELF) { - /* Tests can also let us know they're not supported by the implementation */ + /* Tests can also let us know they're not supported by the + * implementation */ log_info("%s test not supported\n", test.name); status = TEST_SKIP; } else { /* Print result */ - if( ret == 0 ) { - log_info( "%s passed\n", test.name ); + if (ret == 0) + { + log_info("%s passed\n", test.name); gTestsPassed++; status = TEST_PASS; } else { - log_error( "%s FAILED\n", test.name ); + log_error("%s FAILED\n", test.name); gTestsFailed++; status = TEST_FAIL; } @@ -767,50 +864,50 @@ test_status callSingleTestFunction( test_definition test, cl_device_id deviceToU } /* Release the context */ - if( !forceNoContextCreation ) + if (!forceNoContextCreation) { int error = clFinish(queue); - if (error) { + if (error) + { log_error("clFinish failed: %d", error); status = TEST_FAIL; } - clReleaseCommandQueue( queue ); - clReleaseContext( context ); + clReleaseCommandQueue(queue); + clReleaseContext(context); } return status; } -#if ! defined( __APPLE__ ) -void memset_pattern4(void *dest, const void *src_pattern, size_t bytes ) +#if !defined(__APPLE__) +void memset_pattern4(void *dest, const void *src_pattern, size_t bytes) { - uint32_t pat = ((uint32_t*) src_pattern)[0]; + uint32_t pat = ((uint32_t *)src_pattern)[0]; size_t count = bytes / 4; size_t i; - uint32_t *d = (uint32_t*)dest; + uint32_t *d = (uint32_t *)dest; - for( i = 0; i < count; i++ ) - d[i] = pat; + for (i = 0; i < count; i++) d[i] = pat; d += i; bytes &= 3; - if( bytes ) - memcpy( d, src_pattern, bytes ); + if (bytes) memcpy(d, src_pattern, bytes); } #endif -cl_device_type GetDeviceType( cl_device_id d ) +cl_device_type GetDeviceType(cl_device_id d) { cl_device_type result = -1; - cl_int err = clGetDeviceInfo( d, CL_DEVICE_TYPE, sizeof( result ), &result, NULL ); - if( CL_SUCCESS != err ) - log_error( "ERROR: Unable to get device type for device %p\n", d ); + cl_int err = + clGetDeviceInfo(d, CL_DEVICE_TYPE, sizeof(result), &result, NULL); + if (CL_SUCCESS != err) + log_error("ERROR: Unable to get device type for device %p\n", d); return result; } -cl_device_id GetOpposingDevice( cl_device_id device ) +cl_device_id GetOpposingDevice(cl_device_id device) { cl_int error; cl_device_id *otherDevices; @@ -818,53 +915,59 @@ cl_device_id GetOpposingDevice( cl_device_id device ) cl_platform_id plat; // Get the platform of the device to use for getting a list of devices - error = clGetDeviceInfo( device, CL_DEVICE_PLATFORM, sizeof( plat ), &plat, NULL ); - if( error != CL_SUCCESS ) + error = + clGetDeviceInfo(device, CL_DEVICE_PLATFORM, sizeof(plat), &plat, NULL); + if (error != CL_SUCCESS) { - print_error( error, "Unable to get device's platform" ); + print_error(error, "Unable to get device's platform"); return NULL; } // Get a list of all devices - error = clGetDeviceIDs( plat, CL_DEVICE_TYPE_ALL, 0, NULL, &actualCount ); - if( error != CL_SUCCESS ) + error = clGetDeviceIDs(plat, CL_DEVICE_TYPE_ALL, 0, NULL, &actualCount); + if (error != CL_SUCCESS) { - print_error( error, "Unable to get list of devices size" ); + print_error(error, "Unable to get list of devices size"); return NULL; } - otherDevices = (cl_device_id *)malloc(actualCount*sizeof(cl_device_id)); - if (NULL == otherDevices) { - print_error( error, "Unable to allocate list of other devices." ); + otherDevices = (cl_device_id *)malloc(actualCount * sizeof(cl_device_id)); + if (NULL == otherDevices) + { + print_error(error, "Unable to allocate list of other devices."); return NULL; } BufferOwningPtr otherDevicesBuf(otherDevices); - error = clGetDeviceIDs( plat, CL_DEVICE_TYPE_ALL, actualCount, otherDevices, NULL ); - if( error != CL_SUCCESS ) + error = clGetDeviceIDs(plat, CL_DEVICE_TYPE_ALL, actualCount, otherDevices, + NULL); + if (error != CL_SUCCESS) { - print_error( error, "Unable to get list of devices" ); + print_error(error, "Unable to get list of devices"); return NULL; } - if( actualCount == 1 ) + if (actualCount == 1) { - return device; // NULL means error, returning self means we couldn't find another one + return device; // NULL means error, returning self means we couldn't + // find another one } // Loop and just find one that isn't the one we were given cl_uint i; - for( i = 0; i < actualCount; i++ ) + for (i = 0; i < actualCount; i++) { - if( otherDevices[ i ] != device ) + if (otherDevices[i] != device) { cl_device_type newType; - error = clGetDeviceInfo( otherDevices[ i ], CL_DEVICE_TYPE, sizeof( newType ), &newType, NULL ); - if( error != CL_SUCCESS ) + error = clGetDeviceInfo(otherDevices[i], CL_DEVICE_TYPE, + sizeof(newType), &newType, NULL); + if (error != CL_SUCCESS) { - print_error( error, "Unable to get device type for other device" ); + print_error(error, + "Unable to get device type for other device"); return NULL; } - cl_device_id result = otherDevices[ i ]; + cl_device_id result = otherDevices[i]; return result; } } @@ -880,7 +983,8 @@ Version get_device_cl_version(cl_device_id device) ASSERT_SUCCESS(err, "clGetDeviceInfo"); std::vector str(str_size); - err = clGetDeviceInfo(device, CL_DEVICE_VERSION, str_size, str.data(), NULL); + err = + clGetDeviceInfo(device, CL_DEVICE_VERSION, str_size, str.data(), NULL); ASSERT_SUCCESS(err, "clGetDeviceInfo"); if (strstr(str.data(), "OpenCL 1.0") != NULL) @@ -898,7 +1002,8 @@ Version get_device_cl_version(cl_device_id device) else if (strstr(str.data(), "OpenCL 3.0") != NULL) return Version(3, 0); - throw std::runtime_error(std::string("Unknown OpenCL version: ") + str.data()); + throw std::runtime_error(std::string("Unknown OpenCL version: ") + + str.data()); } bool check_device_spirv_version_reported(cl_device_id device) @@ -1064,52 +1169,53 @@ test_status check_spirv_compilation_readiness(cl_device_id device) return TEST_PASS; } -void PrintArch( void ) +void PrintArch(void) { - vlog( "sizeof( void*) = %ld\n", sizeof( void *) ); -#if defined( __ppc__ ) - vlog( "ARCH:\tppc\n" ); -#elif defined( __ppc64__ ) - vlog( "ARCH:\tppc64\n" ); -#elif defined( __PPC__ ) - vlog( "ARCH:\tppc\n" ); -#elif defined( __i386__ ) - vlog( "ARCH:\ti386\n" ); -#elif defined( __x86_64__ ) - vlog( "ARCH:\tx86_64\n" ); -#elif defined( __arm__ ) - vlog( "ARCH:\tarm\n" ); + vlog("sizeof( void*) = %ld\n", sizeof(void *)); +#if defined(__ppc__) + vlog("ARCH:\tppc\n"); +#elif defined(__ppc64__) + vlog("ARCH:\tppc64\n"); +#elif defined(__PPC__) + vlog("ARCH:\tppc\n"); +#elif defined(__i386__) + vlog("ARCH:\ti386\n"); +#elif defined(__x86_64__) + vlog("ARCH:\tx86_64\n"); +#elif defined(__arm__) + vlog("ARCH:\tarm\n"); #elif defined(__aarch64__) - vlog( "ARCH:\taarch64\n" ); -#elif defined (_WIN32) - vlog( "ARCH:\tWindows\n" ); + vlog("ARCH:\taarch64\n"); +#elif defined(_WIN32) + vlog("ARCH:\tWindows\n"); #else #error unknown arch #endif -#if defined( __APPLE__ ) +#if defined(__APPLE__) int type = 0; - size_t typeSize = sizeof( type ); - sysctlbyname( "hw.cputype", &type, &typeSize, NULL, 0 ); - vlog( "cpu type:\t%d\n", type ); - typeSize = sizeof( type ); - sysctlbyname( "hw.cpusubtype", &type, &typeSize, NULL, 0 ); - vlog( "cpu subtype:\t%d\n", type ); + size_t typeSize = sizeof(type); + sysctlbyname("hw.cputype", &type, &typeSize, NULL, 0); + vlog("cpu type:\t%d\n", type); + typeSize = sizeof(type); + sysctlbyname("hw.cpusubtype", &type, &typeSize, NULL, 0); + vlog("cpu subtype:\t%d\n", type); -#elif defined( __linux__ ) +#elif defined(__linux__) struct utsname buffer; - - if (uname(&buffer) != 0) { - vlog("uname error"); + + if (uname(&buffer) != 0) + { + vlog("uname error"); } - else { - vlog("system name = %s\n", buffer.sysname); - vlog("node name = %s\n", buffer.nodename); - vlog("release = %s\n", buffer.release); - vlog("version = %s\n", buffer.version); - vlog("machine = %s\n", buffer.machine); + else + { + vlog("system name = %s\n", buffer.sysname); + vlog("node name = %s\n", buffer.nodename); + vlog("release = %s\n", buffer.release); + vlog("version = %s\n", buffer.version); + vlog("machine = %s\n", buffer.machine); } #endif } - diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index afa9ad92..66c1b036 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -1,6 +1,6 @@ // // Copyright (c) 2017-2019 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 @@ -23,16 +23,24 @@ #include -class Version -{ +class Version { public: - Version() : m_major(0), m_minor(0) {} - Version(int major, int minor) : m_major(major), m_minor(minor) {} - bool operator>(const Version& rhs) const { return to_int() > rhs.to_int(); } - bool operator<(const Version& rhs) const { return to_int() < rhs.to_int(); } - bool operator<=(const Version& rhs) const { return to_int() <= rhs.to_int(); } - bool operator>=(const Version& rhs) const { return to_int() >= rhs.to_int(); } - bool operator==(const Version& rhs) const { return to_int() == rhs.to_int(); } + Version(): m_major(0), m_minor(0) {} + Version(int major, int minor): m_major(major), m_minor(minor) {} + bool operator>(const Version &rhs) const { return to_int() > rhs.to_int(); } + bool operator<(const Version &rhs) const { return to_int() < rhs.to_int(); } + bool operator<=(const Version &rhs) const + { + return to_int() <= rhs.to_int(); + } + bool operator>=(const Version &rhs) const + { + return to_int() >= rhs.to_int(); + } + bool operator==(const Version &rhs) const + { + return to_int() == rhs.to_int(); + } int to_int() const { return m_major * 10 + m_minor; } std::string to_string() const { @@ -66,7 +74,7 @@ Version get_device_cl_version(cl_device_id device); typedef struct test_definition { basefn func; - const char* name; + const char *name; Version min_version; } test_definition; @@ -83,57 +91,78 @@ extern int gTestCount; extern cl_uint gReSeed; extern cl_uint gRandomSeed; -// Supply a list of functions to test here. This will allocate a CL device, create a context, all that -// setup work, and then call each function in turn as dictatated by the passed arguments. -// Returns EXIT_SUCCESS iff all tests succeeded or the tests were listed, -// otherwise return EXIT_FAILURE. -extern int runTestHarness( int argc, const char *argv[], int testNum, test_definition testList[], - int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps ); +// Supply a list of functions to test here. This will allocate a CL device, +// create a context, all that setup work, and then call each function in turn as +// dictatated by the passed arguments. Returns EXIT_SUCCESS iff all tests +// succeeded or the tests were listed, otherwise return EXIT_FAILURE. +extern int runTestHarness(int argc, const char *argv[], int testNum, + test_definition testList[], int imageSupportRequired, + int forceNoContextCreation, + cl_command_queue_properties queueProps); -// Device checking function. See runTestHarnessWithCheck. If this function returns anything other than TEST_PASS, the harness exits. -typedef test_status (*DeviceCheckFn)( cl_device_id device ); +// Device checking function. See runTestHarnessWithCheck. If this function +// returns anything other than TEST_PASS, the harness exits. +typedef test_status (*DeviceCheckFn)(cl_device_id device); -// Same as runTestHarness, but also supplies a function that checks the created device for required functionality. -// Returns EXIT_SUCCESS iff all tests succeeded or the tests were listed, -// otherwise return EXIT_FAILURE. -extern int runTestHarnessWithCheck( int argc, const char *argv[], int testNum, test_definition testList[], - int forceNoContextCreation, cl_command_queue_properties queueProps, - DeviceCheckFn deviceCheckFn ); +// Same as runTestHarness, but also supplies a function that checks the created +// device for required functionality. Returns EXIT_SUCCESS iff all tests +// succeeded or the tests were listed, otherwise return EXIT_FAILURE. +extern int runTestHarnessWithCheck(int argc, const char *argv[], int testNum, + test_definition testList[], + int forceNoContextCreation, + cl_command_queue_properties queueProps, + DeviceCheckFn deviceCheckFn); -// The command line parser used by runTestHarness to break up parameters into calls to callTestFunctions -extern int parseAndCallCommandLineTests( int argc, const char *argv[], cl_device_id device, int testNum, - test_definition testList[], int forceNoContextCreation, - cl_command_queue_properties queueProps, int num_elements ); +// The command line parser used by runTestHarness to break up parameters into +// calls to callTestFunctions +extern int parseAndCallCommandLineTests(int argc, const char *argv[], + cl_device_id device, int testNum, + test_definition testList[], + int forceNoContextCreation, + cl_command_queue_properties queueProps, + int num_elements); -// Call this function if you need to do all the setup work yourself, and just need the function list called/ -// managed. +// Call this function if you need to do all the setup work yourself, and just +// need the function list called/ managed. // testList is the data structure that contains test functions and its names -// selectedTestList is an array of integers (treated as bools) which tell which function is to be called, -// each element at index i, corresponds to the element in testList at index i -// resultTestList is an array of statuses which contain the result of each selected test -// testNum is the number of tests in testList, selectedTestList and resultTestList -// contextProps are used to create a testing context for each test -// deviceToUse and numElementsToUse are all just passed to each test function -extern void callTestFunctions( test_definition testList[], unsigned char selectedTestList[], test_status resultTestList[], - int testNum, cl_device_id deviceToUse, int forceNoContextCreation, int numElementsToUse, - cl_command_queue_properties queueProps ); +// selectedTestList is an array of integers (treated as bools) which tell +// which function is to be called, +// each element at index i, corresponds to the element in testList at +// index i +// resultTestList is an array of statuses which contain the result of each +// selected test testNum is the number of tests in testList, selectedTestList +// and resultTestList contextProps are used to create a testing context for +// each test deviceToUse and numElementsToUse are all just passed to each +// test function +extern void callTestFunctions(test_definition testList[], + unsigned char selectedTestList[], + test_status resultTestList[], int testNum, + cl_device_id deviceToUse, + int forceNoContextCreation, int numElementsToUse, + cl_command_queue_properties queueProps); -// This function is called by callTestFunctions, once per function, to do setup, call, logging and cleanup -extern test_status callSingleTestFunction( test_definition test, cl_device_id deviceToUse, int forceNoContextCreation, - int numElementsToUse, cl_command_queue_properties queueProps ); +// This function is called by callTestFunctions, once per function, to do setup, +// call, logging and cleanup +extern test_status +callSingleTestFunction(test_definition test, cl_device_id deviceToUse, + int forceNoContextCreation, int numElementsToUse, + cl_command_queue_properties queueProps); ///// Miscellaneous steps // standard callback function for context pfn_notify -extern void CL_CALLBACK notify_callback(const char *errinfo, const void *private_info, size_t cb, void *user_data); +extern void CL_CALLBACK notify_callback(const char *errinfo, + const void *private_info, size_t cb, + void *user_data); -extern cl_device_type GetDeviceType( cl_device_id ); +extern cl_device_type GetDeviceType(cl_device_id); -// Given a device (most likely passed in by the harness, but not required), will attempt to find -// a DIFFERENT device and return it. Useful for finding another device to run multi-device tests against. -// Note that returning NULL means an error was hit, but if no error was hit and the device passed in -// is the only device available, the SAME device is returned, so check! -extern cl_device_id GetOpposingDevice( cl_device_id device ); +// Given a device (most likely passed in by the harness, but not required), will +// attempt to find a DIFFERENT device and return it. Useful for finding another +// device to run multi-device tests against. Note that returning NULL means an +// error was hit, but if no error was hit and the device passed in is the only +// device available, the SAME device is returned, so check! +extern cl_device_id GetOpposingDevice(cl_device_id device); Version get_device_spirv_il_version(cl_device_id device); bool check_device_spirv_il_support(cl_device_id device); @@ -143,19 +172,20 @@ void version_expected_info(const char *test_name, const char *api_name, test_status check_spirv_compilation_readiness(cl_device_id device); -extern int gFlushDenormsToZero; // This is set to 1 if the device does not support denorms (CL_FP_DENORM) -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 gFlushDenormsToZero; // This is set to 1 if the device does not + // support denorms (CL_FP_DENORM) +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 bool gCoreILProgram; -#if ! defined( __APPLE__ ) - void memset_pattern4(void *, const void *, size_t); +#if !defined(__APPLE__) +void memset_pattern4(void *, const void *, size_t); #endif extern void PrintArch(void); #endif // _testHarness_h - - diff --git a/test_common/harness/test_mt19937.c b/test_common/harness/test_mt19937.c index c0498ea9..fa57fd3b 100644 --- a/test_common/harness/test_mt19937.c +++ b/test_common/harness/test_mt19937.c @@ -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 @@ -16,24 +16,26 @@ #include "mt19937.h" #include -int main( void ) +int main(void) { MTdata d = init_genrand(42); int i; - const cl_uint reference[16] = { 0x5fe1dc66, 0x8b255210, 0x0380b0c8, 0xc87d2ce4, - 0x55c31f24, 0x8bcd21ab, 0x14d5fef5, 0x9416d2b6, - 0xdf875de9, 0x00517d76, 0xd861c944, 0xa7676404, - 0x5491aff4, 0x67616209, 0xc368b3fb, 0x929dfc92 }; + const cl_uint reference[16] = { + 0x5fe1dc66, 0x8b255210, 0x0380b0c8, 0xc87d2ce4, 0x55c31f24, 0x8bcd21ab, + 0x14d5fef5, 0x9416d2b6, 0xdf875de9, 0x00517d76, 0xd861c944, 0xa7676404, + 0x5491aff4, 0x67616209, 0xc368b3fb, 0x929dfc92 + }; int errcount = 0; - for( i = 0; i < 65536; i++ ) + for (i = 0; i < 65536; i++) { - cl_uint u = genrand_int32( d ); - if( 0 == (i & 4095) ) + cl_uint u = genrand_int32(d); + if (0 == (i & 4095)) { - if( u != reference[i>>12] ) + if (u != reference[i >> 12]) { - printf("ERROR: expected *0x%8.8x at %d. Got 0x%8.8x\n", reference[i>>12], i, u ); + printf("ERROR: expected *0x%8.8x at %d. Got 0x%8.8x\n", + reference[i >> 12], i, u); errcount++; } } @@ -41,7 +43,7 @@ int main( void ) free_mtdata(d); - if( errcount ) + if (errcount) printf("mt19937 test failed.\n"); else printf("mt19937 test passed.\n"); diff --git a/test_common/harness/threadTesting.cpp b/test_common/harness/threadTesting.cpp index 1a07f974..875ee59b 100644 --- a/test_common/harness/threadTesting.cpp +++ b/test_common/harness/threadTesting.cpp @@ -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 @@ -96,5 +96,3 @@ int test_threaded_function( basefn fnToTest, cl_device_id device, cl_context con return (int)((intptr_t)retVal); } #endif - - diff --git a/test_common/harness/threadTesting.h b/test_common/harness/threadTesting.h index 71d57973..08a17ed0 100644 --- a/test_common/harness/threadTesting.h +++ b/test_common/harness/threadTesting.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 @@ -17,17 +17,18 @@ #define _threadTesting_h #ifdef __APPLE__ - #include +#include #else - #include +#include #endif -#define TEST_NOT_IMPLEMENTED -99 -#define TEST_SKIPPED_ITSELF -100 +#define TEST_NOT_IMPLEMENTED -99 +#define TEST_SKIPPED_ITSELF -100 -typedef int (*basefn)(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); -extern int test_threaded_function( basefn fnToTest, cl_device_id device, cl_context context, cl_command_queue queue, int numElements ); +typedef int (*basefn)(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements); +extern int test_threaded_function(basefn fnToTest, cl_device_id device, + cl_context context, cl_command_queue queue, + int numElements); #endif // _threadTesting_h - - diff --git a/test_common/harness/typeWrappers.cpp b/test_common/harness/typeWrappers.cpp index c2fa5f64..e6520b1c 100644 --- a/test_common/harness/typeWrappers.cpp +++ b/test_common/harness/typeWrappers.cpp @@ -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 @@ -19,294 +19,362 @@ #include #include "clImageHelper.h" -#define ROUND_SIZE_UP( _size, _align ) (((size_t)(_size) + (size_t)(_align) - 1) & -((size_t)(_align))) +#define ROUND_SIZE_UP(_size, _align) \ + (((size_t)(_size) + (size_t)(_align)-1) & -((size_t)(_align))) -#if defined( __APPLE__ ) - #define kPageSize 4096 - #include - #include +#if defined(__APPLE__) +#define kPageSize 4096 +#include +#include #elif defined(__linux__) - #include - #define kPageSize (getpagesize()) +#include +#define kPageSize (getpagesize()) #endif -clProtectedImage::clProtectedImage( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, cl_int *errcode_ret ) +clProtectedImage::clProtectedImage(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + cl_int *errcode_ret) { - cl_int err = Create( context, mem_flags, fmt, width ); - if( errcode_ret != NULL ) - *errcode_ret = err; + cl_int err = Create(context, mem_flags, fmt, width); + if (errcode_ret != NULL) *errcode_ret = err; } -cl_int clProtectedImage::Create( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width ) +cl_int clProtectedImage::Create(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width) { cl_int error; -#if defined( __APPLE__ ) +#if defined(__APPLE__) int protect_pages = 1; cl_device_id devices[16]; size_t number_of_devices; - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), devices, &number_of_devices); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), + devices, &number_of_devices); test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); number_of_devices /= sizeof(cl_device_id); - for (int i=0; i<(int)number_of_devices; i++) { + for (int i = 0; i < (int)number_of_devices; i++) + { cl_device_type type; - error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, NULL); + error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, + NULL); test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); - if (type == CL_DEVICE_TYPE_GPU) { + if (type == CL_DEVICE_TYPE_GPU) + { protect_pages = 0; break; } } - if (protect_pages) { + if (protect_pages) + { size_t pixelBytes = get_pixel_bytes(fmt); - size_t rowBytes = ROUND_SIZE_UP( width * pixelBytes, kPageSize ); + size_t rowBytes = ROUND_SIZE_UP(width * pixelBytes, kPageSize); size_t rowStride = rowBytes + kPageSize; // create backing store backingStoreSize = rowStride + 8 * rowStride; - backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); + backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); // add guard pages size_t row; - char *p = (char*) backingStore; - char *imagePtr = (char*) backingStore + 4 * rowStride; - for( row = 0; row < 4; row++ ) + char *p = (char *)backingStore; + char *imagePtr = (char *)backingStore + 4 * rowStride; + for (row = 0; row < 4; row++) { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; + mprotect(p, rowStride, PROT_NONE); + p += rowStride; } p += rowBytes; - mprotect( p, kPageSize, PROT_NONE ); p += rowStride; + mprotect(p, kPageSize, PROT_NONE); + p += rowStride; p -= rowBytes; - for( row = 0; row < 4; row++ ) + for (row = 0; row < 4; row++) { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; + mprotect(p, rowStride, PROT_NONE); + p += rowStride; } - if( getenv( "CL_ALIGN_RIGHT" ) ) + if (getenv("CL_ALIGN_RIGHT")) { static int spewEnv = 1; - if(spewEnv) + if (spewEnv) { - log_info( "***CL_ALIGN_RIGHT is set. Aligning images at right edge of page\n" ); + log_info("***CL_ALIGN_RIGHT is set. Aligning images at right " + "edge of page\n"); spewEnv = 0; } imagePtr += rowBytes - pixelBytes * width; } - image = create_image_1d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, rowStride, imagePtr, NULL, &error ); - } else { + image = create_image_1d(context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, + width, rowStride, imagePtr, NULL, &error); + } + else + { backingStore = NULL; - image = create_image_1d( context, mem_flags, fmt, width, 0, NULL, NULL, &error ); - + image = create_image_1d(context, mem_flags, fmt, width, 0, NULL, NULL, + &error); } #else backingStore = NULL; - image = create_image_1d( context, mem_flags, fmt, width, 0, NULL, NULL, &error ); + image = + create_image_1d(context, mem_flags, fmt, width, 0, NULL, NULL, &error); #endif return error; } -clProtectedImage::clProtectedImage( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height, cl_int *errcode_ret ) +clProtectedImage::clProtectedImage(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height, cl_int *errcode_ret) { - cl_int err = Create( context, mem_flags, fmt, width, height ); - if( errcode_ret != NULL ) - *errcode_ret = err; + cl_int err = Create(context, mem_flags, fmt, width, height); + if (errcode_ret != NULL) *errcode_ret = err; } -cl_int clProtectedImage::Create( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height ) +cl_int clProtectedImage::Create(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height) { cl_int error; -#if defined( __APPLE__ ) - int protect_pages = 1; - cl_device_id devices[16]; - size_t number_of_devices; - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), devices, &number_of_devices); - test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); - - number_of_devices /= sizeof(cl_device_id); - for (int i=0; i<(int)number_of_devices; i++) { - cl_device_type type; - error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, NULL); - test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); - if (type == CL_DEVICE_TYPE_GPU) { - protect_pages = 0; - break; - } - } - - if (protect_pages) { - size_t pixelBytes = get_pixel_bytes(fmt); - size_t rowBytes = ROUND_SIZE_UP( width * pixelBytes, kPageSize ); - size_t rowStride = rowBytes + kPageSize; - - // create backing store - backingStoreSize = height * rowStride + 8 * rowStride; - backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); - - // add guard pages - size_t row; - char *p = (char*) backingStore; - char *imagePtr = (char*) backingStore + 4 * rowStride; - for( row = 0; row < 4; row++ ) - { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; - } - p += rowBytes; - for( row = 0; row < height; row++ ) - { - mprotect( p, kPageSize, PROT_NONE ); p += rowStride; - } - p -= rowBytes; - for( row = 0; row < 4; row++ ) - { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; - } - - if( getenv( "CL_ALIGN_RIGHT" ) ) - { - static int spewEnv = 1; - if(spewEnv) - { - log_info( "***CL_ALIGN_RIGHT is set. Aligning images at right edge of page\n" ); - spewEnv = 0; - } - imagePtr += rowBytes - pixelBytes * width; - } - - image = create_image_2d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, height, rowStride, imagePtr, &error ); - } else { - backingStore = NULL; - image = create_image_2d( context, mem_flags, fmt, width, height, 0, NULL, &error ); - - } -#else - - backingStore = NULL; - image = create_image_2d( context, mem_flags, fmt, width, height, 0, NULL, &error ); - -#endif - return error; -} - -clProtectedImage::clProtectedImage( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, cl_int *errcode_ret ) -{ - cl_int err = Create( context, mem_flags, fmt, width, height, depth ); - if( errcode_ret != NULL ) - *errcode_ret = err; -} - -cl_int clProtectedImage::Create( cl_context context, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth ) -{ - cl_int error; - -#if defined( __APPLE__ ) - int protect_pages = 1; - cl_device_id devices[16]; - size_t number_of_devices; - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), devices, &number_of_devices); - test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); - - number_of_devices /= sizeof(cl_device_id); - for (int i=0; i<(int)number_of_devices; i++) { - cl_device_type type; - error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, NULL); - test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); - if (type == CL_DEVICE_TYPE_GPU) { - protect_pages = 0; - break; - } - } - - if (protect_pages) { - size_t pixelBytes = get_pixel_bytes(fmt); - size_t rowBytes = ROUND_SIZE_UP( width * pixelBytes, kPageSize ); - size_t rowStride = rowBytes + kPageSize; - - // create backing store - backingStoreSize = height * depth * rowStride + 8 * rowStride; - backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); - - // add guard pages - size_t row; - char *p = (char*) backingStore; - char *imagePtr = (char*) backingStore + 4 * rowStride; - for( row = 0; row < 4; row++ ) - { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; - } - p += rowBytes; - for( row = 0; row < height*depth; row++ ) - { - mprotect( p, kPageSize, PROT_NONE ); p += rowStride; - } - p -= rowBytes; - for( row = 0; row < 4; row++ ) - { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; - } - - if( getenv( "CL_ALIGN_RIGHT" ) ) - { - static int spewEnv = 1; - if(spewEnv) - { - log_info( "***CL_ALIGN_RIGHT is set. Aligning images at right edge of page\n" ); - spewEnv = 0; - } - imagePtr += rowBytes - pixelBytes * width; - } - - image = create_image_3d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, height, depth, rowStride, height*rowStride, imagePtr, &error ); - } else { - backingStore = NULL; - image = create_image_3d( context, mem_flags, fmt, width, height, depth, 0, 0, NULL, &error ); - } -#else - - backingStore = NULL; - image = create_image_3d( context, mem_flags, fmt, width, height, depth, 0, 0, NULL, &error ); - -#endif - - return error; -} - - -clProtectedImage::clProtectedImage( cl_context context, cl_mem_object_type imageType, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, size_t arraySize, cl_int *errcode_ret ) -{ - cl_int err = Create( context, imageType, mem_flags, fmt, width, height, depth, arraySize ); - if( errcode_ret != NULL ) - *errcode_ret = err; -} - -cl_int clProtectedImage::Create( cl_context context, cl_mem_object_type imageType, cl_mem_flags mem_flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, size_t arraySize ) -{ - cl_int error; -#if defined( __APPLE__ ) +#if defined(__APPLE__) int protect_pages = 1; cl_device_id devices[16]; size_t number_of_devices; - error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), devices, &number_of_devices); + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), + devices, &number_of_devices); test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); number_of_devices /= sizeof(cl_device_id); - for (int i=0; i<(int)number_of_devices; i++) { + for (int i = 0; i < (int)number_of_devices; i++) + { cl_device_type type; - error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, NULL); + error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, + NULL); test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); - if (type == CL_DEVICE_TYPE_GPU) { + if (type == CL_DEVICE_TYPE_GPU) + { protect_pages = 0; break; } } - if (protect_pages) { + if (protect_pages) + { size_t pixelBytes = get_pixel_bytes(fmt); - size_t rowBytes = ROUND_SIZE_UP( width * pixelBytes, kPageSize ); + size_t rowBytes = ROUND_SIZE_UP(width * pixelBytes, kPageSize); + size_t rowStride = rowBytes + kPageSize; + + // create backing store + backingStoreSize = height * rowStride + 8 * rowStride; + backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); + + // add guard pages + size_t row; + char *p = (char *)backingStore; + char *imagePtr = (char *)backingStore + 4 * rowStride; + for (row = 0; row < 4; row++) + { + mprotect(p, rowStride, PROT_NONE); + p += rowStride; + } + p += rowBytes; + for (row = 0; row < height; row++) + { + mprotect(p, kPageSize, PROT_NONE); + p += rowStride; + } + p -= rowBytes; + for (row = 0; row < 4; row++) + { + mprotect(p, rowStride, PROT_NONE); + p += rowStride; + } + + if (getenv("CL_ALIGN_RIGHT")) + { + static int spewEnv = 1; + if (spewEnv) + { + log_info("***CL_ALIGN_RIGHT is set. Aligning images at right " + "edge of page\n"); + spewEnv = 0; + } + imagePtr += rowBytes - pixelBytes * width; + } + + image = create_image_2d(context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, + width, height, rowStride, imagePtr, &error); + } + else + { + backingStore = NULL; + image = create_image_2d(context, mem_flags, fmt, width, height, 0, NULL, + &error); + } +#else + + backingStore = NULL; + image = create_image_2d(context, mem_flags, fmt, width, height, 0, NULL, + &error); + +#endif + return error; +} + +clProtectedImage::clProtectedImage(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height, size_t depth, + cl_int *errcode_ret) +{ + cl_int err = Create(context, mem_flags, fmt, width, height, depth); + if (errcode_ret != NULL) *errcode_ret = err; +} + +cl_int clProtectedImage::Create(cl_context context, cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height, size_t depth) +{ + cl_int error; + +#if defined(__APPLE__) + int protect_pages = 1; + cl_device_id devices[16]; + size_t number_of_devices; + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), + devices, &number_of_devices); + test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); + + number_of_devices /= sizeof(cl_device_id); + for (int i = 0; i < (int)number_of_devices; i++) + { + cl_device_type type; + error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, + NULL); + test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); + if (type == CL_DEVICE_TYPE_GPU) + { + protect_pages = 0; + break; + } + } + + if (protect_pages) + { + size_t pixelBytes = get_pixel_bytes(fmt); + size_t rowBytes = ROUND_SIZE_UP(width * pixelBytes, kPageSize); + size_t rowStride = rowBytes + kPageSize; + + // create backing store + backingStoreSize = height * depth * rowStride + 8 * rowStride; + backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); + + // add guard pages + size_t row; + char *p = (char *)backingStore; + char *imagePtr = (char *)backingStore + 4 * rowStride; + for (row = 0; row < 4; row++) + { + mprotect(p, rowStride, PROT_NONE); + p += rowStride; + } + p += rowBytes; + for (row = 0; row < height * depth; row++) + { + mprotect(p, kPageSize, PROT_NONE); + p += rowStride; + } + p -= rowBytes; + for (row = 0; row < 4; row++) + { + mprotect(p, rowStride, PROT_NONE); + p += rowStride; + } + + if (getenv("CL_ALIGN_RIGHT")) + { + static int spewEnv = 1; + if (spewEnv) + { + log_info("***CL_ALIGN_RIGHT is set. Aligning images at right " + "edge of page\n"); + spewEnv = 0; + } + imagePtr += rowBytes - pixelBytes * width; + } + + image = create_image_3d(context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, + width, height, depth, rowStride, + height * rowStride, imagePtr, &error); + } + else + { + backingStore = NULL; + image = create_image_3d(context, mem_flags, fmt, width, height, depth, + 0, 0, NULL, &error); + } +#else + + backingStore = NULL; + image = create_image_3d(context, mem_flags, fmt, width, height, depth, 0, 0, + NULL, &error); + +#endif + + return error; +} + + +clProtectedImage::clProtectedImage(cl_context context, + cl_mem_object_type imageType, + cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height, size_t depth, + size_t arraySize, cl_int *errcode_ret) +{ + cl_int err = Create(context, imageType, mem_flags, fmt, width, height, + depth, arraySize); + if (errcode_ret != NULL) *errcode_ret = err; +} + +cl_int clProtectedImage::Create(cl_context context, + cl_mem_object_type imageType, + cl_mem_flags mem_flags, + const cl_image_format *fmt, size_t width, + size_t height, size_t depth, size_t arraySize) +{ + cl_int error; +#if defined(__APPLE__) + int protect_pages = 1; + cl_device_id devices[16]; + size_t number_of_devices; + error = clGetContextInfo(context, CL_CONTEXT_DEVICES, sizeof(devices), + devices, &number_of_devices); + test_error(error, "clGetContextInfo for CL_CONTEXT_DEVICES failed"); + + number_of_devices /= sizeof(cl_device_id); + for (int i = 0; i < (int)number_of_devices; i++) + { + cl_device_type type; + error = clGetDeviceInfo(devices[i], CL_DEVICE_TYPE, sizeof(type), &type, + NULL); + test_error(error, "clGetDeviceInfo for CL_DEVICE_TYPE failed"); + if (type == CL_DEVICE_TYPE_GPU) + { + protect_pages = 0; + break; + } + } + + if (protect_pages) + { + size_t pixelBytes = get_pixel_bytes(fmt); + size_t rowBytes = ROUND_SIZE_UP(width * pixelBytes, kPageSize); size_t rowStride = rowBytes + kPageSize; // create backing store @@ -325,37 +393,44 @@ cl_int clProtectedImage::Create( cl_context context, cl_mem_object_type imageTyp backingStoreSize = arraySize * rowStride + 8 * rowStride; break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - backingStoreSize = height * arraySize * rowStride + 8 * rowStride; + backingStoreSize = + height * arraySize * rowStride + 8 * rowStride; break; } - backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); + backingStore = mmap(0, backingStoreSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); // add guard pages size_t row; - char *p = (char*) backingStore; - char *imagePtr = (char*) backingStore + 4 * rowStride; - for( row = 0; row < 4; row++ ) + char *p = (char *)backingStore; + char *imagePtr = (char *)backingStore + 4 * rowStride; + for (row = 0; row < 4; row++) { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; + mprotect(p, rowStride, PROT_NONE); + p += rowStride; } p += rowBytes; - size_t sz = (height > 0 ? height : 1) * (depth > 0 ? depth : 1) * (arraySize > 0 ? arraySize : 1); - for( row = 0; row < sz; row++ ) + size_t sz = (height > 0 ? height : 1) * (depth > 0 ? depth : 1) + * (arraySize > 0 ? arraySize : 1); + for (row = 0; row < sz; row++) { - mprotect( p, kPageSize, PROT_NONE ); p += rowStride; + mprotect(p, kPageSize, PROT_NONE); + p += rowStride; } p -= rowBytes; - for( row = 0; row < 4; row++ ) + for (row = 0; row < 4; row++) { - mprotect( p, rowStride, PROT_NONE ); p += rowStride; + mprotect(p, rowStride, PROT_NONE); + p += rowStride; } - if( getenv( "CL_ALIGN_RIGHT" ) ) + if (getenv("CL_ALIGN_RIGHT")) { static int spewEnv = 1; - if(spewEnv) + if (spewEnv) { - log_info( "***CL_ALIGN_RIGHT is set. Aligning images at right edge of page\n" ); + log_info("***CL_ALIGN_RIGHT is set. Aligning images at right " + "edge of page\n"); spewEnv = 0; } imagePtr += rowBytes - pixelBytes * width; @@ -364,43 +439,61 @@ cl_int clProtectedImage::Create( cl_context context, cl_mem_object_type imageTyp switch (imageType) { case CL_MEM_OBJECT_IMAGE1D: - image = create_image_1d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, rowStride, imagePtr, NULL, &error ); + image = create_image_1d( + context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, + rowStride, imagePtr, NULL, &error); break; case CL_MEM_OBJECT_IMAGE2D: - image = create_image_2d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, height, rowStride, imagePtr, &error ); + image = create_image_2d( + context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, + height, rowStride, imagePtr, &error); break; case CL_MEM_OBJECT_IMAGE3D: - image = create_image_3d( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, height, depth, rowStride, height*rowStride, imagePtr, &error ); + image = + create_image_3d(context, mem_flags | CL_MEM_USE_HOST_PTR, + fmt, width, height, depth, rowStride, + height * rowStride, imagePtr, &error); break; case CL_MEM_OBJECT_IMAGE1D_ARRAY: - image = create_image_1d_array( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, arraySize, rowStride, rowStride, imagePtr, &error ); + image = create_image_1d_array( + context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, + arraySize, rowStride, rowStride, imagePtr, &error); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - image = create_image_2d_array( context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, height, arraySize, rowStride, height*rowStride, imagePtr, &error ); + image = create_image_2d_array( + context, mem_flags | CL_MEM_USE_HOST_PTR, fmt, width, + height, arraySize, rowStride, height * rowStride, imagePtr, + &error); break; } - } else { + } + else + { backingStore = NULL; switch (imageType) { case CL_MEM_OBJECT_IMAGE1D: - image = create_image_1d( context, mem_flags, fmt, width, 0, NULL, NULL, &error ); + image = create_image_1d(context, mem_flags, fmt, width, 0, NULL, + NULL, &error); break; case CL_MEM_OBJECT_IMAGE2D: - image = create_image_2d( context, mem_flags, fmt, width, height, 0, NULL, &error ); + image = create_image_2d(context, mem_flags, fmt, width, height, + 0, NULL, &error); break; case CL_MEM_OBJECT_IMAGE3D: image = create_image_3d(context, mem_flags, fmt, width, height, depth, 0, 0, NULL, &error); break; case CL_MEM_OBJECT_IMAGE1D_ARRAY: - image = create_image_1d_array( context, mem_flags, fmt, width, arraySize, 0, 0, NULL, &error ); + image = create_image_1d_array(context, mem_flags, fmt, width, + arraySize, 0, 0, NULL, &error); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - image = create_image_2d_array( context, mem_flags, fmt, width, height, arraySize, 0, 0, NULL, &error ); + image = create_image_2d_array(context, mem_flags, fmt, width, + height, arraySize, 0, 0, NULL, + &error); break; } - } #else @@ -408,20 +501,25 @@ cl_int clProtectedImage::Create( cl_context context, cl_mem_object_type imageTyp switch (imageType) { case CL_MEM_OBJECT_IMAGE1D: - image = create_image_1d( context, mem_flags, fmt, width, 0, NULL, NULL, &error ); + image = create_image_1d(context, mem_flags, fmt, width, 0, NULL, + NULL, &error); break; case CL_MEM_OBJECT_IMAGE2D: - image = create_image_2d( context, mem_flags, fmt, width, height, 0, NULL, &error ); + image = create_image_2d(context, mem_flags, fmt, width, height, 0, + NULL, &error); break; case CL_MEM_OBJECT_IMAGE3D: image = create_image_3d(context, mem_flags, fmt, width, height, depth, 0, 0, NULL, &error); break; case CL_MEM_OBJECT_IMAGE1D_ARRAY: - image = create_image_1d_array( context, mem_flags, fmt, width, arraySize, 0, 0, NULL, &error ); + image = create_image_1d_array(context, mem_flags, fmt, width, + arraySize, 0, 0, NULL, &error); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - image = create_image_2d_array( context, mem_flags, fmt, width, height, arraySize, 0, 0, NULL, &error ); + image = + create_image_2d_array(context, mem_flags, fmt, width, height, + arraySize, 0, 0, NULL, &error); break; } #endif @@ -429,55 +527,52 @@ cl_int clProtectedImage::Create( cl_context context, cl_mem_object_type imageTyp } - /******* * clProtectedArray implementation *******/ -clProtectedArray::clProtectedArray() -{ - mBuffer = mValidBuffer = NULL; -} +clProtectedArray::clProtectedArray() { mBuffer = mValidBuffer = NULL; } -clProtectedArray::clProtectedArray( size_t sizeInBytes ) +clProtectedArray::clProtectedArray(size_t sizeInBytes) { mBuffer = mValidBuffer = NULL; - Allocate( sizeInBytes ); + Allocate(sizeInBytes); } clProtectedArray::~clProtectedArray() { - if( mBuffer != NULL ) { -#if defined( __APPLE__ ) - int error = munmap( mBuffer, mRealSize ); - if (error) log_error("WARNING: munmap failed in clProtectedArray.\n"); + if (mBuffer != NULL) + { +#if defined(__APPLE__) + int error = munmap(mBuffer, mRealSize); + if (error) log_error("WARNING: munmap failed in clProtectedArray.\n"); #else - free( mBuffer ); + free(mBuffer); #endif - } + } } -void clProtectedArray::Allocate( size_t sizeInBytes ) +void clProtectedArray::Allocate(size_t sizeInBytes) { -#if defined( __APPLE__ ) +#if defined(__APPLE__) - // Allocate enough space to: round up our actual allocation to an even number of pages - // and allocate two pages on either side - mRoundedSize = ROUND_SIZE_UP( sizeInBytes, kPageSize ); + // Allocate enough space to: round up our actual allocation to an even + // number of pages and allocate two pages on either side + mRoundedSize = ROUND_SIZE_UP(sizeInBytes, kPageSize); mRealSize = mRoundedSize + kPageSize * 2; - // Use mmap here to ensure we start on a page boundary, so the mprotect calls will work OK - mBuffer = (char *)mmap(0, mRealSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, 0, 0); + // Use mmap here to ensure we start on a page boundary, so the mprotect + // calls will work OK + mBuffer = (char *)mmap(0, mRealSize, PROT_READ | PROT_WRITE, + MAP_ANON | MAP_PRIVATE, 0, 0); mValidBuffer = mBuffer + kPageSize; // Protect guard area from access - mprotect( mValidBuffer - kPageSize, kPageSize, PROT_NONE ); - mprotect( mValidBuffer + mRoundedSize, kPageSize, PROT_NONE ); + mprotect(mValidBuffer - kPageSize, kPageSize, PROT_NONE); + mprotect(mValidBuffer + mRoundedSize, kPageSize, PROT_NONE); #else - mRoundedSize = mRealSize = sizeInBytes; - mBuffer = mValidBuffer = (char *)calloc(1, mRealSize); + mRoundedSize = mRealSize = sizeInBytes; + mBuffer = mValidBuffer = (char *)calloc(1, mRealSize); #endif } - - diff --git a/test_common/harness/typeWrappers.h b/test_common/harness/typeWrappers.h index 384493ff..9a58a9d2 100644 --- a/test_common/harness/typeWrappers.h +++ b/test_common/harness/typeWrappers.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 @@ -31,299 +31,376 @@ /* cl_context wrapper */ -class clContextWrapper -{ - public: - clContextWrapper() { mContext = NULL; } - clContextWrapper( cl_context program ) { mContext = program; } - ~clContextWrapper() { if( mContext != NULL ) clReleaseContext( mContext ); } +class clContextWrapper { +public: + clContextWrapper() { mContext = NULL; } + clContextWrapper(cl_context program) { mContext = program; } + ~clContextWrapper() + { + if (mContext != NULL) clReleaseContext(mContext); + } - clContextWrapper & operator=( const cl_context &rhs ) { mContext = rhs; return *this; } - operator cl_context() const { return mContext; } + clContextWrapper &operator=(const cl_context &rhs) + { + mContext = rhs; + return *this; + } + operator cl_context() const { return mContext; } - cl_context * operator&() { return &mContext; } + cl_context *operator&() { return &mContext; } - bool operator==( const cl_context &rhs ) { return mContext == rhs; } + bool operator==(const cl_context &rhs) { return mContext == rhs; } - protected: - - cl_context mContext; +protected: + cl_context mContext; }; /* cl_program wrapper */ -class clProgramWrapper -{ - public: - clProgramWrapper() { mProgram = NULL; } - clProgramWrapper( cl_program program ) { mProgram = program; } - ~clProgramWrapper() { if( mProgram != NULL ) clReleaseProgram( mProgram ); } +class clProgramWrapper { +public: + clProgramWrapper() { mProgram = NULL; } + clProgramWrapper(cl_program program) { mProgram = program; } + ~clProgramWrapper() + { + if (mProgram != NULL) clReleaseProgram(mProgram); + } - clProgramWrapper & operator=( const cl_program &rhs ) { mProgram = rhs; return *this; } - operator cl_program() const { return mProgram; } + clProgramWrapper &operator=(const cl_program &rhs) + { + mProgram = rhs; + return *this; + } + operator cl_program() const { return mProgram; } - cl_program * operator&() { return &mProgram; } + cl_program *operator&() { return &mProgram; } - bool operator==( const cl_program &rhs ) { return mProgram == rhs; } + bool operator==(const cl_program &rhs) { return mProgram == rhs; } - protected: - - cl_program mProgram; +protected: + cl_program mProgram; }; /* cl_kernel wrapper */ -class clKernelWrapper -{ - public: - clKernelWrapper() { mKernel = NULL; } - clKernelWrapper( cl_kernel kernel ) { mKernel = kernel; } - ~clKernelWrapper() { if( mKernel != NULL ) clReleaseKernel( mKernel ); } +class clKernelWrapper { +public: + clKernelWrapper() { mKernel = NULL; } + clKernelWrapper(cl_kernel kernel) { mKernel = kernel; } + ~clKernelWrapper() + { + if (mKernel != NULL) clReleaseKernel(mKernel); + } - clKernelWrapper & operator=( const cl_kernel &rhs ) { mKernel = rhs; return *this; } - operator cl_kernel() const { return mKernel; } + clKernelWrapper &operator=(const cl_kernel &rhs) + { + mKernel = rhs; + return *this; + } + operator cl_kernel() const { return mKernel; } - cl_kernel * operator&() { return &mKernel; } + cl_kernel *operator&() { return &mKernel; } - bool operator==( const cl_kernel &rhs ) { return mKernel == rhs; } + bool operator==(const cl_kernel &rhs) { return mKernel == rhs; } - protected: - - cl_kernel mKernel; +protected: + cl_kernel mKernel; }; /* cl_mem (stream) wrapper */ -class clMemWrapper -{ - public: - clMemWrapper() { mMem = NULL; } - clMemWrapper( cl_mem mem ) { mMem = mem; } - ~clMemWrapper() { if( mMem != NULL ) clReleaseMemObject( mMem ); } +class clMemWrapper { +public: + clMemWrapper() { mMem = NULL; } + clMemWrapper(cl_mem mem) { mMem = mem; } + ~clMemWrapper() + { + if (mMem != NULL) clReleaseMemObject(mMem); + } - clMemWrapper & operator=( const cl_mem &rhs ) { mMem = rhs; return *this; } - operator cl_mem() const { return mMem; } + clMemWrapper &operator=(const cl_mem &rhs) + { + mMem = rhs; + return *this; + } + operator cl_mem() const { return mMem; } - cl_mem * operator&() { return &mMem; } + cl_mem *operator&() { return &mMem; } - bool operator==( const cl_mem &rhs ) { return mMem == rhs; } + bool operator==(const cl_mem &rhs) { return mMem == rhs; } - protected: - - cl_mem mMem; +protected: + cl_mem mMem; }; -class clProtectedImage -{ - public: - clProtectedImage() { image = NULL; backingStore = NULL; } - clProtectedImage( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width, cl_int *errcode_ret ); - clProtectedImage( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height, cl_int *errcode_ret ); - clProtectedImage( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, cl_int *errcode_ret ); - clProtectedImage( cl_context context, cl_mem_object_type imageType, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, size_t arraySize, cl_int *errcode_ret ); - ~clProtectedImage() - { - if( image != NULL ) - clReleaseMemObject( image ); +class clProtectedImage { +public: + clProtectedImage() + { + image = NULL; + backingStore = NULL; + } + clProtectedImage(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width, + cl_int *errcode_ret); + clProtectedImage(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width, size_t height, + cl_int *errcode_ret); + clProtectedImage(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width, size_t height, + size_t depth, cl_int *errcode_ret); + clProtectedImage(cl_context context, cl_mem_object_type imageType, + cl_mem_flags flags, const cl_image_format *fmt, + size_t width, size_t height, size_t depth, + size_t arraySize, cl_int *errcode_ret); + ~clProtectedImage() + { + if (image != NULL) clReleaseMemObject(image); -#if defined( __APPLE__ ) - if(backingStore) - munmap(backingStore, backingStoreSize); +#if defined(__APPLE__) + if (backingStore) munmap(backingStore, backingStoreSize); #endif - } + } - cl_int Create( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width ); - cl_int Create( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height ); - cl_int Create( cl_context context, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth ); - cl_int Create( cl_context context, cl_mem_object_type imageType, cl_mem_flags flags, const cl_image_format *fmt, size_t width, size_t height, size_t depth, size_t arraySize ); + cl_int Create(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width); + cl_int Create(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width, size_t height); + cl_int Create(cl_context context, cl_mem_flags flags, + const cl_image_format *fmt, size_t width, size_t height, + size_t depth); + cl_int Create(cl_context context, cl_mem_object_type imageType, + cl_mem_flags flags, const cl_image_format *fmt, size_t width, + size_t height, size_t depth, size_t arraySize); - clProtectedImage & operator=( const cl_mem &rhs ) { image = rhs; backingStore = NULL; return *this; } - operator cl_mem() { return image; } + clProtectedImage &operator=(const cl_mem &rhs) + { + image = rhs; + backingStore = NULL; + return *this; + } + operator cl_mem() { return image; } - cl_mem * operator&() { return ℑ } + cl_mem *operator&() { return ℑ } - bool operator==( const cl_mem &rhs ) { return image == rhs; } + bool operator==(const cl_mem &rhs) { return image == rhs; } - protected: - void *backingStore; - size_t backingStoreSize; - cl_mem image; +protected: + void *backingStore; + size_t backingStoreSize; + cl_mem image; }; /* cl_command_queue wrapper */ -class clCommandQueueWrapper -{ - public: - clCommandQueueWrapper() { mMem = NULL; } - clCommandQueueWrapper( cl_command_queue mem ) { mMem = mem; } - ~clCommandQueueWrapper() { if( mMem != NULL ) { clReleaseCommandQueue( mMem ); } } +class clCommandQueueWrapper { +public: + clCommandQueueWrapper() { mMem = NULL; } + clCommandQueueWrapper(cl_command_queue mem) { mMem = mem; } + ~clCommandQueueWrapper() + { + if (mMem != NULL) + { + clReleaseCommandQueue(mMem); + } + } - clCommandQueueWrapper & operator=( const cl_command_queue &rhs ) { mMem = rhs; return *this; } - operator cl_command_queue() const { return mMem; } + clCommandQueueWrapper &operator=(const cl_command_queue &rhs) + { + mMem = rhs; + return *this; + } + operator cl_command_queue() const { return mMem; } - cl_command_queue * operator&() { return &mMem; } + cl_command_queue *operator&() { return &mMem; } - bool operator==( const cl_command_queue &rhs ) { return mMem == rhs; } + bool operator==(const cl_command_queue &rhs) { return mMem == rhs; } - protected: - - cl_command_queue mMem; +protected: + cl_command_queue mMem; }; /* cl_sampler wrapper */ -class clSamplerWrapper -{ - public: - clSamplerWrapper() { mMem = NULL; } - clSamplerWrapper( cl_sampler mem ) { mMem = mem; } - ~clSamplerWrapper() { if( mMem != NULL ) clReleaseSampler( mMem ); } +class clSamplerWrapper { +public: + clSamplerWrapper() { mMem = NULL; } + clSamplerWrapper(cl_sampler mem) { mMem = mem; } + ~clSamplerWrapper() + { + if (mMem != NULL) clReleaseSampler(mMem); + } - clSamplerWrapper & operator=( const cl_sampler &rhs ) { mMem = rhs; return *this; } - operator cl_sampler() const { return mMem; } + clSamplerWrapper &operator=(const cl_sampler &rhs) + { + mMem = rhs; + return *this; + } + operator cl_sampler() const { return mMem; } - cl_sampler * operator&() { return &mMem; } + cl_sampler *operator&() { return &mMem; } - bool operator==( const cl_sampler &rhs ) { return mMem == rhs; } + bool operator==(const cl_sampler &rhs) { return mMem == rhs; } - protected: - - cl_sampler mMem; +protected: + cl_sampler mMem; }; /* cl_event wrapper */ -class clEventWrapper -{ - public: - clEventWrapper() { mMem = NULL; } - clEventWrapper( cl_event mem ) { mMem = mem; } - ~clEventWrapper() { if( mMem != NULL ) clReleaseEvent( mMem ); } +class clEventWrapper { +public: + clEventWrapper() { mMem = NULL; } + clEventWrapper(cl_event mem) { mMem = mem; } + ~clEventWrapper() + { + if (mMem != NULL) clReleaseEvent(mMem); + } - clEventWrapper & operator=( const cl_event &rhs ) { mMem = rhs; return *this; } - operator cl_event() const { return mMem; } + clEventWrapper &operator=(const cl_event &rhs) + { + mMem = rhs; + return *this; + } + operator cl_event() const { return mMem; } - cl_event * operator&() { return &mMem; } + cl_event *operator&() { return &mMem; } - bool operator==( const cl_event &rhs ) { return mMem == rhs; } + bool operator==(const cl_event &rhs) { return mMem == rhs; } - protected: - - cl_event mMem; +protected: + cl_event mMem; }; /* Generic protected memory buffer, for verifying access within bounds */ -class clProtectedArray -{ - public: - clProtectedArray(); - clProtectedArray( size_t sizeInBytes ); - virtual ~clProtectedArray(); +class clProtectedArray { +public: + clProtectedArray(); + clProtectedArray(size_t sizeInBytes); + virtual ~clProtectedArray(); - void Allocate( size_t sizeInBytes ); + void Allocate(size_t sizeInBytes); - operator void *() { return (void *)mValidBuffer; } - operator const void *() const { return (const void *)mValidBuffer; } + operator void *() { return (void *)mValidBuffer; } + operator const void *() const { return (const void *)mValidBuffer; } - protected: - - char * mBuffer; - char * mValidBuffer; - size_t mRealSize, mRoundedSize; +protected: + char *mBuffer; + char *mValidBuffer; + size_t mRealSize, mRoundedSize; }; -class RandomSeed -{ - public: - RandomSeed( cl_uint seed ){ if(seed) log_info( "(seed = %10.10u) ", seed ); mtData = init_genrand(seed); } - ~RandomSeed() - { - if( gReSeed ) - gRandomSeed = genrand_int32( mtData ); - free_mtdata(mtData); - } +class RandomSeed { +public: + RandomSeed(cl_uint seed) + { + if (seed) log_info("(seed = %10.10u) ", seed); + mtData = init_genrand(seed); + } + ~RandomSeed() + { + if (gReSeed) gRandomSeed = genrand_int32(mtData); + free_mtdata(mtData); + } - operator MTdata () {return mtData;} + operator MTdata() { return mtData; } - protected: - MTdata mtData; +protected: + MTdata mtData; }; -template class BufferOwningPtr -{ - BufferOwningPtr(BufferOwningPtr const &); // do not implement - void operator=(BufferOwningPtr const &); // do not implement +template class BufferOwningPtr { + BufferOwningPtr(BufferOwningPtr const &); // do not implement + void operator=(BufferOwningPtr const &); // do not implement void *ptr; void *map; - size_t mapsize; // Bytes allocated total, pointed to by map. - size_t allocsize; // Bytes allocated in unprotected pages, pointed to by ptr. - bool aligned; - public: - explicit BufferOwningPtr(void *p = 0) : ptr(p), map(0), mapsize(0), allocsize(0), aligned(false) {} - explicit BufferOwningPtr(void *p, void *m, size_t s) - : ptr(p), map(m), mapsize(s), allocsize(0), aligned(false) - { -#if ! defined( __APPLE__ ) - if(m) - { - log_error( "ERROR: unhandled code path. BufferOwningPtr allocated with mapped buffer!" ); - abort(); - } -#endif - } - ~BufferOwningPtr() { - if (map) { -#if defined( __APPLE__ ) - int error = munmap(map, mapsize); - if (error) log_error("WARNING: munmap failed in BufferOwningPtr.\n"); -#endif - } else { - if ( aligned ) - { - align_free(ptr); - } - else - { - free(ptr); - } - } - } - void reset(void *p, void *m = 0, size_t mapsize_ = 0, size_t allocsize_ = 0, bool aligned_ = false) { - if (map){ -#if defined( __APPLE__ ) - int error = munmap(map, mapsize); - if (error) log_error("WARNING: munmap failed in BufferOwningPtr.\n"); -#else - log_error( "ERROR: unhandled code path. BufferOwningPtr reset with mapped buffer!" ); - abort(); -#endif - } else { - if ( aligned ) - { - align_free(ptr); - } - else - { - free(ptr); - } - } - ptr = p; - map = m; - mapsize = mapsize_; - allocsize = (ptr != NULL) ? allocsize_ : 0; // Force allocsize to zero if ptr is NULL. - aligned = aligned_; -#if ! defined( __APPLE__ ) - if(m) - { - log_error( "ERROR: unhandled code path. BufferOwningPtr allocated with mapped buffer!" ); - abort(); - } -#endif - } - operator T*() { return (T*)ptr; } + // Bytes allocated total, pointed to by map: + size_t mapsize; + // Bytes allocated in unprotected pages, pointed to by ptr: + size_t allocsize; + bool aligned; - size_t getSize() const { return allocsize; }; +public: + explicit BufferOwningPtr(void *p = 0) + : ptr(p), map(0), mapsize(0), allocsize(0), aligned(false) + {} + explicit BufferOwningPtr(void *p, void *m, size_t s) + : ptr(p), map(m), mapsize(s), allocsize(0), aligned(false) + { +#if !defined(__APPLE__) + if (m) + { + log_error("ERROR: unhandled code path. BufferOwningPtr allocated " + "with mapped buffer!"); + abort(); + } +#endif + } + ~BufferOwningPtr() + { + if (map) + { +#if defined(__APPLE__) + int error = munmap(map, mapsize); + if (error) + log_error("WARNING: munmap failed in BufferOwningPtr.\n"); +#endif + } + else + { + if (aligned) + { + align_free(ptr); + } + else + { + free(ptr); + } + } + } + void reset(void *p, void *m = 0, size_t mapsize_ = 0, size_t allocsize_ = 0, + bool aligned_ = false) + { + if (map) + { +#if defined(__APPLE__) + int error = munmap(map, mapsize); + if (error) + log_error("WARNING: munmap failed in BufferOwningPtr.\n"); +#else + log_error("ERROR: unhandled code path. BufferOwningPtr reset with " + "mapped buffer!"); + abort(); +#endif + } + else + { + if (aligned) + { + align_free(ptr); + } + else + { + free(ptr); + } + } + ptr = p; + map = m; + mapsize = mapsize_; + // Force allocsize to zero if ptr is NULL: + allocsize = (ptr != NULL) ? allocsize_ : 0; + aligned = aligned_; +#if !defined(__APPLE__) + if (m) + { + log_error("ERROR: unhandled code path. BufferOwningPtr allocated " + "with mapped buffer!"); + abort(); + } +#endif + } + operator T *() { return (T *)ptr; } + + size_t getSize() const { return allocsize; }; }; #endif // _typeWrappers_h - From e815bf3565854ded28234816489f361e6a8b0428 Mon Sep 17 00:00:00 2001 From: John Kesapides <46718829+JohnKesapidesARM@users.noreply.github.com> Date: Fri, 30 Oct 2020 14:16:22 +0000 Subject: [PATCH 05/36] Fix min version for SPIRV test registration. (#1028) Signed-off-by: John Kesapides --- test_conformance/spirv_new/main.cpp | 2 +- test_conformance/spirv_new/procs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test_conformance/spirv_new/main.cpp b/test_conformance/spirv_new/main.cpp index 68a1e02a..5a8664b6 100644 --- a/test_conformance/spirv_new/main.cpp +++ b/test_conformance/spirv_new/main.cpp @@ -82,7 +82,7 @@ void spirvTestsRegistry::addTestClass(baseTestClass *test, const char *testName, test_definition testDef; testDef.func = test->getFunction(); testDef.name = testName; - testDef.min_version = Version(1, 2); + testDef.min_version = version; testDefinitions.push_back(testDef); } diff --git a/test_conformance/spirv_new/procs.h b/test_conformance/spirv_new/procs.h index fd697a43..31c65a3b 100644 --- a/test_conformance/spirv_new/procs.h +++ b/test_conformance/spirv_new/procs.h @@ -83,7 +83,7 @@ template T *createAndRegister(const char *name, Version version) int test_##name(cl_device_id deviceID, cl_context context, \ cl_command_queue queue, int num_elements) -#define TEST_SPIRV_FUNC(name) TEST_SPIRV_FUNC_VERSION(name, Version(2, 1)) +#define TEST_SPIRV_FUNC(name) TEST_SPIRV_FUNC_VERSION(name, Version(1, 2)) struct spec_const { From e7a23536e5d789c275867dd40d3ef68998467517 Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Fri, 30 Oct 2020 15:29:19 +0100 Subject: [PATCH 06/36] Skip Compiler Unload Tests in Binary Mode (#1025) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following tests make calls to `clCompileProgram` or `clBuildProgram` and therefore require a compiler in the runtime: * `unload_repeated` * `unload_compile_unload_link` * `unload_build_unload_create_kernel` * `unload_link_different↩` * `unload_build_threaded` * `unload_build_info` * `unload_program_binaries` Skip these tests if no compiler is present in the runtime. --- test_common/harness/errorHelpers.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index b01e5298..87701f1c 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -738,6 +738,13 @@ const char *subtests_to_skip_with_offline_compiler[] = { "simple_static_compile_only", "two_file_link", "async_build", + "unload_repeated", + "unload_compile_unload_link", + "unload_build_unload_create_kernel", + "unload_link_different", + "unload_build_threaded", + "unload_build_info", + "unload_program_binaries", }; int check_functions_for_offline_compiler(const char *subtestname, From 337db8882a3ade86ec8958096f4cf09928a32b6c Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Fri, 30 Oct 2020 14:38:39 +0000 Subject: [PATCH 07/36] Remove spirv_new binaries and add Python script to generate them (#902) * Remove binaries for spirv_new (#21) Avoid storing binaries in version control, as it is generally not well suited to this. Instead, in a followup commit we will add a script to regenerate the .spv files from their sources. Signed-off-by: Stuart Brady * Add Python script to assemble spirv_new binaries (#21) This also changes the ext_cl_khr_spirv_no_integer_wrap_decoration assembly source so that the SPIR-V version is listed as 1.0, to ensure that the output of spirv-dis exactly matches the assembly. Signed-off-by: Stuart Brady --- test_conformance/spirv_new/assemble_spirv.py | 164 ++++++++++++++++++ ..._integer_wrap_decoration_fadd_int.spvasm32 | 2 +- ..._integer_wrap_decoration_fadd_int.spvasm64 | 2 +- ...integer_wrap_decoration_fadd_uint.spvasm32 | 2 +- ...integer_wrap_decoration_fadd_uint.spvasm64 | 2 +- ..._integer_wrap_decoration_fmul_int.spvasm32 | 2 +- ..._integer_wrap_decoration_fmul_int.spvasm64 | 2 +- ...integer_wrap_decoration_fmul_uint.spvasm32 | 2 +- ...integer_wrap_decoration_fmul_uint.spvasm64 | 2 +- ...teger_wrap_decoration_fnegate_int.spvasm32 | 2 +- ...teger_wrap_decoration_fnegate_int.spvasm64 | 2 +- ...er_wrap_decoration_fshiftleft_int.spvasm32 | 2 +- ...er_wrap_decoration_fshiftleft_int.spvasm64 | 2 +- ...r_wrap_decoration_fshiftleft_uint.spvasm32 | 2 +- ...r_wrap_decoration_fshiftleft_uint.spvasm64 | 2 +- ..._integer_wrap_decoration_fsub_int.spvasm32 | 2 +- ..._integer_wrap_decoration_fsub_int.spvasm64 | 2 +- ...integer_wrap_decoration_fsub_uint.spvasm32 | 2 +- ...integer_wrap_decoration_fsub_uint.spvasm64 | 2 +- .../spirv_bin/atomic_dec_global.spv32 | Bin 552 -> 0 bytes .../spirv_bin/atomic_dec_global.spv64 | Bin 636 -> 0 bytes .../spirv_bin/atomic_inc_global.spv32 | Bin 552 -> 0 bytes .../spirv_bin/atomic_inc_global.spv64 | Bin 636 -> 0 bytes .../spirv_bin/branch_conditional.spv32 | Bin 812 -> 0 bytes .../spirv_bin/branch_conditional.spv64 | Bin 908 -> 0 bytes .../branch_conditional_weighted.spv32 | Bin 828 -> 0 bytes .../branch_conditional_weighted.spv64 | Bin 924 -> 0 bytes .../spirv_new/spirv_bin/branch_simple.spv32 | Bin 484 -> 0 bytes .../spirv_new/spirv_bin/branch_simple.spv64 | Bin 580 -> 0 bytes .../spirv_bin/composite_construct_int4.spv32 | Bin 544 -> 0 bytes .../spirv_bin/composite_construct_int4.spv64 | Bin 620 -> 0 bytes .../composite_construct_struct.spv32 | Bin 624 -> 0 bytes .../composite_construct_struct.spv64 | Bin 708 -> 0 bytes .../spirv_bin/constant_char_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/constant_char_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/constant_double_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/constant_double_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/constant_false_simple.spv32 | Bin 500 -> 0 bytes .../spirv_bin/constant_false_simple.spv64 | Bin 584 -> 0 bytes .../spirv_bin/constant_float_simple.spv32 | Bin 452 -> 0 bytes .../spirv_bin/constant_float_simple.spv64 | Bin 520 -> 0 bytes .../spirv_bin/constant_half_simple.spv32 | Bin 488 -> 0 bytes .../spirv_bin/constant_half_simple.spv64 | Bin 556 -> 0 bytes .../spirv_bin/constant_int3_simple.spv32 | Bin 504 -> 0 bytes .../spirv_bin/constant_int3_simple.spv64 | Bin 604 -> 0 bytes .../spirv_bin/constant_int4_simple.spv32 | Bin 540 -> 0 bytes .../spirv_bin/constant_int4_simple.spv64 | Bin 616 -> 0 bytes .../spirv_bin/constant_int_simple.spv32 | Bin 436 -> 0 bytes .../spirv_bin/constant_int_simple.spv64 | Bin 520 -> 0 bytes .../spirv_bin/constant_long_simple.spv32 | Bin 468 -> 0 bytes .../spirv_bin/constant_long_simple.spv64 | Bin 512 -> 0 bytes .../spirv_bin/constant_short_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/constant_short_simple.spv64 | Bin 532 -> 0 bytes .../constant_struct_int_char_simple.spv32 | Bin 524 -> 0 bytes .../constant_struct_int_char_simple.spv64 | Bin 608 -> 0 bytes .../constant_struct_int_float_simple.spv32 | Bin 516 -> 0 bytes .../constant_struct_int_float_simple.spv64 | Bin 600 -> 0 bytes .../constant_struct_struct_simple.spv32 | Bin 628 -> 0 bytes .../constant_struct_struct_simple.spv64 | Bin 712 -> 0 bytes .../spirv_bin/constant_true_simple.spv32 | Bin 508 -> 0 bytes .../spirv_bin/constant_true_simple.spv64 | Bin 584 -> 0 bytes .../spirv_bin/constant_uchar_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/constant_uchar_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/constant_uint_simple.spv32 | Bin 440 -> 0 bytes .../spirv_bin/constant_uint_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/constant_ulong_simple.spv32 | Bin 468 -> 0 bytes .../spirv_bin/constant_ulong_simple.spv64 | Bin 512 -> 0 bytes .../spirv_bin/constant_ushort_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/constant_ushort_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/copy_char_simple.spv32 | Bin 476 -> 0 bytes .../spirv_bin/copy_char_simple.spv64 | Bin 544 -> 0 bytes .../spirv_bin/copy_double_simple.spv32 | Bin 476 -> 0 bytes .../spirv_bin/copy_double_simple.spv64 | Bin 544 -> 0 bytes .../spirv_bin/copy_float_simple.spv32 | Bin 464 -> 0 bytes .../spirv_bin/copy_float_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/copy_half_simple.spv32 | Bin 500 -> 0 bytes .../spirv_bin/copy_half_simple.spv64 | Bin 568 -> 0 bytes .../spirv_bin/copy_int3_simple.spv32 | Bin 516 -> 0 bytes .../spirv_bin/copy_int3_simple.spv64 | Bin 616 -> 0 bytes .../spirv_bin/copy_int4_simple.spv32 | Bin 552 -> 0 bytes .../spirv_bin/copy_int4_simple.spv64 | Bin 636 -> 0 bytes .../spirv_new/spirv_bin/copy_int_simple.spv32 | Bin 448 -> 0 bytes .../spirv_new/spirv_bin/copy_int_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/copy_long_simple.spv32 | Bin 480 -> 0 bytes .../spirv_bin/copy_long_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/copy_short_simple.spv32 | Bin 476 -> 0 bytes .../spirv_bin/copy_short_simple.spv64 | Bin 544 -> 0 bytes .../copy_struct_int_char_simple.spv32 | Bin 536 -> 0 bytes .../copy_struct_int_char_simple.spv64 | Bin 620 -> 0 bytes .../copy_struct_int_float_simple.spv32 | Bin 528 -> 0 bytes .../copy_struct_int_float_simple.spv64 | Bin 612 -> 0 bytes .../spirv_bin/copy_struct_struct_simple.spv32 | Bin 640 -> 0 bytes .../spirv_bin/copy_struct_struct_simple.spv64 | Bin 724 -> 0 bytes .../spirv_bin/copy_uchar_simple.spv32 | Bin 476 -> 0 bytes .../spirv_bin/copy_uchar_simple.spv64 | Bin 544 -> 0 bytes .../spirv_bin/copy_uint_simple.spv32 | Bin 452 -> 0 bytes .../spirv_bin/copy_uint_simple.spv64 | Bin 536 -> 0 bytes .../spirv_bin/copy_ulong_simple.spv32 | Bin 480 -> 0 bytes .../spirv_bin/copy_ulong_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/copy_ushort_simple.spv32 | Bin 476 -> 0 bytes .../spirv_bin/copy_ushort_simple.spv64 | Bin 544 -> 0 bytes .../spirv_bin/decorate_aliased.spv32 | Bin 632 -> 0 bytes .../spirv_bin/decorate_aliased.spv64 | Bin 716 -> 0 bytes .../spirv_bin/decorate_alignment.spv32 | Bin 636 -> 0 bytes .../spirv_bin/decorate_alignment.spv64 | Bin 720 -> 0 bytes .../spirv_bin/decorate_constant.spv32 | Bin 628 -> 0 bytes .../spirv_bin/decorate_constant.spv64 | Bin 712 -> 0 bytes .../spirv_bin/decorate_constant_fail.spv32 | Bin 632 -> 0 bytes .../spirv_bin/decorate_constant_fail.spv64 | Bin 716 -> 0 bytes .../spirv_bin/decorate_cpacked.spv32 | Bin 524 -> 0 bytes .../spirv_bin/decorate_cpacked.spv64 | Bin 608 -> 0 bytes .../spirv_bin/decorate_restrict.spv32 | Bin 632 -> 0 bytes .../spirv_bin/decorate_restrict.spv64 | Bin 716 -> 0 bytes .../decorate_rounding_rte_double_long.spv32 | Bin 592 -> 0 bytes .../decorate_rounding_rte_double_long.spv64 | Bin 636 -> 0 bytes .../decorate_rounding_rte_float_int.spv32 | Bin 564 -> 0 bytes .../decorate_rounding_rte_float_int.spv64 | Bin 648 -> 0 bytes .../decorate_rounding_rtn_double_long.spv32 | Bin 592 -> 0 bytes .../decorate_rounding_rtn_double_long.spv64 | Bin 636 -> 0 bytes .../decorate_rounding_rtn_float_int.spv32 | Bin 564 -> 0 bytes .../decorate_rounding_rtn_float_int.spv64 | Bin 648 -> 0 bytes .../decorate_rounding_rtp_double_long.spv32 | Bin 592 -> 0 bytes .../decorate_rounding_rtp_double_long.spv64 | Bin 636 -> 0 bytes .../decorate_rounding_rtp_float_int.spv32 | Bin 564 -> 0 bytes .../decorate_rounding_rtp_float_int.spv64 | Bin 648 -> 0 bytes .../decorate_rounding_rtz_double_long.spv32 | Bin 592 -> 0 bytes .../decorate_rounding_rtz_double_long.spv64 | Bin 636 -> 0 bytes .../decorate_rounding_rtz_float_int.spv32 | Bin 564 -> 0 bytes .../decorate_rounding_rtz_float_int.spv64 | Bin 648 -> 0 bytes .../decorate_saturated_conversion_char.spv32 | Bin 680 -> 0 bytes .../decorate_saturated_conversion_char.spv64 | Bin 748 -> 0 bytes .../decorate_saturated_conversion_int.spv32 | Bin 648 -> 0 bytes .../decorate_saturated_conversion_int.spv64 | Bin 732 -> 0 bytes .../decorate_saturated_conversion_short.spv32 | Bin 680 -> 0 bytes .../decorate_saturated_conversion_short.spv64 | Bin 748 -> 0 bytes .../decorate_saturated_conversion_uchar.spv32 | Bin 680 -> 0 bytes .../decorate_saturated_conversion_uchar.spv64 | Bin 748 -> 0 bytes .../decorate_saturated_conversion_uint.spv32 | Bin 648 -> 0 bytes .../decorate_saturated_conversion_uint.spv64 | Bin 732 -> 0 bytes ...decorate_saturated_conversion_ushort.spv32 | Bin 684 -> 0 bytes ...decorate_saturated_conversion_ushort.spv64 | Bin 752 -> 0 bytes ..._no_integer_wrap_decoration_fadd_int.spv32 | Bin 736 -> 0 bytes ..._no_integer_wrap_decoration_fadd_int.spv64 | Bin 824 -> 0 bytes ...no_integer_wrap_decoration_fadd_uint.spv32 | Bin 736 -> 0 bytes ...no_integer_wrap_decoration_fadd_uint.spv64 | Bin 824 -> 0 bytes ..._no_integer_wrap_decoration_fmul_int.spv32 | Bin 736 -> 0 bytes ..._no_integer_wrap_decoration_fmul_int.spv64 | Bin 824 -> 0 bytes ...no_integer_wrap_decoration_fmul_uint.spv32 | Bin 736 -> 0 bytes ...no_integer_wrap_decoration_fmul_uint.spv64 | Bin 824 -> 0 bytes ..._integer_wrap_decoration_fnegate_int.spv32 | Bin 704 -> 0 bytes ..._integer_wrap_decoration_fnegate_int.spv64 | Bin 776 -> 0 bytes ...teger_wrap_decoration_fshiftleft_int.spv32 | Bin 772 -> 0 bytes ...teger_wrap_decoration_fshiftleft_int.spv64 | Bin 860 -> 0 bytes ...eger_wrap_decoration_fshiftleft_uint.spv32 | Bin 772 -> 0 bytes ...eger_wrap_decoration_fshiftleft_uint.spv64 | Bin 860 -> 0 bytes ..._no_integer_wrap_decoration_fsub_int.spv32 | Bin 736 -> 0 bytes ..._no_integer_wrap_decoration_fsub_int.spv64 | Bin 824 -> 0 bytes ...no_integer_wrap_decoration_fsub_uint.spv32 | Bin 736 -> 0 bytes ...no_integer_wrap_decoration_fsub_uint.spv64 | Bin 824 -> 0 bytes .../spirv_new/spirv_bin/fadd_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/fadd_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/fadd_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/fadd_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/fadd_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/fadd_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/fadd_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/fadd_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/fadd_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/fadd_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/fdiv_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/fdiv_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/fdiv_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/fdiv_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/fdiv_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/fdiv_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/fdiv_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/fdiv_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/fdiv_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/fdiv_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/fmod_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/fmod_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/fmod_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/fmod_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/fmod_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/fmod_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/fmod_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/fmod_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/fmod_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/fmod_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/fmul_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/fmul_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/fmul_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/fmul_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/fmul_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/fmul_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/fmul_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/fmul_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/fmul_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/fmul_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/frem_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/frem_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/frem_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/frem_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/frem_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/frem_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/frem_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/frem_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/frem_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/frem_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/fsub_double.spv32 | Bin 668 -> 0 bytes .../spirv_new/spirv_bin/fsub_double.spv64 | Bin 736 -> 0 bytes .../spirv_new/spirv_bin/fsub_double2.spv32 | Bin 684 -> 0 bytes .../spirv_new/spirv_bin/fsub_double2.spv64 | Bin 752 -> 0 bytes .../spirv_new/spirv_bin/fsub_float.spv32 | Bin 660 -> 0 bytes .../spirv_new/spirv_bin/fsub_float.spv64 | Bin 728 -> 0 bytes .../spirv_new/spirv_bin/fsub_float4.spv32 | Bin 676 -> 0 bytes .../spirv_new/spirv_bin/fsub_float4.spv64 | Bin 744 -> 0 bytes .../spirv_new/spirv_bin/fsub_half.spv32 | Bin 644 -> 0 bytes .../spirv_new/spirv_bin/fsub_half.spv64 | Bin 712 -> 0 bytes .../spirv_new/spirv_bin/label_simple.spv32 | Bin 468 -> 0 bytes .../spirv_new/spirv_bin/label_simple.spv64 | Bin 564 -> 0 bytes .../spirv_new/spirv_bin/lifetime_simple.spv32 | Bin 724 -> 0 bytes .../spirv_new/spirv_bin/lifetime_simple.spv64 | Bin 808 -> 0 bytes .../spirv_new/spirv_bin/linkage_export.spv32 | Bin 232 -> 0 bytes .../spirv_new/spirv_bin/linkage_export.spv64 | Bin 232 -> 0 bytes .../spirv_new/spirv_bin/linkage_import.spv32 | Bin 556 -> 0 bytes .../spirv_new/spirv_bin/linkage_import.spv64 | Bin 624 -> 0 bytes ...merge_branch_conditional_dont_unroll.spv32 | Bin 1024 -> 0 bytes ...merge_branch_conditional_dont_unroll.spv64 | Bin 1124 -> 0 bytes .../loop_merge_branch_conditional_none.spv32 | Bin 1016 -> 0 bytes .../loop_merge_branch_conditional_none.spv64 | Bin 1116 -> 0 bytes ...loop_merge_branch_conditional_unroll.spv32 | Bin 1020 -> 0 bytes ...loop_merge_branch_conditional_unroll.spv64 | Bin 1120 -> 0 bytes .../loop_merge_branch_dont_unroll.spv32 | Bin 1028 -> 0 bytes .../loop_merge_branch_dont_unroll.spv64 | Bin 1128 -> 0 bytes .../spirv_bin/loop_merge_branch_none.spv32 | Bin 1020 -> 0 bytes .../spirv_bin/loop_merge_branch_none.spv64 | Bin 1120 -> 0 bytes .../spirv_bin/loop_merge_branch_unroll.spv32 | Bin 1024 -> 0 bytes .../spirv_bin/loop_merge_branch_unroll.spv64 | Bin 1124 -> 0 bytes .../spirv_bin/op_function_const.spv32 | Bin 552 -> 0 bytes .../spirv_bin/op_function_const.spv64 | Bin 620 -> 0 bytes .../spirv_bin/op_function_inline.spv32 | Bin 552 -> 0 bytes .../spirv_bin/op_function_inline.spv64 | Bin 620 -> 0 bytes .../spirv_bin/op_function_noinline.spv32 | Bin 556 -> 0 bytes .../spirv_bin/op_function_noinline.spv64 | Bin 624 -> 0 bytes .../spirv_bin/op_function_none.spv32 | Bin 552 -> 0 bytes .../spirv_bin/op_function_none.spv64 | Bin 620 -> 0 bytes .../spirv_bin/op_function_pure.spv32 | Bin 552 -> 0 bytes .../spirv_bin/op_function_pure.spv64 | Bin 620 -> 0 bytes .../spirv_bin/op_function_pure_ptr.spv32 | Bin 736 -> 0 bytes .../spirv_bin/op_function_pure_ptr.spv64 | Bin 788 -> 0 bytes .../spirv_new/spirv_bin/op_neg_double.spv32 | Bin 468 -> 0 bytes .../spirv_new/spirv_bin/op_neg_double.spv64 | Bin 536 -> 0 bytes .../spirv_new/spirv_bin/op_neg_float.spv32 | Bin 460 -> 0 bytes .../spirv_new/spirv_bin/op_neg_float.spv64 | Bin 528 -> 0 bytes .../spirv_new/spirv_bin/op_neg_float4.spv32 | Bin 476 -> 0 bytes .../spirv_new/spirv_bin/op_neg_float4.spv64 | Bin 544 -> 0 bytes .../spirv_new/spirv_bin/op_neg_int.spv32 | Bin 444 -> 0 bytes .../spirv_new/spirv_bin/op_neg_int.spv64 | Bin 528 -> 0 bytes .../spirv_new/spirv_bin/op_neg_int4.spv32 | Bin 460 -> 0 bytes .../spirv_new/spirv_bin/op_neg_int4.spv64 | Bin 544 -> 0 bytes .../spirv_new/spirv_bin/op_neg_long.spv32 | Bin 468 -> 0 bytes .../spirv_new/spirv_bin/op_neg_long.spv64 | Bin 512 -> 0 bytes .../spirv_new/spirv_bin/op_neg_short.spv32 | Bin 472 -> 0 bytes .../spirv_new/spirv_bin/op_neg_short.spv64 | Bin 540 -> 0 bytes .../spirv_new/spirv_bin/op_not_int.spv32 | Bin 444 -> 0 bytes .../spirv_new/spirv_bin/op_not_int.spv64 | Bin 528 -> 0 bytes .../spirv_new/spirv_bin/op_not_int4.spv32 | Bin 460 -> 0 bytes .../spirv_new/spirv_bin/op_not_int4.spv64 | Bin 544 -> 0 bytes .../spirv_new/spirv_bin/op_not_long.spv32 | Bin 468 -> 0 bytes .../spirv_new/spirv_bin/op_not_long.spv64 | Bin 512 -> 0 bytes .../spirv_new/spirv_bin/op_not_short.spv32 | Bin 472 -> 0 bytes .../spirv_new/spirv_bin/op_not_short.spv64 | Bin 540 -> 0 bytes .../op_spec_constant_double_simple.spv32 | Bin 560 -> 0 bytes .../op_spec_constant_double_simple.spv64 | Bin 560 -> 0 bytes .../op_spec_constant_false_simple.spv32 | Bin 784 -> 0 bytes .../op_spec_constant_false_simple.spv64 | Bin 784 -> 0 bytes .../op_spec_constant_float_simple.spv32 | Bin 548 -> 0 bytes .../op_spec_constant_float_simple.spv64 | Bin 548 -> 0 bytes .../op_spec_constant_half_simple.spv32 | Bin 556 -> 0 bytes .../op_spec_constant_half_simple.spv64 | Bin 556 -> 0 bytes .../op_spec_constant_true_simple.spv32 | Bin 784 -> 0 bytes .../op_spec_constant_true_simple.spv64 | Bin 784 -> 0 bytes .../op_spec_constant_uchar_simple.spv32 | Bin 576 -> 0 bytes .../op_spec_constant_uchar_simple.spv64 | Bin 576 -> 0 bytes .../op_spec_constant_uint_simple.spv32 | Bin 552 -> 0 bytes .../op_spec_constant_uint_simple.spv64 | Bin 552 -> 0 bytes .../op_spec_constant_ulong_simple.spv32 | Bin 564 -> 0 bytes .../op_spec_constant_ulong_simple.spv64 | Bin 564 -> 0 bytes .../op_spec_constant_ushort_simple.spv32 | Bin 564 -> 0 bytes .../op_spec_constant_ushort_simple.spv64 | Bin 564 -> 0 bytes .../spirv_new/spirv_bin/opaque.spv32 | Bin 568 -> 0 bytes .../spirv_new/spirv_bin/opaque.spv64 | Bin 636 -> 0 bytes .../spirv_new/spirv_bin/phi_2.spv32 | Bin 740 -> 0 bytes .../spirv_new/spirv_bin/phi_2.spv64 | Bin 824 -> 0 bytes .../spirv_new/spirv_bin/phi_3.spv32 | Bin 844 -> 0 bytes .../spirv_new/spirv_bin/phi_3.spv64 | Bin 928 -> 0 bytes .../spirv_new/spirv_bin/phi_4.spv32 | Bin 932 -> 0 bytes .../spirv_new/spirv_bin/phi_4.spv64 | Bin 1016 -> 0 bytes .../spirv_bin/select_if_dont_flatten.spv32 | Bin 828 -> 0 bytes .../spirv_bin/select_if_dont_flatten.spv64 | Bin 924 -> 0 bytes .../spirv_bin/select_if_flatten.spv32 | Bin 824 -> 0 bytes .../spirv_bin/select_if_flatten.spv64 | Bin 920 -> 0 bytes .../spirv_new/spirv_bin/select_if_none.spv32 | Bin 820 -> 0 bytes .../spirv_new/spirv_bin/select_if_none.spv64 | Bin 916 -> 0 bytes .../select_switch_dont_flatten.spv32 | Bin 952 -> 0 bytes .../select_switch_dont_flatten.spv64 | Bin 1048 -> 0 bytes .../spirv_bin/select_switch_flatten.spv32 | Bin 948 -> 0 bytes .../spirv_bin/select_switch_flatten.spv64 | Bin 1044 -> 0 bytes .../spirv_bin/select_switch_none.spv32 | Bin 944 -> 0 bytes .../spirv_bin/select_switch_none.spv64 | Bin 1040 -> 0 bytes .../spirv_bin/undef_char_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_char_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/undef_double_simple.spv32 | Bin 452 -> 0 bytes .../spirv_bin/undef_double_simple.spv64 | Bin 520 -> 0 bytes .../spirv_bin/undef_false_simple.spv32 | Bin 496 -> 0 bytes .../spirv_bin/undef_false_simple.spv64 | Bin 580 -> 0 bytes .../spirv_bin/undef_float_simple.spv32 | Bin 444 -> 0 bytes .../spirv_bin/undef_float_simple.spv64 | Bin 512 -> 0 bytes .../spirv_bin/undef_half_simple.spv32 | Bin 480 -> 0 bytes .../spirv_bin/undef_half_simple.spv64 | Bin 548 -> 0 bytes .../spirv_bin/undef_int3_simple.spv32 | Bin 440 -> 0 bytes .../spirv_bin/undef_int3_simple.spv64 | Bin 540 -> 0 bytes .../spirv_bin/undef_int4_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_int4_simple.spv64 | Bin 532 -> 0 bytes .../spirv_bin/undef_int_simple.spv32 | Bin 432 -> 0 bytes .../spirv_bin/undef_int_simple.spv64 | Bin 516 -> 0 bytes .../spirv_bin/undef_long_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_long_simple.spv64 | Bin 500 -> 0 bytes .../spirv_bin/undef_short_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_short_simple.spv64 | Bin 524 -> 0 bytes .../undef_struct_int_char_simple.spv32 | Bin 484 -> 0 bytes .../undef_struct_int_char_simple.spv64 | Bin 568 -> 0 bytes .../undef_struct_int_float_simple.spv32 | Bin 472 -> 0 bytes .../undef_struct_int_float_simple.spv64 | Bin 556 -> 0 bytes .../undef_struct_struct_simple.spv32 | Bin 512 -> 0 bytes .../undef_struct_struct_simple.spv64 | Bin 596 -> 0 bytes .../spirv_bin/undef_true_simple.spv32 | Bin 504 -> 0 bytes .../spirv_bin/undef_true_simple.spv64 | Bin 580 -> 0 bytes .../spirv_bin/undef_uchar_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_uchar_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/undef_uint_simple.spv32 | Bin 432 -> 0 bytes .../spirv_bin/undef_uint_simple.spv64 | Bin 516 -> 0 bytes .../spirv_bin/undef_ulong_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_ulong_simple.spv64 | Bin 500 -> 0 bytes .../spirv_bin/undef_ushort_simple.spv32 | Bin 456 -> 0 bytes .../spirv_bin/undef_ushort_simple.spv64 | Bin 524 -> 0 bytes .../spirv_bin/unreachable_simple.spv32 | Bin 500 -> 0 bytes .../spirv_bin/unreachable_simple.spv64 | Bin 596 -> 0 bytes .../spirv_bin/vector_char16_extract.spv32 | Bin 592 -> 0 bytes .../spirv_bin/vector_char16_extract.spv64 | Bin 676 -> 0 bytes .../spirv_bin/vector_char16_insert.spv32 | Bin 612 -> 0 bytes .../spirv_bin/vector_char16_insert.spv64 | Bin 696 -> 0 bytes .../spirv_bin/vector_double2_extract.spv32 | Bin 580 -> 0 bytes .../spirv_bin/vector_double2_extract.spv64 | Bin 664 -> 0 bytes .../spirv_bin/vector_double2_insert.spv32 | Bin 600 -> 0 bytes .../spirv_bin/vector_double2_insert.spv64 | Bin 684 -> 0 bytes .../spirv_bin/vector_float4_extract.spv32 | Bin 572 -> 0 bytes .../spirv_bin/vector_float4_extract.spv64 | Bin 656 -> 0 bytes .../spirv_bin/vector_float4_insert.spv32 | Bin 592 -> 0 bytes .../spirv_bin/vector_float4_insert.spv64 | Bin 676 -> 0 bytes .../spirv_bin/vector_int4_extract.spv32 | Bin 556 -> 0 bytes .../spirv_bin/vector_int4_extract.spv64 | Bin 640 -> 0 bytes .../spirv_bin/vector_int4_insert.spv32 | Bin 576 -> 0 bytes .../spirv_bin/vector_int4_insert.spv64 | Bin 660 -> 0 bytes .../spirv_bin/vector_long2_extract.spv32 | Bin 584 -> 0 bytes .../spirv_bin/vector_long2_extract.spv64 | Bin 644 -> 0 bytes .../spirv_bin/vector_long2_insert.spv32 | Bin 600 -> 0 bytes .../spirv_bin/vector_long2_insert.spv64 | Bin 660 -> 0 bytes .../vector_times_scalar_double.spv32 | Bin 672 -> 0 bytes .../vector_times_scalar_double.spv64 | Bin 740 -> 0 bytes .../spirv_bin/vector_times_scalar_float.spv32 | Bin 672 -> 0 bytes .../spirv_bin/vector_times_scalar_float.spv64 | Bin 740 -> 0 bytes 373 files changed, 182 insertions(+), 18 deletions(-) create mode 100755 test_conformance/spirv_new/assemble_spirv.py delete mode 100644 test_conformance/spirv_new/spirv_bin/atomic_dec_global.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/atomic_dec_global.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/atomic_inc_global.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/atomic_inc_global.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_conditional.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_conditional.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_conditional_weighted.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_conditional_weighted.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/branch_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_double_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_double_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_false_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_false_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_half_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_half_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int4_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int4_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_int_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_long_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_long_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_short_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_short_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_int_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_int_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_int_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_int_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_true_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_true_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_uchar_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_uchar_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_ulong_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_ulong_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_double_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_double_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_half_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_half_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int3_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int3_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int4_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int4_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_int_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_long_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_long_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_short_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_short_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_struct_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_struct_struct_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_uchar_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_uchar_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_ulong_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_ulong_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_aliased.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_aliased.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_alignment.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_alignment.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_constant.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_constant.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_cpacked.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_cpacked.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_restrict.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_restrict.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_double_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_double_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_float_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_float_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_double_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_double_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_float_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_float_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_double_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_double_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_float_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_float_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_short.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_short.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uint.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uint.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fadd_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fdiv_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmod_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fmul_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/frem_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_double2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_double2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_half.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/fsub_half.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/label_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/label_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/lifetime_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/lifetime_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/linkage_export.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/linkage_export.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/linkage_import.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/linkage_import.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_dont_unroll.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_dont_unroll.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_none.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_none.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_dont_unroll.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_dont_unroll.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_none.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_none.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_unroll.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/loop_merge_branch_unroll.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_const.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_const.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_inline.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_inline.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_noinline.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_noinline.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_none.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_none.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_pure.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_pure.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_pure_ptr.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_function_pure_ptr.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_float.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_float4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_float4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_int4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_int4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_short.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_neg_short.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_int.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_int.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_int4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_int4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_long.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_long.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_short.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_not_short.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_true_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_true_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_uint_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_uint_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/opaque.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/opaque.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_2.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_2.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_3.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_3.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_4.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/phi_4.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_flatten.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_flatten.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_none.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_if_none.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_dont_flatten.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_dont_flatten.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_flatten.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_flatten.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_none.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/select_switch_none.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_double_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_double_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_false_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_false_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_half_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_half_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int4_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int4_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_int_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_long_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_long_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_short_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_short_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_struct_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_struct_struct_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_true_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_true_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_uint_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_uint_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/unreachable_simple.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/unreachable_simple.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_char16_extract.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_char16_extract.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_double2_extract.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_double2_extract.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_double2_insert.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_double2_insert.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_float4_insert.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_float4_insert.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_int4_extract.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_int4_extract.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_long2_extract.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_long2_extract.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_long2_insert.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_long2_insert.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv64 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_times_scalar_float.spv32 delete mode 100644 test_conformance/spirv_new/spirv_bin/vector_times_scalar_float.spv64 diff --git a/test_conformance/spirv_new/assemble_spirv.py b/test_conformance/spirv_new/assemble_spirv.py new file mode 100755 index 00000000..99b16adf --- /dev/null +++ b/test_conformance/spirv_new/assemble_spirv.py @@ -0,0 +1,164 @@ +#!/usr/bin/env python3 + +##################################################################### +# Copyright (c) 2020 The Khronos Group Inc. All Rights Reserved. +# +# 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. +##################################################################### + +"""Assembles the SPIR-V assembly files used by spirv_new into binaries, + and validates them using spirv-val. Either run this from the parent + of the spirv_asm directory, or pass the --source-dir and --output-dir + options to specify the locations of the assembly files and the + binaries to be generated. +""" + +import argparse +import glob +import os +import subprocess +import sys +from textwrap import wrap + + +def fatal(message): + """Print an error message and exit with a non-zero status, to + indicate failure. + """ + print(message) + sys.exit(1) + + +def assemble_spirv(asm_dir, bin_dir, spirv_as, verbose): + """Assemble SPIR-V source into binaries.""" + + if not os.path.exists(bin_dir): + os.makedirs(bin_dir) + + assembly_failures = False + + for asm_file_path in glob.glob(os.path.join(asm_dir, '*.spvasm*')): + asm_file = os.path.basename(asm_file_path) + if os.path.isfile(asm_file_path): + if verbose: + print(' Assembling {}'.format(asm_file)) + + asm_file_root, asm_file_ext = os.path.splitext(asm_file) + bin_file = asm_file_root + asm_file_ext.replace('asm', '') + bin_file_path = os.path.join(bin_dir, bin_file) + + command = '"{}" --target-env spv1.0 "{}" -o "{}"'.format( + spirv_as, asm_file_path, bin_file_path) + if subprocess.call(command, shell=True) != 0: + assembly_failures = True + print('ERROR: Failure assembling {}: ' + 'see above output.'.format( + asm_file)) + print() + + if assembly_failures: + fatal('\n'.join(wrap( + 'ERROR: Assembly failure(s) occurred. See above for error ' + 'messages from the assembler, if any.'))) + + +def validate_spirv(bin_dir, spirv_val, verbose): + """Validates SPIR-V binaries. Ignores known failures.""" + + validation_failures = False + + for bin_file_path in glob.glob(os.path.join(bin_dir, '*.spv*')): + bin_file = os.path.basename(bin_file_path) + if os.path.isfile(bin_file_path): + if verbose: + print(' Validating {}'.format(bin_file)) + + command = '"{}" "{}"'.format( + spirv_val, bin_file_path) + if subprocess.call(command, shell=True) != 0: + print('ERROR: Failure validating {}: ' + 'see above output.'.format( + bin_file)) + validation_failures = True + print() + + if validation_failures: + fatal('ERROR: Validation failure(s) found. ' + 'See above for validation output.') + else: + print('All SPIR-V binaries validated successfully.') + + +def parse_args(): + """Parse the command-line arguments.""" + + argparse_kwargs = ( + {'allow_abbrev': False} if sys.version_info >= (3, 5) else {}) + argparse_kwargs['description'] = ( + '''Assembles the SPIR-V assembly files used by spirv_new into + binaries, and validates them using spirv-val. Either run this + from the parent of the spirv_asm directory, or pass the + --source-dir and --output-dir options to specify the locations + the assembly files and the binaries to be generated. + ''') + parser = argparse.ArgumentParser(**argparse_kwargs) + parser.add_argument('-s', '--source-dir', metavar='DIR', + default='spirv_asm', + help='''specifies the directory containing SPIR-V + assembly files''') + parser.add_argument('-o', '--output-dir', metavar='DIR', + default='spirv_bin', + help='''specifies the directory in which to + output SPIR-V binary files''') + parser.add_argument('-a', '--assembler', metavar='PROGRAM', + default='spirv-as', + help='''specifies the program to use for assembly + of SPIR-V, defaults to spirv-as''') + parser.add_argument('-l', '--validator', metavar='PROGRAM', + default='spirv-val', + help='''specifies the program to use for validation + of SPIR-V, defaults to spirv-val''') + parser.add_argument('-k', '--skip-validation', action='store_true', + default=False, + help='skips validation of the genareted SPIR-V') + parser.add_argument('-v', '--verbose', action='store_true', default=False, + help='''enable verbose output (i.e. prints the + name of each SPIR-V assembly file or + binary as it is assembled or validated) + ''') + return parser.parse_args() + + +def main(): + """Main function. Assembles and validates SPIR-V.""" + + args = parse_args() + + print('Assembling SPIR-V source into binaries...') + assemble_spirv(args.source_dir, args.output_dir, args.assembler, + args.verbose) + print('Finished assembling SPIR-V binaries.') + print() + + if args.skip_validation: + print('Skipping validation of SPIR-V binaries as requested.') + else: + print('Validating SPIR-V binaries...') + validate_spirv(args.output_dir, args.validator, args.verbose) + print() + + print('Done.') + + +if __name__ == '__main__': + main() diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm32 index 00416401..b76c3a3c 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm64 index ca398d6e..1fa09e97 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm32 index 07f75e8b..f1320bbf 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm64 index 1d362cbb..ad04b78c 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_uint.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm32 index 19bf4770..8b41542a 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm64 index 65c5b273..06614422 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm32 index dc70be61..3c6aebdd 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm64 index 344f9619..d85f61ae 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm32 index 6d70518f..baf2707f 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 22 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm64 index 149143c5..7be5e17b 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 26 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm32 index 6bbfd651..49e49da4 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 25 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm64 index 611cb112..572b7246 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_int.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 30 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm32 index 1e7bc6c3..764f1c4d 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 25 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm64 index 7f7ecbbc..325f4139 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fshiftleft_uint.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 30 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm32 index 45cefcfd..f2f28a1b 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm64 index 0b99dc52..159629ad 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm32 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm32 index feaa27f3..e2dc884a 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm32 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm32 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 23 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm64 b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm64 index d1069979..4dfdc80a 100644 --- a/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm64 +++ b/test_conformance/spirv_new/spirv_asm/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spvasm64 @@ -1,5 +1,5 @@ ; SPIR-V -; Version: 1.1 +; Version: 1.0 ; Generator: Khronos SPIR-V Tools Assembler; 0 ; Bound: 28 ; Schema: 0 diff --git a/test_conformance/spirv_new/spirv_bin/atomic_dec_global.spv32 b/test_conformance/spirv_new/spirv_bin/atomic_dec_global.spv32 deleted file mode 100644 index 853c39a3f0e0d311915ff918695fe54c6973d215..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmaKo%}T>i5QWF2vDTl~TGUM!ErKBKRVa07=+Y;+q-l{rn=5V1JNpK11kZQ5-8$i9 z{?D8wP42p8M`qTwE4{IyCDw^Pi~d-?Z)uoJ6c4Ot)YvQ&1$hRF7G!txQ+BTl%lMS??@Y#{QWw7IICJ--Ngm_U;v< zG1nBm2jRba=)D#%I}-uBRnE6iL(4?DeoFW@>LW3q#ClJjIWX1xRGuDn@EEz#%&kLy zt{8!{$ci5QWF4vDTmdSgRWs6+w{hs~{CuhAw@AOH7LdYOd6n7u1*W4crKx?{d3! z;AG~`oHIX3T9+NO9W(3LslM3ITGoy}jea-!1NojMVpu@mx<-u-dF@}z!Yx;Yds+ME zd>uKdIPjf&e=9eQ%R+HcHNME}(pQV6S*o6iIE_@PrZd0rA632DSf&?xW}gdLoX@`0 z&|L}anu!JXTKI1s`;MhW^B`bndUFdodQSA#&k47YAF1=6Ji2bE>l1w2_T|x$zfi=k zaLI#d)Ep{i_V#_Gn1!d(pzjG20lSOyxd+Wm40;k{%(&5}^k?5~%)k3l)4u#%7qR<5 zpbx;F;=G|^YS>rI9V;f!E}tom?iNGvw;*Ljg*<~!S51M=Bc*A8j{9j#g GEBpZ(j4ieR diff --git a/test_conformance/spirv_new/spirv_bin/atomic_inc_global.spv32 b/test_conformance/spirv_new/spirv_bin/atomic_inc_global.spv32 deleted file mode 100644 index cf04e23a1883f4e11f209f9528e1685df24dea6b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmaKo%Syul5JktNvDQax6?NmHA_(GM1<|FUOTQr0C=#fN)Y@KXxi+BcKd_JJJgQp+P% VZ;XL=+i5QWF4vDTl~TB{ou6+w{ht00OiLzh0mB}S1zO{B)WpgxR`;70I#m+97l zlbJhn&io|lob}8$%&cce`eGyNSl4~(e$)Mq{J;`1EMjPVqeh3ksb9+?lvNR4mi1%4 zbWSP`{1D#X%2gY(SX@+XUF1z!SBodJR6P@MTB%Y^XMRzCRL%3sGQH3<`$WimKKoKb zcP_ANCKlWa;lFw8JCPR6oq!$d%`N2UIn`S~C*DSWtj=5V==!m)PxM{emPbeaR1v$v zB@bq<*;UN!^?Oe-3(urMKM30;W8WkuP(R} F{s1_6EyDl+ diff --git a/test_conformance/spirv_new/spirv_bin/branch_conditional.spv32 b/test_conformance/spirv_new/spirv_bin/branch_conditional.spv32 deleted file mode 100644 index 47abfae9d461a8c0c3a2863f68450452c9c47495..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 812 zcmYk4?@9tu5XGlm&CJS7&HifyLG-97S*7&V(r?P|nV&N~;ilD%9F>zSN~ZI0nkKWw`yx%E z*rZ@q72lW7UY9vWGoBY1-As6_PUu|A$OWn-CXYr#c9zF}9v|kok>eZTFkHSZvQ;>a z(@7Ku$ts;j%n;0q*`B3}9&^y29$g_V{l9Nd@s?t8@CJ(O^6W;wqi);sZF%OoE$erL zIq-Mo(Jpi=daD8xUuuG;JhkwgJ(hjglU{dHfCJ`GbFYcuGnd2c;V?bFG}pd7dh~6{ z=sQ$j=0A|p1LM4?5BF^ucbq5X=+lv*&mHyfx-#$J Sec5BA8HnMy9e(vi9%O&cZY}`; diff --git a/test_conformance/spirv_new/spirv_bin/branch_conditional.spv64 b/test_conformance/spirv_new/spirv_bin/branch_conditional.spv64 deleted file mode 100644 index 5671a394b6034e2d1757f8fbc10c601f22d94c66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 908 zcmYk4?@9tu5XC3|WM*ZiX8&6=g7A9w$u9MmQ?r~EvRusadX_87JC>KilBinQ_=dwM4x;hYAJ3!7 z>}@uWf-uz-rO)eo{IW1G-r+RG_{YKnvG`mm;D&OihNl;OPm((Ay`SJp^6gsK_ZP3T zce#}9CdNhT!ygev5E!7*!aOgbMWo34QZ>Za*a$T8u zxWA?BDL7rZa(7$dDLCCsvy+yIXH}T~>D_|u3UiOTtto5D_@i@ipUuK=!8|u|Km+D* z=T=jrXLg6#)nR&mYxX^5{ODU((7UI;>5l1}(TDS#?bH-*B#hZt#_BaS~6$MVQ1v zOA>$I?ph@qgjsWp9&A8NWW_txuGhF$7Dm2>&iT*C_9FK!9{&mW)I0u}u+wmSa;tpm edQxPsa~VC|J{Q8gGyC*412G)8%dfu7gX|C5*D=2U diff --git a/test_conformance/spirv_new/spirv_bin/branch_conditional_weighted.spv64 b/test_conformance/spirv_new/spirv_bin/branch_conditional_weighted.spv64 deleted file mode 100644 index a710ac52be2f6db7a41722562d4bddaea8bf4dac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 924 zcmYk4+e!ja6oywGva&Q&vvXrc5Z+f1N>_>9^#p?_azLC=vHRYrXQ+p&An5;QW`i4+ z>#+Z|{(sFjooeLF*32wtm-^+DEM=L*XA{4k_`H0<(n45dMavs^Oz6*g)4|vugwtWL z2*PP^;=hf8m+@jWjIdetrG=Y~=0*(1WE{uv%oKN2W!{yHT34Oq)Zv8xB+6qA`%#>a z?yeR4{`@tVE&a|U?DrHYx){!HY2TA)9=v54+%56OJI3z|59c}Asj9dVRm{GU8gD?I zeLs_0O)+(9kE)^PK!y(P;9<{08FhHLbJ!!r=v>7fE2r+TZEc8dzUhb1yb1peW`g|{ z2l=V&OvZfPp53Xvs|O9|GVt`dnbdxS^W?$P@9=fSj>F-pt>Qi9Eip3xLWWMaTSGB# S!)|S9AP3|2`qOLP$^HRUO*QlY diff --git a/test_conformance/spirv_new/spirv_bin/branch_simple.spv32 b/test_conformance/spirv_new/spirv_bin/branch_simple.spv32 deleted file mode 100644 index 6c24c44479fdaad608a13cf0a9741e61f41ee1ac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 484 zcmXw!%Syvw5QWFIwe{9oMcufl2!b!51*uCzmp(yAt6(6erIkLrE(E_XCIcsP{xfGT z=_I%Ph`osD#~EK^97%MW+-veac^IAAnZQRe2sJwwo4i_nWZU9%UB2_S-ox7=7ga>c zG_@me4N@w;FKgbdeRptorMRr!gDl&wi_I=e%he(;=hbet%)g3NHGlixd%;}qoB-pB zmowDdJ%P11s-H8NpRM%)x%J+_4tQHr7f(&ExA>0_c&y6}{f}(X>#mj`!oS($zs}h1 zj$_~)VZ5Sx;|Z{4yr4O22%KlF)kbjVs?F%M_Y~;;Vd|LdPV+O}`mO(R?G*e0GSnPU diff --git a/test_conformance/spirv_new/spirv_bin/branch_simple.spv64 b/test_conformance/spirv_new/spirv_bin/branch_simple.spv64 deleted file mode 100644 index ea1dd83019082fcc9a6cda741476881450d0c570..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmXw$%}PR16oq%1X@8oTHECc3K{T%*j7D7?_5`99biur$<_p$C)gb8m^tfT&z0cZz z>zrFIT~;HuBBC0ne6?njVmtXt@;k}zXY?&N~NLnyChJ_FMt?XH;2x4f_50G@mW|*|-=E#=Xh17!4MAG3mXo zHMHrq=Lu+MoYg1i%noNRywWRwL&jWfmE(i8*tUyz)*ikCG<(%+z5E5y0p419@sQ@L z*EhMP#=Nm+{T)iIRnI2&U4Gbmi0`6UZFS%rp}jE6-3?$)`%c^uvAp;AN?emzUhWyr moyWkv<~Cf5c>TX4e%W@ySuOf*dV@Bxy^nNT@A;2g-GhJWI3U{q diff --git a/test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv32 b/test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv32 deleted file mode 100644 index 4b6c9f1f89cf1e8517d7b821c02bccd57b64df92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmYk2OG^Vm5QN*^jZvd{7#|l85kU~Iq5;vPOK$oLhPZlIh%+HOM$|vwC6BD~E*RmN9W1YgC)dl6mf zIr+lX^JoN>30r8|Meg*<> j#G@4PzAxYtZ}`E(gZO9<1@zgw*Nh%My6F7M(OCEcYKI}2 diff --git a/test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv64 b/test_conformance/spirv_new/spirv_bin/composite_construct_int4.spv64 deleted file mode 100644 index 12bc7fd193617ad02fa3a175872a9950073bce46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 620 zcmYk3%}T>i5QWF4wQ99L)>;=XDuN*0iWWq1W#~?yAk^q0P;*Ojt*DQu59LPieDMky zIGvw6XXZ>A)sCBHYi8E81N~w>t64qxM)2#wx8&Ovsl!TitYy40A$89SS7iPvNnKv} zxI5;VI*KJKy(QJJ?5zvHwC>v7g(% z)!CE35(}NX0$hOI2aSEjykTFVwx^gn`aeT$pqM(fJ8kA}{vYn)26UtKR{dxg3h01$ Mt%#idA1R&)zwJaMvj6}9 diff --git a/test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv32 b/test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv32 deleted file mode 100644 index cb10572eb4956acfee5c06433aaf675a86a514a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 624 zcmXw$%}T>S6os!zYt?FhthEXv6`>+^`w6Ud;*`vO~Lae z>A>l^e{;^AGz`ugW*cVKuw(slx)xZi;(EoK6<>&378W-G#cgXEJrrX9G51-Lzq{C{ zS-$v;b61i{(X6g}p*Ts+A~{fN3MWFO4*6jb*NVB3V*Ddb(Yq9!%jU^q>7to`oz5od z(#O+0@#*BP+@UXBb{`6yfig6x;XPEe-j{k$%K8As+?JR*ywKSeQ{$W}-x1TNPR{Q1 zsiV6qMw9xP@;x!y)W^!X+Y&mz*I(r5w1sbB-R~&2pR&(5=KVlC4w|X`Hy!}s;J@K>V*!e(UA9kR|-hBZNdJj_PJ^Uwl0M3i5>^2bSah_De S=SaYd-lHONG*{Z{PWT7S2`B3S diff --git a/test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv64 b/test_conformance/spirv_new/spirv_bin/composite_construct_struct.spv64 deleted file mode 100644 index 2f1fef9e7ce5e6bda0a496539bbcb7f0b5075a55..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 708 zcmXw%%}T>i5QWG7Shd<(YpwsZ2#VB|3l&6hW#~?yAk^q0P;*NYyAymjUHAk(iyOi7 zCASw&X6DS?nKMbsrK6hJf|=FqKu=D~N>=f<>g}Spb#G5(8&+1O|@=b-6QZw5`gpI=pWWFJ(=9()h79(D8Q1H}E)mts=pn#3-yeVNsQJlb21l_{`T?U3{&UAEcQU zF+kIUi!vf*y16}Y0a7Z)XRY6F`>yfbozi9P7GznyD%P7UT~=@Ta$at#Mcx!uIe-7# zf683%o&xQh$QkC`J;nRK)%-D&d3>nbfrVz@E^LpvOX3l1ulc*K-}_I%Be8S6)Bi9- xX|KMf_MQvWddD}N`|uMgcN_qt*AjA}G?m7DRDn=+Y51@)oa2%ayF11EFl z{AVsC>0I>9w#=+=Q+!~LZFQQqhE%Y<^T(J#oL1zHTVALs)g_igYX|@ diff --git a/test_conformance/spirv_new/spirv_bin/constant_double_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_double_simple.spv32 deleted file mode 100644 index 215454bcd1771552422d5dcfbf9a996a9d75de03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmXw#%}WAN6veMInyIBllrCH-K@iclgeY7@gUi7EWBgbQOz%lE`L_oVbbix#;mo=B z+|M_0blo;Pxo?U#ooUitJ;T zZ%xz8TIz|#nKw%`9jzyfg+v+RtIBUybvN?aov4c3t>9d-%Rcum$-^qm7k(esX_*DT z*!=Im)LibK2-r{&Gtk&Qk$1Qi{X&!Vc4?drO%?NI>d^0$LFe|-{p<2) z+L=GqbGeiM@Sqy%@iF=zwS#`{_}1PN@w2XBE!z}}^Db6+5by-A~gATWd6i#%d( J`PH_W@CUKXAM5}C diff --git a/test_conformance/spirv_new/spirv_bin/constant_double_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_double_simple.spv64 deleted file mode 100644 index 856949fdcde504141d7961aea60b2f4240f61eb0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 532 zcmXw#PfNo<6vUrRYi-rmTC5&CvteOlwe%*ECU<6uw(uU$b0G)#@HT`FWAIe!D!A82>Q;!8S9d+*ECOY$<(ZOHq20yZo z1qu%Bfp9i`di|Mn;`^|R?0lOWY4BjC@VwPtJjwR0EQjh3O33b>z*|7QguQ*u+)-bF gJJJkKrq93)G{eI^i(}8Rz%K3{HE|~MuTtF!e~!i?ivR!s diff --git a/test_conformance/spirv_new/spirv_bin/constant_false_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_false_simple.spv32 deleted file mode 100644 index 63e63313ddfd338e3cbbc348cf97e36f00ea58ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmXw!%Syvw5QWEHtX6HU^|EnM5d?Lwg6PuFrB4uItq_PwF{SV18@dtvzM2l4%*>hj z&z!Vdm%WIsi0H+buQ7^Nbei04@-}%8?e%7hdKmqX^X056>t$9h(~qpE=V_gPE{Zw4 zdtKhN$$1%(penZq&OyS&{&Zb;)_Ygf-b~nXb`8?BUgTe^G%2dLteBRoYL+eYs+_+6 z-#g@*)1M)Wx)g1!wsITS|yuJ>Bn!Cdyq&jK-52jy}O;MMySTXNkMvoqP^`C@&<|w+@}u zc1?9pbq_?ftESnJnKf;qFVVM})kAKCd>rzra>pWdScR^&jT#QC+!tlyOSeg~V(p6b zW1Fo*Uqg2y@zk5ea_2r?Qy~t17ZtBpeb?g5j@3o)jo@6dO+R-o&hob;Tl!tTO3F0% z%lH5JWBIc8vp`IA!UK)jGqJ<2=tDW{@y5MYRo6!`l76C0e_NSe>X$mRGk4JEs^EPl z%mm_Alel{>%!6-7oZshg?uru+si5QWF2wSU^Q6m`=@iy(-5Er`-pLzX_lCAJm<@!n!WU)C3KBY3_v4xG;1 zGjnE68b`N1voka6*+jp@)FSJ&x!dM*<*~)hWTZN=p~0ct24B^=uid^3dF`s=^H6?> zXRa$vtXz1rR9oRj!dytz;eFlIoo4P%H8)dD(YqI%s}9B2(WPa0&&$jo!#1yr;IrN7 z{+0IPcOeirda(nJ+Y43yUg2ljtdG{+*!oTXG&4|5A8sklP?Sc}vKMh%B`@O4x8#=TXcXk1;s zZ>rbW*V9ZQUV5`k?#$zLA!N~S+VXDOcP-BDOkMQe2+q};@?-0=Dm)ie?zdrGG-dGl z%WnUfe7Soi5a)Ws1C8A?vHx4qCvw)u+f>zqw!Z5*6sL}MshNQ?edu#l@Zf zQ&fKO-0mMs7yowxajX*>aO|F{`u7SylCpk+O?0~z?%SF-9)xqM*R?*lKh->*nSq~4 z9qm0~DiAX<%Ds^Q@t#Ig5CU^jQSsyMUvS1zxFKjj}F`v3p{ diff --git a/test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv32 deleted file mode 100644 index 7f1c39b5c581e2b937b35c834177200b8b8bf6b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 504 zcmYk2PfNpa42I+WIGwsVMZI{K2!iNMP(k!)+0jo>=JZgQ?XYE_esM2?&r>Tb@HWYt zoVSxsq=ae}GH2 zsIvo{vCrCFv)}jlzpm+Whq30)8!mOH_kMHV0Ds@;4T+r<+7t8MwF|6ik8sY9fEv~w O;LN?pS-Bs!-hyAdF&>rx diff --git a/test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_int3_simple.spv64 deleted file mode 100644 index 399d14e22d93460fd3b8531a55423388d3ac0c46..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 604 zcmYk3%}T>S6os!%Yqe@?t+g8$6+w`8C#WEbD?^t)!4Rv9fjB896x7GlhjJr$zBq+m zxVdM}{W~*B8mDcu4Kr)oNMEdP4Qs~Oig7c>9mTFCs<7I7)-iHSm=~d}vQRl6stZ^8 z*G2v!x~^-fClU6+EY)=SnRP5r-&UR1M@HYaBHXI4BTNtciSlTt7k;7) zJ9gz`IW~zi_k=&!&RyY;wR2DST|SjEX79`Cp^n^*=AfB3;EgY}i@jhB9amC`4z&KL zvafinF7zJA>BX_fsC6Jr4*QPWp)fr6_=?<67#{9H9DDdr>>_t3jx)O1LHw1vYxy4` C2O<6d diff --git a/test_conformance/spirv_new/spirv_bin/constant_int4_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_int4_simple.spv32 deleted file mode 100644 index 65a6aba930dc3996b20507208e1c38a8c5cd80f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 540 zcmYk2%Sr=b425GaR;#wwdfB+B2!iNRR1jS{bmi5QWF4wOX~c)>;=XDuN(&DJqEK%Fv}x5Mp%^s5ixgiuUpJq1*_b@8${_ zIGveu=gdzUHBQ=QYi8EAL;YfXYgjY*R`Bb=Z^?HpQiXZ+tYf^~%4J5$)?*(nN|gXBMkFdU_oRap-s8dvgbKo4}(@_wV<+`)I@yI*QPyAWgS zcBPBijk|wTxhH=sRdsizMUOp({r43QJY)79xS?`*Zu<%x{}VjigE;1l1ZMGer-+>0 Jf3?-M@CW4(BFO*% diff --git a/test_conformance/spirv_new/spirv_bin/constant_int_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_int_simple.spv32 deleted file mode 100644 index 61a9b4deb4f99d555ce336b1d76d0cf9fc6bd731..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 436 zcmXw!%Syvg6h)6oYpstK5q09AA_(GK1<|3QL%$%z>L3u4VnQeWxD&y(VtQcT^WOX1 zG`X5Y>_o&Q=DgZ*BrzKNc<{UUS)~1BLOhRYSaWmL)NNPPU0#B={9IQbFhq=*Pw{0P zk-=!~09=5Kj`>+1kNUZ5V)Zhn?A?GoZ`bA5CeNzot*DmurdbtT+0@JTf9+Fvy>$V! zb22%ssl6cD-f8^=W!Q;T=UHcnaJEbeo=b>f8fjt<8 diff --git a/test_conformance/spirv_new/spirv_bin/constant_int_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_int_simple.spv64 deleted file mode 100644 index 2f8279a10da5fc08241a59cab04956a555ff25b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 520 zcmXw#K~KU^5QJA+L`6X)>cs=Z#Ds7M6Ql8D!_i;RRP^wY@=9pK#h-^i%8Lo}J)WCP zcRRZ~J8jas@0cB#S;vNY5(8^l8go15xv6nhvYFYTCSNv$C!}vZnZ4m+#29 zMU0q9;G&91aaYsp9HdlypLY4M>$@U%cS@JFYmjBly7<~;X<5JK<+9q;tGq4hYWeoJ z{{&y}o&)2ImmX^Fo|FCGs(y?!A0N)`z)!%iZx^;l{et%dwpaazin{k3=J&m~xB6e) y(qq55;rty}IPWdr?B0hTxX3*Rz*%9upnCTdSTml{oSy+btUZ$X_Ld*EEx<3Vi5%zv diff --git a/test_conformance/spirv_new/spirv_bin/constant_long_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_long_simple.spv64 deleted file mode 100644 index 2362d9469e09b7058d518426fc6b78fb765c1e1c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 512 zcmXw#K}*9x5QWF4wYF+&74_nwA_(GL3&qltp+|qgl2(yG+$|>b59*KdBKW>_Gw?FA zZ)V@TP1d>To9&rd-%j-~^==}xA)^k%u#xsTSBkSD#1Sa;*xt!j4Xnqu}&aIW5#pF5XVVO>-!zYCk9DT80V z{_j7RF20unaj6p;aO|F{YQ4grNm-AN{DE>id#$;F&h+5#)j?w@Oa-Flcmu)QJn7?? z|M8%EXiyVqKFSHR`1#TPBjqQ#V)wDYT|m5~y(881i0{OWRm0=yD{&{P;o+Xev1cN% Pi{3&NXFUJP)lB#U+pZqz diff --git a/test_conformance/spirv_new/spirv_bin/constant_short_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_short_simple.spv32 deleted file mode 100644 index d6f134eaa5eaf254db3eec867c7a2c2a25b32f30..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmXw#%}T>y5JkttTCLhDqHbJN1VP+uL3C;8(kBS93I<|Qn$Vr^?MCn%O$Tn~@7|gD zk|tNfh^>ei#t~obIFi`z{h;?dy+6Z`BmGk(#FH3>Jtr)hy6uX(%iE7;#kc%iR`1m1 z4bY_cvX01@Zfzf2fQ*j0v+c>d2JX&a*}DOG-Y(14I?t-+wW#Lxx>*!m+0^s5|NW{tc<16BU+_~QAf4D;_ v*H}|~&jo6|;~VAy{t=Zs4uM*sy-@Y$F|emSQ&T?y&an4HWbPe5Y@2~!GH@NY diff --git a/test_conformance/spirv_new/spirv_bin/constant_short_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_short_simple.spv64 deleted file mode 100644 index 0e0ec76a51f0148e8546bf7e1efad43e8f56630e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 532 zcmXw#PfG$(6vb~&W?5+_)y9P(1mQk~C|WhR>=O)=1r3bvi8HwC)76J^BY1vxyKv_I zdFP&cn4~dknH`u}%li5fJ!{yZ=ceZ)&!?WRl{=P*X?t|7ZE#SU$57RIsI%%TuJkPy z%ktBCP35AGy)y4hSwF$pJ666B2zV#TaG2k!Z!5!PKGqAG_#X~Y%Rr5yt`V8O9@$=)eo@(aI VUNz&+rNAxTo>kG~cPm#@VF#?|AXWeX diff --git a/test_conformance/spirv_new/spirv_bin/constant_struct_int_char_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_struct_int_char_simple.spv32 deleted file mode 100644 index 09468276eaa35c01d06a48ca7c592e2e3b3f2373..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#OH0F06oijSYkkx{Eb2z2A}CT z>73V`J53y&^~^TRtY;Jb5@U<3({i`v&6Y331B)9)q2 z*=t(4I)7UgFS=^hl{OaV-Yn58^mc_~A<=~Tu*o~k-nnu-B-&zjDL7ZJ@@nmpqI^n= zrC*m>8uHRFpZ|Ou=q~=J0&%2@8}xX4s_fr0{fRE?BN)0ZF(6Ji5QWF4KmOGISZg;T6~Q8P-MsAINfW*wX8iw&(|P48RYx4qx;ekR|uK$TXbZ(XAXr8v*ZD#|KX zR>f;vxkO?792KriUY6-oUEfk~pxPue3pEWLwD*P3>+aQYv#vW<%r2p-s67#!E0;;J za$%Z3MCl@1<#ALcdA4}`+hZ(U?r|$%6J=`*MHY z`CK*3AjX(^p_?(2`+ci&D1WUkcH0r?1=zjcYowSn?9+3*is9M$!*gTB@NjqHn8QC} P7H2n#$l3WvTU`pjRJ|vS diff --git a/test_conformance/spirv_new/spirv_bin/constant_struct_int_float_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_struct_int_float_simple.spv32 deleted file mode 100644 index 2674b9bcc36d7913227438e912c649a3c3024f28..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmXw#%}c{T5XHwNwSG0V7WE=h5d_h*3Zi&2miEd-d~745hqDR3i?xqc7Z=}6teog)8)_BY z*S!6ZL=(*h@~4W!gz)bFL?4*nP4@J1Tu!FkNT)lJOj?jI?~iVt#e$G(6U d@Lp8qhKWFr_pBQJ1A!Uz9>vJHa(CYOS~ct- z#@Klyo$TapKdKzc->VC4M*_V7d-A$QipgQ$o;y|ykLEAWjTOVgJ&I!w|A$@V9u#p# J^RHCh3V)s%Ccppy diff --git a/test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv32 deleted file mode 100644 index f2485f354e5f0c5ba81112e6c8012506febc5f31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 628 zcmYL`%Syvg6h)6oYkkx{tyK`I2$iBE2UZXr8ang~LW~Xq@uoDfGr`aE3;Y%*1@}r* zys)#++2?t0eD9)Rwq<4wJJFZZHP31lZ&zHe_)^?5zpU_Nx2_xTUPP`4^J4K4 z|5NflPu~Qz1|U|ERQUW!_jevjb%jn+Rc;&y&S64ASf+N@s4F z#Zi%DZuYv~W1zn5KN2`YdGtVI_DI%dXY{^0>k-Pl9Wi;#qR*}vjdLb{PfQ#gpWTV0 z)3+(6C;GYk12MhPujEtP5;{LOpZN4?3tz$}-jQwJ>p1z{%D+};=JW)5P>06+zCazh zXv{wp(8<5oEbh#`_*b{eVJ~bBdrtK_?8zJbDsv!yP!;##pHK@p&r;cKC=la3Nu&N) Qpa-!>S@`U-(zH9_4^&qu;s5{u diff --git a/test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_struct_struct_simple.spv64 deleted file mode 100644 index ab0ff235a39946c9c19133bc0c96c4f52dbef16b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYL{%Syvw5QWF4wO(p#t+n2%2#VB|3l&6hW$4l;2r;?{#H2K7cY^Px3!lJeaU*!X z^e+ya%*>hl-+Gnfy4ix6)$KrEq-_z zVLHvCu!ysC_&nRAtG?WEFCaa6^nhb_U)FqQ_>Ma3F^syUGOmw=x@BoNW)oj=zLXux zXLsW8_zh`l;F+@~%?$V>`AunN!4DK+raF9>sFsjzA3gblk3Ncy9l2+@5TBxCe2};eWv_Vt2Ce+4)ynT?>D!Z7e;%MI`f~I zIdj@<+;$@NBBB#RzQ!OL(W-O1&imwEG`Eut>V9-X&dqs|m(?t<(rW#+NXzVVwOl}> z647R-NzU?!1XZ~sa19bVzAv|RYdd#G?ahQKdt;EMoR^-!< z|N9r{>URW;D_&~Id3!{)^C~|?nV*hx@wNl-7}!J Qy%#v&>bmRBFK!;eALs2J5C8xG diff --git a/test_conformance/spirv_new/spirv_bin/constant_true_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_true_simple.spv64 deleted file mode 100644 index 6110276bd29486bc509414d0c6f5471b2841cf59..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 584 zcmXw$%}xSA5QJM6L{a$>kc$V5i3#DZCI;il4M(3~vLc5~)>*=?ypzwN59P(g`o^J? z+ODbYsqTTKaosjMFtfHz^d$z?ux8Aym=9w~??93hXxhi;{ z3R8iYX%ctOgn9Jsiu3#I&pmPCL3Q@webjH|hc}#H)}8#A#r{9)>??oj7W)hY=HQR# xLOQ#i3wQ$JCGI&Cr$&57Z6uD)8@{487Dq>Wmd1Sk8+M@fD8`xjzuNX*_ydBrAt?X= diff --git a/test_conformance/spirv_new/spirv_bin/constant_uchar_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_uchar_simple.spv32 deleted file mode 100644 index e829151018728f4f3f52435d61ae7d4de951356b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmXw#!Aiqm5QNvJwOX}RihA)-5ft&Rg6PrEqfZcG6%53rG_lX_MezG-T$s-OyED6+ zCcTSc#8yNM}&Cnud=52T$b|UgT|2SM#^O z{m0Dp?inync{#(HyJuwow_2YvnU4>BJFqa+?ZRrTo%0^SYOUXNdheft2j0&0PXC8n xoNCPty?0!o*E_yZ?!%9`+;IT(3gd;UH;;im&Aeaq8^z>9vVC Xb!v~QG3QWV7H{`r+}Za>Tipu3M`It@ diff --git a/test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv32 deleted file mode 100644 index d4e3488bd0fb7a8355a6661577782eabe552bfe5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 440 zcmXw!%}T>y5JktPwOX}BMBTWk2!gnBqk`zt(4|ihVs#OSNinfc>chAZJSV0D_nVnJ zKX<-la50Y9iimN{c(ubA#IX0H-f!clk#wB{;#o{W&dFt6HEmwC*;m2S6d$Yd9hxl> zBW4nOQAMO|mD>YnAf;k{(#6BB?~+)}lrC#mAj_In@wv{@vVP6WMYXP%d0W)g;_YAm zn7!UR2ihr_JLJ@!6K!slKVmbV?)V-2ruUq_U2<#k*W~V)fSd1#hklQD`R`jM?KRe% sy+hGib$`(DuaBs!u@9UT+6%1v4}dl88P54BaEG-gB6IKfMeQE^0rS)yT>t<8 diff --git a/test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_uint_simple.spv64 deleted file mode 100644 index c305b5af1891c77e48ca4f47f27e266ce8701d2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#%}xSA5QJNH5k=)kqFg*+OiTh9`>q;=IX+cUF{jr1jk*0MC_cFg-RA1U`NQHKTet!vb9SXRDn3g6_PPM_Mn zugf>dp|7o(MBI6^OzzC%bs=QY?>z7{^j(XyJ5v|EH$tA*Yxl9qv$A?E%7x!l%c60W zU#xcf&*aP9PXaO43lB7QPsILjMIXsoKi-%-2z7lzPVG>c9`sAqyUO&UPgTK_`zHc1 zjULD1x8G(Ddb5k$`EO>LVIEH4cc-iHL?x z&6`Qn6dqIiM1nkB6cH=gkwvaiA4FthDHyEP4HEn``Ue#!GE}_*zL=A z@#s35NriC`1c?rw%;#bDQ4xqcnI^ z^IzOcgPxqn{DZDwo?CvTJP|%=ian5QNvJwOX~cihA)-5d`tBf+(I0J^BkCv5ExZd&R__{crlCya>)0Hw)9< zH@iDKY1TU(nys1H(Dw98Os!{q&jZivp0||8mTAITOl)NIP*|i`H$`m1N0s7hsLQuy z_2P2_?PRLUXqHQzeYB2+-1QFIy5G*7spfXBDQ3@w5b9<5z6yDjo{DN7S7}i+Ws39X z|N95h#rM5H9O;Dy9JgnxIeBQV| zZ~l)8_a>eZ(fnC?LN54Dvo|1h#H&G3br!VJrRl~zQh~v&w Q;1<0*RlM>1D_7UTAMk@8*Z=?k diff --git a/test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv32 b/test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv32 deleted file mode 100644 index b42ec0b63034f11f85dbf8e28a498e46ebe76aa9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 464 zcmXw#%}T>i6okjbTCLhzMBTWk2!goRg6OiLOP}Bpt6(7BTbkHs_7U6^oKMpOlk+=s z&P|?O_oW?4eVzD=jg@J)^S#dRb^hFbsQizSIUZ>sdMGSXY}zum;j8&bt2Q*%=dym6 z)uf&|xqTI-!s^rxjZ33&ha7Es%-tC5E<8o=)(D|lR;zU=>hxOH^SDlnvaM2_zy0q& zGncz326o{L4Qgmk9BprlugFRpU)(4dFST!TL{(4hD1h@3k%-ZnLU0i>ND AlmGw# diff --git a/test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv64 b/test_conformance/spirv_new/spirv_bin/constant_ushort_simple.spv64 deleted file mode 100644 index 3118acb8a2cf86193100129cd44fc7aec3f6489b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 532 zcmXw#%}N775QN*TF&Z^L2KC}0A_$VZ3KH?;lA}*BtWj`boe9}BFQ^aWBX|i|pJ^Lv zyQjOly4b9B(J|XHvyP4QC5G0rZO?7bJD&GFpD6b%6Vv|Cx30lKX`W);6tM{(^;=pt zp)TJS)$4}W)=nl)8O?HCVIR#iA$L8rnZdgh@Q{lI_euz%UX;sK$gA{RRI|8B^P(wJ zoV{%BA8Qx?4+3$j7aH`?9IN{GN`E9}{RCrgS9u^1@b;A9&_CC^s|=U^L=!aeKNg6I zYaFQlUYp(N%`Lq1Z?3h&J~e^fja;FJw;wSNm8aU`Zcktr5Kn%yubLV01<|FUOYs3hje>#LgjNc^xf{Xni*exe%s+Ex z=A=pIydSX<5&anRYmB24-IjYTZ?=314ag%o&-37UKQ&je@K$flQV!6)JvU-`9v&Fi~=buHjn7#hp zK4Pz)C%`!2;Dkk@pi91{ST&0 zsx>#9y}^OA`uIk<3*R&4jXmJ3FrKLDc?j$okJOwW0e9GYZhh>N>*axtecwM^zXiWj C+Z&Yt diff --git a/test_conformance/spirv_new/spirv_bin/copy_char_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_char_simple.spv64 deleted file mode 100644 index 6e740df7f70f6b1efe5cfae6abe9fa8f60b182ad..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#%Syvw5QWF4wXK(4y=+`m1Vy^H1yNiXx)dMaCq}_QOhPLKpHCmE8^QCXof*g;}f(%;I+@#O`%c*UegYsha(Uy^)Ltjjd{%*tZ% zy4`&&Uv7U8h*Q1rfMfSW)&HIFV>#;w7;_zEK%na?qk%iudruiH{8Sx0xql)MQ};Mf z&A+_Wn_b+_f4R{N^V9@>GhKxrw{4_6RKC*`dwT-2fOztqebw}cALjdLwB2V#C6IsgCw diff --git a/test_conformance/spirv_new/spirv_bin/copy_double_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_double_simple.spv32 deleted file mode 100644 index a4bfba7f331c0da49bd7245e280024d21a71da5a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 476 zcmXw#%S!@b6vb~dKAK8R!fMe%2?B|>CWPW58eB^4KYT3)ruhanq5nLHpz|BY3uo@* z+{gJQ4DRb@CuUZ+w!T=~0;`n1TKZb)&*YmH788NumPH1~hNaKH-O7J0(zV+rpLx1A zZ8EE>Ka@{0vsjy{oeOtDEQb8Lh$}_kgJSN+>VoSF&TaE#vv+ao7xQ$Q?fr7TOMEt6 z9d38D7tLJ(yHUmtYTWKBI_ji;rOkS{?uK?MKN0AO5QV3SR;{g3#CFq#QYc9GZJ{Wx3|Wc~a7k?ofiyQ%5qwr(#7&{+i|N40 z%spp*PQu`!Wp-g^EgR@d3@orlott&ORPI?=bq1;<>lhr98($vWSMJlD+h*To{wa>0 zruswWtT2nU5w0uT3$Ya5w^iM!`W{ttFIE@YRB&!vW#OGcEE9atm@w<{7{?q!@3(?5X9G}wbqZuTCEok6+w{RRgjjR3^|Gq5Mosb#QcLT1)opf!WZ!(IKOmV z*z9C>cXpDfbq!i(Wo@q=uiIYtRQncb!kUb&XY^25g!&_UEknM_mc?6L zzW7W>^O0~-nI%$Y7o9U@;##8yx0|_3VeTfHV)jazWy`vFUuQ`fp7JuS)?tyaicqD` zo7*SS#q(TAoazk?IBt)H{(Zs^rK}IPk-9rge>2k)rVn?non2Mt;3w*!hxf6Pn22F^ zU-=!U^E*i?~{;0M942S2hOEABQT#}kc24~Avkd}VKW`I@!GdsDu+WF~3g z`Pjawq}0sRwu~bqb%*?*i<55d)G>EcPtiLwvaD^2k5!hI^;2Fhs#U$rKa09rJomTv z&5P!_fgL)7gBrKzj{bF0pPAV&?z^!zx_%$?e!E?sXw#lq`p4c!GdtAJoin>_eBVje zfginmiwkcuON_C5>09ig=g0SV>>mTq*fCtKbM8$HYByGm1~kD9um@NBf7JJ=-Ma?= Sp23Z&aqEa2zF(`kGX4Nw-W?i5QWF4wXHv`ZLMxxR0Kh~S3wl%qM=Li0WPsB24WJ76x{i4`cQ5J&zFuD zPG;_znKS1mYMivqHq5MT2l{db*083>md8zx+a9}$J&V+7HTu>ydQe&x>7nZB(;oD~mAw#Zk-GI>vn zeDS#6J=QGVZw1bwZfL-vIZ^iS6MiIR{Q$i^vQAxJ=e%#PzBg@4kzVS@n#VIU@KaUL z-Vr7OXDWvIUEyg8mOxEt-T=H{fBtG zd>x#l)Vd(rt?|$u}qU`@iLx{@?|j@FR~&Zz5d-k zgjcNtpdFLRVa?kEqJN#%`!Mt1vc844CQg}a=*FLbPJyLVO2jsB#%#?Z# RfSMl2?3>Hw%nvGV!7rq*9cKUl diff --git a/test_conformance/spirv_new/spirv_bin/copy_int3_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_int3_simple.spv64 deleted file mode 100644 index 24d0cb7909e9d6fd584dc8de1b6bb99843210208..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 616 zcmYk3OH0E*6os!%AJ#`}t+g&(R0N^aouGm!t_)p@KVYcU#XwAgErsgO(;wwV@OdwU3o2rW1q2S!C^zRFoX2tU)8|RB+I+^<- zAHV$X?rAQb?**c-8#B<@JrG;@MDJ>{Ufk&040$~i^fh&&t@^ga=|MkH9`E#`kCb7@ zjxZ32QJlFe{<(H%T+W!iC(uJ3xf{*FGv9#kd#PRQg%kL=l1qHx^+%N* zoww@3@4i4UAReRFt~fd3J8B2w=)A{Q)OzCRXb;lZ!+&BIxhMI1=iJ`& zo^z&JIc-F&MMNXIe0}YxL~Uv7OS_J3Mzv&C@LRDN=Ik66<9V9p)2nony^lw4q)>>c z!>?kqJR(8S+%`A{2^HhR(yx`gGkoVIu&kYfG@XpIk6D_GikHEtpU;ZnV44+q|8+6D zi>|x&fbWP%4Rg-!;r;JvzJoFcm%I(EyhVSFix%_EpOD?c$~AvMEYJPFSK=M~ua$Tg zf4&ko@jt;OO6si5QWF4wbq~3T5A%i&SAA9cvjmI!yConYe6zp3K~9 zk-muXH4W8A@?B;Yt20{q913yhwdei1uRD>?+*noAo(f4aE8N>6iPQXPl8&=QKAp^6 zo{gW&*?sk8=R1KnP(%+nW)J24?+M>iXB}?n)_h(+dgxlRaA?u3%c6llQq1mX;YZ3) zwi?;-5JE5GL%v+uz56~lAeSK#=c;NkAYF=rq!i`=93WA}Z5 R{clx6o|u{3@T+aFgg<2!A-(_r diff --git a/test_conformance/spirv_new/spirv_bin/copy_int_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_int_simple.spv32 deleted file mode 100644 index 8d80084940548b4919855c86715931ad31222246..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 448 zcmXw!%Syvg6h)6oYwN33M4dRO2!c4*g6PoDq4)uzRtJHY1X~K?k2?`uE2anbJ@38G zO_R$(#8yNM;*eK6iX?iS?{|J1KZ>-SOo+!Z3~O#K>gFpis#U%$KAQ5K?T9|JDZZ#8 zGT5x`fpd`2F+XkNUORV1tX9U9y=#!?%cl5T=UG|5&dXV~t{3xFQCG9Kf87&!y>kMz zGcq}>sXZau+-Ut6W&(_N?EK%drc-!F|W$UH@AOU?3@3hJ_UakIU6Sc diff --git a/test_conformance/spirv_new/spirv_bin/copy_int_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_int_simple.spv64 deleted file mode 100644 index cb71d73efb0e6351849d29223d4e6dce0ec91863..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 532 zcmXw#%Sr=L5JcO|#Kcz~#>d7*L=Yr<6(r)yAxrTCE-|{eFwP7n1jNtNk8&ee=h`;Z zblQ1uOS;uU{%sO_UFEO;1<(}J~H$Cqt_bgL~CG@RpXgDnD<~_t}6_)X}DPNM_ zR&ORPR%V4 z`Eu`_Kpg9Z2OPV{s{U_;AIVui+L-GmU7wV5+ft?n{#5$5GQIEoioo=@k7s^Q`8 a#j$5!U>Dk>-#b#x&9_p}dH?9jYvC8E>mDlr diff --git a/test_conformance/spirv_new/spirv_bin/copy_long_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_long_simple.spv32 deleted file mode 100644 index 6b33d2be32cda0f3971a47deb18de3878eef7fb7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 480 zcmXw#%Syvw5QWF2wbn~(5q0CDA_(GM3!=C(bSXYSs8u8olVGLbo4XPGz8D8i&-`;a zbJ8?98$@hG#2_a88k0z(*Kxn&&5n2AQKaogLOzaR*i&IyH(z;KS8w^McyG#AN+?D2 znNQ)OipWs5rp^h-==eTr^Iki5PVU`|DSHwSGy*y8aFGn@(G={ts8o zIB#yae~kZJ!o2*mdkqUfo`$LI%K%p?}py-SAB@2elxOVIhQcL&bS z+%t2}oV!VV(lV==S<8m{5(BGSBj#qzM=^JldzNUz0{YfAdMK=Y`Q>t7yt`etE%S}2 zFw@k0qB<+gQYmv6oogYDT9=`2gt;5l>`gVr>{M`WS7sl3m*)O;l`o6EU#~thUo77a zyDy}R=SP9K(g_VXc8^q5KH-N_*24pTtX$2GHP_ae9{fxlG){z(KvW!WAeg(0`uOEv z-0B`0)C8JyIbjw*zuJGQd@on*?h4!m#By5JkttTI)}15q0CDA_(GM3!+Oym*NA2S_K0!2~8=u@V(s#o}+Q#_I@*S zXXd79a^8>Fh=_iS`8CFo#Ae66j<-5KhKG^YW^23P6l8SF-D^+X1@LZ$%HAc&^R_9L>pUy#=Xp7+*7ah(D(Y(X@^|}) zSv^mHaYE(}Ywn!z`uA!5kj;E}IJXTS07KmXR%88)dU`*1FZXopn}2hC3Vr}v CvK)s1 diff --git a/test_conformance/spirv_new/spirv_bin/copy_short_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_short_simple.spv64 deleted file mode 100644 index c3e06ae963ff06af23fc73d02632663a15fa8ddc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#UrPc}5XDDVGy9{dSuZ^pK@h&D5JgWeK1Ltlq87BU?Oj|Edg#;Dhw3Hh{AwCF zJ9B5woH=Y#zi64&%&cX{`Vu{>Tf=kH^N#0z&nLii+o;e<7%p*d3Z@00#O%K8Du-mdbIK)`D&!=Zn!_ntCb`eRMd#Q#Vj#;$R| z~cRK>RfOznmUDeEpPw(NIK7KyD*HcZO b-b_92^aXA)dvw18)p)+sggNhTxtt0=n%N&L diff --git a/test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv32 deleted file mode 100644 index 402f464bc15217b21a5b9961fea221cdcd5942ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 536 zcmXw#%Syvw6oijSYt?Em*2_kuA}FG(E~+59G;}FGz)y^VKg1*?vEV}RDSZ|+WD+@ z$xB?i%D)!rvo4x-r3=MAGmG>By}ocDM4C|VHF>AmJ5kQNk+ztf3C>l8FPAP#^T#+{ zWXn8>YoBL}r#}z7x{LRzKtb~D&~1p(&_7a* zceM1+RkOP(jJ{?c)abT^PvJsJbOV7M`q$dQ3;&JpH`fmL$O-OW$~E`#{;kcS_(m#x nj0CiRxK|esV}TiQrylxkfg8*ow1t<6fS+4Um{b4g^()~QQlKM9 diff --git a/test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_struct_int_char_simple.spv64 deleted file mode 100644 index 918c423dfaed44fd6bfeda580b300ebb537565eb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 620 zcmXw$%}T>i5QWF4wQ99L)>;=L6~Q8PS&diy=bJL)9&@@{zv!?Cn7wcKg>fSfJU-rJ`{aC(jfjX^1$67`Yo8o-->WXsy z5|=K?N*6yxb5|tKv-Gj*ZD=k~Uy_-Hy2K9l?h2vbxn0Hes_#%SIzn~Pdn7nl%#!)S zg=u~trPFMY$5EN&+4SL0!$5m^!?l17m9Ybk+apE)dg1%ptPf$#tyFdW$jDda;jlgB zYx3mq>_Iy_;P;iU%d-o9q6#-Rgpq(v#4z6$x?d-6dU-$J z_*6aIAjY_Prk8P(_kF9gCx59av~3E^0_@i7>MN#(eR^(7F+7?-JU37b4|gMuJN!r7 VqIM^JXdVjazEXuc`Hxhd3%@pBCT#!! diff --git a/test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv32 deleted file mode 100644 index 862656ec4ec897cbf6c67a20d0a6bb44f45935b4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 528 zcmXw#OH0F05QWDiwLWUvS|1yciXcc`Ye5uOhAc&Jdx=pY5R=ec3;uIAg6B)?!09~B znYkwogY&-GhMD#4K)=M;0*lspbDew2v4x#7P(8GP!Lgaw&9`g);w$&AsJ#0q>&&~h z_-x8|(Yj{V({89-RAz~;GustTghUMeQCCNu?m{(hCQ`v&3eL4nu~@pKtY5P-t(JA3 z`J%4Ux0R1W-NpA*Adb~>gBfp6RsDNrKG9`;yxt9MtK-d1rP)@^&T1Cfj%xJG&&1%H zJ?1m@Xa@oXJ$rk?OPoGjX_LKJK*Ri28hr3w{D0TdaF3ec{*63wAKyPx4wdh;g^!WI kE+C#X#lu*DBOWzle_!AR+_O}8nF#o~7XwfKtJmkkAE)dhdjJ3c diff --git a/test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_struct_int_float_simple.spv64 deleted file mode 100644 index 1d6c75371130b9fc0bd92f7c9a85ca7ffc20a20d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 612 zcmXw$OH0F05QWD!wLWTUt!-V1R0N^awF;tiWyn$lx0hHI0x=0~EcpBMN4XI^UwR!l znYnZ3aqdmCan?55FtfHD>5KKOVS)E8?>D{Ql@G0{3ainzj=?cuUX-71SuH;1l}q!= zy=6sGxn=rZX0M{_`j&c|iqqUI(iY}0^H_-d++iIDb=|pQG(@VRb|N^pEYroxMOpEj zWO2SK=1G+ndHk~0G0k*8;t(wQxCaN$ap#9lZ=aSCFIkJ9CkI7gE@BSC!_ahG9AD5 zr~eecjs`Ep%q>!vhvQ)g9VV!i!9M5^(cez(LYjAs?Ys_I#!f*LO-Au}7Ig;6Q*Y26 z&XRs_8Yjc<^L&RUecincJS{wXs5!fhwb)m^L1!Ky&0B%ZbC!KpVKvVI{u*ptUEke} ztJ`-Swx{|b{swGs^)q~HE1>p$@u6>@D)gL}t%R757|I;No?xpQ<&nsTXJ$<7eGMn%%Ro=&cVy*Bzpt@TN81vktS-%79 VVeFACci9E*b4SFu{x8$7!5`kh2#VB|3l&6hW$03TfKa20Kutm$3oZoTO&30a&*Db# zeCb~YPG;uJ{cpX}LB(v&%qq68FVe7*`A(Oeo_D(H^pSMUJY`yex>b!FIz?&r8jkbP zOO*es_&FOsx!khqJlSz#7HASZ=({TfuIEN!`$gWNZ1xD0MeeZ>hT|+AO~PQ9J`9Ha zWRgaMJWiAT<8+6X`f|gKfVAb&1CH4pS+jlNo9e8GFzObHxIPl<7Ny~sO?=7uQhGDL z*qt~${<1VR+{By}X=cE8<=3Q{1>aMIo$5kIKzd^6w+g;b-|*?(5Z;AZd`-4}P2=P@ zoqwX9%w8AhK^+`BwFK(Og<~h)8lL=1&Ej3SmEZDAIqZs!u=}}QkllI5A7!?suT;g2 zn*y}}xf9EMTLLlU({bCf;ko_8aXYf%;cmq-hyMk$h~29jJMRhXeXR&_{9kQ(A^ZU; Crzy5Jktdwbq~3Qq+x$ilB&l6-1YYF2x53u?hxaQd%we=57SfiE-fe&Np*s z=BAzGv>&k%5&anRYm6g_Zp*!vH(Nf3htX*!67o?D!k!!E_2Mi0oWJGEY*oB3%2#S? zdgwcFQAMO|wzdO~K}yH>VUu?o-5I%eQ&jdYK$fi*#d4jcW&NC&vua(>^N*sgW-ouY z57?{cDKL(Bxx<>br)2*=txwp@hlg`purSmOU^UiGcyGgMtzWi!{ZGIxZ};lc|KN&A zwdRJi*En!iAKxf<;X9_hu?L(L#v@fd4}m@7ftvFp;0}9Ft&e?jz1-8W@B4@AH{cfo CN*oCQ diff --git a/test_conformance/spirv_new/spirv_bin/copy_uchar_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_uchar_simple.spv64 deleted file mode 100644 index 11cdd476d37b53ff1a2f6291ade4f49a6dfc17ca..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#%Syvw5QWF4wXK)dS}z+H6+w~iTcIef8oCr8;3r1GKukib1)onJ%8lUp;&k9- z=09_0=8&jy(Kg#Mv$h@SOAM@GP0uaQ+n#qlUn%!2lG1AQt!rr5l$OceAti5=@7l>26*a64wk*bYP_@OrI2N-i5Wk8_oDx-lr*Lz19E&Ny=cH(~|5M$r5 zr+O&N^yU`c`7aaAFi%aeZz@;p!`qLP`^vYP;%-l177!19v#**S@$KA!YIyv7IX6%Z c4>uRbokM|J^d8+WUh#aV4t?Iga(N^C0WC2et^fc4 diff --git a/test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv32 deleted file mode 100644 index 5084891aec2b3da50e44dc7e2ea00ec1e21c7b02..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmXw!%Syvg6h)6oYpst~5q09AA_(Hhi4{bLh7QFK2(>y0)Fjwi@IU<+CxUCm^uWI7 zz4y6ka^8#Bh=^Y7^J)i?M5p!L)^Fkmkv5YF@i6*f&COX=f90P=xy%>Edp&=n1VcoZ z`4nH25gClucEBmf=$Icjai^KPAXYD9%HAc&^F>{JtnzGLy-eqma#hWy%c3eLum9Rd z@OtYAXeVTHSW|mMw7%2&Aw0Q xjH0{h{-EPu?@?D{7q~05C#v%A0ejjbHTMTV4tvk-9YbPod7xw8{1^3G@CP!1947z( diff --git a/test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_uint_simple.spv64 deleted file mode 100644 index ca15b68192bbfb6972afde86791cf7c1cc527a74..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 536 zcmXw#%}T>i5QWDkwf?r&`m=FS5d`VVjS8Z;GIS|Ez@=6f7h)1@E%@B%G(YQ(^8Fnqu}$8N#fIZ;Mcr_0yyrSBrW&na8>s zKQC|ZOBc^~O5#v&XuxrMDD>|WejsIixUsjE`g)|A>x-86;g8kdP-PZ=Bvmx=KU5MU z*Vqz1|2DhUJGb!8f4R^O`(OgSOSwW1Z$FycR=v>{-nvS5N#en8_JrvXU(W3a!{g`E gxxO$w+`TyN>?*lM@6r7Zgz4T2me4#HGTTK zy^pS*$As^YN)3D79+Un1w7-WkA0F;)fVYHCULTZW|Co9clxzQ-iGBU+jrVm0M{R5W zhYL9J&3*1);=+Bse8b!Zui5g>4&iRA7x#4aJ!oe@+|hG?NT}iL0hV5N3H{tKac=#? H^$GC{zT_OI diff --git a/test_conformance/spirv_new/spirv_bin/copy_ulong_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_ulong_simple.spv64 deleted file mode 100644 index 35b8096a8c6300eb0a7ccba36bce5238bbde377b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#%}N775QN)oVvL$UgL?505rp7f1u=MX$uZ;sh8RT_)}6&@z?<);59LL$zO}cZ zwtK33s%tiBoVCri%&cuAeTktptm(PsdE4`za?cV?ScSfIj2;TBSbl`}JQmMkoxPO# zlh3p?pQz3XvsB95Mdw6FUF)c-o7LR8YWAj@Vs;{gur9OLO-S?ju*_%0Ca#umSuAFc z|GN*Ri|0FmIMxXbIChU!)jr`zQr5#Oen+{UJ=I)CXL|4#>Y%YJj0K|Rcmw_vpEs`0 znSXJqduUJ-XkN()n)vzA&3)xtxng%$;I8Z0-1qjpr)1yG^;N^;>C3r+YIwMNaqJli X?4q}jKi+X5;CreLea^pfc`f__>eU{o diff --git a/test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv32 b/test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv32 deleted file mode 100644 index e19d5acbb4f192b33f92c594953d3804d9387957..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 476 zcmXw#OH0F06okjbTI-_^MBTWk2!goRg6OiLOYsL>Y84E`+|bm5|Ja}4rr>;fJup4@ zJZ8?Md3Mp2wj^~m@-Hz`rtOqFDet6w;@nsM%gFp5s3&G9EMoH+KH9gqT!prLZ>m>W zN$Pk%cP?wGurj@UJ-*@6F=Ip#c{VkM82RZ!jaK?!g}zXfS(9KJbl~2Tzz&Z+v}X F`~d5(9%KLj diff --git a/test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv64 b/test_conformance/spirv_new/spirv_bin/copy_ushort_simple.spv64 deleted file mode 100644 index 85aecddf7a5379fd4bdd88d52f9dc27748237f70..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#-%0{u5XC1qQ~RTt{kiGF2!in5gebad@ltw#53`_!ZNJ4eq35fI=@GgSIzOET z&dz)@XU-fpsa-bAw#=+y$NCaotJ${ay5}9wd!A2~+m?uFYjmt-a8R1X@-uu?Z*jf| zRrX%yuNzKX{6zDtFiUlTUG&a{)V0uM2JcGXekvB+YaxWH%;w9G=J9!&kBeoTO&3`# z#xI-OC)&mPgFu|=g$6w|`>OtZ((g%GKfu^)Djy02yp}Q?`WJfdD#N8e&;(8V_XT3$ z8vCk$R%W+)a|`eMm!WpprzX(5kt_7@_ABOr@}0K0+ZNab#KdoQR5K&Ky@zl5`1$f) fS2cZlkLq#fNZ=N;C->V^jput!nDbuAi5QWF2wbq~3TB{ou6<5B17DSf~>CPtzvAtj*B$9-JJ0IJP;Q6k(;J{@5 z&YU^7jibAf*@2mj>`Gs3W|0m0IPBx0;>2Q)jFeApZ1mXNxozF#oy+pF$XmBlOAKa1 z;bXar2%Q_LfDcV*LBm4Xk>XO0U8^1|(gU|teXPhn{kg88gZ`-^ z9AIztiZexK^n*Y3`)GvYK^tJmF?Jqx2|V{gj=qp{<6C$6y`S|($3zY%j=hQ(9aA|o zY^@%==W_U%u@7!0r_VmKfW1)8z5m#`YWe~D)!*Vjf`@t7Unu7t?7s*{4KD2d=;bT< EFN3io=Kufz diff --git a/test_conformance/spirv_new/spirv_bin/decorate_aliased.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_aliased.spv64 deleted file mode 100644 index 6489935c172e25b0cca7ea28186d3cb1e4c15d1e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 716 zcmYk3PfNo<5XHy-vDRv9t+gs1BA$wO6-4o5sW(4Ch;6_^NF)gbZ+QknEs{1E!QW_>+(a~Ogb5}BgI@@z%x}c7Z2xdzwvSGaL=7h zh2yw-UzO{4mKCo_HqY0^BB@tJK9?hWKFbCD@PrpUjD>cT9~G>L_FZK-bdmPE%GAS; zGz}lr?I}kJ7P@_9dct4mR()l(@FA|Gp!Yx#DOh)Y26tr6wKUX$S@gM)8+za=VD1nw zbARNGH@VjruLp|oUV`@GXAk`u+_&crh2in_<++hCJlvBw=JPJh<%~Jpb*zAA7H2`r n`{3)pcA`Ce(0)omj}rxbI1lxw!rYho2kF?O3$?%cL$``QX*VZ3 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_alignment.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_alignment.spv32 deleted file mode 100644 index ddbd70234df51898e1b06565f650d8c15ca0f4ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 636 zcmYk2%}T>i5QWF2wbq~3TB{ou6<305D~K))apx0+*ai*6L~cXDosaEC@O-zq;J{>N z&YU?jH*s_|FxxS+ft~4#O)Ror7yDh@RUBFDnUV6b4GoORRk3Vb-WFM2m2dS&QMV=q zv%dJTqAS)uN3(k0=IA<~_q>jV+?TLKn{|-g$l<3_q6SCvKz`xt*w@^g2&H!|&$9Jr z={8wXHLrP<)|+OTw`EhOtL?4Nx&%G$LZ3Tk%JvlJa_n67P!SB?T=l*pZv~%f8+U*o zDxv}RQZG4Dqz4}SzMJPpG;TEkha6*Op-u4F7jo_kIXix|mw*1CFL#XOXyVw5bh%?J zr-wZWL-$yY9zEvaP2}Lr(+k`a8-0yDJsW5cthxwUu-ogB%c+~L1?5|#a GC;tQP&m`~w diff --git a/test_conformance/spirv_new/spirv_bin/decorate_alignment.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_alignment.spv64 deleted file mode 100644 index 631f1b1af47bf7d8cab5b0d1f32f51a16bfaf89c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 720 zcmYk3K}*9x5QWF4wbp8Dt+gs1DxO5oDv09A5^w&35Zj=Em`GX*-u!R+qr3>dFWChb zCiC{q+nKl7pmEwZTQjq^9qG#&Si_nww_IL#xvSi>Knkm(ZylpXhj}t9%6OSXahAU1 zZ%MwaH7)4_)yrgIV0ve-HKu=A;bzrGhsqCeQ>kRkE)?iPO=AzwYbhDl^T6iDlQqa4vm?&5`ZU%Q`&ZRV*1GDIJB{%fIlgHe_ zW9I(I8}D+fFJ5;P{>=pK$;}?P8r-+zc7@^b_2sysFg)CYIOgvum`ja0+;yaYXBIWD o<$dt=Upv+w-fKUlpvQrNKGgmBLt*aA`8(;@qw{Bf^@pw%ei5QWF2wbq~hSgRWs6<5B13Zlz~xbq1@Oam4|A~&Jn&c}8mc)r_Q@WN!~ zo;h>o+{DrC$n3z(Ms}$$XKs-V`aJCOq4LCH&x}-0ZERpnZpxx@c~@pdQ@34Scf#Nd z#gCO;+4>sI>SJG{>wG=%I%VCtFJXx$WXO9-r9z#^4SFYvYk!aZ9lwcCdUuK}Yd^Pc zmnBv6o>ytTYl^(vHg&q$`+SuSdiY@fQq__2O2N6(eXIrc4h!#8W?yKQ!(&0f(By%!4+;XJ4rC7ixC=XfOZzSzmli6lfBhH|gSIs-VYN z3qyCNK#v~t@a76|=II6QxoYi5QWF4wbq~3T5DBYL|ln`6-04mh&!Jk#5Q0dB$9-JJKs$o%8lUp(tE*y z)0unb+?jKmpmWhT+c2}fo$8kuTgSRC_gvm|c}IC@ffUwaWCNqeghe(ltF+0Id0Es= zS~O16lRi*gWwlW=JAYf(%&*$I+s?^~ruq;UNhf1=B*fZ89qA@}@o?6j*FMlhV(DE9 zNm9Qrt5p)^Mhow8B?YrbLMRY-ZU=8*&$Tq%qb8VhBR9;zldpM$ui5(} zZ+wq?{o-|BU?w15-0rbzdc?Qm4phVA>&tNy)$njn;@E#Eu$LZtcpIrRPg6V<$z`w!A_M(6MT>L0ol{s3yeC(r-@ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv32 deleted file mode 100644 index 6833d4041d48775c1af0407f4ee5714334e89d92..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 632 zcmYk2%}T>i5QWF2wbq~hSgRWs6<5B13Zlz~xbq1@Oam4|A~&Jn&c}8mc)r_Q@WN!~ zo;h>o+{DrC$n3z(Ms}$$XKs-V`aJCOq4LCH&x}-0ZERpnZpxx@c~@pdQ@34Scf#Nd z#gCO;+4>sI>SJG{>wG=%I%VCtFJXx$WXO9-r9z#^4SFYvYk!aZ9lwcCdUuK}Yd^Pc zmnBv6o>ytTYl^(vHg&q$`+SuP^zeiiJSAO z4Y)UY#hEfa@DNY^JRZ@w*907D4l@th1fPAO#$Tw}@uR)`?`M7SF;SpNaNeYgkEwzl zXDtlfnF2j}%)^^2z?r8PxaX?b_n*7a9XxQq`&}2p(4imZm#TRO^Dp9YhZkml_3}r> EAIm}{fB*mh diff --git a/test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_constant_fail.spv64 deleted file mode 100644 index 3fe5b8d862f69ba9741554c40533f59b7e9d131d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 716 zcmYk3%}T>i5QWF4wbq~3T5DBYL|ln`6-04mh&!Jk#5Q0dB$9-JJKs$o%8lUp(tE*y z)0unb+?jKmpmWhT+c2}fo$8kuTgSRC_gvm|c}IC@ffUwaWCNqeghe(ltF+0Id0Es= zS~O16lRi*gWwlW=JAYf(%&*$I+s?^~ruq;UNhf1=B*fZ89qA@}@o?6j*FMlhV(DE9 zNm9Qrt5p)^3Fyo$wQF z!w2_vl|z9*x2McZ_;bB#sEiig<4OugFWHcfp$XfjdI>GCg;@q?U=VS)X3Y% zJM1fe!gm+1UjCAdxjirh+9ew6TcGoE{o&hQZSV=MsIXTDsFA;iabJH6Z@od|3}eli zw_N5-@B2mB#XoSh_w55~h4vEn>JgjMz9V-)Ebq==k?Rx7%RR$6$N$S&<{pWByYnAg G-GP6dy&+Zr diff --git a/test_conformance/spirv_new/spirv_bin/decorate_restrict.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_restrict.spv32 deleted file mode 100644 index 3045aab1226e3055069815f416cd1560430ba0a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 632 zcmYk3PfNo<5XHx&wbnnawN@`4Dn0oHR1iHH;>}MGVj3_I64{1AZ+>hqg73G@f(w(G zee>qc+cu6?BeMfD8`+hpoTngSXWESebW%&$SI7;HS!H zz`fNg&Xnnahj{Ae@rcH~Cg4zWn0e49`0NWc{zA=;AMNG$e%2Qs69t+C=Uuw^m@4RT zUWK81u0W3-^YCU0aOUX+?uBah{pa#ufCuh(zw1&MI`qT*LN)JT{zW|Q@WSk`UjC@~ E1Jc7Jg8%>k diff --git a/test_conformance/spirv_new/spirv_bin/decorate_restrict.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_restrict.spv64 deleted file mode 100644 index 86cd1ef26cc7693947ae05d8e825c82fd4890fef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 716 zcmYk3K}*9x5QWF4wbp8Dt+gs1DxQjW6-4o5h&O*hh-tt;Xe12#^=fnJ>1ByXVs9$MyP+$OzPo*uWar46zmBX^5Q=FBE$gsncrjTi58}r8L|4GO4n-^m~`) zZX1_MQommpSzLIx4KppxN5W;cGccODGvTJ(EOS-)rMOg%4%)YMe$*Y;xKr02h2wbl znU{xnS@?BQtlYtGk}CIZl^*xv9d>+>V0VoFBKPZYF$NYaCbsIMdp~H_9TwEzI-ajUV|2QqBm0yGhmE2o~6SZ>;~p7zS*z# zLT|3?*z-!xJ2>_c^ajGzu%EzP3&XR^ci@J?@NnwLfShw@{~(`2T2Vk4slv#d5D7H#EX`1WP(KV4Mv(S)LP zwQse}tS@dZAFFMO*tL6yGa$Zu?coom(~Gy=c~c z7dAy(2fr@&n%INBI{~{?u7}!!M0Tb8NS+$H7Rrz1c@OoOZaV4eXh9>hb4`y@ea|`V zdem+-HI|15hu%}Smp8HdK{ND;G3J-r$virU;qgDe(!jmXdI_2)0($`VrY@S!1bW!3 nYVfB5JLthj-?=~?K0U7!KL11yE;?ocTHwAYB4_4Lsvm`aeyJwL diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_float_int.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rte_float_int.spv64 deleted file mode 100644 index aedcc97467e81c377ac54b9547673826839cd1de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 648 zcmXw$%}&Bl5QRqyqJkhI;KBvQg)!{a#AsYeSo#D_rPVZPZcV8qKA%368xzlWd!1xD zGiQFz%x%=V=$h@AS=UbWMMl=LcCejbcZ2Q84lGiIc^z8c$T1OU*J@SD&&=#c;rP=HrHQ>iwS2UCEE*&3j&L z<7H94B*n^Y%XL!crCX)VPRwDyODQr@tb^^5Kr&OjCkw`2bH)3z+yg!q(}65~>@t@k z)b(ZA8GNelLytGPLCArft7<6A9D2wtgu!_volB9sz|Gz8U#o^5e1sV{;$a56;xmgk z{L!B5a<6OIdnEn;M{?~s@EwO7*muCj^1<2VD_|$`!NHz{!84JC!S;Kl{Uh4BT{#AsMaSo#E$LL1VgnK7l1_~vd*Jm1ipoSyst zGfg@VJ+l)t>)BLaWNaNvTkf`e+VVxqeeuweSlN+2vVoC9r@YvNI%^77hrQ2Bzjbxv zT^{!9s&G~CTjfyGRed6^i(S;2S$h1bU{?61{t+)_lh4e%XeZI0MZF*OC+W`ZzRUXH zmQ`41)yf~jCTq&zSNU--`mp1pz}%^99dC01xs`n;#z%ZE`&`UT_$Qjg{nW9`LO{s7 z6tgq_nW_ikg+Od5CWh}`+DJ?vYKXnHbGVUN&&nZ=j*$PNp5(I^I(59)uXdvMyDnqL zD}g=$`BId7#sV?qQ$Fgih2wvwK8^cLTECagExZ>#YM6f`umk-*q+yfur)^(_e>UkT AbpQYW diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_double_long.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtn_double_long.spv64 deleted file mode 100644 index 531a51a022820e6fd8bb129ab18bb16aed0cb0db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 636 zcmXYu%}xSA5QJNPL`6VE;Nk(}!5HsoVlbQ}9DRZbup6?;X2vWFiO;7G<;BGMmYJmK z>gu2BUh1{`mf4A!wQQ_kUf*igh`t&9Y4q*rFXX#cSEW_fvyM^2q$J&hVpXQD2z#Go ze(Q?TyCm$_dFt}ux3Qe9#M`7o7 zpILEmi#)7X`O+W4W>sdvFO%b5%wfj|8M;HoI^O0o-dOROJRJFn;&XX!f*(kUyW!b| z9jP6u`ci%_BiE592X`mbm8Xv$a!=yu>&YfE-fPt2PV}a#p$E)k#Y$DUU*=3u;!sMi-J$NP!gwJwLfShw@{~(`2T2Vk4slv#d5D7H#EX`1WP(KV59S`)ESZ zy4tteX4V%smygvp#q6&=^`2l>`8NK@uaq-C6s}XAr+l8`VT$h+JGcF+d@*{a_^cTvH<#`YFnQl7i>S#eDvvW<4Qhm=k z?RwO1G&Poo2Z!EMx0g4u`$04Gi81Dv+Q~dRh~e=+ztX_H&w2@(CIWi^_NFeH&IEec ot7`D40z2rzN8hs;6F&b$4=y@p0$Sj{C?aR(PpTh zD=Y6_^CGTX=Bv8CquxlhWx6qZcrtJD+fuXCSLLVdQZXFxoz-!}Ij#L(ox76n+~z$i zw{DpiFLA!|+hQG8S>abnvlDaJ?@|iyM6nLGM=3H>yeA7rey(_5mV3a*Vmgqek6q?c zgu1>gJA+TveOTj7ZV+-{=c*dYGKU^=3t?~`N#|1JE^u=<{MV|X2OnX^jd+;BuK3L2 z4S%#JyWHzq_8v+9|B+mK4t&QU2lgGXv3ziL`3l&Hd~mQQVem|(aFK(D+xQ>gaFO%+ Z@*cc7IeOW5CS_-OALJ2J^Q-G_rGNa_Dh2=m diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_double_long.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_double_long.spv32 deleted file mode 100644 index 000c77b22dae61f7439353b32187dd5b2cd04c58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmXYu%}&BV6os!8L`6VEaN`2w!uSGWVl=EIEPaAWp$%!$%#cz@d~-J@o^R+)4(I;Q zxg}{mb71Pg~4>3++JdJ)Y`Y-aG+wY3% z=$2(zr{&5Y!zQhZ;8)p67kkk7EU<5)SjXE;!0r`ah{>UArub6KP2|U#;(q4PvJf!( zuEl63Kh<=QiH8DwC1PsUN`^VNrH6Lfy#dvLtx zp8J2S*X~y%OkEN7KFR#X z73J0?VZX{#mj}OzHBHsm#fx-jaAs!S#2bQH>dWFwb}pYe%)YJsnP?D!ziZzx~K+f3k%<)6u-vDZZYxhyxK4^+k7=MRVxEZg6_>&3?5P z^QO9vJ+B1%0N!Vu*B2+o`-$4MI6Aw0M{OXEj`ksqIX42ch)u<~Z7867`P{>|MWcp2 S`G44zns+gLa{hGHtMCt+d@7p& diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_float_int.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtp_float_int.spv32 deleted file mode 100644 index bfea8ad1994f7909820fb34e2b5fe7f18a87b217..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmXYt%}T>S6os!zYt`1)TCE!w6&Kac=1eWKUKjgaJX9Q8o|u{PiH(dN%CcIwp@@|W?YA#$|K&p5xX-37 zqN{z>HnYC8xniicDQAD}>GuS)%E$1dxKs^)C|svHPxU!_F<6_M>Q4 ze%G#xShs#v?me*we|G}=E>-KHwh%a1s*e=u;cKD#SdsV8pGkGn_3?s7xO1^bslV5p zb~Ac6VvQBip<(vi?ZpGTAH-o!&Vm1^o$&ENj*kEHD-V44MK8hAL|_l#ylaZ5Gl3cB oO+EBefgQ}yYDADS=Y|>#YWb$c8Hx2_e1O{4lGiKH9oYyQDZ}zt;#B?Ggp3!UMB@1i;HIHyhCYic*jo!hMQ zYU>t7`IZz*zb#iuotJ)@?liFneb;jKO?1|U?OBe^bUsi7LszWxp(6JIA8YDJkvX)) za*V#dBAUUcnm%suU2PC*V3+C|Dzb+eYI9+5p2%Z4_7J$y3IDBnm?6j5aVH*jpp~3m zyy35OqUBMyMfXU~9vpiOe5cB(VLt&ID+fo*cfih+gM+;YgJ&X#iyA!KjsF1-4>hkZ Z@4=f>V-~$LIhvV$QpTB{Ki%$L{ty3)DhB`n diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv32 deleted file mode 100644 index 8dbbb9ff92cf90835fb390f5f13f37a026775a06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 592 zcmXYu%}&BV6os!Xh>C!S;Kl{Uh4BT%#AsMaSo#DLpbcr#%$QP0^vT_rc)p>N9M1i} z=aw{i=$M_DS;xluSRvPaD2yxGU~k8aor&1M3+zOv>_2s8)6Es<8K2;kT}; ze_R&!>oRv`@LSc;(^h{fuJT>9*;#nvEx|1Jb@eS?$fus2chOIyKZ$lX+E22b+kF+) z!7a+LUX@FK2%A-11i#FVx|oB;M**E<`8wXF0`FG-nV1;5rt;6l)DjdzXbz&7ai12>(kN BD1QI| diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_double_long.spv64 deleted file mode 100644 index 62a498f4c4fd1c1195b8d778beb62b5f4673f6d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 636 zcmXYu%}xSA5QJNPL`6VE;Nk(}!5HsqVlbQ}9DRZbup6?;X2vWFiN2mblou20TV|4` ztE>O2mwN5CWp-p{EgS2X*SDHAqHjij9DO_bGx@I7RcV#=tYg$LDM{C%SeB_P!p(QZ(>hV{dM6Y-5QvknK$8v%q;a~@hLx7%pP`MSMg!*sKV_kcQ5SR z_9H9yZk~tLGGF+8STD;g_(gKi#T+!=$0;kh*P-)5#vF|I9{2Ty$?<+7cPR{ymhZ?7gyG@d#Iff}#x8PGA#NMW;Jsq*;oHK| UgHHY*w9@k`L`=<}u6maJ1FgU+qyPW_ diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv32 deleted file mode 100644 index 78035b365de634a09e94247ad5bb74fcbbb3d5b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmXYt%}T>S6os!zYt`1)TCE!w6&KyabIz4d17YDCpI#AD9dUc+9Fo24PU;j{fBGgk9%)I z5nb)0wwd*%%@x~flXCXgo_vrpwO?WGs zmEVSS5$oVr<<1j(@OLBN@m#eYY72pLq543P9=;Z;4;A6kpXsKfu8$Wy!kvpfO8uSY zxSP?t5^Jo84h^%%ZZB_Q_nkP*$vN=vwG%!*$kFkCe&vCCpY#$uO$7D;&a0+)IuV$0 pUerTB71+THJ^oGw`skT?ebMuun4!hTOu!4;XJyoI{^a^W_y?y2Cfoo3 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_rounding_rtz_float_int.spv64 deleted file mode 100644 index 3a0489c51069dcf419f2a41c361b2cdbb45f8a7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 648 zcmXw$PfNo<5XHx)wQ6f?t!+JcsCW?Zu7W6@EIs-Ome@oIgpH)JpkGfvlo!GGOV)+S z%)I&Y-fp7SS=VgK%(`~0FK1*eYX{#6emnS{{J8dE>Ds^S??vu>F zy0ZFoFL@DHF7s90-_dNO-ZEVqF+7Z|fYexV!=_)hA);hffSudZDvc5eNa zl^eIni|06B`c1KltE}+Lq|wA4^qtGlI8m+(+k=cVQ@$e)hOW8tU3q%J$70%(XAUiM z8Hc{UJet9$n%=MRrZxyQuv2vn<=MjwwM$`e9?0f0&TZi4-tb?khZ$lHJFdmU4zv=p zi#Pm{PPE+Vw&)(o{{N9edkTDqp$7IHu(4urw0s5ZNHI9rqcC_TGPtP0!`=8F;BZm% a`tlyUIW=a{JCmWA*?UFg^!(~}H?ltyjw%oU diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv32 deleted file mode 100644 index 3fe79826b9be04c05a4f777a4e8e7e6fa782183a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 680 zcmYk3-Acni5QWF4wQ6l^t!)*&sCXfL0To0q4ZZXUmY4=wD2Z%h!3Xf2y%9X$HUS4_ z=j{BPnc0n6w_URXGwa%wPGn>)YuC0@+r!%4$qppiBQ54at8v%KZ;SV2yUce*npA4PT|m_{Zu( zf9g(U$wSEN%Q8Fusj3ITzmE;;7`_{AbtVfBHN?=Tx)(dr?_O-=fDvjQ#7hmcfvMx| z8chEm&B%W|>tyDU6iyU*6EAb0ONk+`^1(Hh!bgmH=Dm>Or=D1oI}xVe|6Kk8f0O&I i3^-;|c!=j>;f?qM{P3~UrIfwkdlBMJ&aYnJQThj-sw~3* diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_char.spv64 deleted file mode 100644 index c84d0be1be7fa1b4423cf4ba8a58cf6c1684d62d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 748 zcmYk3%}T>i5QWG7Shcpb*0%mFDqV=US3wk4mM(pQ5Ys>lC6Sw0@Bw@>eJD4A=SyzD z3zIqb%*>gY+08Yj-Z#D9_P*`?rF_@w%Cy3I)-iHWTEtQ6!aNSL zFna=*FF_h+x@RN)))_qqVj`=3K@5!?p z{6JmkPu;#ec^vXO^2`oDQgyfB%UI9H;4ZY)fjm0Y5W}ujjb2|ik#X*QfA(gE8|6?3 z=Ad({Ug$6{7%l#1g_-F`bMr08#ueu>b%7 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv32 deleted file mode 100644 index 0191776f06b04dc72896ddc629fa0531091cb0dc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 648 zcmXw$!AiqG5Qf(#wQ6l^t!+JcsCe=PR1n3Jp+}!!iAlgf*hmrsK7jA+MezSN$--p* zotgiinN2XdnHY0mjG35AeK|`rGGXt>y+7>ziTvCIo-q<$n3*AmLYgII6*rl!z!{4l$X8kIF};e94%4slIP|)iYpQR>B25H$D!cOcz~46>Pd&aB zwzmGvtJX$E`5qU0*Op1#sQo_eW{lKX3ww>VG>?RLGR{`_V|ilCx6_?{*^T&0UFc8z zRGwL>-Kcsd{~{wdmnTQ;T3amS;lUw?J@(q{g#Miv)POl~?xhQdS-|jks{zyFS2OYc zPx><{9 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_int.spv64 deleted file mode 100644 index 3e2a68ffed634ef2357d803251926a75aad4d3de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 732 zcmYk3%SyvQ7={1dtXkVzYg=!Nh%0fgf>gS)bm5@0mvZs%=&?v$kF6%NbbRn%=g&-SM{L?Y?Z!8j7?Eed`)AR9Z#LGz*K!2>QI(C6#kLKo$ruwqSkw8trdG@`B;`lho}|%}cc3r6 zsTjLX1oUmpi8%B8k2%#H{Zk%t&IIz%6V>5=@?PlFVb^nkeW~*(#+{g7{h52=57jU) AX#fBK diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_short.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_short.spv32 deleted file mode 100644 index 29579f4e0959a8ca6d406e436e34d1026648ecfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 680 zcmYk3-Acni5QWF2wf?oW*0u^>RJ`&9svvr4=%r7v#5T}ENn{fPK7jA+jo|qA~-^ih`&Q^s_tIU;Y^@+1~ zt0J#6Uv7)sm7Bs>Qa0;~AItiz3_iVfo5rV~4}K@;W_jhm6iYM_+*9Eu+~aU(oz8U z{_xIZ&jk*3eOYEFJ{5Zq;!SSY=7`;DD|qO@AqSq?UhF}?h196Q=fHW8E*xgVhsVF$ z`}F_OjJ(IQzRWxl&;*<}>9XI2K#udO7+PZiJ#z4w_fjAZpWME7BAi5QWF4wf?oW*0%mFDqV?t6-04m=+Y+$F%7g(61j;1AHXNmhjJr$zVsHn zFqye$X3m+(4I0z7*_N5L?LuEp-x}8RzUBS4_xs+D;z7V8*YSI5noH_b}-AuLoCn#{qxp`U?y zLZRfYWKmSSEnO9btNb-y&9W*_;!^Un`FckBw0O-i6z7iOCmCm~`>s3~^G$T$lV>;Z zfmG0^??C=g#-Xkw&+OnMb$4rgo$L7=*rm3j4<35RVb|(Lw=bK>IQL$k-I(Dcn-=iY#)copC H-O2s{nEx<3 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv32 deleted file mode 100644 index 46ab303a2d3fceed6bcb9d1999528959692f9906..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 680 zcmYk3-A=+l5QRqyq9Pz7pote4FAOiBCPpu9xbz8{+BSg%TeB@BK7jA+jfv-5+Qdm_ z=j{BPnb{3mw_URXGwa%wPGn>)YuC0@+r!%4$qp>=6)oYR^^F(|X_gc&uCl0%t1Tdn zk|N(_u3Q&+v`tpA6SG-I^?|I*N{{KaS?w|XoX2g?o8^`Jk}uRm)b^y;{vP=I)Z?DV z3*jg#Ki6&-g`46%-YoN7k;IkSFVp>up*m|}&oL3_k?>rK%yd7N#m9Ve-A`oM4gXkO z=uh3LEO`ideOYG5KUMX>`}eV79m98{t`rV6-956!7gLtW7HZXO( zU4!ZWqZ#>+XPwMElER51Z{lU{b15<8RX(`JQuv5b&%75>{L~X`awo#{`=85S;BRuj jl>x_03J>uQvG7Lx0e<+{=~BvG@Vy9eC+Al$@F@KQqd6@% diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uchar.spv64 deleted file mode 100644 index aa7e3a205ccd4fee90cdea50649bd2ca7c607b9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 748 zcmYk3%}&Bl5QRs6L`6VEz`q5Cg)#2c#AsYeSo#D_ElnW7*0hDh2k^=Cq1>2wzRPXm zO{R11nVB;)z17ONVYX#v4LjGD)3u7#ysvw|?S0exOZm1{m1)j8)-rNXn#EC?g+(0X zVX*?tf+$Vaah5OABv?iBFmp9^)mN3D#kqm$xtwn>eKUt^PB%`9>_gl{S@dKM=AHN% z1`an}>`FKY^7loy4kpX=HC#@UbsB|*+D~Vj8L89aPNOf)9pNV#XQ=zGJRI|lbl;O_ zH~5~q(4V?}dGa{qwd9!{exT~M<2SL6kHKANs{?s-s3C@3s~WwoY$W5{`~K|B3^&T5 z4$ML4R=v<+UNBnx&k{4!kLKo$9`t38Ls|KLg7)Hj_k0ZQ+jB?4@XYn)xxO$w+_N}( z@(%PRMjv(^%HZimtjs+YX0HFaC%VIzxu42F<5Y$Y@i(dPe|bN6^w|AO#{TF%3UMdr JSAXhG_6KqIFeLy0 diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uint.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_uint.spv32 deleted file mode 100644 index ddd4d10a981bb21d1cbc2fdd362c3771d27326f0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 648 zcmXw$!A^rv5Jkt*TD7*d*0wHO)VT5o)Wm39NxJk42m*;D2nHyLAK*W`G4Y-UykwaB zX6D|Rd3b}HvDtx{jqOrj&cX&Z?EI+nhn+u>pPA{MR=G*GdzU)SPsV?*< zek#wb)UH)Mm4A_uo5_?4fMeJVjcGo^^~EDy^b0&4MEG^Pt#3 zR(_Z!+bGM|Y2t6zNm1oAmG3D&i*ke0Gk&W$eY27`%DPcfWFOKNilQfTFz>?6Fe-Vw z^xcU2e*V7Bw*DecUxRp=Y|}6()PA|DW+YFGmo_p%Y*O6s*^pUc=vU34nPZl5AwYEBzr4Bjxz^x+a+ZQGR=h5|N@0xI@81mp8 z>fEarb(j}UE&k_@)AvVn^F}j$+2cf@Cg8ld-UD%boNuR{ilZ~vm(zyg=xEQ<=*c_K z7vD^bUB?3YF6K;}dH%yG{@4>=bCdFYAi@IQGkbn39{rNF+_c@pDJ%&-2;gYXCL CW-s0V diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv32 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv32 deleted file mode 100644 index ad44b06fa115f3c15adc6b8f6952b780972a80c0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 684 zcmYk3-Acni5QW#Iwf?r&+E&4fidVjX3Zj>WUit(}Oad*$L^f%_2k@P}5j@`}0S8Xz z|IAD_3~oop>=|Q5=1N~=Y63Ip^sv+WonAU`Vs1ba9>8Dz0}JsZGkF z$y~K93%jc}rK?pYc4LO(2&G+Cd7F9prnQ;rygl&TSy8($#UgD*@3C<0{m}dD6e&vX zPO!H6+`7g_dHEja>!K->xYi2mwB0k(WF74}=Hfh%y%Lb6{6lGC?6;DCB+Y%qXPUx% z`c9RQ1{r!+uWqf5xdb<^ua?9Iq=lY;tuBBi;Ws=gq{cS(!*}p^zrX{ zoB2Q5kvDnPmz}2qoB(+fFZZ1bz(`46%1k9Y&(@Nv_nz+LdY$ik=QSAXD9_yY`EEx`Z) diff --git a/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv64 b/test_conformance/spirv_new/spirv_bin/decorate_saturated_conversion_ushort.spv64 deleted file mode 100644 index 385760fe9f9195d1db4955763ba6b21d8cec8135..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 752 zcmYk3-Acni5QW#Kwf?r&+Sb2|idW*j3Zi&r=%r5(ViIT}CbCHbK7dcA59N*E`H~H| zFqzpiGiT0Zz0PIdmxsitY?HzeGdEo}F|%zQcWdq>EA59cUscRS3z~hW z15LhAa#yk-DBf4L3j8#G4bw$dT(x>HXj)^$86hFy0Gu^l4!O%C?eMg@C zz{i@xeERm}4`dwb_T|wIK2`Ui#+%&G<-jhq6@Bo~Lk_!EH*-g_xr}q~=Cd0bZd5}b zF$bPo&4LHL#BlLH+Zath(#<=GOpf#Iup`Cb==yTlL@_wnvoL1z z4$LLT9Cn?_z?nm?tvyzZuK%?sx`Vg1pQ?c4R0a?EH?i=4c|UOY*!@h#{_s62;!e%4 I{?wi95BuscuK)l5 diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spv32 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fadd_int.spv32 deleted file mode 100644 index 45e6f4f1053994c5511cead0afdf72bbd65fdb3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcma)3O-sW-6nr+;YGYb!t-W}t2!a=nDo8~XtWm))@Vdk_+CZ9weAKHy+l%1Lx(goN z^7=k@-pnL%8hb5~B@t=K5dS)r_t1Dg8cQPw=O|1g;1PDB=>?1hy;eb8o)N~O$ zy8rdCt!q!;9iaY?55CC>Hdc}Ap2&^Sq#tSy(61qn5IjTlZDh{qVT7JO$isOb9@ov> zLnaTgyI|`e^Nw>Hr)HmAI2=ef541dJ+5u8(>dKSBdnmT{61N59*?5EMlFrs%vKpquY~aBW5;foBHR>+o+A@c|6Y(c`hjz^?SH|bXOPmE>2u8&N{E1)P1I{ zzI*PpleCrflGvYDLZXBWe4EP04Gv;Jqiq%wzmV-GRsKN`)Jm&`aBnf?iV& zsOhtlcjPV_s;HMeE_=Ky{2w3ODEukq;k?;pz7s#}tg4KSEp=`YH2Iq%OZqYHma>J??4(GPKy^U*?MUkqlrdk&lfZDO8pA27NBpwim&fbr(Fk z<@J5+yqQVjH1=8|OCr*eA^v%K(vW47n}WD^=!k zQLBqZoK$`~NwU`<@zXjBwV)4rU>)r_TU5HH?_^f$npy?w2@rT#*++2Z!vTBFsp%qi zbpPvNTi2exJ3##(AAFM&Y^);JJ&_xuNk7yapkG5CA$W%9+sK^J!w5Znkcaa=Jg%F$ zhfE$~cfr;{<{jrYPR%~K$Z>=XV)(9kxN{68;`xnjOFVCD>e|`D=+30sh?z~=mi{>lHfm#e9?$bco{P#e`aRw~x$DaZ7bmV8XYIFk>ORwE z&%Lx;N!rZ1No-cMaj$&aYscp|`~B?2Y|aW&Hy>r~M3?&Yy_t1fD-zTM!OyH#DoCa1 zv2*=iHyygOK{v`8aXm_&n^7YkCN00PA$iRfy!T{~d5r(4)AyKNsc>BrdTHBL&}+y6 zHGOvSj@(6E74?e8C6D)n|Ko!jg+HY{Trj)JcjAYg71h(qH3f%yM!8C%v#J^&%;2G_ zdR7@-`b+X$%KLN5=)&KYdRdug^g|rye6-Lw5Q7=+o&)Dlo0#X@2aImO`2H4SUil>V zr&sg-?xlyU5LZJih@1#PvjpCcTOLF_zB!qVe|rbO&DMF o19x4Re&Bvd9ZkLkx;zhh8^V9}HdV8a{;7D>@PgKlZtqC(3-OUeg8%>k diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv32 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv32 deleted file mode 100644 index 98adfe9c262528f0655ed7c8dc271ec3bd8958e7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcma)3O-sW-6nr+;YGYb!t-W}t2!a=nDo8~XtWm))@Vdk_+CZ9weAGYSkM<%sv+jaN zx4gcOoi{T{oW@>DWJyF?GQ>YmPa3jpa?|7$4>9e4e)fKMLyPV^PrlkFhL0fgFlgT&jE|8Yo*FO zE*9#dj+4qyCrS1iB!0TcLM`Zn9#}_v&gx3n^qtH~T~n(-Jplp_EBgq}d^ljwIW=9x zj_!XwZ0p+7cL%8d@L_k$h_m+#;MsS7deiwK@8tD4|k5CL_EK-t;uU^`uxI17kO;_ZJ;LSBlxI~ zM-$F?t}r9tCW1V?8^a%QeFW#!r=G=bp{CAX>;OII7W-+m_%6xAd%MqXLq6`G0mq&= LyZeo&KSBHePZmK8 diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv64 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_int.spv64 deleted file mode 100644 index 8918eac260995a0fcd12234b7f52fdb6ddb1a3aa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 824 zcma)(OG^Vm5QJOfGcm?jd>38C@>%BqtY&L5Jshf|AcA`uD^47|_t{n+#g5YOXFBhaz z^4PgSzn6Zv(_t^lnsFmao?1~e{z%$>VN>#&EqL$AF!LDyQFq`myHeqXCiK#_qoCK6 z18Vy0@12XozN&&f^pE8q4tGu;fA|U96=C!OcU2f) p^aFQIn10}XNgYkT1-d*Bdh5b}^)^(qkN$~x)bN7Vk8bZ!@eA<{M1}wW diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv32 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv32 deleted file mode 100644 index 595c92f73610f41a5f9a261f0734d66db85f78c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcma)3O-sW-6nr+;YGYb!t-W}t2!a=nDo8~XtWm))@Vdk_+CZ9wB#nQ-AMHhOX59sk zZh3tlJ8x!^IE}rQ$dZV(WQc#Bo-}0HxbX==v%JW4O`4$EpP(h*0`8sOLQS2&*a3RZE%wuB@m-RK_jaG(hJ4&V1CBj$ LcJ~`ke}eb{P?|vv diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv64 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fmul_uint.spv64 deleted file mode 100644 index 6d19c7dacf3ee1192b53f77a1fda3a051ebc4457..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 824 zcma)(OG^Vm5QJOfJI45m??Xfoym(YWl%QaY3ckSW5MwlfbvJG{@elZ;y$IGf?0`on zbh^5?tGaf!FuF5oHezOzwxxg0f{of(p2zb%k>{fFjDC-IPwx8i!NrN|###HVox0Do z*>f-LR+2WeZW5anZQLv0_S*6J&3-?7F`Ki3)Xhg(JJF?neQ#zR*NOx+LGUxHl?qZR zdhA@k*G-4+Y|xFeMqH1Q=VsK1he^vXY)D?S1@Ao>WFF%`>hwKkS1MfBgkIWq74#Z% zKuw>Wyd!r}S4F+zamnL7;s5yHM&VB>4;Rd?@}2l$XGQh2a!tXZo>8t+=&Y*72Qzr6 zs-9Iwm;RDGm-7CcGP>}$rCwI%8T}B)IUg-F4#Z%FyXU|;)F$Tn_5q_CFuuRVm{&f@ z{pr=bzkBK7bx}c&^Pw3$Eh*@ys+n2Ndl%xcucBZN{S*0z!=2N|AASONRT#a%T@%I^ p{lHxprXRRpQb&_-fiBO3-iGjBy-n5Zqkk$MHN2qpquV=D`~vdfM27$X diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spv32 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fnegate_int.spv32 deleted file mode 100644 index ebf4dc420d55fa729057b20be39fd1c00036db31..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 704 zcma)3OH0E*82n7E)yA~eTD^Fv2!aSbsvs3nFh&Jm;B|>o}?W)Jw9rAo0_A7HUEt@R+r==B%!COx?+>)G@gV#2zN_v2p-o&BM+reBBrEp@u!q zkl%sr>U^PxcjJkxdxwbsqlveAYdEQgoI~Vm@FN({k;yxYRCbV)n={lgLcR`9EY=6m z>6&^Mp17Rd19}ghJ=PmLGyB9M#xXWH!@K9<&Iy<}&wt*;#BE~g{=vou{KV+Pm1%uX zz$5=Aj5VHX)QC5L5r@4A^l@$r#ya`Q_l-B}{15CkyF$ui28ns~bxffGG&E~uVRY{)U{isCwjY$w$4V@s+h z71=@8y6T!D*!1htJr(-XitvE9A+{Ms&gd6@81}&eV^15*@GUTQ_Qk|J|Ait4x5&B2 zw>I?J>?r7)Qx4{>@X%V9)5G31gQj^o{Y*783!!(W9r$?1@X$Y!es-4R^wEc&uYkpO cMOx!O{ZS(B?K&mq_GJl;L2>&pj~q$)~^@HNcTdlpR8 zC>*9)P(*1W;!0IB-cG{g{ANEdMj}mdbgu%Q7PQDm{PGqQV>OHcF~Q&?a@ugf;%cl^ zK8doaIxC~N@DndipM%&>rs+@%`k=?Gqdli(p)q~O<6L8EWxyUL@UgOkV9$pG*6dT$ zMQrH$*TbsD4ZXJu{2w2@Ne?IHk;}HomC>XhYIadCAomemd#0`fZz6iA>4P)$)JMID zOkVao@Z2!{CNgWdwU%7wD0%gCGz02JpwZ6$Ja#r=Fed0#oPjEbpIvJNs$0dgyVFclKd= byl--I&vLE-Q-ho*m}AX3%lC~NIYRsZ!qY7FU|{uwmuF|$GYr8jHRdaW<`{@@3KFUybU`FHu>ot^x3Y35pK(Y$Ns z?m4fw-A%KR<@KVKrDkR8_sAFRW_onK*(q+!#;hcC^ENI{aLI2U>czclBns7m@t7S{ zNq#wr${L=qCV2Ihy!NbH_!#}keaFXe<%+B7(4lQj zMy)0V6#6FQ#l1$|SB!MqY4TBl{ySdZ#K(~OLIuAH9PP&?KPeB3uY)c2&HnRyv? z^r0utE+_^s&MqoO7xg&1q?me~eHA*G%QE)3{#no7; zd=h1)I-5pu;U`|4J_oU%l<80l`k=?Gqdlk7LSy=l$GOJT%78sg;A3S6!JZEXtl6ig zi`dZhuZLBQ8+vaS_&+{)lO9gYBbRNFE2Bw2)a;^OK<*>B_Do#|-bD0J(+6khsgHUQ znY`?G;JIP?O=R+Nb_?t+WbUzV8YUcJ|X~_0Z!U@9e|$ bc;Dpap56Y7)@Zi8#inG2L=D7z6hS* zbO!q9EO+n6+bv7cG_9qDtcLJR0+&H|Y2Bq5JXJONwUNNV1z&(oBb0+Y>eguilc^o;?;mMt{;B_!zESaYG$C zw0)CNYf1q*bvQZWiqHRP`0C@T-}|okJvzA2h9<`4hc&a)z=<9>=ahevKa#P?C*f z(feNy+ZucN>;U*bK6sNiW)3}Y&IAgp$aPO-fU`B=5rS)oeH)oIdKh6(AJk#J50C4n z?jci?++8Slka@YfdJ%6F2i##^|Hh`)52tCfn zrwD6YSEx~M6G0uGjp2{HK7w`5=RC{Z0_L2*+yVBiTkfZs#k->p&uu^d4fWW61|Ik1 L+1_t_{R!d+MUFuV diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spv64 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_int.spv64 deleted file mode 100644 index 4b67f27f27abb58fc9f0c213d4f9c95ecc3feff8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 824 zcma)(NlODk5QR(Qni%62_d`Swym(YWl%QaY3U1)Fi7}eMI1?umz5A=Z2)?hG29Neo zsaMriuU=OQquY~aBW5;foBHL<+o+A@emwURxi85V^*!7^x~q$O7bmV4XPwth>ORv} z-#vHQN!rSKNo-cKanF3y@5E=aU)8eT2V9pNZNj2Q}n7WcA+2dW||L9<&m-!qtFbBRV`Qf}-Rd>_Ebs2}aC|@JcSy7A*YS2(q zJR=V;`9*0i=lNNAX3)Q-NfmkS$Ok*h`{9CPUmeu2dk#GZnnXSSeZcSr%p1PdF(-eV z>(f)bzB}=ubwNgs^R5~+Ey~EJim6%3bLZ+|URA~%^2gFo4?8E1KJ7@2W7m p$cNrFVe+B(OYCs6dw97IeCxu0`8E_YkNk=Hi0KPlKib}*>=)-{M1%kU diff --git a/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spv32 b/test_conformance/spirv_new/spirv_bin/ext_cl_khr_spirv_no_integer_wrap_decoration_fsub_uint.spv32 deleted file mode 100644 index f80ba8afc62069094839c1c89e450abc04ce78ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcma)3O-sW-6nr+;YGYb!t-W}t2!a=nDo8~XtWm))@Vdk_+CZ9wB#n1}wHLvebr(Fk z;pNS~oi}f?aT4>9i4d`?+i+aRw^PrlkFaZRE!AIoWbD-jCtW=rD zMXfFtaZ>r|B*|Wb#82xi)B}CUgX?I|*`m^zzLQz0F=rLP6EN_xvX5ZRhXd|e=S&x| zqxZiawl((j*#Yo>eDEf3%p7{)oCy?Gk?Wqw0B38!BLvqF`!+Ib^f1DnKB&WbA0F3D z-9x4(xw}yAAoGlM8>gn9TGTi~2RXcJF7_N_68Zec7E{+^dj3L37kO;_Z2(jA5qg}D zPZ8F*u27@iCW1OV8^a%YeFW>A&v}-+1Q!~stJjsn=+30sh?z~=mVP-4Hfm$JAJ6?n?u+s>`X29|-1X&yixbz4v-Vp%b)RXo z=U&>aByDEhBsMGBxM#lYwd3=f{eJdhHfIH~o42xN!b|-6-po3#6$z>W<1?$33SudG z>|DRsO^5Dm(2cT2T#u6HX4Hs>Ny`sxh+ee?uRR%L9-}|%^gU))DqL5E9&Niaat$dU zCeKXX$S&%Nh*vx=dAuk5A02G;DxZS}=D;^4KU^@Y=x$oLCgTv#$X5w;Ru!Xz8Z=ZD z&&tC~eo2~3d45iw8T4;!Qdyom^1+Vtez@Q`PzN>aoo%z#|PVuywXLpZhW%Xv(wb0c9?f2wG zAN>6zsTQ+xRf~s;w!U~4^U`sA)5RZ0Q#js|gV{W*icjHGiVfk3g8o>}P~*&r za?V9heW01Pg(L0m2yYeibcJ|QJCbuxNFQ|{SB)3G_?=5Z5AVl9b0J^)nbC86J!j@` zDR{SQox@DK3Ov2fvwWGq-|PwOUNwC86!@`+o_Plf>gahN-@7l)dH;Kd%BlO_FS+5t ZzrcrmuOEwZ5A-+cBd5=6fAk8MieL4p1yKk=Vg%7A5GzB$c4b|J9{X(dp?V2Azq|KB z7iQ7PTdN&=5x{KlF!RNSClJOa+8mSZXQZO6ES^A;e)5MDMv4Z}-l&Rs- zWTyjHN3L!;TygkBcp(2tx)}7P$@6g9j~B_yFq;fpu_txzbDN1GJm5!YWl+LuWsv7@dp%< BDCYnG diff --git a/test_conformance/spirv_new/spirv_bin/fadd_double2.spv32 b/test_conformance/spirv_new/spirv_bin/fadd_double2.spv32 deleted file mode 100644 index 7983bda57f8af200e72e1a5aac34204d35bf4784..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 684 zcmYk3PfNo<5XHx)wQ97r*0u^BDuUp}qY9!3f~6vepCCl7v=Eb$gn&oCwHLwn+h)Oq zxASM`y_ww&8YgYDH8X45p>|f!8n#v2W^G%wU6&25Ho%lu1rBF2X7sX+Zy%EaW+422^X z2QD5uKXm??{7C&5c@<5P>@`lNX_dXj|WACe=UDN g-q(Ih4ULh24(FbKAfJ1{zf~PEb)NgHSGW@X04NtGZ~y=R diff --git a/test_conformance/spirv_new/spirv_bin/fadd_double2.spv64 b/test_conformance/spirv_new/spirv_bin/fadd_double2.spv64 deleted file mode 100644 index 33cd29ac76ccf2ce7d5d5005771fceeef0119f29..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 752 zcmYL_UrPc}5XC1~v)a``1au}%U{iE7HHav zs7sT6>bLh{J|1MVx$;0!(I4$}lodJp)A1r_CN1)^6wF3(o_+}XnphDYE9j4;Obw4F zJ8_4;D(ZHThedv(d?5cxIv@0>$@6d;#q;E4m`{>8(%!tly;RX-FZ9`?rD|2!Q}A_E z^EPmJbXDWaJbY6-tqa>a-4ON^%+!R`yah9LAs+CDa@rI!2k+xl9r!d9T?OBj^TQj@ zbM-KXE+0A<@Yg-Q}&cUQCPor_r*0H`}+s2k4>4rGzOFstd(X}I}pt?8+p4n;7V7IpO{KUT+<{JD(!iO9s{VaBo(7Y8mL zI2}8EA)RXeyjrE>ynM~_NwF&5vU*+?6Yb3}eiRiRd%Ub>~tW5={YarvVXU^ld}iq;2z50aYsM<_GIMgXRfb3l4joj+P-4)zV=%*82lG- XxcB`-X?XPCsg9UB-}|dqxR(6^eqtrG diff --git a/test_conformance/spirv_new/spirv_bin/fadd_float.spv64 b/test_conformance/spirv_new/spirv_bin/fadd_float.spv64 deleted file mode 100644 index f06cef0b5b0ad26fd36141dacc97815a3cce93b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 728 zcmYk3UrPc}5XC1~v$8TXwSNyr5Jb>p1yKY+vJpg|K&%XfZI#_c=&{dMAF7w2^Sj;) zT^Q%gxija?UZc`s)oj7cs^{d_tTjuaLBqMZ$MhtW?)bIeTUa9Ijw!?egglzW<3Qa)19A4{1U9!+-I zcXj0Iw!<}tkA?g4A7`_EFPS_Kk~p1BUIxW@lE&JbFTa;6dhCThd$d$7E8i$M9n~w! zaCmlAEiCod$P;?cXORtX?9%t%djyL6? zb1pA5*gIhM518-x(FAXKC2#g@D9{W#Pu_de-znL*=bFOs?DgfjEn#@LJ8}586!>z7 y58ujv0FMv*h2D-Zd;Ra-Rt+C|Kc$AojshL-!~Cu=ddy#|kD9(P`>WTwQ2YUn+9;j? diff --git a/test_conformance/spirv_new/spirv_bin/fadd_float4.spv32 b/test_conformance/spirv_new/spirv_bin/fadd_float4.spv32 deleted file mode 100644 index bd030e105976127b6ab3fe310df7198c3c544709..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLcyc|+Kb?P&pa@& znc00iv-^@TIBA=$nOWNo_2%hWV66tD2G@nLMXvK{nHP7D=T-e?*0Ipl0-bl|K_C46 zBde!rwOomZib!uf%e-he=KmSRJAs-S-&XL9Oz#)>1Chb|vF z9y@*}o@)NAT&3gr;w76;iq+yZt7nU1qP@BCgIw`rFZ|hKplnl^D0oK7w}jM~nJ8y2 zdg^`cv@IO!bVryd&~$|4c%$hGnL+(nlXivZsQb8XyqSalg%tGgJ$cYvY7YJQdXBH> z+~HdazT=JNuwzewr}uf5FZbDN&IER^8oqr6ew?9a-+cvj^z7h!2ja~8-^)Ls?t8!F chQ~;O59eNgAkIC|->Q$CKCk`JSGZFA052Q>Dk0v{@ zdtViGr^stXeylu_|0JD9{b}+%oDSl7@-oaPNj%Wr-27gu=&=|2?9o=WD!ftfbycqk z;qVAm`X$bLvKa|s^kU4lCC+fhbsR$K(m(CAwJkQj_ z9B<5r&bhqNz{}@&`J8+GXo9!Bk~e#ADbVyfPtLpL&II=DxNYU|?DgfiwsLs5J8}5) z{`hi+4|nY<;PGKs-@BuH@!tQvyW-$|@2Awz*i)dxxu4%x&VBK^Rv$Hee)d5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FQk-YcGQHJrgjn zncaOmv-6(sop#MO%&coi`tuFUvrdCSgPRR*3quPW<7t)VcaInA>dmZYzUz59?@Nn$ z^7oIVTEy#Bt=v}x`lDT@YnP*+E&g&irOP`~FiZ2Q{1nc`*b<&8n2)4PO&`rraqMc} z)nk{3Er}xvQN1Ii$Ihv0 z_QIz>l&4+cSf_i!eFZZ;A)53~q}&%WN574mMhji^F2!Jm_v3?eC0*w6*yiZAIiA18 z;N520gC{(o+3Gw?7ypCiOknrwp?jb}kF%M!;CHB?-_9H=XV3qck!t#1V#DF>;n8n- S6Xp1ZcPmHK%>C%L*NR_dktL`A diff --git a/test_conformance/spirv_new/spirv_bin/fadd_half.spv64 b/test_conformance/spirv_new/spirv_bin/fadd_half.spv64 deleted file mode 100644 index 12a145005a2ff7455e07fb06ebfd954d4c705068..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3UrPc}5XC3g&C1fu)c!pbLJ&cZ6@(E4i4jDfV6ie3wpDf)p~pU3eW+f7&hL5` zx-ia}vvbbOy#}Rj#cavUDz>j*PQyx8_Br%<+2^XytIAaio$_%uN^T#{vi#MoW`We^ zqApK#)Nk*@d>m!7xp1He^~;QOlsU|tc)Y-9QiscOFdHR#`k~yHVnz8_LH|I`)bMz+ z+kvYCSGOImI(#A=Y5pXgNBwyEJd6j)eEKrXC(~r0y?KFqx#GuO__Ie#6?eT+a5}2j zl;N0psG7Ox;hWlNUAe8V8_JssdTPpe!X3%Eu1p_%5vS_FccBr`x$^$ZV#c|8(D9}m zd@eK#5B4rFvkJ^Tex%?ndz#Ij4F#Ts&y%0M<-aM}x96I|@a*;Fxou&1xI1yoZz-6| ux1P4)uKWk^MNdbVeg60CsD}TP8qKZ(9eknN6Xt&CuC+NeeZP8@OT`~Fp(v67 diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_double.spv32 b/test_conformance/spirv_new/spirv_bin/fdiv_double.spv32 deleted file mode 100644 index ed02f3fa5468dc5dd8ea162f3cf1699cacc2e89f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmYk3K}*9x5QWF2wQ97r*0vrzR0P3`M-@a71WQB^e?f^_X(1*h2?76sKiP}m`_?SD zFnMog=e?cXgu!vgY|YF%cAzh-Z-H$!*lMud;JPrfwo^Q<=GoojSy{cAbuDzYK>Iy; z(FcG3NUFuGT-D;CqOC8U#k_PJ-*oZE(G-ris^U{Pm10A9qM$#PGdXoUBgLW1 zLzj;nj~qW0pXvN%QO~An{*t6|R_Cutwal|vb93_tx#GuM_%p{)*`{!!V2zdYCe%1{ zqMUQlQy*xiZQ)3}JHlH9JzXK5)Q;rb6VgZB$5rEnFMj7z(8K$&&|JuuerEI>U(cEO zTMFLoTIVp+t^!Z*^DJNH?>Bn_yH^e0Jq3R3p=aKKf;xKM$M^1wbKd{np>pcJ_e*Yg a@GtOT-|NTX+yniM`pD_?+8@2brQ#R&nkEDQ diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_double.spv64 b/test_conformance/spirv_new/spirv_bin/fdiv_double.spv64 deleted file mode 100644 index 25847af62d683ed27627215550f59de6191f8e8e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcmYk3?@9tu5XC1~v$8ZZwSOOsAc&xk6+|Hfi4jCkAXbKg?aI0cy+Q9)57n2T^SgU5 zbYXVRoSivm_HI--Dw{2tS=sjW_ z%|%U`^i#jR53})LK3fP!ijtmar=z*U=ugKvW+rvGC!-n!xe{5ga`7Uq>DjsnmiAu{dkeQ46{iR_q8`Sa4%K#*b9C3XsTLO?kYHK z)!Ypno*mWrG7sO-PV34oz1>jmD(I;yqX~B?<(e{m@F7msf$pZFqu^Y5eZ25ER}XXC zDF>Ykd7;7H0pk@g-|?df?($mR`M=Hg4?0iYdrLia1?Ssy4Pkip`tsbiFg)CyIQ*Lm ze0hft-^xFL$A`NOy=`Ik`ro^w8b0)XN)3%&1vR0P2rFI5ml5G)lze1Z_Q(n3s15(2(~kL-=$`Llie)7~5L(*N%x8u3(M{$nA5QN4rWDL(X_sG_A6?xLjoERC9ClN2#L6T<9~$K+&e`SYVA5^Cslz zIaW+x_~iSVXXe)4H&&(+y!y!Awm^&08>27vcebD5p&!bMQV+)qzh#(N*wWIX}Gd zJXa5M=<=a+A#XIehtKiyIrsX}1aEsSZ}#3&py_p&tO1`{H$@K5F{>?5|$y GQt=038!2c2 diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_float.spv32 b/test_conformance/spirv_new/spirv_bin/fdiv_float.spv32 deleted file mode 100644 index 5e299e698d51f48bc595526fc8647990d6524e9d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmYk3!AiqG5QfJlv1-&>Yg-Qhs|1?_G?`HcJxLiy39Wkgw ze|%>3EL|>E(t#|}7iKkGIt@3Utu;NB)1e4v)1t1vj=Z;s=ry}~&CWmS z;N5ODhn)^&Fg@o*T=wracXIZi9Na@0Jnrac-=2&-{mk{XN7BsuU)xtq-q(JM27~_s X4)?x)C=HMPJJk_W=X-zk3fHnffIcO= diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_float.spv64 b/test_conformance/spirv_new/spirv_bin/fdiv_float.spv64 deleted file mode 100644 index 33f1b29ce6812350fa401716cb21a7b7e1180a51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 728 zcmYk3?@9tu5XC1~v$8TXwSOOsAc&xk6+{sP$wm-8fmj&|+bX+@&>Qq#^-z5YI=}0^ z(1mf%oI7*Q>@_MKR?Qa7tZIAu?qLTKFse5qsRQU`l#s(v%h++3&kIgwkV|l diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_float4.spv32 b/test_conformance/spirv_new/spirv_bin/fdiv_float4.spv32 deleted file mode 100644 index 3fa367ff23ab006f81a04bbef798a6112fde8d2c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLcxFFPxc}>-!l&k zY-V=f&g{M<3{Ki+Yi8EAL%n%=7FesnsKIq%Y?14HTIR*w<9SuTnRP65wLs@xdC&)c z|H$fTS}j-Np(4^7&oZwZ$9F#c<7i69TXHbVi@N+2j-}WTo+{{{$eElvp0VP{<)O=m zj>nFliKm)BD_7}wzIe&zlVY`a&Fa~rm}qZq{2*8S*b9I57%1BmCJLUB@+~1XW+uv+ zi=KL4J8cVxI^7W_3N#%dIo@cxLS|4u)}&n_I_f^I8*k>|e<1}ud`})UmzqOAzMkXj zId}M$g70{vIqcX|;OTvy<;#8cnlpjjtA=l1fgfk+*>_(-9X&hv-hnvt{`c|^sQcb8 cx#2NV;KRAsABb}g^tb9Gr_XDD^cAiYzqD8;JOBUy diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_float4.spv64 b/test_conformance/spirv_new/spirv_bin/fdiv_float4.spv64 deleted file mode 100644 index d174c49cffb3efa5be3604906fdde1ccbd87994a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmYL_?@9tu5XC1~v$8ZZwSONrgdl=GRuDxHBt{TD!D3}7*skm@LT}J})kF0q==|1u zX<_!voI7*Q+#8g7RkI~CtJ;D7d`&A^*5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FUgwKiP}me9r_7 zY-V@g&g{JBd#7Eq4KwT7k^X!G^Q_Zg(BNi++rrQS$9P($`Q78ix_UF~neTd@&im40 zp8WkIsTT2iRV()uf&OTh>DuM!XN$iaPU-TF6wK1RDnEsDF}8$f3g#mzQ`1K?R2;k7 zclFriq07&e$J)Ov>v*0OFG&{Vb@7^1%Oa2Do0~sK6+L{RkB^Zm?mAWQO;qm)>9KRF zn!WJp59MiBIM(T&a9_bpPlzVH6DjwF%+YV-rqMzdy-P8e;r;mFTuGOCJhnNyZI0(} zF?hF`_TUK*Xtp}f(#8LvITP5udgvY~(Bo{TE%+TO=(jV6%GvXOW~7?_m)LN4dwBF) T-b6XR;oZs+HFH0@?X}_;XEi0S diff --git a/test_conformance/spirv_new/spirv_bin/fdiv_half.spv64 b/test_conformance/spirv_new/spirv_bin/fdiv_half.spv64 deleted file mode 100644 index 1c52fbc1e716b0485b8eb9601b80361608eebccb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3?@9tu5XC3g&C1fu)c$=agdl=GRuD!IBt{TD!D3}7Y^&@pLT}J})kF0q==`pC zp$p@jIXmaf+-p$kR?L>ntYZ863J3k>*d*dDM@m&%=0-%%?BId@@Z2+M5@+mn(kkg+F_=RB_iE1*fBW zO&N}vhpL&29=@ra)|K1(x}m(Opr@vcC)|;o>&o=O7jdc%d>0x4oh$FpEM}am2OV$9 z!RJD=@L=x(GpoSd<3|eKvZvYX*-+qF_&oX9TmGApeS5Ac49{L)p4%3Nhr1KU{FZ{b veCuf&?#h1vU-Wc@+2?=Hj%xT%snP5z(7_kFJz?&L?pm8u)Ay@axm5fCHbp3z diff --git a/test_conformance/spirv_new/spirv_bin/fmod_double.spv32 b/test_conformance/spirv_new/spirv_bin/fmod_double.spv32 deleted file mode 100644 index 17dd5a3f8fdb6387bb1042442cab017344af2686..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmYk3K}*9x5QWF2wQ97r*0vrzR0P3`M-@a71WQB^e?f^_X(1*h2?2kE|JRG)`_?SD zFnMog=e?cXgu!vgY|YF%cAzh-Z-H$!*lMud;JPrfwo^Q<=GoojSy{cAbuDzYK>Iy; z(FcG3NUFuGT-D;CqOC8U#k_PJ-*oZE(G-ris^U{Pm10A9qM$#PGdXoUBgLW1 zLzj;nj~qW0pXvN%QO~An{*t6|R_Cutwal|vb93_tx#GuM_%p{)*`{!!V2zdYCe%1{ zqMUQlQy*xiZQ)3}JHlH9JzXK5)Q;rb6VgZB$5rEnFMj7z(8K$&&|JuuerEI>U(cEO zTMFLoTIVp+t^!Z*^DJNH?>Bn_yH^e0Jq3R3p=aKKf;xKM$M^1wbKd{np>pcJ_e*Yg a@GtOT-|NTX+yniM`pD_?+8@2brQ#R(?j{KU diff --git a/test_conformance/spirv_new/spirv_bin/fmod_double.spv64 b/test_conformance/spirv_new/spirv_bin/fmod_double.spv64 deleted file mode 100644 index d0142746960eeaf911e0998b14f9d6fcc837d3da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcmYk3?@9tu5XC1~v$8ZZwSOOsAc&xk6+|Hfi4jCkAXbKg?aI0cJw#7c57n2T^SgU5 zbYXVRoSivm_HI--Dw{2tS=sjW_ z%|%U`^i#jR53})LK3fP!ijtmar=z*U=ugKvW+rvGC!-n!xe{5ga`7Uq>DjsnmiAu{dkeQ46{iR_q8`Sa4%K#*b9C3XsTLO?kYHK z)!Ypno*mWrG7sO-PV34oz1>jmD(I;yqX~B?<(e{m@F7msf$pZFqu^Y5eZ25ER}XXC zDF>Ykd7;7H0pk@g-|?df?($mR`M=Hg4?0iYdrLia1?Ssy4Pkip`tsbiFg)CyIQ*Lm ze0hft-^xFL$A`NOy=`Ik`ro^w8b0)XN)3%&1vR0P2rFI5ml5G)lze1Z_Q(n3s15&}Mi@9T}=`Llie)7~5L(*N%x8u3(M{$nA5QN4rWDL(X_sG_A6?xLjoERC9ClN2#L6T<9~$K+&e`SYVA5^Cslz zIaW+x_~iSVXXe)4H&&(+y!y!Awm^&08>27vcebD5p&!bMQV+)qzh#(N*wWIX}Gd zJXa5M=<=a+A#XIehtKiyIrsX}1aEsSZ}#3&py_p&tO1`{H$@K5F{>?5|$y GQt=04Zz*j6 diff --git a/test_conformance/spirv_new/spirv_bin/fmod_float.spv32 b/test_conformance/spirv_new/spirv_bin/fmod_float.spv32 deleted file mode 100644 index 3bcfc99a9b177c642be0d1a2922a21316ba7bdd0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmYk3!AiqG5QfJlv1-&>Yg-Qhs|1?_G?`HcJxLiy39Wkgw ze|%>3EL|>E(t#|}7iKkGIt@3Utu;NB)1e4v)1t1vj=Z;s=ry}~&CWmS z;N5ODhn)^&Fg@o*T=wracXIZi9Na@0Jnrac-=2&-{mk{XN7BsuU)xtq-q(JM27~_s X4)?x)C=HMPJJk_W=X-zk3fHnffs!S_ diff --git a/test_conformance/spirv_new/spirv_bin/fmod_float.spv64 b/test_conformance/spirv_new/spirv_bin/fmod_float.spv64 deleted file mode 100644 index 07576a50772a2b8a2eaf84e7f768c92e7a92b955..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 728 zcmYk3?@9tu5XC1~v$8TXwSOOsAc&xk6+{sP$wm-8fmj&|+bX+@&_nc8^-z5YI=}0^ z(1mf%oI7*Q>@_MKR?Qa7tZIAu?qLTKFse5qsRQU`l#s(v%h++3&kIi3Mi@o diff --git a/test_conformance/spirv_new/spirv_bin/fmod_float4.spv32 b/test_conformance/spirv_new/spirv_bin/fmod_float4.spv32 deleted file mode 100644 index e02908113d2c1506dead22e973fa73159ef28765..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLct&5|Mem`-!l&k zY-V=f&g{M<3{Ki+Yi8EAL%n%=7FesnsKIq%Y?14HTIR*w<9SuTnRP65wLs@xdC&)c z|H$fTS}j-Np(4^7&oZwZ$9F#c<7i69TXHbVi@N+2j-}WTo+{{{$eElvp0VP{<)O=m zj>nFliKm)BD_7}wzIe&zlVY`a&Fa~rm}qZq{2*8S*b9I57%1BmCJLUB@+~1XW+uv+ zi=KL4J8cVxI^7W_3N#%dIo@cxLS|4u)}&n_I_f^I8*k>|e<1}ud`})UmzqOAzMkXj zId}M$g70{vIqcX|;OTvy<;#8cnlpjjtA=l1fgfk+*>_(-9X&hv-hnvt{`c|^sQcb8 cx#2NV;KRAsABb}g^tb9Gr_XDD^cAiYzqPC;K>z>% diff --git a/test_conformance/spirv_new/spirv_bin/fmod_float4.spv64 b/test_conformance/spirv_new/spirv_bin/fmod_float4.spv64 deleted file mode 100644 index ef36e2afc12c37dc976356693c298706bc5c98c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmYL_?@9tu5XC1~v$8ZZwSONrgdl=GRuDxHBt{TD!D3}7*skm@LJ!eX)kF0q==|1u zX<_!voI7*Q+#8g7RkI~CtJ;D7d`&A^*5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FP|I|JRG)e9r_7 zY-V@g&g{JBd#7Eq4KwT7k^X!G^Q_Zg(BNi++rrQS$9P($`Q78ix_UF~neTd@&im40 zp8WkIsTT2iRV()uf&OTh>DuM!XN$iaPU-TF6wK1RDnEsDF}8$f3g#mzQ`1K?R2;k7 zclFriq07&e$J)Ov>v*0OFG&{Vb@7^1%Oa2Do0~sK6+L{RkB^Zm?mAWQO;qm)>9KRF zn!WJp59MiBIM(T&a9_bpPlzVH6DjwF%+YV-rqMzdy-P8e;r;mFTuGOCJhnNyZI0(} zF?hF`_TUK*Xtp}f(#8LvITP5udgvY~(Bo{TE%+TO=(jV6%GvXOW~7?_m)LN4dwBF) T-b6XR;oZs+HFH0@?X}_;XkjI^ diff --git a/test_conformance/spirv_new/spirv_bin/fmod_half.spv64 b/test_conformance/spirv_new/spirv_bin/fmod_half.spv64 deleted file mode 100644 index 1b2ab0aac6bac41444e8b08825c1c7ea558290dd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3?@9tu5XC3g&C1fu)c$=agdl=GRuD!IBt{TD!D3}7Y^&@pLJ!eX)kF0q==`pC zp$p@jIXmaf+-p$kR?L>ntYZ863J3k>*d*dDM@m&%=0-%%?BId@@Z2+M5@+mn(kkg+F_=RB_iE1*fBW zO&N}vhpL&29=@ra)|K1(x}m(Opr@vcC)|;o>&o=O7jdc%d>0x4oh$FpEM}am2OV$9 z!RJD=@L=x(GpoSd<3|eKvZvYX*-+qF_&oX9TmGApeS5Ac49{L)p4%3Nhr1KU{FZ{b veCuf&?#h1vU-Wc@+2?=Hj%xT%snP5z(7_kFJz?&L?pm8u)Ay@axm5fCH*qMQ diff --git a/test_conformance/spirv_new/spirv_bin/fmul_double.spv32 b/test_conformance/spirv_new/spirv_bin/fmul_double.spv32 deleted file mode 100644 index 818341c59031f8642feae0536d73eb024f97756a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmYk3K}*9x5QWF2wQ97r*0vrzR0P3`M-@a71WQB^e?f^_X(1*h2?2kA|JjS+`_?SD zFnMog=e?cXgu!vgY|YF%cAzh-Z-H$!*lMud;JPrfwo^Q<=GoojSy{cAbuDzYK>Iy; z(FcG3NUFuGT-D;CqOC8U#k_PJ-*oZE(G-ris^U{Pm10A9qM$#PGdXoUBgLW1 zLzj;nj~qW0pXvN%QO~An{*t6|R_Cutwal|vb93_tx#GuM_%p{)*`{!!V2zdYCe%1{ zqMUQlQy*xiZQ)3}JHlH9JzXK5)Q;rb6VgZB$5rEnFMj7z(8K$&&|JuuerEI>U(cEO zTMFLoTIVp+t^!Z*^DJNH?>Bn_yH^e0Jq3R3p=aKKf;xKM$M^1wbKd{np>pcJ_e*Yg a@GtOT-|NTX+yniM`pD_?+8@2brQ#R%&L#l> diff --git a/test_conformance/spirv_new/spirv_bin/fmul_double.spv64 b/test_conformance/spirv_new/spirv_bin/fmul_double.spv64 deleted file mode 100644 index 6b83060ade170b3ffba7b6ec03d8f1bccd596fd3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcmYk3?@9tu5XC1~v$8ZZwSOOsAc&xk6+|Hfi4jCkAXbKg?aI0cJwQ)Z57n2T^SgU5 zbYXVRoSivm_HI--Dw{2tS=sjW_ z%|%U`^i#jR53})LK3fP!ijtmar=z*U=ugKvW+rvGC!-n!xe{5ga`7Uq>DjsnmiAu{dkeQ46{iR_q8`Sa4%K#*b9C3XsTLO?kYHK z)!Ypno*mWrG7sO-PV34oz1>jmD(I;yqX~B?<(e{m@F7msf$pZFqu^Y5eZ25ER}XXC zDF>Ykd7;7H0pk@g-|?df?($mR`M=Hg4?0iYdrLia1?Ssy4Pkip`tsbiFg)CyIQ*Lm ze0hft-^xFL$A`NOy=`Ik`ro^w8b0)XN)3%&1v BDC+R0P2rFI5ml5G)lze1Z_Q(n3s15&}Me@9d4>`Llie)7~5L(*N%x8u3(M{$nA5QN4rWDL(X_sG_A6?xLjoERC9ClN2#L6T<9~$K+&e`SYVA5^Cslz zIaW+x_~iSVXXe)4H&&(+y!y!Awm^&08>27vcebD5p&!bMQV+)qzh#(N*wWIX}Gd zJXa5M=<=a+A#XIehtKiyIrsX}1aEsSZ}#3&py_p&tO1`{H$@K5F{>?5|$y GQt=02Pbp;p diff --git a/test_conformance/spirv_new/spirv_bin/fmul_float.spv32 b/test_conformance/spirv_new/spirv_bin/fmul_float.spv32 deleted file mode 100644 index 05da0ad12b7b415d24594893fe58d8dc7ac973c3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmYk3!AiqG5QfJlv1-&>Yg-Qhs|1?_G?`HcJxLiy39Wkgw ze|%>3EL|>E(t#|}7iKkGIt@3Utu;NB)1e4v)1t1vj=Z;s=ry}~&CWmS z;N5ODhn)^&Fg@o*T=wracXIZi9Na@0Jnrac-=2&-{mk{XN7BsuU)xtq-q(JM27~_s X4)?x)C=HMPJJk_W=X-zk3fHnfe{v@_MKR?Qa7tZIAu?qLTKFse5qsRQU`l#s(v%h++3&kIf>L{WB diff --git a/test_conformance/spirv_new/spirv_bin/fmul_float4.spv32 b/test_conformance/spirv_new/spirv_bin/fmul_float4.spv32 deleted file mode 100644 index 388fce9519b8028989ec9de1218ed1015a88ffb9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLct&4fA%6c-!l&k zY-V=f&g{M<3{Ki+Yi8EAL%n%=7FesnsKIq%Y?14HTIR*w<9SuTnRP65wLs@xdC&)c z|H$fTS}j-Np(4^7&oZwZ$9F#c<7i69TXHbVi@N+2j-}WTo+{{{$eElvp0VP{<)O=m zj>nFliKm)BD_7}wzIe&zlVY`a&Fa~rm}qZq{2*8S*b9I57%1BmCJLUB@+~1XW+uv+ zi=KL4J8cVxI^7W_3N#%dIo@cxLS|4u)}&n_I_f^I8*k>|e<1}ud`})UmzqOAzMkXj zId}M$g70{vIqcX|;OTvy<;#8cnlpjjtA=l1fgfk+*>_(-9X&hv-hnvt{`c|^sQcb8 cx#2NV;KRAsABb}g^tb9Gr_XDD^cAiYzq5=cIRF3v diff --git a/test_conformance/spirv_new/spirv_bin/fmul_float4.spv64 b/test_conformance/spirv_new/spirv_bin/fmul_float4.spv64 deleted file mode 100644 index bbff46b070b7d840baf56642036791e98e07bb6a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmYL_?@9tu5XC1~v$8ZZwSONrgdl=GRuDxHBt{TD!D3}7*skm@LJ!cB)kF0q==|1u zX<_!voI7*Q+#8g7RkI~CtJ;D7d`&A^*5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FP|E|JjS+e9r_7 zY-V@g&g{JBd#7Eq4KwT7k^X!G^Q_Zg(BNi++rrQS$9P($`Q78ix_UF~neTd@&im40 zp8WkIsTT2iRV()uf&OTh>DuM!XN$iaPU-TF6wK1RDnEsDF}8$f3g#mzQ`1K?R2;k7 zclFriq07&e$J)Ov>v*0OFG&{Vb@7^1%Oa2Do0~sK6+L{RkB^Zm?mAWQO;qm)>9KRF zn!WJp59MiBIM(T&a9_bpPlzVH6DjwF%+YV-rqMzdy-P8e;r;mFTuGOCJhnNyZI0(} zF?hF`_TUK*Xtp}f(#8LvITP5udgvY~(Bo{TE%+TO=(jV6%GvXOW~7?_m)LN4dwBF) T-b6XR;oZs+HFH0@?X}_;W`QNF diff --git a/test_conformance/spirv_new/spirv_bin/fmul_half.spv64 b/test_conformance/spirv_new/spirv_bin/fmul_half.spv64 deleted file mode 100644 index 3551201939d60000bf2dad658a027fe2920a73ed..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3?@9tu5XC3g&C1fu)c$=agdl=GRuD!IBt{TD!D3}7Y^&@pLJ!cB)kF0q==`pC zp$p@jIXmaf+-p$kR?L>ntYZ863J3k>*d*dDM@m&%=0-%%?BId@@Z2+M5@+mn(kkg+F_=RB_iE1*fBW zO&N}vhpL&29=@ra)|K1(x}m(Opr@vcC)|;o>&o=O7jdc%d>0x4oh$FpEM}am2OV$9 z!RJD=@L=x(GpoSd<3|eKvZvYX*-+qF_&oX9TmGApeS5Ac49{L)p4%3Nhr1KU{FZ{b veCuf&?#h1vU-Wc@+2?=Hj%xT%snP5z(7_kFJz?&L?pm8u)Ay@axm5fCHIXQm diff --git a/test_conformance/spirv_new/spirv_bin/frem_double.spv32 b/test_conformance/spirv_new/spirv_bin/frem_double.spv32 deleted file mode 100644 index 6ca297cbdf5a935c859e014768aaf56b24181cd2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmYk3K}*9x5QWF2wQ97r*0vrzR0P3`M-@a71WQB^e?f^_X(1*h2?76uKiG@l`_?SD zFnMog=e?cXgu!vgY|YF%cAzh-Z-H$!*lMud;JPrfwo^Q<=GoojSy{cAbuDzYK>Iy; z(FcG3NUFuGT-D;CqOC8U#k_PJ-*oZE(G-ris^U{Pm10A9qM$#PGdXoUBgLW1 zLzj;nj~qW0pXvN%QO~An{*t6|R_Cutwal|vb93_tx#GuM_%p{)*`{!!V2zdYCe%1{ zqMUQlQy*xiZQ)3}JHlH9JzXK5)Q;rb6VgZB$5rEnFMj7z(8K$&&|JuuerEI>U(cEO zTMFLoTIVp+t^!Z*^DJNH?>Bn_yH^e0Jq3R3p=aKKf;xKM$M^1wbKd{np>pcJ_e*Yg a@GtOT-|NTX+yniM`pD_?+8@2brQ#R(swM~k diff --git a/test_conformance/spirv_new/spirv_bin/frem_double.spv64 b/test_conformance/spirv_new/spirv_bin/frem_double.spv64 deleted file mode 100644 index 3e458b235328c565798c3cde49d625a8b2d28311..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcmYk3?@9tu5XC1~v$8ZZwSOOsAc&xk6+|Hfi4jCkAXbKg?aI0cy+dzR57n2T^SgU5 zbYXVRoSivm_HI--Dw{2tS=sjW_ z%|%U`^i#jR53})LK3fP!ijtmar=z*U=ugKvW+rvGC!-n!xe{5ga`7Uq>DjsnmiAu{dkeQ46{iR_q8`Sa4%K#*b9C3XsTLO?kYHK z)!Ypno*mWrG7sO-PV34oz1>jmD(I;yqX~B?<(e{m@F7msf$pZFqu^Y5eZ25ER}XXC zDF>Ykd7;7H0pk@g-|?df?($mR`M=Hg4?0iYdrLia1?Ssy4Pkip`tsbiFg)CyIQ*Lm ze0hft-^xFL$A`NOy=`Ik`ro^w8b0)XN)3%&1vR0P2rFI5ml5G)lze1Z_Q(n3s15(2)15A2QL`Llie)7~5L(*N%x8u3(M{$nA5QN4rWDL(X_sG_A6?xLjoERC9ClN2#L6T<9~$K+&e`SYVA5^Cslz zIaW+x_~iSVXXe)4H&&(+y!y!Awm^&08>27vcebD5p&!bMQV+)qzh#(N*wWIX}Gd zJXa5M=<=a+A#XIehtKiyIrsX}1aEsSZ}#3&py_p&tO1`{H$@K5F{>?5|$y GQt=04D=BOM diff --git a/test_conformance/spirv_new/spirv_bin/frem_float.spv32 b/test_conformance/spirv_new/spirv_bin/frem_float.spv32 deleted file mode 100644 index ec6cd3626a05895d8af4e2e1ae674e8e990acef6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmYk3!AiqG5QfJlv1-&>Yg-Qhs|1?_G?`HcJxLiy39Wkgw ze|%>3EL|>E(t#|}7iKkGIt@3Utu;NB)1e4v)1t1vj=Z;s=ry}~&CWmS z;N5ODhn)^&Fg@o*T=wracXIZi9Na@0Jnrac-=2&-{mk{XN7BsuU)xtq-q(JM27~_s X4)?x)C=HMPJJk_W=X-zk3fHnfflejA diff --git a/test_conformance/spirv_new/spirv_bin/frem_float.spv64 b/test_conformance/spirv_new/spirv_bin/frem_float.spv64 deleted file mode 100644 index 18b1b8244525a4ee5aca640d176b55e110961c75..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 728 zcmYk3?@9tu5XC1~v$8TXwSOOsAc&xk6+{sP$wm-8fmj&|+bX+@&^z>2^-z5YI=}0^ z(1mf%oI7*Q>@_MKR?Qa7tZIAu?qLTKFse5qsRQU`l#s(v%h++3&kIh#we)( diff --git a/test_conformance/spirv_new/spirv_bin/frem_float4.spv32 b/test_conformance/spirv_new/spirv_bin/frem_float4.spv32 deleted file mode 100644 index ef444d6971fb0db03666d779d487b53f3098cfab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLc#yw5B4HB-!l&k zY-V=f&g{M<3{Ki+Yi8EAL%n%=7FesnsKIq%Y?14HTIR*w<9SuTnRP65wLs@xdC&)c z|H$fTS}j-Np(4^7&oZwZ$9F#c<7i69TXHbVi@N+2j-}WTo+{{{$eElvp0VP{<)O=m zj>nFliKm)BD_7}wzIe&zlVY`a&Fa~rm}qZq{2*8S*b9I57%1BmCJLUB@+~1XW+uv+ zi=KL4J8cVxI^7W_3N#%dIo@cxLS|4u)}&n_I_f^I8*k>|e<1}ud`})UmzqOAzMkXj zId}M$g70{vIqcX|;OTvy<;#8cnlpjjtA=l1fgfk+*>_(-9X&hv-hnvt{`c|^sQcb8 cx#2NV;KRAsABb}g^tb9Gr_XDD^cAiYzqM#4KmY&$ diff --git a/test_conformance/spirv_new/spirv_bin/frem_float4.spv64 b/test_conformance/spirv_new/spirv_bin/frem_float4.spv64 deleted file mode 100644 index 074f6cbfb15f8ceccd6c1e3c52df1a3d0f36e364..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmYL_?@9tu5XC1~v$8ZZwSONrgdl=GRuDxHBt{TD!D3}7*skm@LhsO9)kF0q==|1u zX<_!voI7*Q+#8g7RkI~CtJ;D7d`&A^* diff --git a/test_conformance/spirv_new/spirv_bin/frem_half.spv32 b/test_conformance/spirv_new/spirv_bin/frem_half.spv32 deleted file mode 100644 index d9a84cc5b777edc60aad943127a7e8e2f82c46fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmYk2K}*9>5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FUgyKiG@le9r_7 zY-V@g&g{JBd#7Eq4KwT7k^X!G^Q_Zg(BNi++rrQS$9P($`Q78ix_UF~neTd@&im40 zp8WkIsTT2iRV()uf&OTh>DuM!XN$iaPU-TF6wK1RDnEsDF}8$f3g#mzQ`1K?R2;k7 zclFriq07&e$J)Ov>v*0OFG&{Vb@7^1%Oa2Do0~sK6+L{RkB^Zm?mAWQO;qm)>9KRF zn!WJp59MiBIM(T&a9_bpPlzVH6DjwF%+YV-rqMzdy-P8e;r;mFTuGOCJhnNyZI0(} zF?hF`_TUK*Xtp}f(#8LvITP5udgvY~(Bo{TE%+TO=(jV6%GvXOW~7?_m)LN4dwBF) T-b6XR;oZs+HFH0@?X}_;XeA}H diff --git a/test_conformance/spirv_new/spirv_bin/frem_half.spv64 b/test_conformance/spirv_new/spirv_bin/frem_half.spv64 deleted file mode 100644 index 5d0fce065da90df2bd80f11156b83c6d8afa33bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3?@9tu5XC3g&C1fu)c$=agdl=GRuD!IBt{TD!D3}7Y^&@pLhsO9)kF0q==`pC zp$p@jIXmaf+-p$kR?L>ntYZ863J3k>*d*dDM@m&%=0-%%?BId@@Z2+M5@+mn(kkg+F_=RB_iE1*fBW zO&N}vhpL&29=@ra)|K1(x}m(Opr@vcC)|;o>&o=O7jdc%d>0x4oh$FpEM}am2OV$9 z!RJD=@L=x(GpoSd<3|eKvZvYX*-+qF_&oX9TmGApeS5Ac49{L)p4%3Nhr1KU{FZ{b veCuf&?#h1vU-Wc@+2?=Hj%xT%snP5z(7_kFJz?&L?pm8u)Ay@axm5fCH#I1o diff --git a/test_conformance/spirv_new/spirv_bin/fsub_double.spv32 b/test_conformance/spirv_new/spirv_bin/fsub_double.spv32 deleted file mode 100644 index 32fa6d805eba3bf38697d8ab9c1689f8af05ebeb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmYk3K}*9x5QWF2wQ97r*0vrzR0P3`M-@a71WQB^e?f^_X(1*h2?5XkX)l8BTeIN8 z%z#|PVuywXLpZhW%Xv(wb0c9?f2wG zAN>6zsTQ+xRf~s;w!U~4^U`sA)5RZ0Q#js|gV{W*icjHGiVfk3g8o>}P~*&r za?V9heW01Pg(L0m2yYeibcJ|QJCbuxNFQ|{SB)3G_?=5Z5AVl9b0J^)nbC86J!j@` zDR{SQox@DK3Ov2fvwWGq-|PwOUNwC86!@`+o_Plf>gahN-@7l)dH;Kd%BlO_FS+5t ZzrcrmuOEwZ5A-+cBd5=6fAk8MieL6dCI0{b diff --git a/test_conformance/spirv_new/spirv_bin/fsub_double.spv64 b/test_conformance/spirv_new/spirv_bin/fsub_double.spv64 deleted file mode 100644 index 153b094c106130b0c662faade3a1068fe0e94576..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 736 zcmYk3UrPc}5XC1~v$8ZZwSNyr5Jb>p1yKk=Vg%7A5GzB$c4b|Jp8II^p?V2Azq|KB z7iQ7PTdN&=5x{KlF!RNSClJOa+8mSZXQZO6ES^A;e)5MDMv4Z}-l&Rs- zWTyjHN3L!;TygkBcp(2tx)}7P$@6g9j~B_yFq;fpu_txzbDN1GJm5!YWl+LuWsv7@dp(d BDCqzI diff --git a/test_conformance/spirv_new/spirv_bin/fsub_double2.spv32 b/test_conformance/spirv_new/spirv_bin/fsub_double2.spv32 deleted file mode 100644 index 62e5c8fc49ab68a8de8361393da3fa759141bb9a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 684 zcmYk3PfNo<5XHx)wQ97r*0u^BDuUp}qY9!3f~6vepCCl7v=Eb$gn(ziv=_nm+h)Oq zxASM`y_ww&8YgYDH8X45p>|f!8n#v2W^G%wU6&25Ho%lu1rBF2X7sX+Zy%EaW+422^X z2QD5uKXm??{7C&5c@<5P>@`lNX_dXj|WACe=UDN g-q(Ih4ULh24(FbKAfJ1{zf~PEb)NgHSGW@X04Sd(asU7T diff --git a/test_conformance/spirv_new/spirv_bin/fsub_double2.spv64 b/test_conformance/spirv_new/spirv_bin/fsub_double2.spv64 deleted file mode 100644 index bf3006520ef56ce9454ed4100e838ae6b21ca82c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 752 zcmYL_UrPc}5XC1~v)a``1au}%U{iE7HHav zs7sT6>bLh{J|1MVx$;0!(I4$}lodJp)A1r_CN1)^6wF3(o_+}XnphDYE9j4;Obw4F zJ8_4;D(ZHThedv(d?5cxIv@0>$@6d;#q;E4m`{>8(%!tly;RX-FZ9`?rD|2!Q}A_E z^EPmJbXDWaJbY6-tqa>a-4ON^%+!R`yah9LAs+CDa@rI!2k+xl9r!d9T?OBj^TQj@ zbM-KXE+0A<@Yg-Q}&cUQCPor_r*0H`}+s2k4>4rGzOFstd(X}I}pt?8+p4n;7V7IpO{KUT+<{JD(!iO9s{VaBo(7Y8mL zI2}8EA)RXeyjrE>ynM~_NwF&5vU*+?6Yb3}eiRiRd%Ub>~tW5={YarvVXU^ld}iq;2z50aYsM<_GIMgXRfb3l4joj+P-4)zV=%*82lG- XxcB`-X?XPCsg9UB-}|dqxR(6^e(EK* diff --git a/test_conformance/spirv_new/spirv_bin/fsub_float.spv64 b/test_conformance/spirv_new/spirv_bin/fsub_float.spv64 deleted file mode 100644 index 028c52242da2f42ce5cf2a126654fde575ec3461..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 728 zcmYk3UrPc}5XC1~v$8TXwSNyr5Jb>p1yKY+vJpg|K&%XfZI#_c=(&$pAF7w2^Sj;) zT^Q%gxija?UZc`s)oj7cs^{d_tTjuaLBqMZ$MhtW?)bIeTUa9Ijw!?egglzW<3Qa)19A4{1U9!+-I zcXj0Iw!<}tkA?g4A7`_EFPS_Kk~p1BUIxW@lE&JbFTa;6dhCThd$d$7E8i$M9n~w! zaCmlAEiCod$P;?cXORtX?9%t%djyL6? zb1pA5*gIhM518-x(FAXKC2#g@D9{W#Pu_de-znL*=bFOs?DgfjEn#@LJ8}586!>z7 y58ujv0FMv*h2D-Zd;Ra-Rt+C|Kc$AojshL-!~Cu=ddy#|kD9(P`>WTwQ2YUoVkn>h diff --git a/test_conformance/spirv_new/spirv_bin/fsub_float4.spv32 b/test_conformance/spirv_new/spirv_bin/fsub_float4.spv32 deleted file mode 100644 index c7705dcf043691436759541745538c413d235bdc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYk3K}*9>5QNvHv1+un*0u^BB7)$>qY9!I!BP>#Ul5{3TBvDBLcz0t+Kb?P&pa@& znc00iv-^@TIBA=$nOWNo_2%hWV66tD2G@nLMXvK{nHP7D=T-e?*0Ipl0-bl|K_C46 zBde!rwOomZib!uf%e-he=KmSRJAs-S-&XL9Oz#)>1Chb|vF z9y@*}o@)NAT&3gr;w76;iq+yZt7nU1qP@BCgIw`rFZ|hKplnl^D0oK7w}jM~nJ8y2 zdg^`cv@IO!bVryd&~$|4c%$hGnL+(nlXivZsQb8XyqSalg%tGgJ$cYvY7YJQdXBH> z+~HdazT=JNuwzewr}uf5FZbDN&IER^8oqr6ew?9a-+cvj^z7h!2ja~8-^)Ls?t8!F chQ~;O59eNgAkIC|->Q$CKCk`JSGZFA0<#1rHvj+t diff --git a/test_conformance/spirv_new/spirv_bin/fsub_float4.spv64 b/test_conformance/spirv_new/spirv_bin/fsub_float4.spv64 deleted file mode 100644 index c2593fd5e1707bfcc68cd0ae8f53b8db13c75dbf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 744 zcmYL_UrPc}5XC1~v$8ZZwSNyALJ&cZ6+{sPi4jDfV6ie3Y*%&{q31qYeW+f7&TqY! z7G}@Pxija?y+Ns0HCr;XsvYRh*R+zA9abDJJFE$7Rw*VPXQTM`;WW!%&FU6t%8F=6 zi+<|2_hCMcve{gDps47Nb~?(69R2Bdku#GPd07f(qc~4Lgndn{2#*x>52Q>Dk0v{@ zdtViGr^stXeylu_|0JD9{b}+%oDSl7@-oaPNj%Wr-27gu=&=|2?9o=WD!ftfbycqk z;qVAm`X$bLvKa|s^kU4lCC+fhbsR$K(m(CAwJkQj_ z9B<5r&bhqNz{}@&`J8+GXo9!Bk~e#ADbVyfPtLpL&II=DxNYU|?DgfiwsLs5J8}5) z{`hi+4|nY<;PGKs-@BuH@!tQvyW-$|@2Awz*i)dxxu4%x&VBK^Rv$Hee)d5QNvHv1+un*0vrzR0P3`M-`-A1WQB^e?f>EX(1*h4FS*oX)l8FJrgjn zncaOmv-6(sop#MO%&coi`tuFUvrdCSgPRR*3quPW<7t)VcaInA>dmZYzUz59?@Nn$ z^7oIVTEy#Bt=v}x`lDT@YnP*+E&g&irOP`~FiZ2Q{1nc`*b<&8n2)4PO&`rraqMc} z)nk{3Er}xvQN1Ii$Ihv0 z_QIz>l&4+cSf_i!eFZZ;A)53~q}&%WN574mMhji^F2!Jm_v3?eC0*w6*yiZAIiA18 z;N520gC{(o+3Gw?7ypCiOknrwp?jb}kF%M!;CHB?-_9H=XV3qck!t#1V#DF>;n8n- S6Xp1ZcPmHK%>C%L*NR_e2_>ok diff --git a/test_conformance/spirv_new/spirv_bin/fsub_half.spv64 b/test_conformance/spirv_new/spirv_bin/fsub_half.spv64 deleted file mode 100644 index 7f71faa952a269959efa5664fa5368bdbb4f6f3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 712 zcmYk3UrPc}5XC3g&C1fu)c!pbLJ&cZ6@(E4i4jDfV6ie3wpDf)q31qYeW+f7&hL5` zx-ia}vvbbOy#}Rj#cavUDz>j*PQyx8_Br%<+2^XytIAaio$_%uN^T#{vi#MoW`We^ zqApK#)Nk*@d>m!7xp1He^~;QOlsU|tc)Y-9QiscOFdHR#`k~yHVnz8_LH|I`)bMz+ z+kvYCSGOImI(#A=Y5pXgNBwyEJd6j)eEKrXC(~r0y?KFqx#GuO__Ie#6?eT+a5}2j zl;N0psG7Ox;hWlNUAe8V8_JssdTPpe!X3%Eu1p_%5vS_FccBr`x$^$ZV#c|8(D9}m zd@eK#5B4rFvkJ^Tex%?ndz#Ij4F#Ts&y%0M<-aM}x96I|@a*;Fxou&1xI1yoZz-6| ux1P4)uKWk^MNdbVeg60CsD}TP8qKZ(9eknN6Xt&CuC+NeeZP8@OT`~G87Pzh diff --git a/test_conformance/spirv_new/spirv_bin/label_simple.spv32 b/test_conformance/spirv_new/spirv_bin/label_simple.spv32 deleted file mode 100644 index c7345cf4a00751299c49b4e24ea4cd5aa15487d6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmXw!%Syvw5QWF2we{9oMBTWk2!b!5La9qbmp(yAwTnPZij_XQ8^Q03$-wz%=FFMP zpC)&sh=Yh2#f(>*MG}L~4?BN|pG4X!6XI!%L(a~sSZ}I)SAK4*4Jq9bL$oQrtRpg} z$(?{3kWn$eYU4qxyC-&6hRWIl$n)K{{MzSP)vSwZRqvbk;=63>)yMzdOXhm#9B9{M z&X9BWoT$H1{({MTw&ln8UVBS)L~c!9EV^EA@sE#atQ%|UpV*?-U448^{KFpqx@5aM sPJwfT_6F;XXTX~F3g@f|aGtfEn-V)$Zb_%T=RoZXYU}2|T=xwA0KI}4$^ZZW diff --git a/test_conformance/spirv_new/spirv_bin/label_simple.spv64 b/test_conformance/spirv_new/spirv_bin/label_simple.spv64 deleted file mode 100644 index 1fb5419727d8ae51e8f1b585365e56c5aae47d47..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmXw$%}&Bl5QPWIuPBIsY+PVWObmMO;9P@qD+JNlxe7 zGp93i+o<}`G^?0d(?)s{eXCk6 ziD$VPoW8}^(PA-r(CX iw0CLDyb+j7?W_&N%m2;n^3FqPcwgnF&iPNbSP1{>b{bjs$8$~p7OCpju{HKt!ea_%(Jg_lg-m)oz0hds%f*j zxRLTIT|10k{#{};SHe@dpmD397i*H5J{m2>wW}jnpE=xe_)a)U*2`?QO{RJAKFj09 zw)mKBvSJZ`mV3QQ6+QOAACJC}9&AGeXP~;NOb^~r^}aIiqTiF-fpS-weeSFILtzg5 zBW1Kp-I~5riK%b2L0g$wcs`yhAKr=AgB0L^Im|q2Blzs)G4Jpg&tL6zqKqEC9RB>fzH&d+*=U2 n9f1?QjD5KuOC7%p1-)R0=RGgg=Ud=8kv27a@As##_oVm-9HArS diff --git a/test_conformance/spirv_new/spirv_bin/lifetime_simple.spv64 b/test_conformance/spirv_new/spirv_bin/lifetime_simple.spv64 deleted file mode 100644 index 861581d1526a7acfc11cceca9c3a2f5934a64908..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 808 zcmYk4-%0{e5XMJW)3P*Ev;P`F5Z+f1N>_>9^#qI6Mhoj7RD6J5tsbhIpzn9~EO=m? zZ@!r`-^^Kq{8h;;XJ#eq=$BKsycN7JdcWm;MZRi*D$H5U%0`Y3N&FG5;z<-PY$(LwXf#i{P0!xfji5e~!UJYKBBVKRFi zC!^_l_BLL{v+3wPo$Fa$>Bk)CqtO!5;`S)xv=x`-;i&5>-j-)C_@>l$6IhhYoul%iz%=m(`vKGv{XQsbcu7_DdD?;Qv4$@|FwSF2I3afW64~)t%aN8C-6o XF4Mda&zqq+P;X-DGrd2(^1bXIkmo0P diff --git a/test_conformance/spirv_new/spirv_bin/linkage_export.spv32 b/test_conformance/spirv_new/spirv_bin/linkage_export.spv32 deleted file mode 100644 index 280021b681dc5ba65b5db571cba527cc51365a12..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 232 zcmaKn!3x4K5JbnsTJa!=;92qH52%0OXOtddDb`ZZyT9#8`X=;jU^APU-JMMg$5NU} zDz)VH*(hi}VKLzXTr1|vKwePou2=gUx>Vi!)YR`(b#4EsnQc%FFj2R8p;pCLVTMRY}&cYk}QVNyI>cukwU=A|a93*Z2t zz=^xo6&a2j+6{B!1%?VzS$6ByxBpC|@7~b|H~Vhv#sk8()O-Guz}UHEq_FHdPFz znbS77W8qqG>QGN(-if+9<=o|@qIWNNUvI4E2VCvU;SgC^nmugsvGxBE|(KT3s$9(oS@(Xbz%Kk_wHT*y5>M*{l+=SB1Q mI}_+}R$`bR3+$k`kPEz=3-C|UP)`K>!7rtz2lp#S`1=EJt|X%X diff --git a/test_conformance/spirv_new/spirv_bin/linkage_import.spv64 b/test_conformance/spirv_new/spirv_bin/linkage_import.spv64 deleted file mode 100644 index 5b730cccb69a467c34f29f9d4fbc98de6f0bdfe2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 624 zcmYL`Pfx-?5XDCdf~fovfr|%>iHY%!8iVoVhNGXLsai>6ZHaC8g8HGnnD~CnCT#MU z**9-z-jt|u(Kg#Nv$jq3%Nbh3njyAA+z;_kv1gGK=Fzu~QKLhhR&|_b#YeJAb@la@ zw2|_xFmvk4J9?Z6F7%oByy~o!`@q3Z3k~-bF!QWUadOr%BsqT1(!{bbMeGI<~{74QuiW5~2e0{6wD(4N{ zx!$l3I{0f4+CpyeJQm>Zq~Xqg$sX_z MQd5KblXLd?2g?&DU;qFB diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_dont_unroll.spv32 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_dont_unroll.spv32 deleted file mode 100644 index 9376243655316847a4e1fc114d609424ee854e4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYk5NlyYn5QSS7QBe>9aTmlj-qpmwQGz#r!GtYJGR%-+IeYLA`R9z9nE1Y-J7G*w zuU=Qbe$_K36ZMQSE5?|Nxz;aF!6Zz|=CsYL$~lvaI}^fr{lT%*55uuH8bq%HuN!rO z-kaA8gZ^+j41JgvxdQf=e%ezj(PNh*~qlyMkdXr zg7vmksNvDeDvshh8P~fp&c^sg*z+diVKnzze%S5!?O-1EI+$zs7yh5EKA!MW*6*5f zRl!qHy{-&LPgV7XGPA>%bP^tl%A3l!cK?|uXinOPR+q|CN3Gf~%s3d(5F zN5B)0_H5=x>rN{4fqB?>FPH4WtHaC%MuT%5=8nJRdq){cf(;_yIjs1vO{1-+lz!`<#%4)0&;IZ!@Sp#7_w zb-n?3w7^d5SQxDj>+?hyj@jQWcPfm3)}F+1e^mv(S#w%7;p$R-Cd`~pr!EXfpSuG% zcL&UiZ#sLrhxi8gCIm=G zoHOo5X{lVdZgp4Rs%du?c9tW~MZ|KvbN+mnz}60*(K_9z|G_+#NIirqQ&0ZOlB>% zesyvf`|Ln$JjToqP+%;t9<|+Re*B0?byqtS_#Fy~)F5gF$Id$|f*9Ny=#;@bA;H|le?_sWfio5gh ze|(kLy56ydx8M1>#kdBxZ{uyyI^Npu)8w_cNuRT^)+?&GPwevCYdZ0a{bX$KVrzJB z#(sxi^s#}rwmLR3wdB~D8}ITeoXHlJ-wH53rWxHxIk_K+y9t(ee%}*!3oI|!q*>ht z%kQzr`<jBtWUpejEb}%_-_9bx-!D=`69?rQx!qjap*YbVK=lBWOK69O?U^(~Y8OY@s*l&+m xjrv^2|9~2Eo#$XV-`XDE+nn6ldD&||-v_HBYkvXu-Q;g!?4GRSFE8y4_78}~MmPWf diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_none.spv32 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_none.spv32 deleted file mode 100644 index 5223ddd5d19321f4738028aff679c42c4792942b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1016 zcmYk5OHTqp5QJMm@r8O%GrZ|$UkS)#KiiRnS@E2 zuCD2+sU9GksprjR%q(x``eYR?V>y>+U7k~3v25Cz5ni=|!Ev%5$HQO{CeLB;l(eJH zOVEjQ?)8{A{+91`Wwh~8QsBkcWmh-!O*3yr!Tkj5QHtpD z?(DIe;?Us@=;MAkw5GWq?N-I%f!t6hTAK=bKXrz;-Eth>ztpp>yrW?Ks%D?x06bb? zueB$P)`#=CFAT@*?~XeV#y@*^;&{KB0^jU;twZ73RDC4OoL;9c3`d`T133Q%%!_Y4 ylD+P+Fdn_mi7*_$nWnxs_TZ-9i&_17{u}u4-p_>j{+S6M)bw~CfBMDTDEr@)`7*jGCDE zeKXyLPHOAa>FVlJHNCyLoyCZA5wRFA_;sztT+AoGko@`Nm+&jmBO_W{jpcC93e&ot zmB-`eXj~pN!)o-g9M#p~hp2z zlYz*1gt(NkAgTqeu`&3^| zYT4xX0{$)L+9JM)moujzzJ#}D`97-LQ%8ZhHn{yVejUGzx8@4Iz+C+luXf@8_zJOg zy<-h;zumd{xC*v!<89D7-rDAA^4goE&)Hb(B~{E5yFB-bPCR2j8QZ(q8s3|+-{BX1 zY~Zb}j!jH0IdgZF0LweS?}@t!mX~YNtZsqj_sH>n zXXhR2mQ%x7?l-%>3$^QaQ=L0tbH8!MZ*&)vv*(}W+`|``>kqN}+nBty#JSdeu(iH& z+PUpua?b2a;vRt2?%q2%=l&2=w|lvk?^`~{kHPkt>pTI=nU`lEmuFzV1+g0SxsLw< rHRd|cz;eE|J-)Yla%bmdulal*td6YxIoNlTzlE_mS;t>q+H33|ER{nv diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv32 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv32 deleted file mode 100644 index deac6d94832d5acd9f9769eedfc5b0c5eb254b52..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1020 zcmYk5OHTqp5QIk_qM{-K;@d@h#=DvrI7;y5FWB&kk}SJq5zZd`L;g9VCMMRm%p^?G zbahQnP4xijR6S?Rk})P{uJp+&nv}`doV9sbdDEnm&XjOL6&xpnC>r~tLHsiCyKyJ% zz52Z<><{0DQP>ImX&6UApf;%*la)qVIUY*;BBp zs#lfa=u4FZs^-)-im_z3D&a| z(dFIQV>QL0!yC}Y{cvb4azEOwio*lBp-!}R74&}U3~#$dy1uz=!jGDa`lJO!%Ot$NBiv%iSyf0ev7o A?EnA( diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv64 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_conditional_unroll.spv64 deleted file mode 100644 index 69e31a5665dd133030b975b908cff25f73fdec8b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1120 zcmYk5-A)ui5QSS7LUw|Pu29cCbp(SxD!H{4)6JOErf|M8U0lBccY)d&xIBlp|LiRdsZl_ zYLuT3>a#(9QuoUKm%Lwh~1ZJsoR5 ziuKi`mSukL;Xh%n72^ANIdd}N2YCCI@1V*(b!3=piQ8xKi};6lYtG>_%+-l;dmR3c z=ZUTB9SeB-9iN*FkHGeAya8IoTiZNMUfYZMoQ<_UP{lm4%X1&;#54Aju)T||;k^m_ z9sbbA65iVCSjN#-D_D9bz;GOA^d#=d{fgXEu)Op88M#%kyj&e;wFZ_y zAjkWiop-2PP7SxYzwG)h)UMx;b)JFE{lOW((Q{1Bo_~|`0-s^d>mRZE8<@Pc#HrRM z*jnE??cBC7IcN4QaxcMZckeTtbAN@Y+r3oF_bs2|H(>irb>4#I%u6$nOEa+Fj988O uRLB2-8dIHjU^(B~0pHs_x!d!y*L1!ER!7pl1NPmdZ((ds(s9k?cCi}}@Cj>OiLZ8F>@(nzbzGFc=U3z zqd0crcsItm7&C|GO~%7$?zQ}|+wt4MJnVI*!!T&~7d<~G`t(FE6@Ay_T^XyYcwHWj z99Qv%JoCbrbrL<4dsv;^+bYrOZ9~eHnG^AIP(hZ)l&h4rOS4O4I&-IA;4*4)5Vu zh8DG8TYDl*?T50_I+ek37w-w@3NsITPvW@Gnv6MInbkTIhPQEDn7OUaxiB1g_D(j(sLTnN*n)#2^K@rIiEkLuW^Y&x>eFU_csy?E!NIiW52?OA*~>cr z3+Q)<-v;(Yw45;o_9e9Q%J=C?pM4aF-x{YcqF2$E(bil-7l>a!*~?S&zkLPUx}LFu zcHU{;Y+MC9xArDz6>V+f6nW)s>d)O+>lIau6Z@I>nn}!Yo{XJcYz@!N*n9ZJ9BXK6 z+s8U$FWGkI+S|MYcd~)x_W_KLX-C(SPwq$JZh+<8-}l7b1k1~{X;-(v@;k(MzPs}b z`g{w+0k+mRYI=v8NP)PMKg4L?N33P8IOlGG z&HYNWdwhV%xx+7sdkA(GeedDC2j8}H=*zVpCqCOxu$?>C@omc)mv9@!ul;#(Om}aw)+(pP)f(lmuE*lxr`1Az#j@iHYYc-Goi1 zbLQ;K*_rKTGtIo&oSEhATwhk%GL}pIeCikEi`Hi36ECzHng@*Rzr3oW4|L6VtDilvfU)kCho9lxt-jag(WZ}zj9y$^P2*erUFNOHI3Hs@ND*D`ojq1d96Hz<()oQ+`XvVt-qnef+KVIcrCT)~7Vx|A%9?U*+%~_GD;L3wE{p z!qk2!8?6Hw9Cz`aa-J~ruy-ep`)tUV!;?9!Lt%IqH-(wo=^P2ek>~CN&fN*~F)Kad wozAf^JvtrUJ{)hTrT@qt-0b}^tE)d1rVrQqnK18xndpO<9M{L6UeLAdA5336O8@`> diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_none.spv64 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_none.spv64 deleted file mode 100644 index 944e64ebc1299335f1db797471eba3dee6ec81e5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1120 zcmYk4+fEcg5Qa+@L_s+Sh-U}Ehp2z6G3C~0MS37nzp>P z?c-K!cfDL~@nY+H3@*!)>9{#9_b2tia5AV)>%-xvaa|3Lx?bO<{Ptuo8+X*=K=*wtxE};v=(@*wtXa2WWu+3|YRkZVV_h#b? z*txa0Kx=4o8>h%CuTy{S##}GRVw~9Hy_Zbl9p}l|*~R9tZpQwHU(B(NHn)9jAoh}N zcdot53vef!NPZW1}HSAl?9?o*V z@%k?8UHy~D+vq!pNB>>4e)VpuQ-IC&jhz0&Eu=u)$sc00?;+;$t~lS_27C7_(e7~v zk#mP%5_cc$Ec)KU`5%1S&Y>^odYJfZKf-qIoX58%Eh!n3Q=KCp`;!EtJq+hO`msMwc=W>Q$aHkNnlk4y_PbIchDWa;J4j+D ziMJD6NH8;a-ef$CXI>|W`n{kV&Z0r@Z5V~!=Xt-6sXjf?OHJPuc~{1&D_)g{Bga*| zCeN(!Rh>i+75R1f>$HADm}TRlFg4Vd#%A7ed95nb+`Jyu&B zI@|$yoDYZABKM=+x;T2ke<^cEepkj!?C;65k8f$8v-V|ZeM-~*e>i6QRSxgrP=*$@ zU|V}6OznrV(K?pFaTo6?=L$0qdk^Bc&xVXST$$B65r(&MQ<%A}&Z#gQdG=1=?42+l zv(h8p>YNGFqt)TmMw(n&B))hQC diff --git a/test_conformance/spirv_new/spirv_bin/loop_merge_branch_unroll.spv64 b/test_conformance/spirv_new/spirv_bin/loop_merge_branch_unroll.spv64 deleted file mode 100644 index 10232b136e6778f7f011d6ed3696a0567b673adf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1124 zcmYk4+fEcg5Qa+@L|p|D5YGzz+9Szx1^3^SWSxc0&q@)`7*jGCDE zeY4$$Nowk^zpCrh-J9E5j5re!i}8ZL-%8BIe9{X^pG~@tUWy(O(aCc3L!TL{rkR$9 zc_-ryWl_Y`*&VFm{Qcxp;`^ACg5| z-um`(tFveQTcrbLh8- z-v;)1w45;o_64-F$`9yDpM4aF-x}2~qF2$E(B@o17l_{=*~>HYzkM0oyw+GjJMZk= zd|UxLxArDz6>Vd)Pn>m^x?6Z?7Y6_a?zc`|l(u{o@pvG?$cIo8nTwvTnh zUb5}ZwYPZ%?qmbWZvz+~(vGerpWKhcT?fm%zwe2=0hX6*)2?oU<#&j&zPq!AeaqRy zY3?^(--W%ae-e2ceFt$D`tPFktG82~0&K2tLhrXQaQR1`x7~8pX9^bZ{ad{_lc_+^2toEqRd7gsp qG3Ob8<$QZP+`m4#)BAJQeEu2OK63BR!M>w>H`>PJKK`=p*T_HdZ9#Yd diff --git a/test_conformance/spirv_new/spirv_bin/op_function_const.spv32 b/test_conformance/spirv_new/spirv_bin/op_function_const.spv32 deleted file mode 100644 index 715bdfe0bb4aa007da11424500268367a1eba31f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmXw!%}&B#5JksUMEn5}(Txj?iHR>D8iPw4mOep)H6~3+O9a{a+HN$S19g(ynclf` zXTCJKZb$4yL_5y;8vRIOx5=$0?~%KaZj=diFFGOTWWC7WKdWL@)>U5A)p7-=riDHw zmsLcDque351Q{Lw-DywV4RBwE%HA!=^W~!aSm)Wiex1#y)w(WbE}Fh=cMqBM))6o+ z_|rp9&k@!Co$>>mc`$p^*x&TGnhv#nxhrN4$m-<%_ilUQvGMdq-+#xX{1Gs#9XI~R z)ZgsvlE0X<-vjc$@YeUZ=;1#74EO8de&3dLl|9k@Ukb^*ookP>@8{D_Hgx3-4w0wI1P+5 zu33A{8qI2FO|uO%Yud3siLTYG?zQ1{)9a3E+cGh%%8s>+84770Uf*M}EK>|cii@Rl z8scZ_%V?HMnYZYiD09~uRDHeTovUYWE*9JiWeAIT`L+uAEIm(WlekL7ltq)5_3plO z@%*49hWdsE7`sR6{(XY?q^!ejpy^gMUvpaOnS-6`&9*8$@Jmh5!}~}{z}Z!WPu}?+ zeDj-J=?(avk_z|Qced4k%ST7`L+_aHE5Uz-)89x14LqPn;0X;paT^+4)v+$b`+<`E zB=O|Fd+M1HUydEB2j`|w$NK8Q!5)RNhyRCN%*O6@==iNTct28dC-}YCyaD@>bME*9 Di`ydV diff --git a/test_conformance/spirv_new/spirv_bin/op_function_inline.spv32 b/test_conformance/spirv_new/spirv_bin/op_function_inline.spv32 deleted file mode 100644 index 9ee6de8dcc8255a7a7a3b7faf077dc6de0a06177..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmXw!%T5AO42J8Bho5{D5-@F*PNGqa2TqR+Y>kpG1@zClF|=c%VTUk&GbhZ+a?G1s_fA2?rVkFef+2+U~@aP|*? c8s^4nhoi*bQsYiT;QsRWRNEu>!$$7+2LdV}b^rhX diff --git a/test_conformance/spirv_new/spirv_bin/op_function_inline.spv64 b/test_conformance/spirv_new/spirv_bin/op_function_inline.spv64 deleted file mode 100644 index 8a83d99190c2ff403c75ffeb89915451b9565711..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 620 zcmXw$T}uLC5QQgKGyCu(QwzERuaOH@)ttwk;9E%IsLnn4wUt!t;AvzGX!WSc8cqqxzwD@VZLyU*Ysqsi1)e^awnmfhTT5qo+F4g?Qgr zvY#aG-FII-Gvdp!1NGqC^y%0@Jvi8%F!u2Ou#4Huy^b8e5(n>xO6~-|5t}z)KXT3; Ee>w~!I{*Lx diff --git a/test_conformance/spirv_new/spirv_bin/op_function_noinline.spv32 b/test_conformance/spirv_new/spirv_bin/op_function_noinline.spv32 deleted file mode 100644 index 07f66b5c1a38087ba6d9da2d455c0d97be05e7bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 556 zcmXw#%}xSA5QJM+L{ULR^x^?yV&V&k#^BKnN1tGWsL3W|miWWf*Y=|E`(Wv$wr8rl zt7|rET(%;%BBB+ie2rc-V!O`GI`5D>k*zu#oV(EuIVY<{@%EKwpJkPbRF!F7rdMcG zBAU!(*FIbXmIwMe(sH--_^} z^*aQ{8858m@FDr&e-J;VKKxZiiEaYP>T8h!SFyM*xs>zj{(HRBP^ e`94s?+PL;`QuBB8=xG4-FaJQdGjhK;(%(P3t|3(b diff --git a/test_conformance/spirv_new/spirv_bin/op_function_noinline.spv64 b/test_conformance/spirv_new/spirv_bin/op_function_noinline.spv64 deleted file mode 100644 index 815f5f4764430ca1ce63354f5e5c657d9b015069..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 624 zcmXw$-AY1H5QQg?W?5-wYC#u95J>m^5Jp!WyzB`!W(5Zh`$#|D_Hgx3-4v~FI}MC8 zu358YZOv*YO|vyKYuceciLTYG?zQ1{-RqWW+cGgMWye~^425bDp5NpAt*By%RT0Y~ zJ_$~|hITUbMKsH$&OTa4%G~t^sjnyAsd{ebV!<6NLwH>jFUydZ)x)fu#$`31acugy zy5E;BzHgPpP~Xr1jV>b|;KG{6E}cHgT^*$FIb}`+<^og5QYE4%m;J G^Nv3#S0ow$ diff --git a/test_conformance/spirv_new/spirv_bin/op_function_none.spv32 b/test_conformance/spirv_new/spirv_bin/op_function_none.spv32 deleted file mode 100644 index 19edd132a4a5e68978a540123b5eef216251f70c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmXw!%TB^z5QWE9M7)5A=*9)c#Kafy5`#+{mOep)s7Vvj5-)6hZ8sXf4}K>(o#~k~ zXXekd^LE5WM6~0WuhEYzHdAh;yhZLtzEWn?z37CTlg*-h{j6snRa2LBQ@=pr5Ya-P zldC$Sz)@}&oPvUm|L(M>?gF^4KxOX|l;!)PdRvyoym^|=C-t(KO#ZYT zobacIoSq}9|2yReIP+lk=CQr%uQeTN`*LT@?2y&T`|sWM#9i|AM&EzMr2HN*)Ltk5 zed=#^cFAANsp|pxUwG>qT=a0Ceun$?aKG=+2*i7X_*+7vSkfphC;av&+l>mR+KTsGCm1P zoSOKV`XZX;Qsyl>$I9Hb`l+ub-kEy#=3>DeDMNT&7B8!iFUp76Vj5TFe8!^b<9c^b zx_G`-5(9lh1B~56b^kuWyHeKS*4K0^&DWfUdgfp!db6zx5Byvc^zc4Z5^#1^;gi?C z2jBcA7kUG}rzGHB`p%~MZ~17ce&`*%wi5hTIQ>{EXy5@o0#9h*iQCZVs7`bt-uIR4 zCy9Ia-Br(w_;Tz(JvcXgI@VJU4t6JuJ^VlHVm5KF1IMq#!TX_-JHc$eP zGyc?&Q*%W1f2aHaWgd)g8oTTMW~M`JU+#jPJ+gE1{(HAQ@z7{`qwl|AQ~m(x>+Ef# ze@Oj}XP5j%*SQ{$|An`{Lq!e!)HC!~Lx10)#u0hUYrL}$^cTi6tlr1Kp78|d{s5?9 bZ`|B)((w1pc+(Jgzx*T9?#TUck@x)pptc{j diff --git a/test_conformance/spirv_new/spirv_bin/op_function_pure.spv64 b/test_conformance/spirv_new/spirv_bin/op_function_pure.spv64 deleted file mode 100644 index 8757f7ff59629192a9928c285cf60f761b42f17e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 620 zcmXw$-AY1H5QQg?X7=MxrWSNz1c7v4Mi^an@Ukb^m=zq5a}Ji?_Hgx3-4v~FI}MC8 zu33A{8cizab+auqtJ{e_iH=pQ>b2%|+v}cc(-JW(X3HAJ427Z$ud96io)vj0SIZYc zky8^tQJ>{zsg!w(&Z#nWt$ysQk$0h7sa=EvEUpn9o==ectTu zNf*!eN@AdIXn?VMsP5kc8cqrTU>MytWejS2+DxDrn#VJpxZ?;ECJN=%`L~A>I#_ z>?esw_uW;`jQDcwNIf_=eLB`t4-WPqj6M86>|!=?uLH+##KHTqk~_ig#O4jykDPPI EAFEsBOWF?h7$=qG3pHEBZHrUF;Lwik`>S9TLOdCct0 zn|ZTSg4$KnY{Sf&7V4MNwVKtPZ8*Cr+qR%$*5r4rWyGk=i{xXO%@%2%CB?FQPl`pU zu)3HvR1?UinOUr^#CC*pAy$U_QRUYw-nD!*W3kBH2ubo;q~$7!=lSb&KFL=3Y>L?A zZLQx|U*-)3&OkSM5JNkZ=Vv9}Q)fL|x`Ay~`88)-K6zr1YFe`Jh~Mf?KV}bwNX%VX zxa7%2QrVOBHN?n2DvLhvVPAKuCEga`(C1#W(5K^k;`_q4s=Bhzsv&>nS^f%EBmETDfP>-A6N!-w~z8t(9Zr14*ecXHUF y*Wp{x?@V^Ajj(I}2kZrKUKC}H3xOPGBrfw@3hazN#PNGJ$ro`nO`k{8VX{ca zBgBR;OZ|@KviF04_4LIIIJ5&repmRmChPFlRd%h&FKgBnlZOk{Q{z@6Zu_gN@+{p_ra0Bb31S*?(AB<@C|_)=G<}_Ulzb$-g-lR({=pF diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_double.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_double.spv32 deleted file mode 100644 index b369290575b0a462819cdef4f4d659a6a3b48158..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmXw!%Syvw5QWF2wO(6`s2dj*LGT4skculqmp(ygZIM7oikEJEZ8w777k>v%X6DSv znfdeVauBf<5rY`>HO7%eFXev9+bQpnhmm)GWYnYB31>RA>#|wBmdo~YQLpHo_tEC$ zs);CYmD>mBpkQKu+SR>IcSY^a0+q9CP?qoO>TOdNb-S3?vu4x2%s;BOnJxeJp5W`f z6JVUt=^^Lt3Dy6N^2a#yX!hn@AMps(?2?_!UC{ehb@KPg!<&5T4N7O$hT2>F)VlMV w9lmqQW<3vp{|e(7*82{DGvf))|A#;iXH!((GXnBosXt2G14?=OAFjCrzy1pvnE(I) diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_double.spv64 b/test_conformance/spirv_new/spirv_bin/op_neg_double.spv64 deleted file mode 100644 index 509ceb43e44f09183a7f38a31bfb65f12b6e72a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 536 zcmXw!%}xSA5QJM61poLEg$oCai3#zJCI-UE4M(3~0z%9tn;jy`)rZrE@m+?$K0DkN9z}r5YapZ|B;o;o+Xe;nNZDqBqfg W{N+-B|MGj+xv7-!-1pl0QTPMXA{{{h diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_float.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_float.spv32 deleted file mode 100644 index 5032936ebec7e2cb61fd84465ceb265530326e45..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 460 zcmXw!%Syvg5QfL3wO(6`s2dj*LGT4skh(N<=@T5{l|V>}mTrA*H-g`n#)1FL%s>BJ zPM%$kBDNx86jNSp8d(f_KkWTBejItH%!ntk6LNO8%hbGmr1!clSEO`D4AJKJs);C= zCbtjHK|#g*w2KFw?uyu51uARTAf>Nm^|?+(-9DG~qFJ{u<*I6%#p`D833I)32DCFW zXUMsGM)ZH9{4taHEPHdV-}I^3CAKbiLB5AqCx741@FxFygVLI@ruLS3YTfz64*xl4 svojBXy+V6}^}a)3O?!m1e+-;qZH~%&CP4nX&yRZU0j0e8FW20GKN+nV_W%F@ diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_float.spv64 b/test_conformance/spirv_new/spirv_bin/op_neg_float.spv64 deleted file mode 100644 index 52ef3da3c74522a17e6c6e6c92ab9b5199330a98..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 528 zcmXw!%}xSA5QJM61pEOJ#ES=viHY%!CI-Wa4M(3~vi@e1%??q*)rZrE@?v6rL)%Gh z_f%JR^=6HWw%LxEwQZy?F|dX;J-0mXdfr#=Stf-g^sQs`*brBtet8S8RV>zerhZG> zOm$hC<=V;|JI;jM_l#5BOu9?ec;-@}y%IwBSe5UakXP}ssFw96J{9XS*30Lu?}_$u z?_3~G^eIC#UWqcG?EzfaoERA;yBV)nUGInE99JPmU;d5k-t|>vAU+VKSY}n%Q_;% zO>P&QfsBszNt+K^-6grZGF0}iK%Rds%g=S5Rn2ozE$VgiQmo3RUc7dDkMZ@+8StG_ z=^^Lt8QK4h@<%xHv+PZ|zMFGqo7}qd8pIB{diir$?{-f9zW4M-|NRD~J#(MhTm02} z!w)<6h;uH{b00V>d{40M9Rqv5M>yvvKo5I!RNiv{?!&iSk7O!z60&$ z-Y0=L*NYu+c#l-=ZiMe^vp(8}>b9!>cIH4eZ|0aeR7MYfsW*2s2Y;gux?^D^5D#MT z;cotqTWQc!6U^VqlX>p?mGVS+swsTh0<(ZvxJO4dJ>ti?u4;Jvzn$x;hKHMp!{=1M ai{4cC@hyD;e&g>m=N_em=l!Rv?}dM+PaPlt diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_int.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_int.spv32 deleted file mode 100644 index cf7a97e9e826bb4a962b2a674de9f1dc5248565c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 444 zcmXw!%Sr=55Jk(G#Q01MqHbJ71i>FrLE_RO%X~o-AIL!H2^zBWyWI$$GfoO_SJkas zk1mVrLBvi(4B~`W8%Ghn&i6aNiyubWDhuKfdO16rRm$%lsm|-5Gop{K#Me2ZVv^h; zxC9jy^Yb?DwYnQ(_f)8?-GY?9R`us5Rmu9!H%@?dLFNoO zcTb46_sO3!nUA*o9)7F6Lbp$DP5!a#^A7)Zhtis{ruLorF?%n)VE5|1ofewJ9ofLm>a%<)e;!LMdZ8VlY8B$*Bb0HyuQjC0#Fx>m z&_sIZzZ43eF-&oubT^9GS4f5SRtVv1Reo+lv8-O_%URr1Z}W9o#o7CQ=eg!`>yv<8 zC}Rd3yGM%t?}Hy`vOa9|9i+OR{FTh@WM@KO=?AN)jVtDrdIM-7Q5BDsNJ$->))TaK&Q|G@u QA1H@=loCDpPFFt&f1qX?(f|Me diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_int4.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_int4.spv32 deleted file mode 100644 index e2b16196b243f928a1630d306964bcc77f3cfed1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 460 zcmXw!OH0F05QWDiwLV*ms2dj*L2xfBNL@B`*;Yb_{8Kl_yZq}tN^8cN+6OkOb?*;*{Og46 r&O8G43T+PS-eX`*o5I;Y0M4*BLFGL|AphOvCmr{UQr`TRYaYQLT@D#Y diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_int4.spv64 b/test_conformance/spirv_new/spirv_bin/op_neg_int4.spv64 deleted file mode 100644 index eccef16e979ef38f3b838e4cf85bc4716db29fff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#%Sr=b425Ga)@y66)s2gaAc)(df>c~Nbm1)Cl zWkkkAHR_K+mS!B*ajWh-BX(a#m%Zm8&)*lt+bYlI)#GeFEmzgkY*|$0^!ab+kh$J^ z2eczHXUMsGMD%~3{D8?kn76iKqptJ8)NSJB)T-OUtC2q;_ja}N7gX%q0VAN@z_`oX z{U4X~*l(<Dec&!@ Y6YldZ10esA@`J?P(kXBL!`0W|7jmc^Qvd(} diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_long.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_long.spv32 deleted file mode 100644 index 9e99f195f43b68ec9363d88b8252acec143bee2b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmXw!%Syvg5QfL3wO(6`s2dj*LGT4skcz8@F8c(bUMPW(6qPQ0Za0G87f%QNGc*7E zb2)i-J&4$eh(U~bwQ*$8OTM4{Zt{otVdPy$Mm(a=niJY}*}SjHx@}fWi0Grs@l_L1 zFj3C_OHfcTKkwpRr@J9`UxCWnEhx*+b@j0+i@JST*7Ii5zAnG2wwb^E?>u9!w@!d| zLFNoOcTb46_sO3!nGc73d-!LdsoTe^k-s88z^j#iOmn=;zuuv=W~`~bXQNv8{;uU46JE0IQxgd8P=w#yk`XDzf*paxF?kI=D%F?0R8|802$2y diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_long.spv64 b/test_conformance/spirv_new/spirv_bin/op_neg_long.spv64 deleted file mode 100644 index 90201ff5c7e7470408a0bae21bab9c92f81acd66..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 512 zcmXw!OG^Vm5QN)oVvLVG4AF~+h#-h}BZP#UTypdm4Dmr&SZ0Dsj{Z6QQCK+GcxZ*0!O(#K0QX^xX2i@A*i%YlRe+(bF6~Hl$66uj^2!xX!(nbcOgT znw8qf4D%O4={wGH-ORdc)%cZCp}i48c;8fS+fdf&X;m-dHa)LCsuY(m|DGf5<<^Bj zoa@C7IK0QIcK5*#wOK!$`2*#h_ENfz-t^#a)nUh>FcyfZ@8UN8_f8u0)CBVrxiXLU zkG%NbnJ&QRSYQ?qkM41znjZ1(Tvs(b{$I}ZRKvqPh{LBZ;6-ny`?z@^z<>Jt)VaBo L@VtL@^}X;1!IB%$ diff --git a/test_conformance/spirv_new/spirv_bin/op_neg_short.spv32 b/test_conformance/spirv_new/spirv_bin/op_neg_short.spv32 deleted file mode 100644 index f5675e80ffc65a856c309784ab1ba1cf32e5dbde..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmXw!%Sr=L5JcMD$%S z)jef#)s5JRh;EGd8lxy;x6Pe4@3r}i+>i2iqToGD02Li;J?*Kx2JWm-*}DNLt(Wy`o2o^Ao-d}&Howd_b#A7we|t}v_1-Zs z&Z+c}({s%0|3>)}ocZZ+u16jML)|`Ejr=9`0a>m5L+j&R{_ibHd%g{|cWhMa-Y@p} uuM@WGc?6sl#thaQkAXeo3C{UG(8JyYmG=yQ{AXKxx7;I2dFyYkxd%VXJ{l^> zt*)-_N!B=PMXW_cD-QTIdeMmWl$$AUq`aN-5xEl?%2=Tr?NFmrJuRx&w_^TY&lWsa z{U+Lsx~w8{+?~_w1mwv_PkZXlfxB~5YA--h%%|mSS>%)YX*?NK%ldh|DC=tU^0)Vp zS?|6F#xXBFD=uq1;z7p4^mUsVW;=Em6?g7p{J>V{TL+
  • FrLE_RO%Y4BQbu$pAgAVydKgo^YIb)~bc2(WF z_2{y=9YyR##3;^qwP_SF$bOjpK7Jf!uPlfs=;iE8o4QS1-LzfM88Jjx;+r<2Vv^i3 zxCRv!^UFRS^twA@_f)8?-GjRR+BBcrx>~2V)q2rx)BCDxQoH#0-+94YZ=3<`ip&{u z?w%3t?vp=fG9T^v1N=^VgYJ;rn*4L_^A7*^fYO?=ruLByYTfh0+#~#)ZO-(c_6ltY k>rE%Xn)V83|0!^WwK*zvV<7*X^GW7jP|BPCa?KO?1K+C|D*ylh diff --git a/test_conformance/spirv_new/spirv_bin/op_not_int.spv64 b/test_conformance/spirv_new/spirv_bin/op_not_int.spv64 deleted file mode 100644 index f416a7d4c96099c1f94af0c4146437c8fd6ccd51..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 528 zcmXw!%Sr=55Jk((#Q4m^B)V}C5d?9sf+VZ9+^*U_xf zM0)7I6e^!_p5rp>ZWObxk_zpu5W>f%e&2>_onDvgdEBPevZ+&?zwLI8HJ4kT1?)l@ zGvL@gQS^Tw{7{qiVWaOL*Y#vy+Mzre_$$?qTRZI>0a;~Qsp8cQB^%cXzy@+GaKwuZOssHiJ`ESpM P%Hd{Gq9^~=)sMm-(*Yba diff --git a/test_conformance/spirv_new/spirv_bin/op_not_int4.spv32 b/test_conformance/spirv_new/spirv_bin/op_not_int4.spv32 deleted file mode 100644 index 5f2962077c405281248bade48f31600ed4c93269..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 460 zcmXw!%}T>i5QWDiwbq~3BI?FPMG)MJ3R0JbE`5Sf?Iuuii-ta4Gg`}lF>oiZbypqH~VZK@`n~zNtVaGC_7JaD{<)vyUH>x`K>oYWPkZhKrM&qs*F1qgibWZz diff --git a/test_conformance/spirv_new/spirv_bin/op_not_int4.spv64 b/test_conformance/spirv_new/spirv_bin/op_not_int4.spv64 deleted file mode 100644 index a2b8d9a7cbcc5d5fd96881dc039184573d1b7ede..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmXw#%}N7d3`Jw7wf?r&THUy)2!gmRDoDkZLzh0mP<1mmpy&&-2BsTGuc0RasZF*T0=3=6dS` z&`!vlA?NNf(f@t&LniZJ-rA0>rp^abw~d!mt8NFcM*fW4+ttcnQL%3ijDdCs<1TOa ze_YdJzpj}muJr@Z+OSKoqPrn4Nh diff --git a/test_conformance/spirv_new/spirv_bin/op_not_long.spv32 b/test_conformance/spirv_new/spirv_bin/op_not_long.spv32 deleted file mode 100644 index 041931f0993fe1750df5827f4e1a5efe74ae99b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 468 zcmXw!%Sr=55Jk(G#Q01MqHbJ71i>FrK_adkvh)jvs2~HwbkLA*^po5Oo-?)ux2x*b ztw)!|aB8KQneA7i# zOq8?#98^@yPy2Y#>#m61SD~_Y4eI)H)qHH~s!cD;cF}Fp>vG+sZt?cF^MtwHIs@7n znKR_vJtO+RPyU$6d^qge!9M~`-7a2@`~~?QUakCnp5tBq^#-LiV@>TX8`Zk^n?3$@ t&UR-W0DFb@4C{@Dz?$|1Xa5*D!`d8`_e_BNSI&x{9m8BVvu>gqzfvl+w?YW(RrR?IWu4v@^(=1Fa`r*tUDetvo>5lcL2Y;syJ5Gd=Ks@;_ZsULNr9n?kF#jM|=JEcK z7ymoe1^Ao^%mQNW9_Om*5ns-ARKw%HbFQlz9`02fJ{JOB^rpIxn|lKMx4$o)dzKQO K_ph#g6#fA6y&N$B diff --git a/test_conformance/spirv_new/spirv_bin/op_not_short.spv32 b/test_conformance/spirv_new/spirv_bin/op_not_short.spv32 deleted file mode 100644 index 42d233f093850cc55b41efc050f9fc8dbf33b7cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmXw!%}T>i5QWFY+SZ@eBG!$IiXiv`Do9-#y7UPyRTl+q_!^TaV!zA1E+2GxN*+b|J5lf+#~|$Kkk_fnZQ6e1O-qSOL=SCA zuA7JoSGgl_2`W0)dfHQW1Ke4mvUdwo+OF%(E>)}ix?C-qU4C1(b#4~#e|yiF_1+mU zE~xa7({sk_|3>*UocZZ+Za_W-hPokHjrt{_h=1d%g{|_iR+_-Y@p} vuXDERc?_Ht#tW=Bo&bBsGo14ypohIVD(@Ks`OmKQZn-Cv^48y6^8kJT_|Y1Q diff --git a/test_conformance/spirv_new/spirv_bin/op_not_short.spv64 b/test_conformance/spirv_new/spirv_bin/op_not_short.spv64 deleted file mode 100644 index e07f9adf020b4e3263ee4192d6f214dec3961799..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 540 zcmXw#%Sr=L5JcOIG4Yic<749@A_(GM1&O$F$kHzuqAnZ=Ga(uBgSzmO+z6f%uML&% zTU}kMZ7er{{?3|3>*C&U}10*CihSL)|u6jr=+99kN>aYdU&*{|FfOFnW8d|G^C! z_11>-w_M@8w|t}ABafMK&pvQg7|&@(kJ_H`nYcc+y!$^A=k4-xPjK!T0C(9NbD!UG U2;{%gdziQfl=8lRxcUzK0=iHgG5`Po diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv32 deleted file mode 100644 index a7a4718628790bf4b54f45854b4281c5c6fab1e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 560 zcmZWl%SyyR5Ufo$M%|Yp>{;<9l7j~oL=imfMeq}bxEVYcl8{Vyz;HF)yr$vxdNCY_FTmH0*8=Ze%IKw zS=UwP%%^QDTarsLqZ-%}CT~BC+cY-Y(`H58znAvv8r16pnx7H7PyJl``W=&3&V1!% zZ<&*DnuJ*QuIYC)xv`(qR<7N6UCh~lyeP0@H@$tyv!W-TWAJ6$f1$Re`b%n$h|fId zRBA^uacA7ZgeZPW)Ewe3_&*~mCjN#I@v0l_ft+fow@k5Ha>~(eWvX$<{-O3SBij8V lZ`GUgsHgPG5B!3@>IVLM=&$!HNAV|e$`u!Me|+^l&p%m5JxKrn diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_double_simple.spv64 deleted file mode 100644 index 62cdf072986bad9f50387cfd3d9c093354e967a9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 560 zcmZWlO-sW-6r47VQTwF`JuBWsa`0dUQ3MaY2>yg6Hj4*CvLqX!NB@Ao*Gs{fZ9)%y z;bnH`&HLCF4X+bm03g8`|FUxoG3xNB!&BlIaZtWHTfV-fjn9D@BB~L5j$=r#d*kfd ztgEu|=F8TlEyyL9QVr|~lhvQbZ=6jJv}s_d8(sNto+Uzh|=2oA0b> zEpuW{6BDb}yLL~L8-+P->FZ6I48Cl47iwFozo7Pn_(H#= zQah4~yWkeaMDY`%<`93y`;@4d_&Y|#t8QQ-JbvH`s@A5QT&;la>ez!EnodW{|8$$JxTxo diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv32 deleted file mode 100644 index adc01353be692106471cd9c1d55dfded4304a7d9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmZXS$w~u36h&Vq;}l~|oLwXciUSR992UB9;YRQinh?tYrPFpgLUw+E{~`XM3X1o1 zmm*l9a^G<4z9A_U*Q;g)GppK~zBvsmTG?a8@wasU*3WZgo0P#e)soGNIVD7&gFh{7{TcaakcVIQeoGsj zmEF-U8ba)*VspZ_xJ@BDpk_yYOGu9Rp5DNxzkRW=nS+DYn{;^lC4_UR4&d>g-;smf zfppMgx4dDOM^Zv>UKh<5W$9tT$C!s1Uwz$0pCk667x?Umy`zbJ>@}8T|NNKO$%FXp lWLcNolQi*He2iVeq5i6mpNNA7KC__nF6*Zr_^Bu}e*?giN9h0n diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_false_simple.spv64 deleted file mode 100644 index 2046ab64ba834a20300443facbd3447220ff4f05..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmZXS$w~uJ5Jf9P8>bkjI4=?e#eoJl4h!A5$VTuJnh>8x3~ifq1b2Rc{~`XM3X1o1 zKP6y=mzr+f8j@0Rvtm{-vx;r#8=14BmAwwU9`kxzddh;V;xcjZ`9(NLugqqwq$mo@={Ru zAe%3BVts7)hR(7Gv${C#KS>9gfEn(GX)^pnZIq^0Tccl1X4=ee>?%HWzB$?8H*NyCrePfIs&Bzrzz&D}qLMm`+m!PmUMsEf|Z zZt50u(%1`%%}Y0gU6AGm^lZvslqN^~KsDf*?@%ag_CVlz7Z0`H(qN7?0XXXU9TE7B z!~-9$e~JOHp?I0mD~E>Hq)$ diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_float_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_float_simple.spv32 deleted file mode 100644 index 5ac5fdfbdad833d608d05b2dfa9795bb3fa90fe1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 548 zcmZWlyH3ME5S;jd19^dvQU}o?2&WJw=tW# z>b&`IZRJXG8D>-i|AevayYbt`v)J(^bCR23^eA09zDTv!C9) zcg`(Lh%4qyiJC+F1^pROG4VI_#jCFDflAd;KbiPja?)$BGUeZ~_fYqT5$*kvf7P1v hsGszzGw_R@Kk#2vNw2pnNAV|e$`v>0e)-~io&=I4DqE6EF{K*#CrsYF8^3clJJM!vWu5z*TWX{50q%Ri?vpUjvHrm1l{cSx*;(c$ zoF*aGop;@VCKrb}ZRML?&_$dL$cq9i_S2ge^cDZ~uQ`N@M?`H&^%vBh5|_baoDpT> zF1dvGgKy=>CPAa>ez!U%vQ}{s(!+JeL3f diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv32 deleted file mode 100644 index b775b80d42a1f08d9046090d932b583d3c8c1329..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 556 zcmZXQ%}T>i5QV2nW2*gAgsv5LB3ZalL3HDy8^K2ip}8s;(vaK;UHSq(uN%Sh#fC0A zVRG(0bLQ`c!9{E~FtgZ>^~X*uu;CUDwm1@wE$Wmnl`Ef~lg8&}GYdN|P<(D9L(jRX z+$vqI%f_c4t}b06F1D%EX8%N*)o-caR4&=mChuACdU++O^n7O3_dwkz-CX7zhTWX5^!29Gg__MQ%X3?*8@n&$OPx3~2s?4-9e6G3FQh#b z@@{8}9SJeGQ)P^W@Dm|(z@O_r6%vEL)*YU@*u9k0p)Ur1BMv{+W1cX2j96o9smFU diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_half_simple.spv64 deleted file mode 100644 index 3107949596aadf1c9c36bebe5d84fdffc4aa205c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 556 zcmZWm%}T>S7@RhZsrFA1dRDxNJPyCfT-M_<6_^-^#qHuTUh zd^@|d^Zjj-{#6F_0Ax7jDmz0TgB>32a7Y{>ZI!RV`RA9sjs-A9LN!{SVF>AUu7g{d z)!Nt5e7efJl3a!f)xbYtZ1ry9Cb;}Sn}68y?fQmN>h%HPr^o8!wy#6|p0PffFIzT_ zF)6!AiR&hYW>1qFw0$}st4*s**c)Jr0!voY>~s2(JMGnoX3|;jpx09VIkm?`z1s!v zPKYvb=ZqK;#gB>VL;NMr6Qb_K-|{S8d1Vh&Dv#>Q#NUyVUOmVZzhLby?=Nrk?vGrR kYf4wW?!R>WjGXdz{5Mt7Yj(xx{)wDo#dW$ZC%&iu0pX!M9{>OV diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_true_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_true_simple.spv32 deleted file mode 100644 index fa0deb0db807554842ec08d1cbb7df9473e62245..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmZXS$w~u36h&Vqqec^B;_N~Z6bBkt4h!A5$VTuJLWt#n(rG*0LUw+E{~`XM3X1o1 zmm*l9a^G<4z9A_UH>zd@GppLFzBx@RTG?a8+9tJ<{KW_h67i?6%MD00C+ZjknGdhyPlxTWl47CjeK zy^{5pIH^AN?o(%3gkD{k#3Nxv9nixdO``OdmGd<4A6{AAn%!On$&Cv$or&Ccq2}tS z61&*c<#g0N{A7 zve&hXrVzWO*sO3(+?J3XP;*^=TS$)hzTUv6zXP$bnS+DYn{;^lC4_UN4&d>g-;smf zp>)t=x4dDO$5KLXP8ZD=W$9tw$C!s1Uwz#LpCk667x?U)J)sGnc#TEbKmR3m@*qAt lS<)rtBbqRNShV70j$+>-y%*TG7fL1CL`KcZ5|7vW%ELbE$E{8rYJoudLQ#J`|rQRP9DW) mCo8(dUZjb=>V51A4)xc(|6Ck2u$cv&Prax~J@8vzX8r}jGe_wF diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv32 deleted file mode 100644 index ac0536a7abcebc4483e39db268636c42e99c4426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 576 zcmZWmO-sW-5PeM=Q|*^U^jz^Eh~(g*3ZfSey$Jq~36Kz@n=q*q** zHZ$3}sGa$=Rbf}eVvMN}Q!e$FUU%v6Q^xAs;onqAulG=m_-A6O71rtg*yVw13tosk`Tzg` diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_uchar_simple.spv64 deleted file mode 100644 index 5f2e95ddec579e9e84fd2393c6985f0048f23ea0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 576 zcmZWmO-sW-5PfYLQ|*^U^jz^Eh~(fw1<{L#UIc$a2+5*g*)GXO=*?f?@AV@1-Zr6N zC(O>wn>Vwwlc;}@06hQ+<~${H^f74dL2EB*M~DOS)fxNzlGeTirijQ!&>4mhUvceB zkriuO`|QJ1)~tvnn2-%@fh@1yGQV*q-Q%WB@t#*#*W^aw1Kf9yw~xbI`}`e}Tc3UA ztH!W4<}@+wy78{r!Ndk(PGfzw3A~820eM+s$@}#7GwPC_e9fT^DIT`I`kyjBq!lJn zd_=oYK)LysUoakRQ=#sJn;J6~KB3jD>UYj~N~@gk2WC{KStPpemYDL|wM6_o&ffL; rVMhPrk*9jjsOm4i-qPX6^wqb+zsM3_`%sPYPsCI!tmFN%%RTiEV1zvT diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_uint_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_uint_simple.spv32 deleted file mode 100644 index a7734d984d17ea826eb7b0e7091003a96e6adc73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 552 zcmZWlO-sW-5PeM=Q|*^U^jz^Kl7j~oie5bQQt&4%p;<&M+mLL8-uwmrUN3_0Z4-Lv zgw30I^JaE-;^-y?dH_As4w~a5G15K_U=CsaNyP%6X8;}f}0t({D`R8RDVs~n5dli1v9GCoig=%Ag8=`E0g|_vvz%cnbGc_`B%>g ikNQimJ{>=8AA=T;h$Ey?@#d|2dCluk0#hVZA^HqMNT;~=c4bx@ zR|oTHD`(f_GEArjc7!RacN4bW<_Frm`EcRpmQw2V0sg1Q+sAR9L;ap9Trgk7y0NTD zIZaC3G{HA}n%p4HXd diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv32 deleted file mode 100644 index eb1469f85a8d88500cd21c162ff137795b76b2f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmZWl%SyyR5Ufo$W_4eR=vnb5l7j~oL=imfMeq}buo?DXn1o~^?9DImd%Xx&jR||$ z4n5sdRo&C+IJ!!K5r7oOJY^?{Fz(|)AE%5{BtiLJTle~wwY~rrhyxapUt$93mAAEB zn|0+{Z$50}Y)LG|oNC}7FnO~vep}mYPn&gRhBR>pM|;h^*bbY-hAd| zXIYzYnuM|HeBJF}V&gEUb-vjKUCh~lyeP2Zd;0ft`ihxy%`xfkirSX?pOHOee4)#3 z*;#jK2D_lO0_HR7tNLs7CxVG1Uqibie%b2l^kaBRul} diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_ulong_simple.spv64 deleted file mode 100644 index e37d3226af44070f1693598c01aec14a9e48e30a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmZWlO-sW-5PfYLQ|*@`dRDxNi0};UG|li zondXvX<}m4xw_la%A|kbyrIu8Gur<% mPxYMB)n9tm2Y$i3`Ud`+D(STY)hPc$PPO8KZpS}=r2hf06Fl?) diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv32 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv32 deleted file mode 100644 index 84926b4cbd3911b150ecb4146d2d7e4cf3c73f82..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmZWlO-sW-5PeM>Q|*^U^jz^Kl7j~oie5bQBKQ-QP!|QuCL|l7H-CY@*NfnL+blhF z!enONyqTSuesYxoJpdWz{7dFYFzD=2XD?_+NCWe=vhMjMZ~PlDML%E(^D_(~zWk=L zYqKt0C=>k7*YQ zD7Rf+HIfD6lbsvt&e(O-;bU6Or+$~@O=y)9zGOyqnnj|1cf^#}eI?@GbN1Nhml@sv lk$?4^Qq^C4X~bvr)i>hbWW}9Sqx=&w)oRbk`{NZJsQ*A+JV*cl diff --git a/test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv64 b/test_conformance/spirv_new/spirv_bin/op_spec_constant_ushort_simple.spv64 deleted file mode 100644 index 00d01a7f44bab3e1b43dd1bccac3a6b50005c93d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 564 zcmZWmO-sW-5PkiKsrJhvdaigA$-#pPMK2zDDfB0VP!|QuW=S?eZ~g**uNT4hwpn`U zgxT47^JaEt((B%&KnFmI8BfU!UG!Uf(%LK9A(FscJ7Zs0S?%9|33_BB=oABpFTZwX zlW$5}`~1^X)@+HT7?Ta`fxM{RbH8&YJK|Oog_<|ATsTYarJrGk|`<00Q$lha}Uq-b5 mXP&A#p{joTKM|i2Q{9MvlND!Dj^Z!Gl&d)-?~hw}qW%LyO*}~e diff --git a/test_conformance/spirv_new/spirv_bin/opaque.spv32 b/test_conformance/spirv_new/spirv_bin/opaque.spv32 deleted file mode 100644 index 0dbe21f8621b268b3271aeaad3194ef979647334..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 568 zcmXw$TT8=05QWFYUc5Ed+WI2cA_&rVFNomVl1G0*h?j>z$<{XZ&-zDv5j@{!Gi5rn zduGm=*`&$!z--UV1~$__Hnzm}W9-G)R~%UyDih_I_4R8z{kr`6{xo%&^;DB8R<)TE z3wKBIOSu!m867a{Zscez#iuo66VuN2}*-80Mq4)h@P; z-)Mpsp9+O@&V}qkXJ+LN&AHB6I_$#zM9M?Onb3oPn_a2;Pgk>UEfBDrY8mz}fRpn&|!ml=~wi diff --git a/test_conformance/spirv_new/spirv_bin/opaque.spv64 b/test_conformance/spirv_new/spirv_bin/opaque.spv64 deleted file mode 100644 index b3b0adab6a78478807139a1a7c4484bf1367c96d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 636 zcmYk3+e*Vw5Jkr(y?AS^wXK4nMG(YyFNn~$kVn5D)XPJlG_{TWLH!GV#23N6PNv|L z>CD-)XJ((1sBzIY+cLAZo#-FyS;JzFO^+>)yNX?l#IWFrwe+hel#A*6$6Jjz#fgL$ zbF);_;M035PrZK_@;LA=m9r}q3+|OX&sU3Lxz5vB`8=Iv^L6<$t%`Dja%} z>)rXPDwk4F*9WRHa{?e6>5Nt|w4Lj$%ZJ;8_qDmBI8=2z)XlENhQH%y1z~ZhbD!@d zn>_d&bn}vD>ey3sO_kEHYhRIB)W+)RDzXoJEM>{RGdwihr~?k)1A}ubee@i74!7qy zJ%{o;DcSU*31i=;m;3+dzJ0|<|At4(xdV-Dg3TA3su zEW_#y`wOhr6x>1G-gC@cmri5zYE-b}EKag`FT<4#Ux3qeHW^IkX=gZo?hU)6`S_*x zJ{XU>uZw*iQB}`9obQY#hz|{I%+n%X!<&=WCSJ#T6XqLC+rZcH?qhuuua-ThOxVI( zGav0X*YP{lx}rml*kjK%6XiQMV)u;L8Q;v^#@{i=eX5w6n&$~!_t?R#c^=5ATf@|| zX1}~$%)I^9BDW59-ZHmAY(8>7VR#o!OdadLs2Ka(v@rJ-f8=}ZgXPKpp>}|mBR6sm n^SZocj@&P{cJCuhEw$y_A9wdZ;vKsCJ#&ra$G!i!^&9LTX0azf diff --git a/test_conformance/spirv_new/spirv_bin/phi_2.spv64 b/test_conformance/spirv_new/spirv_bin/phi_2.spv64 deleted file mode 100644 index 6d153537da01f29f0e0c7de60da99b4ab4d7dc5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 824 zcmYk4T}lH%5QN*TNz`a!Ok(_ZgCK}+KBypyPlol)6D;uuvJkRiBRPOK@(g+>SJ7R;<_J^g1jtz?TXmtC&7TvM)FAcf`8u!{bQ4wGRLpEB4raV0E=$QiekpYQL<^7lA+3DQYW$leOx&&?uy^JPM`s^ICG(?&@-FI+{I%&zBR|X^0j=J zxvB8)BWMrq4jZlp_vyHnFg*ABa9mp$9_~&Y{v8Fr)bQb6yazm9)V#JU%v|%@E$!jG z_FW3T;kJT4)PL25{f=T+!M(t5(&EQ&0Ui1u)%KOqp!J#qS4TImLHnhbq|c#(Ui3!K Yc|Ut7%(rIt8~L(F@8|y0>s%`S0Uf6*`2YX_ diff --git a/test_conformance/spirv_new/spirv_bin/phi_3.spv32 b/test_conformance/spirv_new/spirv_bin/phi_3.spv32 deleted file mode 100644 index 047c695b110d97c6caaf853b2852d135201f0e81..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 844 zcmYk3+e$)F5QbOo(#q0GJD+w1L39~Z5OrDDT~DyF10;xwg%8jh^>9H2LEpFC3tTeJ zKePV%XZEb5bW{mpDuhr8hx~h%Ln%xbex~qcd@Uq7vjnb(GQV-<;I)&Tfz8jrN$|s$ zw;Zd}eH~-9hTuEYtv$xfwWu^UuSONy$>SuC*K%CV@d-G~-UglFD7)+SAKTqlZ`6Nk zzjyk**7JCtdsNkP4*T0<6~u>z6!WYT&*II=ONr<3Zo+(%Zu9sC-g!=o`US8@{vuv& zH4f-l!^<@v?W)lAyVO3XLXOyD%>@(4caDgiJ7Rl$Ge;eNO&{l5!qn6}59m6_GUlD< zmYljPn0nq>FRy`_x8A$RZG!DL$z3HjAGx0}+>P&|j`zQ)7_Va+nDdGwcM~kv{mC`n z!nQHF;*a7Re0zEFf4JMl%aI#7d&RxHNshfEXTRV$-y}!9FJ9X{q?rBeucke$Qz!1^ V0PNeilN)9&Cc{j(~Tv3cin&gY#k%9kuFh9y?EynbngQLi7Jx_nNY ztnm1GVqogUy%bY(EZk9+v*?lwRgsuH_0if%;#6-v!Np|nL^z5jqyBgrb>iVeHx38W z;bZruKOBTlX+L+WNTM-rJ?q;qGXi=>!}wi!_WYl5*M^%WoWqb$R3+%bO!f=^0T;e_1z6>t-RdxN_z=Qv-y{6;9 z^_&B@4{w%(w&%1QhyG?c)ce$g&^nX_GW4m52Ir{bXL2OW8#2FZ^+?P)KaXF%`i1Nd D4Hzq`qFNm!rd>R$rJm} zgOuyjc^PrN`tV!at+k(f4Jysu*JBQBrg=WiS5iKg@?&_jIe2aNht1ng@1fOcbcemi z)?2&RZ9I+Uxx-aI=diy$mSJ2pB*0ZCpC-DeE+L;G`V#Kf=r&8N5}oHHtDlFv)GrYA z)?=5BC8ApQBQ7&v@1^${6>8)zYtETKy>mqF+>zVki#f`~EBZL!BG6N~?(ubw3h>Nz z!=AoNKtIo{S62n@Tkl!a*5LLV*DjO0AGIGSd>g-uKA!*JVqOQUz8cw z2OB`G{5`va-(H>iZ_c)eYSc!}c6P3ATx0Lpa|iBhv8Q;-zQ(ycRc{k?|q!nne|S9_4>uPK7{+ted}xPZf<>i=U;v$7vK-srZq$W diff --git a/test_conformance/spirv_new/spirv_bin/phi_4.spv64 b/test_conformance/spirv_new/spirv_bin/phi_4.spv64 deleted file mode 100644 index c907b9f74979d6de75f1b2442455aa6fa4967e95..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1016 zcmZ9L>q$YP|&7p8ZSy*@f3;cJxnm0uGqPnKN|>pI!|!n_)CQ z)mK6OQaa4AB(wJtba#HHqTeI;?sFw!^340@b7f)jA|sC$d&XT6 zj_>}DyQ&;{ fXKJIxdFt6+^Sj{N;9agXJ2B_&o`3W;oy&d!fx$U^ diff --git a/test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv32 b/test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv32 deleted file mode 100644 index eebbba2394a2933a6a7c79c4c43d843ceb48020e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 828 zcmYk3?@9tu5XC1~v$Qf(v;P@E5Ph#8^kZV*dV_+ZeJbJ*V&hbx$osQ#^Tjf*N dmoB@V$>`~JIv3_&v(rE`5W{i%{OWb?Wq&&*Fv0); diff --git a/test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv64 b/test_conformance/spirv_new/spirv_bin/select_if_dont_flatten.spv64 deleted file mode 100644 index 5eda1248362df54d0013d0df00c385170ca08f57..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 924 zcmYk4>q%5dNzdM_|4GaJS98TgsV};>@&&n2ISfI zBgxf;$&-6fj(PTF%)uQx?0Fy~j}CW^dnnADtK1{Sb&lTqvcj9yDj-&A-iCHh>-$a$(HCQpx+?4*d@BHk}>tH4*nzMs7<(xpF* zlII}u;$<=m@PkQ6Kp&01ke2@6cc6GfF*$f6#Z7s3Bj1zSrhHePd9JJa zEnyD)ZFzc^eQSEF5)+?mg0?)h@T}ceI_!zojXJ;qbEvu1MDUr*V)n2Y%`eThD^EXk zJ2G^~(q;ZV85$VpNjltjW!!NdltZT{qd#}l!|Th)Q_r2{@-NU|;itTX5`;fL+wO$>_+ZeJbJ*V&hk%%t&ZiBTjf(XmM*)U Z$>?c!8Vd8)>@?8~#Bl6Bznc0^_6HOOF023m diff --git a/test_conformance/spirv_new/spirv_bin/select_if_flatten.spv64 b/test_conformance/spirv_new/spirv_bin/select_if_flatten.spv64 deleted file mode 100644 index 3c211e1c1788e0a2e0d76dda0aa0cee0801a0e69..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 920 zcmYk4>qKW>tx^OP!cJz36)w$4T#<7#HHZ3*jJGyiDfH zpcl>_2VsA@oDB!jWH#+TC9~a26+PylKRs$fTHbDDoVwyQd2;X?iu3a9M!u?U>+%(O z=AnK=z9HkZrAqCltRdsH9jBOtv1Un_{z+}dwuGr8ZfeT1Jo@mw-MCr!7R+-g1vp?1 zHCLJ%KC^qwt{&6#OS5mwqetJ0jNTpfO?FJ)l|GyYw^L2H8fVNtT#h#&&%W<2R~IHv z?oK)8*_AN|cl2S;JsElWaOb)E!p!-fd!U%S=XSLrbMsB##O6)-Z=ebHQ};*me48Js zb9XE|k+DDcRdxRDsG-*DHiW;$Ljyi_p5GMqeLSDse?D~`^+o?w#;kt7mN4(beqGH# M49D;GtEsPLe>KiBxvE2L#WT&t1GXO+@dOTQ|=Wq!`|gqv13a#Utv98Tv!^b#a#5}K;b zs^a?cvoOms{o>aG({m;~k_tU8WaP%GBqmRfhU_Sh{XE{yaU;ix#+2>nmQ9XD{*{sjbVm<(cQItltpk zz~7XochR?^|5RY&GfmKxrxu>GyHbZe(YjU#IA9JnH<}1Ob2-c&4x{;{xwhr$hi*%T z?m)WCzav8f<2*`-`?icb&b@NzbY%4Bj(T`q8F}itb6nm6{bg=XF?q-R5QBfWC!-Jd zpW0?$p7W!Q+#SdcW$XfeFK6WKsiAhLI(8%XEgn7KQ|I`{!cNEW$u0A#8%USkPGt0S WJDm#iui0s+8HnMyeSY;ix3WK7l`U)l diff --git a/test_conformance/spirv_new/spirv_bin/select_if_none.spv64 b/test_conformance/spirv_new/spirv_bin/select_if_none.spv64 deleted file mode 100644 index de1439398ed75a1e565ecc7eb980c0be21c4964d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 916 zcmYk4?Mebs5QZl|(y}yDv+vf7ApBoJDE&(8Ustf0Z6qvisCWV0QP)uS)CUB;&+Z=Z zz&P)jdFP#(J!UiQg4v3h73@sEoT_Ckm->9_S5se-FI!d&i>+csBZtB)2!qkwA3yt( zXc8p(ytrBAroqg>=!P!|MtdsUR}_tN8L@$sxf7=kJrCo1(sw7ur8svX?EACV@pR$$ z!{~7s4kn9eG@Os4$>1rO>t3qpF$ewW(Gb$&b}QpFbuY>jgXihKCeL2P>*}^HUz2AZ z>Nn&)8K)yvYByz`jMGUu<>VS`R)p!F)aGnUm^$t)O<9#kAD*+DbQZn^^IS>+4wysD zm8OQz><+W5!}R>t?A!9_(YGd}cUOIr9g{bs59cA>sUcjCBW9mzj5i?8z8`6`KIq;^CtW^(1iP?{E#8sMr!r=B`?ZC6ANK2M2JUd& KZhv~wYuP^$DKVu0 diff --git a/test_conformance/spirv_new/spirv_bin/select_switch_dont_flatten.spv32 b/test_conformance/spirv_new/spirv_bin/select_switch_dont_flatten.spv32 deleted file mode 100644 index 5c67309a44ca40642e853de39776a0aa4032f8ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 952 zcmYk4T}uLC5QQgKv$8T%v+p!3i0&&0y-e(`U$B^NC@gO1Vz=G)iz_1NJnO!&FN|~M z^UTcZ<=REF6*DW^rG9x8%UM3vg;cLfZ=087=7h^uGJI6dgD@Dz{``Fs56Au}n#TTX zIEdq5YU*TGP@N||3+4%?cQ{^R`p<-WVx-@d1Ycj3*!byDk{l`xcba1c+TX@9hw@kw3j#~kp(Q5Vwk)|BuXve%^Xk=K;HF3pbkYhv4w zu1Yh{O>Xidg0CXYY|FXwwwq$?mNuwL!%d!(hjdOj z;JsA`a=<)l?!-twybiP@$Dc!!(L4c#FYehe!&D`3?vgUFu|=`zf1o~jWO|_nQlWT zHTCSex2h*KU&|UZXN<|33w=37GjGyXXRKbZIwzesDOH$Q3MOaB(P0vVK{xUzFN3Jt z_j{vZV1mCF`w555*v`c{ z`1}6kc`%;(t#I_%3ERWzsN0DKqhY(3aJ*Mn`oRNyFv_yD1am9lROBy86Qj$2eur;;@M z6YR8jC7kiAnzAenKkA&^=pM6x0q&(bP=n3k&Xo|U2iMtPIvdO{bzt}O1Gge!=7w4q8n>evM#o)uc!-E_+%(*Wi4h}h2dmtO0v$cov ziM!gSCWJR{@~Ue0hV-QN&Bm&-Jqf%2)SV+~di-dUCBZjPB{qI~lqJWh?WOi!ipwd!77l`VK3Ob- zel&X-MuX{cHX0_A*>v!_n(s+n>Bk)K!_gGd;>MToTCz8!@sa1t-jrrP{0*^{r0dem zb7Skbgn7>17N*A86=8O8c2$`E&fXDbCirU7%(j{d8Bh z;HRFL%RLl^Kbw0b8^6o_uw48H=tKO|`c8!LbH^`jcq+~AzxsN_&aCZA)2}Vz4(Aef z_N9CBurJ^4M?QKGBiF_Fj@cOXF2*;_#^7`@{vX*Gy}P;qH|a>=b+@<>W;Slo(|*|G LxI6r5vwO)umWDRC diff --git a/test_conformance/spirv_new/spirv_bin/select_switch_flatten.spv64 b/test_conformance/spirv_new/spirv_bin/select_switch_flatten.spv64 deleted file mode 100644 index ea822e6442680f6658b53d6966b7a23f2ab7bc2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1044 zcmYk4%T5A85Jg)7QBV*O@$Dc!!(L4c#FYehe!&EB3?vgU%mlY?{Vx3{HO9nym~KNS zHTCSex2h*KU(XsdXN<|3bA34_GjGyXXRKbZIxk%?DOH%M6iv>MqeB#gK`-{BmqFa? z`%hsvj)S4C%jix@_BeEA>b1S5A5BkpWtsy?ff(cci)em z2jhv~4o45&urr*Ddfj+18g?ENes}6hKX`x-Mn#quU~VLws{BQ1V$^x^m!z4G_`1+? z(q(D*aDQ3alW-d9%H0)-C*d?~O(Ajr{i1yOy8Nna=5&5ZHXNM4CL7*xDoevZ!A^@; z!WqA&DJ#Y(&2iu5_zz}tV7eUqXLIy!Y8%XRDq%*qmowRLV=pbuhffW>+25}wyOR6?DLXqa diff --git a/test_conformance/spirv_new/spirv_bin/select_switch_none.spv32 b/test_conformance/spirv_new/spirv_bin/select_switch_none.spv32 deleted file mode 100644 index 36bf67c29c544f0d8ce0ebec01b78c99bb3ed7d5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 944 zcmYk4TT23A5QZlYnOT~t**VP$qWcO$FB7}#7c6EA3d?S|Vz=G)iz_1Neb)V8KN#no z<2y5JKG!Rmt(jTLF7?Z+Th0opE~a{2x@!3(GbdcLvf-mL_5**i@Z$H`Vlwr@DD+Jo z%!eK0U4WbPB=EXhTnIB8w-{(YY;xQk J{ABAN|8u6olo^*s!P&klU0R@rDBSP933Lh_l8q9dKpiL zBR2>GFR96^KCAr1iwris{ZV4meDk;lyJLOSNg#Nd@$;=G`zW$a2oQLq=`}I$S+DW8}SXHElby= z;luqEX-C3ot1EX`C60vCPHW1E`|nre)7R$LWHYDrtFqx>{dL*!hEq)%{t0$Yyb{j% zO-)&sh97lSZgh`XzySAB9jL+PaOX;h)PrknFs%*dmpZU}`hnY!Fmp$^>}X2@2Eutr zcd{*;9OomA?Z_t1zTVT=u59AO?i7O$?+y=g;4tUDgg7|lZ0&(;c+S@z$|r7XyP6Q* zyveJo?HkgQ+P5^;lozRmF;%;&(gIrz`#=-tsanCDEwjCL>Qvf;*Fx|$E48hEq6Urll?`2%OOIqv`f diff --git a/test_conformance/spirv_new/spirv_bin/undef_char_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_char_simple.spv32 deleted file mode 100644 index 1250c05525e6145bf8eaa13ad45c889705fb9b72..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV2rYps`75q0CDA}GFq7DShZE`5R!+lqmhlvexfZUnzC#(|SFmyGk>YG`A6$TxiS=2N_ZruEzg<`u>V~iydzaLEuv+^Mt&ey4<~x+m%nh~oY*g#s rZ}#}s4wZff;E_x8KLq*+hxp(j5jHL`CK}^jO$daQ6PA9#%?KDL8D|J6Kd2w&#>6^9(@9PD zty{OMGg0-rX;v|_ruFrudRDcX_qz9n_Y?28>TQdpv=SX_85*3v^5yC+EZ&n%*rp%r zY~`A|^pWN?H;a|PTl_AC*u4hjTq|`qn#qr)LVG8KuwAE{U5K;dHOc1ru2>|WX_3#D z`|Jz(vinS+hC1N^NA^h5VNdwJob>~YcSq`gLf2A919zqKu{v7#d)?s4{v&}Ji@}>+ z`411$pl7Cd|EMi^&n~}Go~l=LBI8V$$brnZfDfQvJg=jfJL<=|u4Z_4`F5_S86NIg T9GT|=x!g@PaVGOm8$1dBq!As> diff --git a/test_conformance/spirv_new/spirv_bin/undef_double_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_double_simple.spv32 deleted file mode 100644 index d7ef1922ad3175d11e6861448829c8b17af5963a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 452 zcmXw!%Syvw5QV2rYps`75q0CDA_%^K3Zl3&bm)ffYy{14vxhE=ny?$`M2fvZa93}t& diff --git a/test_conformance/spirv_new/spirv_bin/undef_double_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_double_simple.spv64 deleted file mode 100644 index 923d2c8afb61d7a396b39f5b9a3bdb644c1b5e06..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 520 zcmXw#%}&Bl5QPWIkD!7`#ElCKiHTv4CPu@`hNVw%1GXehYD++PL47DUCZ4a1lbp`n zGw05k-l#rlo7K#$Z9{#Dfz_?yx#_v(`P6e)xo44-R-tblL&Kzfk)-R8l>1elhF$it z$Hls-~FE6id!aF=;ELhQ3fRo$p`cdGG^r9yizgs|IW+e3)+a<$AC#i4v(er9E{ zNRHlDn#=BUfw(u) zvL|malLkFC!Tkq$aGyPXSHyt!XrH9g|nxeL|s?DFN@Ks7wv Vt2jI_1$^nfsN#(0uQqrT{s6Y-9>o9v diff --git a/test_conformance/spirv_new/spirv_bin/undef_false_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_false_simple.spv32 deleted file mode 100644 index 5d78c7379e7d95222ab40b4d2f3b559f28296423..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 496 zcmXw!%TB^z6od~HM7)5AmyHXIiHUKKCPtSwEPa9or6f&iA)>sKZ|KIv@56GE>AC(h z)1-OTiD*PbCx(2DK{TUP=XRZU$h}B5mrd$^biY-TD_DjcQ+u*R?FgJou%dCby`lU_2O;%SuCo_>|gs7 zUcHWhaZV?PGqp!lTc6H{F!RH4Lf)$X3jHXdqz{kk8+ zlhR~*v- diff --git a/test_conformance/spirv_new/spirv_bin/undef_false_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_false_simple.spv64 deleted file mode 100644 index f3b7372b2ce745d7d8567e53dc6dafcbe7d0cdde..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmXw$%}&Bl5QPT{BL08~$i@Z6#Kf>i6Qglu!_p_XsZx?AwIx=0C!a$f%8iNVE5jtG zGjnF{x#vREyzH1Y%&cP*eTjiJt>wAxdC&8qa?c`dSdG4QjTs7`#WG!mRgza}sIs?p zo^E&A+K)8P3bRhN?Td`SU61Mj&D{d@6v uJr&Rg#IySxs%A#~I5$!a&l|p-8>@zgdlH8i{u}%-dr(Es{eNi5QV2nYpp-6BI?FPMG$-e6-1YYE`5R!Z3}^z6kGf3ZUnzCjRWV-+%xB% znVTjz!-!r)4C92;IE^IwT^@9Kk35dFRVLJv7=@fKzw7y8nJ=rR*yQW-b5$(@hlm0C zlw8&k8IE#?;0k1PykE3+zt!DRJ1;|J?+)bodR2aH^Q>y#i)vPHn~!2sHuY@2n|+S2 zyH0^|$xRPAXHTjA_mn@wnGZ8Jjs3R2(~PL?%U$#4fUHjbsq=6r|9g+pp0%O&0YA0Q s{9%Uw>~%AasGr$F|6`z!Fy3I@bqwqouW))zfPVH~sJ!d-i}NG+1G&S`fbasW@arL>602*-5NfdK2Lm}Yj!P?!piPh+t}gonXfn7u+56(5ccW&F56U^ zru32aX>JzFnYZ{{t7G>Xm$*^tro!aLQlY(5hp^wJAIA`9#cPtS@?-Iq9MU3Rt*h)y z`Ev6@O-o=-}_Q!H?S~YUUOcZS%#QkYt}hJFEnm(JgyG?q;>aAT Q$z?Ye;yanYy5LFu2e_pkBLDyZ diff --git a/test_conformance/spirv_new/spirv_bin/undef_half_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_half_simple.spv32 deleted file mode 100644 index 810406a836b66abc0aede7e1f19c078b2da701a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 480 zcmXw!-A=+l5QT@fh=_tn&>JrxBqqK9nh?CC;gToVl)u=dwuCCr?u`lOTh>X=&hMTx z6GxMlS;Nd)_MjK*TVzS_&ET(sZ_9Tr_CF%UJ!>017=Fs_Ztp&`V(;qw>rm`eW2UM3 zSUxY!QZZBO2+u;Q4*8>x6F>K&7~ND;^j-z$>O+1!xwNR(S+Oin)h7GSt8%%$Xb;89 z&LaVPQU(V#v`32m_oO}$vksSTY}dYjiMj9I=ZW3OGfRK0|Ln{k>a)Pde%wCQBt2q` z**9@Bi~g_lZsi-w(6|$7alqXT`CJ>K*Aw6c*h*FIU@v;uLN&Pi0{rwo6p_RCC#84c E3^)=T3IG5A diff --git a/test_conformance/spirv_new/spirv_bin/undef_half_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_half_simple.spv64 deleted file mode 100644 index 18467ac999184f9ea0f39be32d47bb7e9090a665..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 548 zcmXw#%}&Bl5QPU?MEn5}!Ho-yiHUKqCI;flhNVx?RDsx}w!|tgs1N1F#Pi*blbp`E zGw05n-l%=iHEWq!*T(u1Lu*^?x#M}q^S-=p~ ztX$KPJ`&GMvqT%X%e*ro@mZ6=rMW?O_QQ}&Wc63tzNQ^yeb#V zX7^Zg@%|tXr#dl%8oQ@r|30aYG+7T|6Loh(zv2AfQ8>r8r;L{Vx$fhcJJhe$VfKMA z6^MJ^foI<1MjG^Rg8R4H$9+8g$ity>OQ+^t&1%hH-$3XKGr7hCo|p@WC*MC5r$>By h?O2>T-oCsx5~oh>Q8hfA2>75k7vs#{UpcxH{s37a9<~4g diff --git a/test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv32 deleted file mode 100644 index 70bbf4527acffb021eb16dd9fa92372eee69d706..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 440 zcmXw!O-sX25Jjg+Ypow`MbwRpiXgZav>>`{=+a*hs;v-+NwKxR-HqTmF%H}}^X}Yt zXI`3I_aizH(T@?QaS};%+uUpO9(fpPqfDqrF$g(depSoWdtOxAyL?l8tjiUgnjZR; zTvQPmj&g_K5@d9|pEq^4(cMrxFGFST7UcP6U3~8HtgK%b<-FR}Z;NeFSM%lH>@$4b zbpnhFZhFW$dqVZUr~E0-e7NEF$#UWf-GFRQ{;_@M9{%wjl|5@i?E@3kI_DeT19FF( oe*W``$<{|eA7Q+}y5BLdXUyRA8Up?7J;Qm|%eQ0j!-OgL1$8hQsQ>@~ diff --git a/test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_int3_simple.spv64 deleted file mode 100644 index c23bf6488397a7ff818eaef777a57f9b4c989d3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 540 zcmXw#+e$)V5QWE6W(UpeaMOhm1kq(sK@?pjUiJhVOM?xzl{8|# z(_p?vofi=Ul-*V51PqeaQCZi^xpQiL2TVD80kUi{&p%e#U^;slO^3y5_BvYTvtl^@ z_dZ0|n;(I3%u5Y9z57(_JLP*Q^TWfv&9cvjaIZy{TkmaAyCZ)}-`m}lzoetb4(J2p z4n{9;_kX!&#(8VQ{TtNX*W-uDU2=t&9&K=sf}S0qjxe5+-yXF+<2!L(YI$$@O58rR YyxbFaFrpU`!#L(^oJ2p;E)TlALmoxaDErjo*b6ytepid-M_yE$yL?@IuF55xngRNR zTvQPmj&cX!5@d8dpEq^d=x(T;m!YzE3-WxuD!#UPR@QIxa#n5Y_xYx%tJ$KReTJ{Q zPJnU2Ne?+^PpJO)lt0Cp2RFK1vby$u%8T0h@>j6?WVP~-osWC@=6j~tvo_Q|Fj1{@ vf0*N2dz|z;1W#<@4o5&AVZ6e+!wA?jUf}c^1O4nh!+F-ryZ*0VCQQK}`K}u4 diff --git a/test_conformance/spirv_new/spirv_bin/undef_int4_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_int4_simple.spv64 deleted file mode 100644 index 346ab87c3830d32a1dbc32f3e1b2881872de2c5d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 532 zcmXw#%Sr=L5JWpKV|>LJ9~&1DK@hj1f+(&Wvh)jvXd(>6NiZ=#s2}A<@SO45P}6;@ ztGhaB)KA+HwTNiPK3}63^=PKtN_j2iP4Z4OP(+1pbi$q+KFaarH80BLWxgoh=F>^i zw9q%Gi!vf(v$O6w23gv5Sk=u+cSfymhDz-@$n(X#cwgn&boM-&4$IZ-Wwb12<#7Dx zeZXFCegMW1FL%i4J)ru(Q@+n;et0;yUiJA9&UMIg&N{b2c1He$x3@bhe?dpx78n5I z7Dg{`_kX!Uqu$zZ{+g?t_qK18+vFNAJ$Aqy8}#e~_Xy)D`R!8MGrkhnqn7uU&&2If W%ga5&>DdSR+PkOnt>+IH+<;%Q#2wWD diff --git a/test_conformance/spirv_new/spirv_bin/undef_int_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_int_simple.spv32 deleted file mode 100644 index e6e1d7e101dab01c26c12f6bf1f5e1de7409ee97..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmXw!%}N775QICsi81~ph^QA25kc?;R1iJ7FqfGUtT&K@fwS>YUVt_s; zr#hm*QSK02f`W>1$gSRr5BlX7#ptpKnrA&ldl?&+zrF zQ(#=s=^^LtDb??L!$01kbY^X+y=Q}3_x#{{KS^p!Tk1$?g)f@w7#tWQYW1ye2XDWNWesO*Pe`G}(U;qFB diff --git a/test_conformance/spirv_new/spirv_bin/undef_int_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_int_simple.spv64 deleted file mode 100644 index 818fe0d929faa4bbded6605a74aa133b36ea2498..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 516 zcmXw#!A=4}5JVex5kUcwC>IYH6BFZINQlOh8;*X#1O$^w)>$IR58_98F|pn-c2e6t z)jicUo7HccW;HWw+CX2TZ*|L4Zlrva@`-ZSGEG=S&ss(gg|Dz&y*nSaZsR}JejsH%+_-lf`})M3>qUqC@Ym|Mm6?UVmnxe09|^=XY2%gu z@SqvysR{0n<%0Wo`O)rE<(f|H=m?K;hp(=H4j^9BzMg7&#CPJ(RKw$CpSZqic(@mF T>^v9POYcb)XLkO|!9@52!zUeB diff --git a/test_conformance/spirv_new/spirv_bin/undef_long_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_long_simple.spv32 deleted file mode 100644 index 0f6bea696d97ddd21fe4c695398433dec97ac654..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV2nYps{IBI?FPMG$-e6^i1jp-Z12R9htwlVY{c?ndzYVjMU*b2&LP zf0|tOBRUb$k1=24D3a*5+-rHK<$ZVzBo6QCIWj-|iE9 zy?FwRGb%moxqCwPf2aLpoOyWo-!A+J40Quojr|MiJy@;%Y3t)%zWD~FGjl`jEgRLk s_nSSwwL_)f0l4Q9{SSdY!g!+Vy+h#4n9cs=b#Kd?P5(44GhNDj~K>@SLI!i=(L47DMCf2t$ozzZG zbxl=oQoU`MRm`kmeSN8(RjuY{-OnRGPjt2|k-|!JtZB?}_>8OdCgeqY4ZG}Zo3C9{ zmp)OSMYB}Syv65QNZsqQ>}#d&PCdD)RA}#o5O&+_eIL@icwXjtN-i^ z`Lgp&pssYo1CH#0y2GCE=W^DMm;ABLgZ4(crtZw(A2h+EB@6^=>|X4~e?Llto}S|U zP^r8p`$t*)Z$&q}PKAlKA@fYY2T)I**H+Jr`gX3P9-dvkoa?HGhntHdvnPVxphaFu2 diff --git a/test_conformance/spirv_new/spirv_bin/undef_short_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_short_simple.spv32 deleted file mode 100644 index f7dde05ef77bab396ab8d2fa74cb49c539381ecf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV3Swbn~(5q0CDA_%^K3PqQOF8c(b+KPdgl&1FC-3Wf4rUU1n+xgGT zq{&S$q7xClIOWwwk;Go>yRF}E{RMsy>EDlpco_Y#r@~jYSia}YN4?(UP4T%Zmw{45 z7k-K_s)!6_Ye(P;WOU5cwI}ZuI5&f3?+)a7vntlxJS*$hc{#1N_1kGJpq{;FB6GEVP<{lzb9@`O diff --git a/test_conformance/spirv_new/spirv_bin/undef_short_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_short_simple.spv64 deleted file mode 100644 index 49231a2ae79e851a3a46926985242cc28904b4b1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#T}uLC5QRt0%sw=e>ZS`L2%`H6qUfr{%YMOPX|!OwqUIm0AJt9J^W@vW*_rpu znKQ#S>SwKpT12#>&)4WhJvLHqro5T*PRd8*PBc))AG*;FH9CEi8jc&p~id{Mm5 zrjxa%iM~OIc&!*M$XgVxc)yrsERON8I z-hIfdw?6>mn3o=MdJd@m@09Q3%nu0Xw#fUyP}e4_kw4|VO;#&^Nk>ob9{}SPMsIKR zKU|?vZ*4e#%@xjj%Qwnha*dZe_P`wu?(6`4gz=R2b*b$cUy1W(d2jhlT#s5_?h($N R2f)4d?x}pc^M?y=z%PHB9##MV diff --git a/test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv32 deleted file mode 100644 index 2e0d462e39300d6028a34a488bb240c0486a35de..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 484 zcmXw#-Acny5QMi$YyIgjqTYy91jQF<1+kZgUit)wm{vRxPfC*Z*?S{&z8DuKvpc&x zXGt7A^vybE*0-s?#MC0|wtUiZujME4$l_)rQa-kUF@wV{tT$h-s>@wgJ0EJ7eW#_X z{LePus4Z8so_1rg4`zv8LAwxcg+v|d>n86ubC1e-JJA%qXTiB@>&v}M^5QeiS7Bdd zY3+-!TL0Z~C138J3B-*mJkWT1rtJS_^h-JGCm4IDVnE!fJ`=Nt#@@M@9rSzE+|Dlg zt7?3?lm9W-Bt3G1*@Z4(mOBob9Edxr@EZzma=?Ei-~)&csoXIZ=n?PI@R|tt(OW8` K#_LzkFTxSN03av; diff --git a/test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_struct_int_char_simple.spv64 deleted file mode 100644 index d6e8917b22a2f69ed8f8141d2d8a729c03df8620..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 568 zcmXw#-Acni5QV2rYW=DGu~u(HDuPnH*McZs8G7jxEHSMZh)GG(zMwvoH-hJj>%hs( zoSi*qvO)W@Yt}Neu1)kMM%K2_=Z?=iJ|Fmet=zXjlh$BhJ!1x?O}<>cxvDNVN$t|S zcFB8Ox+?uxXDb~y^Bvs{RHwOFBsX->J`*CZd(zZlGk2w$T_Q~}I}@C%)@iwQQC7Uh z*&^Q-NnEEzzF7Y4F_A9+@gxwZ>d=70d#dVxXZW#{^%#1G&~}@1eH8S2%5cQF`h8`3 zcy!nu4fqT7J!Q1uZ*+p^p)eJQdog(PFTB~UW|*fYxPPZDxzDcOn(QmL)ZsA@9;ATh tP(TL|FWzsYnls|db4RM-+2zx7W7Y6*&*Jbr7VzclQ58L&KiXg}`~u=kBQF2| diff --git a/test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv32 deleted file mode 100644 index 0741b5d7527fdb5768b51ae1e38eef1ef19557fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 472 zcmXw#-Acni5QV2nYW=CLrKmR|6+!R?v>@%Jp_hGvCH4mv;-)m)KD#%9=S$CDbK zb7s;sdG48Y%&cc4{SqTfENk;wo4d*bOB-dPdT4!vWAYHzo2{$k{;-P9hv>FtRYX_& z?_IeOkG`wfRM`i!T<-L)ga;uP!~3qOvqtx#nw_~+aIb=M_0I2)E-$OEqFjVywJM^o z!eV{8<5s@hJrRg|z3`yN?un}Zo9U0`tdG~;)Xp2;>`|Hv)y$lFnO&+zPya~_cQZ%- zqxIxQ{);y$;iw6;@A5~>4L{o1SMKPA-?cE)Rrn7Cd;qajmpg_69Pz0hUN-`MaC23> K@%okXRQLn1%piUM diff --git a/test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_struct_int_float_simple.spv64 deleted file mode 100644 index 1dc8888e772d24a15cc72bb0d898fda0913ee669..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 556 zcmXw#-Acni5QV2rYW=CLwYJ`fLnN46JABNnzvXi>0gT^=4MP+}Cbd zlv(Yn{Bu<-!hDCj5q0j(Qe31X%?pqQ-APl&&D;&Oc1W4h>@9GvTIK7lON;U&E2e&1 z&ayf${dB(DV~no$e+7zjPSOx3?}X}qXYnJH`3bx~w*98hhnO&ZKu*9Vy+gA4J1%ba z)_w6;^m}CK=skBh%I_E?K=A}4U%f;B>z*0St5)d#1D?9CJ%5<&lUtnRF#yjf$nyk9 rM^L;6zah1HitoUkQj6CvUx6D@ix>9>C(kn=U-e$7be88Y8$5zP>HH&w diff --git a/test_conformance/spirv_new/spirv_bin/undef_struct_struct_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_struct_struct_simple.spv32 deleted file mode 100644 index 6a883433bf0082a44e4b35dccb70a5c76a531b36..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 512 zcmX|--%0{;5QRrqv$8ak>L$VnieA8isLK{FdxFK(V8M39f6v}c(D!ZDz}Yi%W`1Xe zP3kwTh+0InqR-dpMLilj-rI3=$9HfilIlgByc_LsMu$x?oqc4h^>Q;=|5N_Cn9l;o zh$in6I4>enHmJ41B}nO5pI3RKn!6=;Z_1Rtdyr+TMZVl->AZX&&qu|!oQ&6bS&XK? zH=NH&MkE1F)XKtFpg MWY&6pJc;wh{yb(4nP^T5%vWC&ard_&Ry+_-8vs>i<5Pz(b z)uFelxj=n!Y8Fa~9qb*-L*IE(#Fe7&S}}Ko>Y{fdkD~25-t40=$=>G4EZt{|c^+r! zYk%pD8i(58Okxxhxsxt%&Z`Kgc@ zcy!K$Xuw}8Zwk?Zzg2~sTJo_Rdl18I=g$6j5prFu3-LpOro7t?{0nK?86 zIg>{HrX5j>h;|J48vUq8v&yY1?~%LFC^zfWz37CTFE_@Ui?S?=9Z>zA<*;qYLPFuX)>F?PiEs{JO7xh^La6z{(GOJ z>#ajzT+*o_r}vO*cc=USWqvr$$otj2L*Bi)X8(ZR9r=5DwY=MZ-StP*##5#5z0OA{ z`PSM{>w!zu@}3`jkI6MU{k!0s3-#z#yuvpZpH}C^sh78JkXO zy1Tk>-MSD}uN!6+Gi%sLU!rSOt9h<_KJt8`+_p#?R-$7qV}`;mUncKiyWS;XlYXqS z#CPi2k5s3*SuADFqH`(4u60q?wQ}!9HTTBaV)s@EVY5ot`w(Zv>mr-w`{He}O^bZC z{J(oBT|B=C#7G?)aNIpsb?^z_m$DvioNJbIeG~)nEoJtPmDy!}r5?|mfuCrC_Ng!y zh>2^Rspj`M^lgTUN6qoTo0#8813hX2{d>7ZAJ0G9>?l{%;ptrXlmdRb-g6iFPvY^~ s6VM05+{Gb6s88>oio4PVX;Rl~zg#o>kj20zT6Rnc?*ube#yf4Zk1sQ>@~ diff --git a/test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv32 deleted file mode 100644 index 6814e8d1467b4e6e3f91a26648e89c2161d3ed2f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV2rYps`75q0CDA}GFq3ZhFxmp(y=ZN)%LN^ASS+-slt8JE+^;=#}t8G2Yzlyq=&i{6w z;_J;5V4PFwVb9$Yvj02npWw{H!~b?+VW=CzYV2K7@4;&AKej&J<(uzNIx{!a-m_7y td%xM^TRT+x9e^h;(f<(WBaBzN-a7)$j2C)(je&m7p2@8B`oZ}D`~qHt8>0XK diff --git a/test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_uchar_simple.spv64 deleted file mode 100644 index 93cfb56bc8c8b91db274d6b2675be3d6b36627c9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#OHTqp5QH0+hdcz42p0|*5)JXLCPu@F4M%^$WO>C+)?EU^AH*N!g~a-np_AI~ zsi~>zY)~9k%?f5#wXVKY$BI_+z3h9%_lEC}>MaYTv>a`#85*4S>2kGp`^8tZb-Va` zldR5~vh;!OS=^&p!z!D0Y~;w(`8TiuAKD)jCWV+fI?SOM+0}Sb6p)R{F83*WdET+y@|n_ zUHK2s(x7Lic>kg;c+W0>Qa05KI+1ZLyvu>imVghSK7C$WGk4Ul=WaB^v&+$Q9nJ7? VQ*mV83gmM4p@}n@CvEU5`~zk49zp;B diff --git a/test_conformance/spirv_new/spirv_bin/undef_uint_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_uint_simple.spv32 deleted file mode 100644 index 3d2bf5fc3ecbc58c91c49c74d9f67db7b7d35c7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 432 zcmXw!%}T>i5QV2nYpp*mQmPvl6+!R?RFJwfbmYAXa{QtZ#OyAk}pm=2sfGiS~{ zb8nj5_9HqG(T@?QaS=&$+uUpO5qTJCqfDqrF$g(t?yBYLGv5`}Hs2Iq>v9FBriVTy z7ga=tqueRD1{o9k%ckx&x;tw3WvHCpgFN4?i|>7&mG%3goLBq$W3esjYQFs6J;B$v zPJwYnr-z)or&Nb`%8zm8!wr8-K4@>y4d|W8KezXMhktxP>CDhT86_ z?y0WXqJ7adYnfTshWZi%Yg_5L<9W;To^sC$O;|?Xc8neht2CXxhgD3=u!tY?dge17 z%@?X;GOMJ_U3AWb%C$~%UFNw<)$FY_#q5<3!eSmj*P*JL*GWB2>*j5;j7=I(H@lCe zi{~eSIMoRaIChUz{riL;N?8v#?rrD3J~@|q(PlsVx%#`x%)(zw6;1q)1mfPc@ydU= z(G2s{1ov;{g8O*+(e8camQL(A5FX?XUp)aGK)m?AzG`~Jw{wT8;qmh2+(0!v+_N}# S9trHF_o#|9JAdWiPWS_bTpi5- diff --git a/test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv32 deleted file mode 100644 index 2ddf4943cd1f5e1943cafee392097517b99f1775..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV2nYps{oBI?FPMG$-e6-05>(4|ihs;v@;NwK!i?ndzYVjMU*b2&LP zf0|tOBRUb$k0ZXuIFjhL+-rHK<$ZV7wXI+0UqxNb7Js`> z@b%^iFwUs-u;=ax+5esPk8$SV;eWgE6EM^bU^VtHsP|yC_U~IC@AAzzD4m%bYH!)7 t*1g~C@vR*y{SLqbm*{^8^by80UGE(NXU3GCUL&BNvqv&(y?$`M1HX128_@s& diff --git a/test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_ulong_simple.spv64 deleted file mode 100644 index 538945e3dacf2b474e2b6138f4789bdffcad243e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmXw!%}xSA5QG~RMC4C2>V*S_goJn(5~A_shNDj~K|!*~GE4Y-L3t=HCe*hKozzZG zbxl=oRP0sE3T9TZJAJ9P6|EG`ayYNTS<~6HND9l*vZ^t|VdrP_U$;v$zi^vmxk~3} zOW6Ti=XrrRX*li4}@ zLB8z#Ay7}c;Q>c>SKVb#_JL{sMQa9v<#f9GPu_TxRd; LxRd#>4MxHVb_X5O diff --git a/test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv32 b/test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv32 deleted file mode 100644 index cc39ca7296b91f97b6157ea082d61908ee31dee3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 456 zcmXw!%Syvw5QV3Swbn~7h`Mo65d>dA1<|FUOP?TATQLxm(zJbcH-g`%>A?BtcK$On zX>#3*=tM*>M!ecMlGtl~xApt2KgSOu{riy+52GLURM=GW#YetrKI_#wZ;G#Fxj-qR z3qQpdRYZoewIgr|GCJn!+LLz!oSVV2cMI~oSr)5po|X06tejTc`hB)8>S{XwpMAz( zcb)+4f=mr-YEFoDds;t5nZv_>2l(CX^7`a*tY48I;^kU@Y<1kro9|%SGuGtZGf}Q{ sznSB$9WwQf!4sRPe*)AI+ACG}9RPdU3pKTdKs|fUMCNM!p!@)S0U2N%EC2ui diff --git a/test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv64 b/test_conformance/spirv_new/spirv_bin/undef_ushort_simple.spv64 deleted file mode 100644 index 2e45d210499c4a94c542a7a99793b59707b310e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 524 zcmXw#%Sr=L5JWqPF~(PnLEX5B2!gm*K@?XGS^5P-G!X~lOvvj8^`qPfo)fPPHQl$m zy1JQ0{k#=Xi-=bA_!`})$41J{ls8k}N%@$(9}SeTMkm^#MyF*t8o%Ys`Fk~6X40Ua?8u>Hc+hn!!S9J9B{ys47VD$D@ z|HCyJ_11>-H(cSow|t}ACD(YlV-MWp;Ld%Zk1(Foz7DlL<12CAEblF!iR)6!%RRxl S^ANb#-UF3ycm8m}E%*gM>mJJh diff --git a/test_conformance/spirv_new/spirv_bin/unreachable_simple.spv32 b/test_conformance/spirv_new/spirv_bin/unreachable_simple.spv32 deleted file mode 100644 index 2adb0b45c0a03c24af756d75ec2aa163adbccb44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 500 zcmXw!%TB^z5QRrBB3?iw>c$1e#Kad+5`#+{mOepKki;gn5Kx|77e>FY(n(Hd{xfIJ zOq-3HPQ+eBbYjTY7(^plyWHO8eR40Fm9jzIk8a30`B|g9p4vK-KuoA)b2}A*}DU2x>@DxZJHFzSyoKT?Q))dxlOfsFh zXU;uy+6I;Ty4i`D)oq|B(Y1g%~`%K|aXW!oCY425mJO5(+5JkOG7oqjE| zq~z4Z4>V76GkUa(?Z!fN=%9J44887+>#Oe0gL*uKV!?e>M$vkiu69wF74tZo<-1}L zZ_*;4eUv`>(&f&pk{IZWM=*R0b=FHe&)`p*FgtTIJrq4{Yp9~tR2?b_?&23d_?@~7 zRk+~fi`U05-(@5Yb9w^)SWe*L=h*XIezo^fbt1=jYbntoiFawSyRBqK{CKRR9-R01 z_E=XvIM|yoc3vsj%j}5t)R+If=|mUK+;`7A z_ulhh>b0w8#7;ys2WnLuNds>Xf z$^5G<(yWA6*Py3PUaTUfY>{h&3ozxzS|8r2y9Ro&*3*C8-e_;(lH~JaQLK~cGJj2% zv(-A!(sGfnW^Y?R13H~C1jaeFUgg{|r1o8Um+v!qpKRX&*|T9^i!65x?9;n*? zTHPhnj>z`Q|7jo4xzD${bIb%ao(+5MaAuGGJlpI0J-e?1zM0S^PuQbxJvmbtFDTXa tfOp0djB`(bv%Q-zS-*WCuf~0+VEZ3LJj40M0Z`}uM<%F|`@#J^_yv>HAMOAE diff --git a/test_conformance/spirv_new/spirv_bin/vector_char16_extract.spv64 b/test_conformance/spirv_new/spirv_bin/vector_char16_extract.spv64 deleted file mode 100644 index cb3ad0712e44901e5dea7165dcef834e913d0654..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 676 zcmYL`!Aiqm5QMi)YqizZT5DB2R0Ksld8vX_JQ;fM;1h%x3kFIeF$CXFAIgj1d~wAe zw!8oQv$L~l&^+mwHO#DIhx+9Vt!XXKZO?0-d!ElctJ(S%sKe?QSl8g9SS^z>FQVin zE-q)$^1UqLq;y_eJ%Q>pGYd71ezcDiq3i9{b*tu`s>Taky#3#Mb?>>bD0+KMiz*6N z`BS`FWL2KTWtwM;=U+c#b)s>n;7oMKD;Qp;y0Z`7!7uc}+qz<^;GnUgJmsP@()6w} zIR4>s(B4!A+g6~xrHmdJ_rBlZ9c$u187*+Q%()Q{Pkf(-VkQMR)Es)Q(~?9;Jb)!^**;n-L;IM}@~=JS8yfw#FFu-8NZ d4hLWR3cSI25XQGSP{70ItrXyZeQV2W#SZ|RBQF2| diff --git a/test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv32 b/test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv32 deleted file mode 100644 index 421f91f90ea3a55bd53344d992370854177d0c58..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 612 zcmYL{K}*9x5QWF2wc2WHt+f{q6+!XXOBJL&HuNI+3zirQ21+7n$Zz)|_`c1G3)7i- z`{vDCnmD@anH`x~&u04Nj4iTG$lZ{SLl)WJKPV3^_LGt7k@XD@O3f~-%gSY+X|-6o zyg2NtTCh~jx|)fV^TI6A7O;WhMv>@-{@T|a&%0NR2e^3p?+2dyD9pLTS6($P*_ZF> zep@tUmezS$Y(H8*Q%#~VS8!(P@d}2Qxq9A(ckqdnPn4NERi@@J*H;F+P%wvgbinA( zLJ#j&YUj$#!~45?5s!Vmm7Pl|z@g?a^CV}?;E$SF-cQZGq2gN#BjuI$;2Te95}Y?N z;f@vDaW+EGy;Pvh-Ac;%pD4iLu0jXT>i( CW*`;- diff --git a/test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv64 b/test_conformance/spirv_new/spirv_bin/vector_char16_insert.spv64 deleted file mode 100644 index 9ff56217e87e043bc5223fee9cafb34d79091765..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 696 zcmYL`-Aco748^lAr<-ohIp^0!MNq^mZ>As@`}>(=v;rBFWPE+n=71CgFILV`J551w%`qntRX=eytbYHsygFgJVlEppXrW_Prm+UO6|pO9r_#Cmt*_N!MW|zv5|6cuqR>c=X;@nx2Y6x=U5I- h54sNJXj}Ji`;p_%Qbv937_(@95G!-wKf3%*{tL}UBV_;p diff --git a/test_conformance/spirv_new/spirv_bin/vector_double2_extract.spv32 b/test_conformance/spirv_new/spirv_bin/vector_double2_extract.spv32 deleted file mode 100644 index e69fd372477567c29cf544991a124fe04429b3ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmYL`K}*9x5QV3Swc2WHt*sXi6+!UoK?SLJGW6iVU$CTU4uO!B7=u6Ei{Sgx6&GG+ zXXeeDw+SW(}Q;{u$vq&|M{rn-l*o>$9qw?E-C#cE!S1+ zv$QFEwchUh%r%L|QsA5`$162i5QV2rYqizZTHC6)s0f0%bD@G%x-xX(!Y2r6nnj@`5@YcF^r74cp6}*@ z1C#l==bkxt5;QM6W(_mz*qOfA(3;lrvF+oIk3Ao|ihT=&H0J~B8W@7iw&T1#-+>EGytvt4(lj|`4I#TkWcr0MKn zA_nv?dlfs5sXg-gP906USctJ4ebn!@hm*SUG)m@a21B<@D)2tH*r)6&g63O9Ahi f%ISka*NGf$U|!T?7pHP?=zJ0b7<#{Y<%9eWysab3 diff --git a/test_conformance/spirv_new/spirv_bin/vector_double2_insert.spv32 b/test_conformance/spirv_new/spirv_bin/vector_double2_insert.spv32 deleted file mode 100644 index f4783fc5c4509af94859f9f1497b34114fa2d2d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 600 zcmYL`OH0F05QV2nYqizZTH9`1R0P4T3l*f|%FvDAF9>~P5eT`G#{70Sg6F%r;)RoW zpE*O~=%#PhF|)oc^yN(~vTm@wV2^?w$c`-b6OsI}4U8HLO}49DmG0fww#e?&ygX!8 ztvr1_&BU^KX_knc+)%g@5><%j-tYRpTlws!7cKws(D&Xcm!^l$ylT>E*rPo z)VV9y`&Q3PlW;5r-a;{2$)RPbSjT(qUGIcCxHB39i5QV2rYqizZTHE@!s1yWo=RyUkbY4dJhNDe2Cz506&l+(jLJ$9@doHzLJ*ibn**t0Os=U<_L-b@O(=U5KT i47yI_X#1Pt?x!AqkuvHtkFksPC$X{z{;iuo$bSHrbtC`) diff --git a/test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv32 b/test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv32 deleted file mode 100644 index fe887814d40c2d5d4735b55d6db00e6e635083fa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 572 zcmYL_K}*9x5QWF2wc2WHt*sXi6+!SWRgm`B(1Qnm!4hMIK*&m5f;b?7++hw$PU|wa9v1?04}{acptJjC7ya(5Nw4@3Y`5_g?rk+`Ii(sM0K` z4zI77STQfn5^be660U?q9ddN(!MhdEB*(*lK5DpksyX-hkyo`#3jdlGyR!CK8ggIm z-daC%O|oMta4wbOl^PmL<$84Eo%&3hj}#Z`9yk4VW~e(kKA6EbJ6cZ9PP!c4wG>Vj z*+c!0`_yUiPX5(O8{lx~F!LZ?X7I+HSv0w$Hx|C-aiX}E4xY~hb^^|em~f{8J8gHBn@X+6A0~~5Ua{nm&0uG=b>i_@% diff --git a/test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv64 b/test_conformance/spirv_new/spirv_bin/vector_float4_extract.spv64 deleted file mode 100644 index 53696b75e214176c849a68b7748a1d6e192303d7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 656 zcmYL`!AiqW5Jjg=YPD5st!-6YM1+F46&0l7%Fu-izaYd|ArKOYA^3m#QEmk9NuKy% zGBbB(?%em{bi5QWDiwc2WHt!+0hDuUo%svvb~=tl4fLaY@6Ay?9nXLlobzMESdn9kps zGv_vOblW#OGPAxd^ova_vLwV_h{uW}i#;+@KDL3;W3%0D8&_vvrOTU#tf=<8x=~v! zW|LjF`p>TH9ht7ZfBsJ8XfGQ8;%Z>*jcE--RQ!( zB0S&@v*&P&ck*AY!~ljIW9LzK*+CmQyWAw_-bnr3U+-h%>;_G+$!vyJ211p&GqF>EwL=dUW|u|BTEA_Q9ibT(POgPmcD6SRr`Cl{qk*5dMTLo z#7`Bg+ANnMy`gX=tnat<>Oa>5LL$eCp)Ir^uP#(t&SXjGb?oEV^DY!K7cM&f?>%38Da^T#_q=LcvMOKG)uL$1 zEUojhSiEhtj8#dGM;T|LJ37J8GSyv+d)?qy%8=XfIem2K(UqTa(HUv_t~|ZaPY!+b z+LNb#!;fu0+~J*Ta$lZWaJca9Rfh)t2mkLz9pDgisJWF|YS2tfEi;MfF_3+$!-4!< zbJ%4l`+FaS_7ZkG3^}l`fQ=M`v-fAfjueA~Jqcs}ScV32b17gi-V7WLx+XHT!Fd*j Tz7rWdbUvs99Izj4c_;e?{^TL_ diff --git a/test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv32 b/test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv32 deleted file mode 100644 index 31104e0af1214b3e2c85ec6201f78355cf0632af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 576 zcmYL_O-sX25Jks+SZlSl*6PMZMG)Le6{IdL-3b1IP-_=~l1Li*+uaDBlSX`SGjHzP zxic@##%(9!AR;<($=5TCMzreKuHzxGAI(bH;68|M$l1ADugbhg(yV;ovt1Wu;1JP9 z-z274#2iPt9=HZ`D(23#rtS_n&)oU{d9Tvm!zIb~D=l`(e3O4HH;ZhSua;$+XN%AM zE@L|Nm;lcexqHevV?xe@tG(q%I3E$!b&2Ynt?sza_kOKvckk+Ma6KW~tIl^>d#?R` zoBw7CtH!&>o<}yZ$9=rp>rC%@oPuxm>Jw+oanAwJQ+VD{syzeNJg+eN4uRg*W;m-m j2l8s1Hv-Q5)A*)~ntx-W`MBonb*C3x?UVoEMNi-thYlXs diff --git a/test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv64 b/test_conformance/spirv_new/spirv_bin/vector_int4_insert.spv64 deleted file mode 100644 index dc1a26668a93e8809e88994bd61e7f3f784ff2ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmYL`!AiqW5Jkr(wbp8Dt+gsHDuN(xMFpw2GIS&O1)iU` zX6DYFnfsEcaoIB4GP9PQ>E`sUVX^zB`)&6f`L0D`Sg@Y8jT#f`#k?xYG|Q`7U8_Y| ztvOBcBh|CqEYW0onR6~neAaP@_0W=2o;qX`G{6Yb$G zec9&!D6}_!+o9LMz8xDV2It*hjvXlm2YV65{-F#F)Fx8EZvGiK9CVFjXxngj`-$VP VQbvC27`sHU?wpjGhu`D)7u1npH6h)%zgK~ zd(SHa| zHJg{vs6{lGsgtujVuHGyTIXQGjkWu|v+oMH+gdOGb$io$4VR{$AK7Z1PL{>%Y&p%> z#e7y~MLvDo`WY~(#t;~1)OwY3$B>%GZ@kO*QQjjvw@-cqhI1{loIah?yE<~#2UTs~ z1zQfuYRUig-qYtkHELjlf<2xMXKr!kjQ%`3>-#;suLHhO=#t0m(f1KhQy4FF+S>!( r8BZ|k9s{+#8>6h>K9IM^eJ5c1|0AB^eB%Jv=l%y2?2-Gy{T=uP4>2FV diff --git a/test_conformance/spirv_new/spirv_bin/vector_long2_extract.spv64 b/test_conformance/spirv_new/spirv_bin/vector_long2_extract.spv64 deleted file mode 100644 index 75329a17bbb2f152dd64e43476ef8bc34ffbcd44..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 644 zcmYL`!AiqW5Jjg=YqizZT5A;TMD$iv&WR#1Q;H{U|qr_dFkT zU@|jzX70PwM(y*SS#pTCkt%Y9~^jmu9ip*@x>?9tXZ7pLhJ+g>v3z7A>24;CC;DCCSHoUNuQvxR#&M9OQz1~-Z3;oP< z3tYRQ2BY2!HFIZrd8o)PIJ5BHX$}o=wB$EpWQH7LXCbxhpqZRqeiL#yM)Dsq>?+88|cOn#s||%v0bx SR?Zwc@5R6j*srd^BrwboudR0P4RhblMk|x)EvyPedZLTk8Vu^KQ?8SHx<4|#AX_!cqk8NPwq0sEMwXa;^%g;NPm-}5+ zOUbM!eyW(4W|@@fp>ru@x}m-Zc{lKGl(QEuKK|=r;NGg|-2N-C8kZIReN(K<#&0)u z?#uN@>t&`%G!_D9t{R{8@Ul>?hX>#Er&2ytWNx7NEO3}RQly7Z=J1XVJ?i6F!@JU! z6GgP({oOr^$38SV!cq!w$T`g1%NaBHBWITPle2Fmd`n@hxY8bcp9*LK&YPHUCjxhz x7j@7*6VT>vC1w0i1^RHv-pal>Ozv2T$kEcn2>Mh}L1wXBLV$%_2#DoOM8 zs;t6HTl10nX>JyanO%5Ju^SmyW ziz+Sh`RlKiu{Pm&kYf|o=mbN{RJ9Hdy1_5ip|=@&`pDquDo!b6BfY+*2p9U9=N7oO zy#}M+@tV0)z1&x1mpOXy-f0dEa5UuCVq}IKW9LR{*+DZoyZk2Pa17*MV%Sxj=^btv z%HhPZXTNPvIX&#tv5|6c?*4FWUpY9~qcGkd%h5n@CI#Hde+JGBx+Ze8{mpRuq2o_d UMt$TMyJ)``D|_JIy8KrD1BLn`djJ3c diff --git a/test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv32 b/test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv32 deleted file mode 100644 index ee5dd3c745f480766e7de07dbe8ce47dfcf44a89..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 672 zcmXw$%Syvw6oik7wbp7c*0u^RB7)!xs8AGFmbmi?LW}_ev5_R?F??P(g7f`Jewd#7 z%sHv=T@TIn%xq{E`sK~dv;EEvI(yLBBiV`hZo-p4wUJSSp-GdvD5E<2N~@?!;yf{*mv>D`D5qb%8#PzJ1d)Ln-}kK z9`2eViR-M`g&*y1uVRIdJG7bqUdavS-D)VP18D*HSO^c>5= zM-GmY&PRv(M3y@FD{V2AZNDSm(%k%})8bb2?leIUK98Au>C(?`y^jWdzr(L~oGJGx z9d@1za01?&c)9OXpvHSq4&H?TA2sIL_e>zqd?3(^)>7c6zL(qiPsr1Y_K!N?SPSq_ W@3qe5a|iQJ>LaGF*ZI@s55hkbc_hgI diff --git a/test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv64 b/test_conformance/spirv_new/spirv_bin/vector_times_scalar_double.spv64 deleted file mode 100644 index 5407183cb049fe46e822b3b4fd4c231a55dd6825..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 740 zcmXw$%}T>i5QWFaT5Gkn*0%mFDuN*HRS=~sL)`fUA;y4#*ho_H7`~J~lpDeGB{vr) zbMBd+Gjrp0E_!AgX4bPaeK}+6*rxMc=eL|6IKLx5G*6jU+sOJx4xOqbUgt%)PCt?| zEaNDPiaMvOd{6NrDGiK9_TFH03SnO?eJ*8ifhxJfqlG?m`c8XR<3Sy}5)Q-iGcBsn z&+^wO3szMgN9#0S1#iu4&+1A)=0G2fsgNGQmNL#<_icGN@)o-H<=GAXT2;h&gN2MU z(FDvkQ^l_QQbygLJQ{HH9XgCQ@sT`n_;XFRFHawMjQV@0&;HDCqY84s9BOW*OFr|q z7!7bc!>?u>i+hj`dmPB3d6JWx8tV5@NiG!(C2@kOAH{lf>lVI1z5T*zaQY2$iL_7UH=6&Z{;Ki}F1w zqFr02Nt2hm=wrXzt61S<5A@Mk$kXu_2)vczBUy6v1&YVA+(v#bwPV?(s_YYV7}%*S zeB|Ib>wR?Kn8;Emf2%E~vha`x%x`)v?m_QC6ZGKon0b^g{p{v^H1ORHzuNI!xvg~A zc_zRKcyHq6z6*gG??pLy=K_4xm}lQhfjsl@(u>wY;3n70?fet+^uqI_4mefi5QWF4wbq~3THE@!h!g~IuYxG93~}cZgcu7JVk1e&WB5|~P;Lazm)u-9 zow;Yuoimeqokibl!_4}2reDt3I@Wcu=i;V|GZ%LhhvrFXHAXftG<2$#NtxwQx%yZZ zQIW)HoY$J3^q%VZvM_Qy()T9ECs!VbrO$-`7wRQ`~y%b>C8iL+9&0P-HjwE4`w&E%*Xw zq6wI7rWd=4evPi}DdGV~-=WL#rte6RI{djN+gGFyJmCGE^Jhn9xYi3a Date: Fri, 30 Oct 2020 22:49:48 +0800 Subject: [PATCH 08/36] Fix memory leak of test_basic (#943) (#948) Fix issue https://github.com/KhronosGroup/OpenCL-CTS/issues/943. Free buffer while verify fail. --- test_conformance/basic/test_async_strided_copy.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_conformance/basic/test_async_strided_copy.cpp b/test_conformance/basic/test_async_strided_copy.cpp index fe76c844..c456f38d 100644 --- a/test_conformance/basic/test_async_strided_copy.cpp +++ b/test_conformance/basic/test_async_strided_copy.cpp @@ -215,6 +215,8 @@ int test_strided_copy(cl_device_id deviceID, cl_context context, cl_command_queu sprintf(values + strlen( values), "%2x ", outchar[j]); sprintf(values + strlen(values), "]"); log_error("%s\n", values); + free(inBuffer); + free(outBuffer); return -1; } } From 8894e7f04665fd6921066e76cc4cbcaea86323b0 Mon Sep 17 00:00:00 2001 From: Alastair Murray Date: Fri, 30 Oct 2020 15:01:48 +0000 Subject: [PATCH 09/36] Add memory_scope_all_devices testing (#999) * Add memory_scope_all_devices testing This duplicats memory_scope_all_svm_devices testing, but it seems pretty quick so I don't think it hurts. Fixes #990 * Address clang-format failures * Address a further clang-format failure --- test_conformance/c11_atomics/common.cpp | 19 ++++---- test_conformance/c11_atomics/common.h | 48 +++++++++++-------- test_conformance/c11_atomics/test_atomics.cpp | 6 ++- 3 files changed, 42 insertions(+), 31 deletions(-) diff --git a/test_conformance/c11_atomics/common.cpp b/test_conformance/c11_atomics/common.cpp index c0cd265a..668d7b50 100644 --- a/test_conformance/c11_atomics/common.cpp +++ b/test_conformance/c11_atomics/common.cpp @@ -44,16 +44,12 @@ const char *get_memory_scope_type_name(TExplicitMemoryScopeType scopeType) { switch (scopeType) { - case MEMORY_SCOPE_EMPTY: - return ""; - case MEMORY_SCOPE_WORK_GROUP: - return "memory_scope_work_group"; - case MEMORY_SCOPE_DEVICE: - return "memory_scope_device"; - case MEMORY_SCOPE_ALL_SVM_DEVICES: - return "memory_scope_all_svm_devices"; - default: - return 0; + case MEMORY_SCOPE_EMPTY: return ""; + case MEMORY_SCOPE_WORK_GROUP: return "memory_scope_work_group"; + case MEMORY_SCOPE_DEVICE: return "memory_scope_device"; + case MEMORY_SCOPE_ALL_DEVICES: return "memory_scope_all_devices"; + case MEMORY_SCOPE_ALL_SVM_DEVICES: return "memory_scope_all_svm_devices"; + default: return 0; } } @@ -276,6 +272,9 @@ cl_int getSupportedMemoryOrdersAndScopes( } if (atomic_capabilities & CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES) { + // OpenCL 3.0 added memory_scope_all_devices as an alias for + // memory_scope_all_svm_devices, so test both. + memoryScopes.push_back(MEMORY_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 3f0d2c5e..d1219f23 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.h @@ -35,25 +35,26 @@ enum TExplicitAtomicType { - TYPE_ATOMIC_INT, - TYPE_ATOMIC_UINT, - TYPE_ATOMIC_LONG, - TYPE_ATOMIC_ULONG, - TYPE_ATOMIC_FLOAT, - TYPE_ATOMIC_DOUBLE, - TYPE_ATOMIC_INTPTR_T, - TYPE_ATOMIC_UINTPTR_T, - TYPE_ATOMIC_SIZE_T, - TYPE_ATOMIC_PTRDIFF_T, - TYPE_ATOMIC_FLAG + TYPE_ATOMIC_INT, + TYPE_ATOMIC_UINT, + TYPE_ATOMIC_LONG, + TYPE_ATOMIC_ULONG, + TYPE_ATOMIC_FLOAT, + TYPE_ATOMIC_DOUBLE, + TYPE_ATOMIC_INTPTR_T, + TYPE_ATOMIC_UINTPTR_T, + TYPE_ATOMIC_SIZE_T, + TYPE_ATOMIC_PTRDIFF_T, + TYPE_ATOMIC_FLAG }; enum TExplicitMemoryScopeType { - MEMORY_SCOPE_EMPTY, - MEMORY_SCOPE_WORK_GROUP, - MEMORY_SCOPE_DEVICE, - MEMORY_SCOPE_ALL_SVM_DEVICES + MEMORY_SCOPE_EMPTY, + MEMORY_SCOPE_WORK_GROUP, + MEMORY_SCOPE_DEVICE, + MEMORY_SCOPE_ALL_DEVICES, // Alias for MEMORY_SCOPE_ALL_SVM_DEVICES + MEMORY_SCOPE_ALL_SVM_DEVICES }; extern bool gHost; // temporary flag for testing native host threads (test verification) @@ -320,6 +321,7 @@ public: } break; } + case MEMORY_SCOPE_ALL_DEVICES: // fallthough case MEMORY_SCOPE_ALL_SVM_DEVICES: { if ((gAtomicMemCap & CL_DEVICE_ATOMIC_SCOPE_ALL_DEVICES) == 0) { @@ -538,11 +540,17 @@ public: } virtual cl_uint MaxHostThreads() { - // block host threads execution for memory scope different than memory_scope_all_svm_devices - if(MemoryScope() == MEMORY_SCOPE_ALL_SVM_DEVICES || gHost) - return CBasicTest::MaxHostThreads(); - else - return 0; + // block host threads execution for memory scope different than + // memory_scope_all_svm_devices + if (MemoryScope() == MEMORY_SCOPE_ALL_DEVICES + || MemoryScope() == MEMORY_SCOPE_ALL_SVM_DEVICES || gHost) + { + return CBasicTest::MaxHostThreads(); + } + else + { + return 0; + } } private: TExplicitMemoryOrderType _memoryOrder; diff --git a/test_conformance/c11_atomics/test_atomics.cpp b/test_conformance/c11_atomics/test_atomics.cpp index 6d8ffc9f..c3a190b7 100644 --- a/test_conformance/c11_atomics/test_atomics.cpp +++ b/test_conformance/c11_atomics/test_atomics.cpp @@ -1843,7 +1843,11 @@ public: } virtual bool SVMDataBufferAllSVMConsistent() { - return MemoryScope() == MEMORY_SCOPE_ALL_SVM_DEVICES; + // Although memory_scope_all_devices doesn't mention SVM it is just an + // alias for memory_scope_all_svm_devices. So both scopes interact with + // SVM allocations, on devices that support those, just the same. + return MemoryScope() == MEMORY_SCOPE_ALL_DEVICES + || MemoryScope() == MEMORY_SCOPE_ALL_SVM_DEVICES; } virtual int ExecuteForEachParameterSet(cl_device_id deviceID, cl_context context, cl_command_queue queue) { From 4e2d4c3a663e4a70542956e08ca63bb25a4d303f Mon Sep 17 00:00:00 2001 From: David Avedissian Date: Fri, 30 Oct 2020 15:02:08 +0000 Subject: [PATCH 10/36] Remove uninitialised input buffer from test_zero_sized_enqueue (#952) --- .../api/test_zero_sized_enqueue.cpp | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/test_conformance/api/test_zero_sized_enqueue.cpp b/test_conformance/api/test_zero_sized_enqueue.cpp index dabe75fe..26a335f1 100644 --- a/test_conformance/api/test_zero_sized_enqueue.cpp +++ b/test_conformance/api/test_zero_sized_enqueue.cpp @@ -17,14 +17,15 @@ #include "harness/typeWrappers.h" #include "harness/conversions.h" -const char *zero_sized_enqueue_test_kernel[] = { -"__kernel void foo_kernel(__global float *src, __global int *dst)\n" -"{\n" -" int tid = get_global_id(0);\n" -"\n" -" dst[tid] = (int)src[tid];\n" -"\n" -"}\n" }; +const char* zero_sized_enqueue_test_kernel[] = { + "__kernel void foo_kernel(__global int *dst)\n" + "{\n" + " int tid = get_global_id(0);\n" + "\n" + " dst[tid] = 1;\n" + "\n" + "}\n" +}; const int bufSize = 128; @@ -62,7 +63,7 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl int error; clProgramWrapper program; clKernelWrapper kernel; - clMemWrapper streams[2]; + clMemWrapper output_stream; size_t ndrange1 = 0; size_t ndrange20[2] = {0, 0}; size_t ndrange21[2] = {1, 0}; @@ -76,15 +77,15 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl size_t ndrange35[3] = {1, 0, 1}; size_t ndrange36[3] = {1, 1, 0}; - streams[0] = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, bufSize * sizeof(int), NULL, &error); - streams[1] = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, bufSize * sizeof(int), NULL, &error); - - int* buf = new int[bufSize]; - memset(buf, 0, sizeof(int) * bufSize); - - // update output buffer - error = clEnqueueWriteBuffer(queue, streams[1], CL_TRUE, 0, sizeof(int) * bufSize, buf, 0, NULL, NULL); + output_stream = + clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, + bufSize * sizeof(int), NULL, &error); + // Initialise output buffer. + int output_buffer_data = 0; + error = clEnqueueFillBuffer(queue, output_stream, &output_buffer_data, + sizeof(int), 0, sizeof(int) * bufSize, 0, NULL, + NULL); /* Create a kernel to test with */ if( create_single_kernel_helper( context, &program, &kernel, 1, zero_sized_enqueue_test_kernel, "foo_kernel" ) != 0 ) @@ -92,44 +93,53 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl return -1; } - error = clSetKernelArg(kernel, 0, sizeof(cl_mem), &streams[0]); - test_error( error, "clSetKernelArg failed." ); - error = clSetKernelArg(kernel, 1, sizeof(cl_mem), &streams[1]); + error = clSetKernelArg(kernel, 0, sizeof(cl_mem), &output_stream); test_error( error, "clSetKernelArg failed." ); // Simple API return code tests for 1D, 2D and 3D zero sized ND range. - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 1, &ndrange1); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 1, &ndrange1); test_error( error, "1D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 2, ndrange20); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 2, ndrange20); test_error( error, "2D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 2, ndrange21); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 2, ndrange21); test_error( error, "2D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 2, ndrange22); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 2, ndrange22); test_error( error, "2D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange30); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange30); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange31); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange31); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange32); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange32); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange33); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange33); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange34); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange34); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange35); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange35); test_error( error, "3D zero sized kernel enqueue failed." ); - error = test_zero_sized_enqueue_and_test_output_buffer(queue, kernel, streams[1], 3, ndrange36); + error = test_zero_sized_enqueue_and_test_output_buffer( + queue, kernel, output_stream, 3, ndrange36); test_error( error, "3D zero sized kernel enqueue failed." ); // Verify zero-sized ND range kernel still satisfy event wait list and correct event object @@ -171,8 +181,6 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl return -1; } - delete [] buf; - return 0; } From c55ab4f503c1d387dc69d22259760467d2a3790c Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Tue, 3 Nov 2020 16:08:32 +0100 Subject: [PATCH 11/36] Remove unused code in clCopyImage (#1027) * Remove unused code in clCopyImage Some of the declarations that are still used now moved to testBase.h as these are reused throughout the image tests. Signed-off-by: Radek Szymanski * Add missing file Signed-off-by: Radek Szymanski --- test_conformance/images/clCopyImage/main.cpp | 14 +-- .../images/clCopyImage/test_copy_1D.cpp | 8 -- .../images/clCopyImage/test_copy_1D_array.cpp | 8 -- .../images/clCopyImage/test_copy_2D.cpp | 8 -- .../clCopyImage/test_copy_2D_2D_array.cpp | 8 -- .../images/clCopyImage/test_copy_2D_3D.cpp | 8 -- .../images/clCopyImage/test_copy_2D_array.cpp | 7 -- .../images/clCopyImage/test_copy_3D.cpp | 7 -- .../clCopyImage/test_copy_3D_2D_array.cpp | 8 -- .../images/clCopyImage/test_copy_generic.cpp | 116 ------------------ .../images/clCopyImage/test_loops.cpp | 12 -- test_conformance/images/testBase.h | 6 + 12 files changed, 7 insertions(+), 203 deletions(-) diff --git a/test_conformance/images/clCopyImage/main.cpp b/test_conformance/images/clCopyImage/main.cpp index 04a8f51d..f64119e9 100644 --- a/test_conformance/images/clCopyImage/main.cpp +++ b/test_conformance/images/clCopyImage/main.cpp @@ -13,23 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" #include "../harness/testHarness.h" bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -bool gUseRamp; bool gEnablePitch; bool gTestMipmaps; int gTypesToTest; @@ -38,8 +31,6 @@ cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; extern int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod ); -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - static void printUsage( const char *execName ); int test_1D(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) @@ -135,8 +126,6 @@ int main(int argc, const char *argv[]) gTestSmallImages = true; else if( strcmp( argv[i], "max_images" ) == 0 ) gTestMaxImages = true; - else if( strcmp( argv[i], "use_ramps" ) == 0 ) - gUseRamp = true; else if( strcmp( argv[i], "use_pitches" ) == 0 ) gEnablePitch = true; @@ -182,7 +171,6 @@ static void printUsage( const char *execName ) log_info( "\tmax_images - Runs every format through a set of size combinations with the max values, max values - 1, and max values / 128\n" ); log_info( "\trandomize - Use random seed\n" ); log_info( "\tuse_pitches - Enables row and slice pitches\n" ); - log_info( "\tuse_ramp - Instead of random data, uses images filled with ramps (and 0xff on any padding pixels) to ease debugging\n" ); log_info( "\n" ); log_info( "Test names:\n" ); for( int i = 0; i < test_num; i++ ) diff --git a/test_conformance/images/clCopyImage/test_copy_1D.cpp b/test_conformance/images/clCopyImage/test_copy_1D.cpp index ab223202..2c996c72 100644 --- a/test_conformance/images/clCopyImage/test_copy_1D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_1D.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_1D_array.cpp b/test_conformance/images/clCopyImage/test_copy_1D_array.cpp index 62eed3fd..0b616934 100644 --- a/test_conformance/images/clCopyImage/test_copy_1D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_1D_array.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_2D.cpp b/test_conformance/images/clCopyImage/test_copy_2D.cpp index 7af2fe3e..1a69a1fe 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp index f784230f..eb6dd552 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_2D_array.cpp @@ -16,14 +16,6 @@ #include "../testBase.h" #include "../common.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp b/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp index d341455e..8a56c95f 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_3D.cpp @@ -16,14 +16,6 @@ #include "../testBase.h" #include "../common.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_2D_array.cpp index 5624245a..6327ba58 100644 --- a/test_conformance/images/clCopyImage/test_copy_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_2D_array.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - // Defined in test_copy_generic.cpp extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_3D.cpp b/test_conformance/images/clCopyImage/test_copy_3D.cpp index fb176233..da6731d7 100644 --- a/test_conformance/images/clCopyImage/test_copy_3D.cpp +++ b/test_conformance/images/clCopyImage/test_copy_3D.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - // Defined in test_copy_generic.cpp extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp b/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp index b3b32230..c098f645 100644 --- a/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp +++ b/test_conformance/images/clCopyImage/test_copy_3D_2D_array.cpp @@ -16,14 +16,6 @@ #include "../testBase.h" #include "../common.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern int test_copy_image_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, const size_t sourcePos[], const size_t destPos[], const size_t regionSize[], MTdata d ); diff --git a/test_conformance/images/clCopyImage/test_copy_generic.cpp b/test_conformance/images/clCopyImage/test_copy_generic.cpp index 5a8f3d31..d56ae770 100644 --- a/test_conformance/images/clCopyImage/test_copy_generic.cpp +++ b/test_conformance/images/clCopyImage/test_copy_generic.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - static void CL_CALLBACK free_pitch_buffer( cl_mem image, void *buf ) { free( buf ); @@ -642,111 +634,3 @@ int test_copy_image_generic( cl_context context, cl_command_queue queue, image_d return 0; } - -int test_copy_image_size_generic( cl_context context, cl_command_queue queue, image_descriptor *srcImageInfo, image_descriptor *dstImageInfo, MTdata d ) -{ - size_t sourcePos[ 3 ], destPos[ 3 ], regionSize[ 3 ]; - int ret = 0, retCode; - - for (int i = 0; i < 8; i++) - { - switch (srcImageInfo->type) - { - case CL_MEM_OBJECT_IMAGE1D: - sourcePos[ 0 ] = random_in_range( 0, (int)(srcImageInfo->width - 4), d ); - sourcePos[ 1 ] = 1; - sourcePos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE2D: - sourcePos[ 0 ] = random_in_range( 0, (int)(srcImageInfo->width - 4), d ); - sourcePos[ 1 ] = random_in_range( 0, (int)(srcImageInfo->height - 4), d ); - sourcePos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE3D: - sourcePos[ 0 ] = random_in_range( 0, (int)(srcImageInfo->width - 4), d ); - sourcePos[ 1 ] = random_in_range( 0, (int)(srcImageInfo->height - 4), d ); - sourcePos[ 2 ] = random_in_range( 0, (int)(srcImageInfo->depth - 4), d ); - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - sourcePos[ 0 ] = random_in_range( 0, (int)(srcImageInfo->width - 4), d ); - sourcePos[ 1 ] = random_in_range( 0, (int)(srcImageInfo->arraySize - 4), d ); - sourcePos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - sourcePos[ 0 ] = random_in_range( 0, (int)(srcImageInfo->width - 4), d ); - sourcePos[ 1 ] = random_in_range( 0, (int)(srcImageInfo->height - 4), d ); - sourcePos[ 2 ] = random_in_range( 0, (int)(srcImageInfo->arraySize - 4), d ); - break; - } - - switch (dstImageInfo->type) - { - case CL_MEM_OBJECT_IMAGE1D: - destPos[ 0 ] = random_in_range( 0, (int)(dstImageInfo->width - 4), d ); - destPos[ 1 ] = 1; - destPos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE2D: - destPos[ 0 ] = random_in_range( 0, (int)(dstImageInfo->width - 4), d ); - destPos[ 1 ] = random_in_range( 0, (int)(dstImageInfo->height - 4), d ); - destPos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE3D: - destPos[ 0 ] = random_in_range( 0, (int)(dstImageInfo->width - 4), d ); - destPos[ 1 ] = random_in_range( 0, (int)(dstImageInfo->height - 4), d ); - destPos[ 2 ] = random_in_range( 0, (int)(dstImageInfo->depth - 4), d ); - break; - case CL_MEM_OBJECT_IMAGE1D_ARRAY: - destPos[ 0 ] = random_in_range( 0, (int)(dstImageInfo->width - 4), d ); - destPos[ 1 ] = random_in_range( 0, (int)(dstImageInfo->arraySize - 4), d ); - destPos[ 2 ] = 1; - break; - case CL_MEM_OBJECT_IMAGE2D_ARRAY: - destPos[ 0 ] = random_in_range( 0, (int)(dstImageInfo->width - 4), d ); - destPos[ 1 ] = random_in_range( 0, (int)(dstImageInfo->height - 4), d ); - destPos[ 2 ] = random_in_range( 0, (int)(dstImageInfo->arraySize - 4), d ); - break; - } - - if ( (dstImageInfo->width - destPos[0]) < (srcImageInfo->width - sourcePos[0]) ) - regionSize[0] = random_in_range(1, (dstImageInfo->width - destPos[0]), d); - else - regionSize[0] = random_in_range(1, (srcImageInfo->width - sourcePos[0]), d); - - if (srcImageInfo->type == CL_MEM_OBJECT_IMAGE1D || dstImageInfo->type == CL_MEM_OBJECT_IMAGE1D) - regionSize[1] = 0; - else - { - if ( (dstImageInfo->height - destPos[1]) < (srcImageInfo->height - sourcePos[1]) ) - regionSize[1] = random_in_range(1, (dstImageInfo->height - destPos[1]), d); - else - regionSize[1] = random_in_range(1, (srcImageInfo->height - sourcePos[1]), d); - } - - regionSize[2] = 0; - if (dstImageInfo->type == CL_MEM_OBJECT_IMAGE3D && srcImageInfo->type == CL_MEM_OBJECT_IMAGE3D) - { - if ( (dstImageInfo->depth - destPos[2]) < (srcImageInfo->depth - sourcePos[2]) ) - regionSize[2] = random_in_range(1, (dstImageInfo->depth - destPos[2]), d); - else - regionSize[2] = random_in_range(1, (srcImageInfo->depth - sourcePos[2]), d); - } - else if ( (dstImageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY && srcImageInfo->type == CL_MEM_OBJECT_IMAGE2D_ARRAY) ) - { - if ( (dstImageInfo->arraySize - destPos[2]) < (srcImageInfo->arraySize - sourcePos[2]) ) - regionSize[2] = random_in_range(1, (dstImageInfo->arraySize - destPos[2]), d); - else - regionSize[2] = random_in_range(1, (srcImageInfo->arraySize - sourcePos[2]), d); - } - - // Go for it! - retCode = test_copy_image_generic( context, queue, srcImageInfo, dstImageInfo, sourcePos, destPos, regionSize, d ); - if( retCode < 0 ) - return retCode; - else - ret += retCode; - } - - return ret; -} - diff --git a/test_conformance/images/clCopyImage/test_loops.cpp b/test_conformance/images/clCopyImage/test_loops.cpp index 1cb79e98..03f34be7 100644 --- a/test_conformance/images/clCopyImage/test_loops.cpp +++ b/test_conformance/images/clCopyImage/test_loops.cpp @@ -16,18 +16,6 @@ #include "../testBase.h" #include "../common.h" -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; -extern int gNormalizedModeToUse; -extern bool gTestMipmaps; -extern cl_channel_type gChannelTypeToUse; -extern cl_channel_type gChannelTypeToUse; -extern cl_channel_order gChannelOrderToUse; - - -extern bool gDebugTrace; - extern int test_copy_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_copy_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_copy_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); diff --git a/test_conformance/images/testBase.h b/test_conformance/images/testBase.h index f50f6b5b..7c45fdd1 100644 --- a/test_conformance/images/testBase.h +++ b/test_conformance/images/testBase.h @@ -22,6 +22,12 @@ #include "harness/clImageHelper.h" #include "harness/imageHelpers.h" +extern bool gDebugTrace; +extern bool gTestSmallImages; +extern bool gEnablePitch; +extern bool gTestMaxImages; +extern bool gTestMipmaps; + // Amount to offset pixels for checking normalized reads #define NORM_OFFSET 0.1f From ac05575abc8fd79e56e94b95e589a443cff9cad5 Mon Sep 17 00:00:00 2001 From: Yilong Guo <7253534+Nuullll@users.noreply.github.com> Date: Wed, 4 Nov 2020 17:02:11 +0800 Subject: [PATCH 12/36] [api][test_zero_sized_enqueue] Add CL_SUBMITTED check for waiting status (#1012) --- test_conformance/api/test_zero_sized_enqueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_conformance/api/test_zero_sized_enqueue.cpp b/test_conformance/api/test_zero_sized_enqueue.cpp index 26a335f1..7efb32c7 100644 --- a/test_conformance/api/test_zero_sized_enqueue.cpp +++ b/test_conformance/api/test_zero_sized_enqueue.cpp @@ -159,7 +159,7 @@ int test_zero_sized_enqueue_helper(cl_device_id deviceID, cl_context context, cl error = clGetEventInfo(ev, CL_EVENT_COMMAND_EXECUTION_STATUS, sizeof(cl_int), &sta, NULL); test_error( error, "Failed to get event status."); - if (sta != CL_QUEUED) + if (sta != CL_QUEUED && sta != CL_SUBMITTED) { log_error( "ERROR: incorrect zero sized kernel enqueue event status.\n" ); return -1; From 12fce84a66602c33cf909b4a47911d7085962661 Mon Sep 17 00:00:00 2001 From: Stuart Brady Date: Wed, 4 Nov 2020 12:44:54 +0000 Subject: [PATCH 13/36] Minor refactoring of CL_PROGRAM_SOURCE tests (#1032) Signed-off-by: Stuart Brady --- test_conformance/compiler/test_build_helpers.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/test_conformance/compiler/test_build_helpers.cpp b/test_conformance/compiler/test_build_helpers.cpp index 6cfdcf27..c5ebb807 100644 --- a/test_conformance/compiler/test_build_helpers.cpp +++ b/test_conformance/compiler/test_build_helpers.cpp @@ -428,7 +428,8 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman int error; char buffer[10240]; size_t length; - + size_t line_length = strlen(sample_kernel_code_single_line[0]); + bool online_compilation = (gCompilationMode == kOnline); error = create_single_kernel_helper_create_program(context, &program, 1, sample_kernel_code_single_line); if( program == NULL ) @@ -440,7 +441,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman /* Try getting the length */ error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, 0, NULL, &length ); test_error( error, "Unable to get program source length" ); - if (length != strlen(sample_kernel_code_single_line[0]) + 1 && gCompilationMode == kOnline) + if (length != line_length + 1 && online_compilation) { log_error( "ERROR: Length returned for program source is incorrect!\n" ); return -1; @@ -449,7 +450,7 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman /* Try normal source */ error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, NULL ); test_error( error, "Unable to get program source" ); - if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && gCompilationMode == kOnline) + if (strlen(buffer) != line_length && online_compilation) { log_error( "ERROR: Length of program source is incorrect!\n" ); return -1; @@ -458,12 +459,12 @@ int test_get_program_source(cl_device_id deviceID, cl_context context, cl_comman /* Try both at once */ error = clGetProgramInfo( program, CL_PROGRAM_SOURCE, sizeof( buffer ), buffer, &length ); test_error( error, "Unable to get program source" ); - if (strlen(buffer) != strlen(sample_kernel_code_single_line[0]) && gCompilationMode == kOnline) + if (strlen(buffer) != line_length && online_compilation) { log_error( "ERROR: Length of program source is incorrect!\n" ); return -1; } - if (length != strlen(sample_kernel_code_single_line[0]) + 1 && gCompilationMode == kOnline) + if (length != line_length + 1 && online_compilation) { log_error( "ERROR: Returned length of program source is incorrect!\n" ); return -1; From 0e67969989b76c2f8ccec71745cce2df58d66cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Fri, 6 Nov 2020 10:09:33 +0000 Subject: [PATCH 14/36] Fix build warning/error introduced by 8d443029 (#1042) "control reaches end of non-void function" Signed-off-by: Kevin Petit --- test_common/harness/testHarness.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index f9dd1252..c96f4b53 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -721,7 +721,8 @@ int parseAndCallCommandLineTests(int argc, const char *argv[], { case TEST_PASS: case TEST_SKIP: return false; - case TEST_FAIL: return true; + case TEST_FAIL: + default: return true; }; })) { From 46fead41f4ab203072db2f839b7aabc0818dc907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Fri, 6 Nov 2020 11:23:50 +0000 Subject: [PATCH 15/36] Replace Travis CI with Github Actions (#1047) * Replace Travis CI with Github Actions Signed-off-by: Kevin Petit * Fix OpenGL coverage * Tidy up - Fix shell warning - Remove ENABLE_OPENCL30_PROVISIONAL ICD CMake option --- .github/workflows/presubmit.yml | 40 +++++++++++++++++++++++++++++++++ .travis.yml | 22 ------------------ travis.sh => presubmit.sh | 6 ++--- 3 files changed, 43 insertions(+), 25 deletions(-) create mode 100644 .github/workflows/presubmit.yml delete mode 100644 .travis.yml rename travis.sh => presubmit.sh (90%) diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml new file mode 100644 index 00000000..85db407d --- /dev/null +++ b/.github/workflows/presubmit.yml @@ -0,0 +1,40 @@ +name: Presubmit +on: [push, pull_request] + +jobs: + build: + name: Build ${{ matrix.os }} ${{ matrix.name }} + runs-on: ${{ matrix.os }} + env: + JOB_CHECK_FORMAT: ${{ matrix.format }} + JOB_ARCHITECTURE: ${{ matrix.arch }} + JOB_ENABLE_GL: ${{ matrix.gl }} + strategy: + matrix: + mainmatrix: [true] + os: [ubuntu-20.04, macos-11.0] + include: + - os: ubuntu-20.04 + mainmatrix: true + gl: 1 + - os: ubuntu-20.04 + mainmatrix: false + name: Format + format: 1 + - os: ubuntu-20.04 + mainmatrix: false + name: Arm + arch: arm + - os: ubuntu-20.04 + mainmatrix: false + name: AArch64 + arch: aarch64 + steps: + - name: Setup + run: if [[ "${{matrix.format}}" == "1" ]]; then sudo apt install -y clang-format; fi + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Build + run: ./presubmit.sh + diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 98984d8c..00000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -language: cpp - -os: - - linux - - osx - -jobs: - include: - - os: linux - dist: bionic - env: JOB_CHECK_FORMAT=1 - addons: - apt: - packages: - - clang-format-9 - - os: linux - env: JOB_ARCHITECTURE=arm - - os: linux - env: JOB_ARCHITECTURE=aarch64 - -script: - - ./travis.sh diff --git a/travis.sh b/presubmit.sh similarity index 90% rename from travis.sh rename to presubmit.sh index 6b2b2dea..646a7f00 100755 --- a/travis.sh +++ b/presubmit.sh @@ -4,7 +4,7 @@ set -e export TOP=$(pwd) -if [ "${JOB_CHECK_FORMAT}" -eq 1 ]; then +if [[ "${JOB_CHECK_FORMAT}" == "1" ]]; then ./check-format.sh exit $? fi @@ -41,7 +41,7 @@ if [[ ${JOB_ARCHITECTURE} != "" ]]; then echo "SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> ${TOOLCHAIN_FILE} fi -if [[ ( ${JOB_ARCHITECTURE} == "" && ${TRAVIS_OS_NAME} == "linux" ) ]]; then +if [[ ( ${JOB_ARCHITECTURE} == "" && ${JOB_ENABLE_GL} == "1" ) ]]; then BUILD_OPENGL_TEST="ON" sudo apt-get update sudo apt-get -y install libglu1-mesa-dev freeglut3-dev mesa-common-dev libglew-dev @@ -57,7 +57,7 @@ git clone https://github.com/KhronosGroup/OpenCL-ICD-Loader.git cd ${TOP}/OpenCL-ICD-Loader mkdir build cd build -cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DENABLE_OPENCL30_PROVISIONAL=1 -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/ .. +cmake -DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} -DOPENCL_ICD_LOADER_HEADERS_DIR=${TOP}/OpenCL-Headers/ .. make # Get libclcxx From c8163e931f885da64d09ac81a4147dbf828d0e48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Petit?= Date: Fri, 6 Nov 2020 11:24:15 +0000 Subject: [PATCH 16/36] Fix a few typos and remove unused code (#1041) Fixes #845 Fixes #844 Signed-off-by: Kevin Petit --- test_common/harness/errorHelpers.cpp | 60 ------------------- .../events/test_event_dependencies.cpp | 2 +- .../images/samplerlessReads/main.cpp | 2 +- 3 files changed, 2 insertions(+), 62 deletions(-) diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index 87701f1c..03684a15 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -620,66 +620,6 @@ cl_int OutputBuildLogs(cl_program program, cl_uint num_devices, return CL_SUCCESS; } -const char *subtests_requiring_opencl_1_2[] = { - "device_partition_equally", "device_partition_by_counts", - "device_partition_by_affinity_domain_numa", - "device_partition_by_affinity_domain_l4_cache", - "device_partition_by_affinity_domain_l3_cache", - "device_partition_by_affinity_domain_l2_cache", - "device_partition_by_affinity_domain_l1_cache", - "device_partition_by_affinity_domain_next_partitionable", - "device_partition_all", "buffer_fill_int", "buffer_fill_uint", - "buffer_fill_short", "buffer_fill_ushort", "buffer_fill_char", - "buffer_fill_uchar", "buffer_fill_long", "buffer_fill_ulong", - "buffer_fill_float", "buffer_fill_struct", - "test_mem_host_write_only_buffer", "test_mem_host_write_only_subbuffer", - "test_mem_host_no_access_buffer", "test_mem_host_no_access_subbuffer", - "test_mem_host_read_only_image", "test_mem_host_write_only_image", - "test_mem_host_no_access_image", - // CL_MEM_HOST_{READ|WRITE}_ONLY api/ - "get_buffer_info", "get_image1d_info", "get_image1d_array_info", - "get_image2d_array_info", - // gl/ - "images_read_1D", "images_write_1D", "images_1D_getinfo", - "images_read_1Darray", "images_write_1Darray", "images_1Darray_getinfo", - "images_read_2Darray", "images_write_2Darray", "images_2Darray_getinfo", - "buffer_migrate", "image_migrate", - // compiler/ - "load_program_source", "load_multistring_source", "load_two_kernel_source", - "load_null_terminated_source", "load_null_terminated_multi_line_source", - "load_null_terminated_partial_multi_line_source", - "load_discreet_length_source", "get_program_source", - "get_program_build_info", "get_program_info", "large_compile", - "async_build", "options_build_optimizations", "options_build_macro", - "options_build_macro_existence", "options_include_directory", - "options_denorm_cache", "preprocessor_define_udef", "preprocessor_include", - "preprocessor_line_error", "preprocessor_pragma", - "compiler_defines_for_extensions", "image_macro", "simple_compile_only", - "simple_static_compile_only", "simple_extern_compile_only", - "simple_compile_with_callback", "simple_embedded_header_compile", - "simple_link_only", "two_file_regular_variable_access", - "two_file_regular_struct_access", "two_file_regular_function_access", - "simple_link_with_callback", "simple_embedded_header_link", - "execute_after_simple_compile_and_link", - "execute_after_simple_compile_and_link_no_device_info", - "execute_after_simple_compile_and_link_with_defines", - "execute_after_simple_compile_and_link_with_callbacks", - "execute_after_simple_library_with_link", "execute_after_two_file_link", - "execute_after_two_file_link", "execute_after_embedded_header_link", - "execute_after_included_header_link", - "execute_after_serialize_reload_object", - "execute_after_serialize_reload_library", "simple_library_only", - "simple_library_with_callback", "simple_library_with_link", "two_file_link", - "multi_file_libraries", "multiple_files", "multiple_libraries", - "multiple_files_multiple_libraries", "multiple_embedded_headers", - "program_binary_type", "compile_and_link_status_options_log", - // CL_PROGRAM_NUM_KERNELS, in api/ - "get_kernel_arg_info", "create_kernels_in_program", - // clEnqueue..WithWaitList, in events/ - "event_enqueue_marker_with_event_list", - "event_enqueue_barrier_with_event_list", "popcount" -}; - const char *subtests_to_skip_with_offline_compiler[] = { "get_kernel_arg_info", "get_kernel_arg_info_compatibility", diff --git a/test_conformance/events/test_event_dependencies.cpp b/test_conformance/events/test_event_dependencies.cpp index 0ab0f2ad..41136548 100644 --- a/test_conformance/events/test_event_dependencies.cpp +++ b/test_conformance/events/test_event_dependencies.cpp @@ -203,7 +203,7 @@ int test_event_enqueue_wait_for_events_run_test( cl_device_id deviceID, cl_conte // then incremented to 5s, repeatedly. Otherwise the values may be 2s (if the first one doesn't work) or 8s // (if the second one doesn't work). if (RANDOMIZE) - log_info("Queues chosen randomly for each kernel exection.\n"); + log_info("Queues chosen randomly for each kernel execution.\n"); else log_info("Queues chosen alternatily for each kernel execution.\n"); diff --git a/test_conformance/images/samplerlessReads/main.cpp b/test_conformance/images/samplerlessReads/main.cpp index cc882f3c..e62765d7 100644 --- a/test_conformance/images/samplerlessReads/main.cpp +++ b/test_conformance/images/samplerlessReads/main.cpp @@ -186,7 +186,7 @@ static void printUsage( const char *execName ) log_info( "You may also use appropriate CL_ channel type and ordering constants.\n" ); log_info( "\n" ); log_info( "\tThe following modify the types of images tested:\n" ); - log_info( "\t\read_write - Runs the tests with read_write images which allow a kernel do both read and write to the same image \n" ); + log_info( "\t\tread_write - Runs the tests with read_write images which allow a kernel do both read and write to the same image \n" ); log_info( "\t\tsmall_images - Runs every format through a loop of widths 1-13 and heights 1-9, instead of random sizes\n" ); log_info( "\t\tmax_images - Runs every format through a set of size combinations with the max values, max values - 1, and max values / 128\n" ); log_info( "\n" ); From e31e3a6694a20d21491d37b490dc744f35dc075a Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 6 Nov 2020 12:24:46 +0100 Subject: [PATCH 17/36] Remove unused code in clReadWriteImage (#1043) These declarations either aren't used or aren't needed, as testBase.h already declares them. Signed-off-by: Radek Szymanski --- test_conformance/images/clReadWriteImage/main.cpp | 15 +-------------- .../images/clReadWriteImage/test_loops.cpp | 10 ---------- .../images/clReadWriteImage/test_read_1D.cpp | 9 --------- .../clReadWriteImage/test_read_1D_array.cpp | 9 --------- .../images/clReadWriteImage/test_read_2D.cpp | 9 --------- .../clReadWriteImage/test_read_2D_array.cpp | 7 ------- .../images/clReadWriteImage/test_read_3D.cpp | 7 ------- 7 files changed, 1 insertion(+), 65 deletions(-) diff --git a/test_conformance/images/clReadWriteImage/main.cpp b/test_conformance/images/clReadWriteImage/main.cpp index d8d096ee..5fd5367d 100644 --- a/test_conformance/images/clReadWriteImage/main.cpp +++ b/test_conformance/images/clReadWriteImage/main.cpp @@ -13,30 +13,20 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -bool gUseRamp; bool gTestMipmaps; -int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; bool gEnablePitch = false; -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - static void printUsage( const char *execName ); extern int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type image_type ); @@ -99,8 +89,6 @@ int main(int argc, const char *argv[]) gTestMaxImages = true; else if( strcmp( argv[i], "use_pitches" ) == 0 ) gEnablePitch = true; - else if( strcmp( argv[i], "use_ramps" ) == 0 ) - gUseRamp = true; else if( strcmp( argv[i], "test_mipmaps") == 0 ) { gTestMipmaps = true; // Don't test pitches with mipmaps right now. @@ -142,7 +130,6 @@ static void printUsage( const char *execName ) log_info( "\tsmall_images - Runs every format through a loop of widths 1-13 and heights 1-9, instead of random sizes\n" ); log_info( "\tmax_images - Runs every format through a set of size combinations with the max values, max values - 1, and max values / 128\n" ); log_info( "\tuse_pitches - Enables row and slice pitches\n" ); - log_info( "\tuse_ramp - Instead of random data, uses images filled with ramps (and 0xff on any padding pixels) to ease debugging\n" ); log_info( "\ttest_mipmaps - Test mipmapped images\n" ); log_info( "\trandomize - Uses random seed\n" ); log_info( "\n" ); diff --git a/test_conformance/images/clReadWriteImage/test_loops.cpp b/test_conformance/images/clReadWriteImage/test_loops.cpp index e8ca8c8f..f0690e18 100644 --- a/test_conformance/images/clReadWriteImage/test_loops.cpp +++ b/test_conformance/images/clReadWriteImage/test_loops.cpp @@ -16,16 +16,6 @@ #include "../testBase.h" #include "../common.h" -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; -extern int gNormalizedModeToUse; -extern cl_channel_type gChannelTypeToUse; - - -extern bool gDebugTrace; -extern bool gTestMipmaps; - extern int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_read_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_read_image_set_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); diff --git a/test_conformance/images/clReadWriteImage/test_read_1D.cpp b/test_conformance/images/clReadWriteImage/test_read_1D.cpp index 7d9eb845..8f996e8f 100644 --- a/test_conformance/images/clReadWriteImage/test_read_1D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_1D.cpp @@ -15,15 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - - int test_read_image_1D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) { int error; diff --git a/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp b/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp index 3f845564..ad0444d7 100644 --- a/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_1D_array.cpp @@ -15,15 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - - int test_read_image_1D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) { int error; diff --git a/test_conformance/images/clReadWriteImage/test_read_2D.cpp b/test_conformance/images/clReadWriteImage/test_read_2D.cpp index 0eae51b5..7c205035 100644 --- a/test_conformance/images/clReadWriteImage/test_read_2D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_2D.cpp @@ -15,15 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - - int test_read_image_2D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) { int error; diff --git a/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp b/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp index 547e5eb4..6118e697 100644 --- a/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_2D_array.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - int test_read_image_2D_array( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) { int error; diff --git a/test_conformance/images/clReadWriteImage/test_read_3D.cpp b/test_conformance/images/clReadWriteImage/test_read_3D.cpp index 16baeebf..8f21ae94 100644 --- a/test_conformance/images/clReadWriteImage/test_read_3D.cpp +++ b/test_conformance/images/clReadWriteImage/test_read_3D.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - int test_read_image_3D( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) { int error; From 51d2e5003ed8a2685d55cb9bdad022a5effb8f6e Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 6 Nov 2020 12:24:59 +0100 Subject: [PATCH 18/36] Remove unused code in clGetInfo (#1038) These declarations either aren't used or aren't needed, as testBase.h already declares them. Signed-off-by: Radek Szymanski --- test_conformance/images/clGetInfo/main.cpp | 11 +---------- test_conformance/images/clGetInfo/test_1D.cpp | 5 ----- .../images/clGetInfo/test_1D_2D_array.cpp | 5 ----- test_conformance/images/clGetInfo/test_2D.cpp | 6 ------ test_conformance/images/clGetInfo/test_3D.cpp | 5 ----- test_conformance/images/clGetInfo/test_loops.cpp | 12 ------------ 6 files changed, 1 insertion(+), 43 deletions(-) diff --git a/test_conformance/images/clGetInfo/main.cpp b/test_conformance/images/clGetInfo/main.cpp index cea2ad66..10694186 100644 --- a/test_conformance/images/clGetInfo/main.cpp +++ b/test_conformance/images/clGetInfo/main.cpp @@ -13,30 +13,21 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -int gTypesToTest; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; extern int test_image_set( cl_device_id device, cl_context context, cl_mem_object_type image_type ); static void printUsage( const char *execName ); -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - int test_1D(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) { return test_image_set( device, context, CL_MEM_OBJECT_IMAGE1D ); diff --git a/test_conformance/images/clGetInfo/test_1D.cpp b/test_conformance/images/clGetInfo/test_1D.cpp index e1d92064..0d704b82 100644 --- a/test_conformance/images/clGetInfo/test_1D.cpp +++ b/test_conformance/images/clGetInfo/test_1D.cpp @@ -15,11 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; - extern int test_get_image_info_single( cl_context context, image_descriptor *imageInfo, MTdata d, cl_mem_flags flags, size_t row_pitch, size_t slice_pitch ); diff --git a/test_conformance/images/clGetInfo/test_1D_2D_array.cpp b/test_conformance/images/clGetInfo/test_1D_2D_array.cpp index c250e094..447fc7c2 100644 --- a/test_conformance/images/clGetInfo/test_1D_2D_array.cpp +++ b/test_conformance/images/clGetInfo/test_1D_2D_array.cpp @@ -15,11 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; - extern int test_get_image_info_single( cl_context context, image_descriptor *imageInfo, MTdata d, cl_mem_flags flags, size_t row_pitch, size_t slice_pitch ); int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ) diff --git a/test_conformance/images/clGetInfo/test_2D.cpp b/test_conformance/images/clGetInfo/test_2D.cpp index 49537075..74a60123 100644 --- a/test_conformance/images/clGetInfo/test_2D.cpp +++ b/test_conformance/images/clGetInfo/test_2D.cpp @@ -15,12 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; - - int test_get_image_info_single( cl_context context, image_descriptor *imageInfo, MTdata d, cl_mem_flags flags, size_t row_pitch, size_t slice_pitch ) { int error; diff --git a/test_conformance/images/clGetInfo/test_3D.cpp b/test_conformance/images/clGetInfo/test_3D.cpp index 4bc189a4..af5062e3 100644 --- a/test_conformance/images/clGetInfo/test_3D.cpp +++ b/test_conformance/images/clGetInfo/test_3D.cpp @@ -15,11 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages; - extern int test_get_image_info_single( cl_context context, image_descriptor *imageInfo, MTdata d, cl_mem_flags flags, size_t row_pitch, size_t slice_pitch ); int test_get_image_info_3D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ) diff --git a/test_conformance/images/clGetInfo/test_loops.cpp b/test_conformance/images/clGetInfo/test_loops.cpp index 9b0e9243..0abb14bf 100644 --- a/test_conformance/images/clGetInfo/test_loops.cpp +++ b/test_conformance/images/clGetInfo/test_loops.cpp @@ -15,18 +15,6 @@ // #include "../testBase.h" #include "../common.h" -#include "harness/imageHelpers.h" -#include -#include - -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; -extern int gNormalizedModeToUse; -extern cl_channel_type gChannelTypeToUse; - - -extern bool gDebugTrace; extern int test_get_image_info_1D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ); extern int test_get_image_info_2D( cl_device_id device, cl_context context, cl_image_format *format, cl_mem_flags flags ); From 83cc521e17f18fd1c8ec091c57d718eb2c188843 Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 6 Nov 2020 12:25:12 +0100 Subject: [PATCH 19/36] Remove unused code in clFillImage (#1036) These declarations either aren't used or aren't needed, as testBase.h already declares them. Signed-off-by: Radek Szymanski --- test_conformance/images/clFillImage/main.cpp | 9 +-------- test_conformance/images/clFillImage/test_fill_1D.cpp | 8 -------- .../images/clFillImage/test_fill_1D_array.cpp | 8 -------- test_conformance/images/clFillImage/test_fill_2D.cpp | 8 -------- .../images/clFillImage/test_fill_2D_array.cpp | 7 ------- test_conformance/images/clFillImage/test_fill_3D.cpp | 7 ------- .../images/clFillImage/test_fill_generic.cpp | 10 ---------- test_conformance/images/clFillImage/test_loops.cpp | 9 +-------- 8 files changed, 2 insertions(+), 64 deletions(-) diff --git a/test_conformance/images/clFillImage/main.cpp b/test_conformance/images/clFillImage/main.cpp index 23d9e4cc..1f09a49e 100644 --- a/test_conformance/images/clFillImage/main.cpp +++ b/test_conformance/images/clFillImage/main.cpp @@ -13,17 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" #include "../harness/testHarness.h" bool gDebugTrace; @@ -37,7 +31,6 @@ cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; extern int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, MethodsToTest testMethod ); static void printUsage( const char *execName ); -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 int test_1D(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) { diff --git a/test_conformance/images/clFillImage/test_fill_1D.cpp b/test_conformance/images/clFillImage/test_fill_1D.cpp index 51eb822b..c3f23185 100644 --- a/test_conformance/images/clFillImage/test_fill_1D.cpp +++ b/test_conformance/images/clFillImage/test_fill_1D.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - // Defined in test_fill_2D_3D.cpp extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d ); diff --git a/test_conformance/images/clFillImage/test_fill_1D_array.cpp b/test_conformance/images/clFillImage/test_fill_1D_array.cpp index edbcacd9..b4347a47 100644 --- a/test_conformance/images/clFillImage/test_fill_1D_array.cpp +++ b/test_conformance/images/clFillImage/test_fill_1D_array.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - // Defined in test_fill_2D_3D.cpp extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d ); diff --git a/test_conformance/images/clFillImage/test_fill_2D.cpp b/test_conformance/images/clFillImage/test_fill_2D.cpp index 8e76e86c..bb66fc27 100644 --- a/test_conformance/images/clFillImage/test_fill_2D.cpp +++ b/test_conformance/images/clFillImage/test_fill_2D.cpp @@ -15,14 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - // Defined in test_fill_2D_3D.cpp extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d ); diff --git a/test_conformance/images/clFillImage/test_fill_2D_array.cpp b/test_conformance/images/clFillImage/test_fill_2D_array.cpp index 260b869f..3265aab0 100644 --- a/test_conformance/images/clFillImage/test_fill_2D_array.cpp +++ b/test_conformance/images/clFillImage/test_fill_2D_array.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - // Defined in test_fill_2D_3D.cpp extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d ); diff --git a/test_conformance/images/clFillImage/test_fill_3D.cpp b/test_conformance/images/clFillImage/test_fill_3D.cpp index 298db0e7..9db0ac7c 100644 --- a/test_conformance/images/clFillImage/test_fill_3D.cpp +++ b/test_conformance/images/clFillImage/test_fill_3D.cpp @@ -15,13 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; - // Defined in test_fill_2D_3D.cpp extern int test_fill_image_generic( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, const size_t origin[], const size_t region[], ExplicitType outputType, MTdata d ); diff --git a/test_conformance/images/clFillImage/test_fill_generic.cpp b/test_conformance/images/clFillImage/test_fill_generic.cpp index 6b59bada..c5989392 100644 --- a/test_conformance/images/clFillImage/test_fill_generic.cpp +++ b/test_conformance/images/clFillImage/test_fill_generic.cpp @@ -15,23 +15,13 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gTestMaxImages, gEnablePitch; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern uint64_t gRoundingStartValue; - extern void read_image_pixel_float( void *imageData, image_descriptor *imageInfo, int x, int y, int z, float *outData ); - static void CL_CALLBACK free_pitch_buffer( cl_mem image, void *buf ) { free( buf ); } - cl_mem create_image( cl_context context, cl_command_queue queue, BufferOwningPtr& data, image_descriptor *imageInfo, int *error ) { cl_mem img; diff --git a/test_conformance/images/clFillImage/test_loops.cpp b/test_conformance/images/clFillImage/test_loops.cpp index 0a4c571f..3ab696ef 100644 --- a/test_conformance/images/clFillImage/test_loops.cpp +++ b/test_conformance/images/clFillImage/test_loops.cpp @@ -16,14 +16,7 @@ #include "../testBase.h" #include "../common.h" -extern bool gDebugTrace; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; -extern int gNormalizedModeToUse; -extern cl_channel_type gChannelTypeToUse; -extern cl_channel_order gChannelOrderToUse; - +extern int gTypesToTest; extern int test_fill_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType ); extern int test_fill_image_set_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, ExplicitType outputType ); From 8fa24b8a727a5efbcc51f489b7f1e4ed168166ca Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Fri, 6 Nov 2020 12:31:56 +0100 Subject: [PATCH 20/36] Change arg type to unsigned int from signed int (#1031) --- test_conformance/c11_atomics/common.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test_conformance/c11_atomics/common.h b/test_conformance/c11_atomics/common.h index d1219f23..bbcc68c6 100644 --- a/test_conformance/c11_atomics/common.h +++ b/test_conformance/c11_atomics/common.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 @@ -888,7 +888,7 @@ std::string CBasicTest::KernelCode(cl_uint maxNumD else // global atomics declared in program scope code += R"( - if(atomic_fetch_add_explicit(&finishedThreads, 1, + if(atomic_fetch_add_explicit(&finishedThreads, 1u, memory_order_relaxed, memory_scope_work_group) == get_global_size(0)-1) // last finished thread @@ -1048,7 +1048,7 @@ int CBasicTest::ExecuteSingleTest(cl_device_id dev refValues.resize(threadCount*NumNonAtomicVariablesPerThread()); - // Generate ref data if we have a ref generator provided + // Generate ref data if we have a ref generator provided d = init_genrand(gRandomSeed); startRefValues.resize(threadCount*NumNonAtomicVariablesPerThread()); if(GenerateRefs(threadCount, &startRefValues[0], d)) From e8c55e59bc51ddcf4b9e1ea44400b3109c8767e5 Mon Sep 17 00:00:00 2001 From: Jack Frankland <30410009+FranklandJack@users.noreply.github.com> Date: Fri, 6 Nov 2020 12:32:13 +0100 Subject: [PATCH 21/36] Skip `features_macro` Test in Offline Mode (#1034) - [x] Skip the `features_macro` test in offline mode since it makes calls to `create_single_kernel_helper_create_program` and fails when the call doesn't return `CL_SUCCESS` which will happen when the offline compiler fails to compile the kernel which is deliberately supposed to fail compilation in this test. --- test_common/harness/errorHelpers.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test_common/harness/errorHelpers.cpp b/test_common/harness/errorHelpers.cpp index 03684a15..c1d06028 100644 --- a/test_common/harness/errorHelpers.cpp +++ b/test_common/harness/errorHelpers.cpp @@ -685,6 +685,7 @@ const char *subtests_to_skip_with_offline_compiler[] = { "unload_build_threaded", "unload_build_info", "unload_program_binaries", + "features_macro", }; int check_functions_for_offline_compiler(const char *subtestname, From 63f01be181574d9720b5a90253123f4bad89b094 Mon Sep 17 00:00:00 2001 From: ellnor01 <51320439+ellnor01@users.noreply.github.com> Date: Fri, 6 Nov 2020 11:33:36 +0000 Subject: [PATCH 22/36] Reimplement buffer tests (#1007) * Reimplement buffer tests Reintegrated and fixed test code for buffer tests buffer_read_half and buffer_write_half tests. Added mem_alloc_ref_flags test code, as was previously non-existent, to test CL_MEM_ALLOC_HOST_PTR. This flag was otherwise untested and as similar tests within the suite are used to test other cl_mem_flags it has been assumed that this was the purpose of the test. Fixes #439 Change-Id: I5accf986be7436d09377d0bfd7afd5de2235c329 Signed-off-by: Ellen Norris-Thompson * move mem_read_write_flags to a common function Code under mem_*_flags tests have a lot of duplication, this is the first step of moving test code to a common function. Contributes #439 Signed-off-by: Ellen Norris-Thompson * move mem_write_only_flags test code to a common function Code under mem_*_flags tests have a lot of duplication Contributes #439 Signed-off-by: Ellen Norris-Thompson * move mem_read_only_flags test code to a common function Code under mem_*_flags tests have a lot of duplication Contributes #439 Signed-off-by: Ellen Norris-Thompson * move mem_copy_host_flags test code to a common function Code under mem_*_flags tests have a lot of duplication, moved mem_copy_host_flags code and rearranged function where appropriate mem_ref_alloc_flags test also uses common function. Contributes #439 Signed-off-by: Ellen Norris-Thompson * Remove unused NOT_IMPLEMENTED_TEST macro This define is not in use anymore, since tests have been reimplemented in #439. Tests should be working and implemented or not registered. Signed-off-by: Ellen Norris-Thompson --- test_common/harness/testHarness.cpp | 13 +- test_common/harness/testHarness.h | 4 - test_common/harness/threadTesting.h | 1 - test_conformance/buffers/main.cpp | 186 +++---- test_conformance/buffers/test_buffer_mem.cpp | 511 +++++------------- test_conformance/buffers/test_buffer_read.cpp | 91 +--- .../buffers/test_buffer_write.cpp | 40 +- 7 files changed, 260 insertions(+), 586 deletions(-) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index c96f4b53..6a3cacc9 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -829,17 +829,8 @@ test_status callSingleTestFunction(test_definition test, } else { - int ret = test.func( - deviceToUse, context, queue, - numElementsToUse); // test_threaded_function( ptr_basefn_list[i], - // group, context, num_elements); - if (ret == TEST_NOT_IMPLEMENTED) - { - /* Tests can also let us know they're not implemented yet */ - log_info("%s test currently not implemented\n", test.name); - status = TEST_SKIP; - } - else if (ret == TEST_SKIPPED_ITSELF) + int ret = test.func(deviceToUse, context, queue, numElementsToUse); + if (ret == TEST_SKIPPED_ITSELF) { /* Tests can also let us know they're not supported by the * implementation */ diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index 66c1b036..235926ac 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -64,10 +64,6 @@ Version get_device_cl_version(cl_device_id device); { \ test_##fn, #fn, ver \ } -#define NOT_IMPLEMENTED_TEST(fn) \ - { \ - NULL, #fn, Version(0, 0) \ - } #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) diff --git a/test_common/harness/threadTesting.h b/test_common/harness/threadTesting.h index 08a17ed0..91ff279f 100644 --- a/test_common/harness/threadTesting.h +++ b/test_common/harness/threadTesting.h @@ -22,7 +22,6 @@ #include #endif -#define TEST_NOT_IMPLEMENTED -99 #define TEST_SKIPPED_ITSELF -100 typedef int (*basefn)(cl_device_id deviceID, cl_context context, diff --git a/test_conformance/buffers/main.cpp b/test_conformance/buffers/main.cpp index 1a5c8644..c8713127 100644 --- a/test_conformance/buffers/main.cpp +++ b/test_conformance/buffers/main.cpp @@ -22,104 +22,104 @@ #include "harness/testHarness.h" test_definition test_list[] = { - ADD_TEST( buffer_read_async_int ), - ADD_TEST( buffer_read_async_uint ), - ADD_TEST( buffer_read_async_long ), - ADD_TEST( buffer_read_async_ulong ), - ADD_TEST( buffer_read_async_short ), - ADD_TEST( buffer_read_async_ushort ), - ADD_TEST( buffer_read_async_char ), - ADD_TEST( buffer_read_async_uchar ), - ADD_TEST( buffer_read_async_float ), - ADD_TEST( buffer_read_array_barrier_int ), - ADD_TEST( buffer_read_array_barrier_uint ), - ADD_TEST( buffer_read_array_barrier_long ), - ADD_TEST( buffer_read_array_barrier_ulong ), - ADD_TEST( buffer_read_array_barrier_short ), - ADD_TEST( buffer_read_array_barrier_ushort ), - ADD_TEST( buffer_read_array_barrier_char ), - ADD_TEST( buffer_read_array_barrier_uchar ), - ADD_TEST( buffer_read_array_barrier_float ), - ADD_TEST( buffer_read_int ), - ADD_TEST( buffer_read_uint ), - ADD_TEST( buffer_read_long ), - ADD_TEST( buffer_read_ulong ), - ADD_TEST( buffer_read_short ), - ADD_TEST( buffer_read_ushort ), - ADD_TEST( buffer_read_float ), - NOT_IMPLEMENTED_TEST( buffer_read_half ), - ADD_TEST( buffer_read_char ), - ADD_TEST( buffer_read_uchar ), - ADD_TEST( buffer_read_struct ), - ADD_TEST( buffer_read_random_size ), - ADD_TEST( buffer_map_read_int ), - ADD_TEST( buffer_map_read_uint ), - ADD_TEST( buffer_map_read_long ), - ADD_TEST( buffer_map_read_ulong ), - ADD_TEST( buffer_map_read_short ), - ADD_TEST( buffer_map_read_ushort ), - ADD_TEST( buffer_map_read_char ), - ADD_TEST( buffer_map_read_uchar ), - ADD_TEST( buffer_map_read_float ), - ADD_TEST( buffer_map_read_struct ), + ADD_TEST(buffer_read_async_int), + ADD_TEST(buffer_read_async_uint), + ADD_TEST(buffer_read_async_long), + ADD_TEST(buffer_read_async_ulong), + ADD_TEST(buffer_read_async_short), + ADD_TEST(buffer_read_async_ushort), + ADD_TEST(buffer_read_async_char), + ADD_TEST(buffer_read_async_uchar), + ADD_TEST(buffer_read_async_float), + ADD_TEST(buffer_read_array_barrier_int), + ADD_TEST(buffer_read_array_barrier_uint), + ADD_TEST(buffer_read_array_barrier_long), + ADD_TEST(buffer_read_array_barrier_ulong), + ADD_TEST(buffer_read_array_barrier_short), + ADD_TEST(buffer_read_array_barrier_ushort), + ADD_TEST(buffer_read_array_barrier_char), + ADD_TEST(buffer_read_array_barrier_uchar), + ADD_TEST(buffer_read_array_barrier_float), + ADD_TEST(buffer_read_int), + ADD_TEST(buffer_read_uint), + ADD_TEST(buffer_read_long), + ADD_TEST(buffer_read_ulong), + ADD_TEST(buffer_read_short), + ADD_TEST(buffer_read_ushort), + ADD_TEST(buffer_read_float), + ADD_TEST(buffer_read_half), + ADD_TEST(buffer_read_char), + ADD_TEST(buffer_read_uchar), + ADD_TEST(buffer_read_struct), + ADD_TEST(buffer_read_random_size), + ADD_TEST(buffer_map_read_int), + ADD_TEST(buffer_map_read_uint), + ADD_TEST(buffer_map_read_long), + ADD_TEST(buffer_map_read_ulong), + ADD_TEST(buffer_map_read_short), + ADD_TEST(buffer_map_read_ushort), + ADD_TEST(buffer_map_read_char), + ADD_TEST(buffer_map_read_uchar), + ADD_TEST(buffer_map_read_float), + ADD_TEST(buffer_map_read_struct), - ADD_TEST( buffer_map_write_int ), - ADD_TEST( buffer_map_write_uint ), - ADD_TEST( buffer_map_write_long ), - ADD_TEST( buffer_map_write_ulong ), - ADD_TEST( buffer_map_write_short ), - ADD_TEST( buffer_map_write_ushort ), - ADD_TEST( buffer_map_write_char ), - ADD_TEST( buffer_map_write_uchar ), - ADD_TEST( buffer_map_write_float ), - ADD_TEST( buffer_map_write_struct ), + ADD_TEST(buffer_map_write_int), + ADD_TEST(buffer_map_write_uint), + ADD_TEST(buffer_map_write_long), + ADD_TEST(buffer_map_write_ulong), + ADD_TEST(buffer_map_write_short), + ADD_TEST(buffer_map_write_ushort), + ADD_TEST(buffer_map_write_char), + ADD_TEST(buffer_map_write_uchar), + ADD_TEST(buffer_map_write_float), + ADD_TEST(buffer_map_write_struct), - ADD_TEST( buffer_write_int ), - ADD_TEST( buffer_write_uint ), - ADD_TEST( buffer_write_short ), - ADD_TEST( buffer_write_ushort ), - ADD_TEST( buffer_write_char ), - ADD_TEST( buffer_write_uchar ), - ADD_TEST( buffer_write_float ), - NOT_IMPLEMENTED_TEST( buffer_write_half ), - ADD_TEST( buffer_write_long ), - ADD_TEST( buffer_write_ulong ), - ADD_TEST( buffer_write_struct ), - ADD_TEST( buffer_write_async_int ), - ADD_TEST( buffer_write_async_uint ), - ADD_TEST( buffer_write_async_short ), - ADD_TEST( buffer_write_async_ushort ), - ADD_TEST( buffer_write_async_char ), - ADD_TEST( buffer_write_async_uchar ), - ADD_TEST( buffer_write_async_float ), - ADD_TEST( buffer_write_async_long ), - ADD_TEST( buffer_write_async_ulong ), - ADD_TEST( buffer_copy ), - ADD_TEST( buffer_partial_copy ), - ADD_TEST( mem_read_write_flags ), - ADD_TEST( mem_write_only_flags ), - ADD_TEST( mem_read_only_flags ), - ADD_TEST( mem_copy_host_flags ), - NOT_IMPLEMENTED_TEST( mem_alloc_ref_flags ), - ADD_TEST( array_info_size ), + ADD_TEST(buffer_write_int), + ADD_TEST(buffer_write_uint), + ADD_TEST(buffer_write_short), + ADD_TEST(buffer_write_ushort), + ADD_TEST(buffer_write_char), + ADD_TEST(buffer_write_uchar), + ADD_TEST(buffer_write_float), + ADD_TEST(buffer_write_half), + ADD_TEST(buffer_write_long), + ADD_TEST(buffer_write_ulong), + ADD_TEST(buffer_write_struct), + ADD_TEST(buffer_write_async_int), + ADD_TEST(buffer_write_async_uint), + ADD_TEST(buffer_write_async_short), + ADD_TEST(buffer_write_async_ushort), + ADD_TEST(buffer_write_async_char), + ADD_TEST(buffer_write_async_uchar), + ADD_TEST(buffer_write_async_float), + ADD_TEST(buffer_write_async_long), + ADD_TEST(buffer_write_async_ulong), + ADD_TEST(buffer_copy), + ADD_TEST(buffer_partial_copy), + ADD_TEST(mem_read_write_flags), + ADD_TEST(mem_write_only_flags), + ADD_TEST(mem_read_only_flags), + ADD_TEST(mem_copy_host_flags), + ADD_TEST(mem_alloc_ref_flags), + ADD_TEST(array_info_size), - ADD_TEST( sub_buffers_read_write ), - ADD_TEST( sub_buffers_read_write_dual_devices ), - ADD_TEST( sub_buffers_overlapping ), + ADD_TEST(sub_buffers_read_write), + ADD_TEST(sub_buffers_read_write_dual_devices), + ADD_TEST(sub_buffers_overlapping), - ADD_TEST( buffer_fill_int ), - ADD_TEST( buffer_fill_uint ), - ADD_TEST( buffer_fill_short ), - ADD_TEST( buffer_fill_ushort ), - ADD_TEST( buffer_fill_char ), - ADD_TEST( buffer_fill_uchar ), - ADD_TEST( buffer_fill_long ), - ADD_TEST( buffer_fill_ulong ), - ADD_TEST( buffer_fill_float ), - ADD_TEST( buffer_fill_struct ), + ADD_TEST(buffer_fill_int), + ADD_TEST(buffer_fill_uint), + ADD_TEST(buffer_fill_short), + ADD_TEST(buffer_fill_ushort), + ADD_TEST(buffer_fill_char), + ADD_TEST(buffer_fill_uchar), + ADD_TEST(buffer_fill_long), + ADD_TEST(buffer_fill_ulong), + ADD_TEST(buffer_fill_float), + ADD_TEST(buffer_fill_struct), - ADD_TEST( buffer_migrate ), - ADD_TEST( image_migrate ), + ADD_TEST(buffer_migrate), + ADD_TEST(image_migrate), }; const int test_num = ARRAY_SIZE( test_list ); diff --git a/test_conformance/buffers/test_buffer_mem.cpp b/test_conformance/buffers/test_buffer_mem.cpp index 4671f1a8..2753eab5 100644 --- a/test_conformance/buffers/test_buffer_mem.cpp +++ b/test_conformance/buffers/test_buffer_mem.cpp @@ -39,12 +39,12 @@ const char *mem_read_write_kernel_code = "}\n"; const char *mem_read_kernel_code = -"__kernel void test_mem_read(__global int *src, __global int *dst)\n" -"{\n" -" int tid = get_global_id(0);\n" -"\n" -" dst[tid] = src[tid]+1;\n" -"}\n"; + "__kernel void test_mem_read(__global int *dst, __global int *src)\n" + "{\n" + " int tid = get_global_id(0);\n" + "\n" + " dst[tid] = src[tid]+1;\n" + "}\n"; const char *mem_write_kernel_code = "__kernel void test_mem_write(__global int *dst)\n" @@ -68,13 +68,14 @@ static int verify_mem( int *outptr, int n ) } - -int test_mem_read_write_flags( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements ) +int test_mem_flags(cl_context context, cl_command_queue queue, int num_elements, + cl_mem_flags flags, const char **kernel_program, + const char *kernel_name) { - cl_mem buffers[1]; + clMemWrapper buffers[2]; cl_int *inptr, *outptr; - cl_program program[1]; - cl_kernel kernel[1]; + clProgramWrapper program; + clKernelWrapper kernel; size_t global_work_size[3]; #ifdef USE_LOCAL_WORK_GROUP size_t local_work_size[3]; @@ -83,443 +84,177 @@ int test_mem_read_write_flags( cl_device_id deviceID, cl_context context, cl_com int i; size_t min_alignment = get_min_alignment(context); + bool test_read_only = (flags & CL_MEM_READ_ONLY) != 0; + bool test_write_only = (flags & CL_MEM_WRITE_ONLY) != 0; + bool copy_host_ptr = (flags & CL_MEM_COPY_HOST_PTR) != 0; global_work_size[0] = (cl_uint)num_elements; inptr = (cl_int*)align_malloc(sizeof(cl_int) * num_elements, min_alignment); + if (!inptr) + { + log_error(" unable to allocate %d bytes of memory\n", + (int)sizeof(cl_int) * num_elements); + return -1; + } outptr = (cl_int*)align_malloc(sizeof(cl_int) * num_elements, min_alignment); - buffers[0] = clCreateBuffer(context, CL_MEM_READ_WRITE, sizeof(cl_int) * num_elements, NULL, &err); - if (err != CL_SUCCESS) { - print_error( err, "clCreateBuffer failed"); - align_free( (void *)outptr ); - align_free( (void *)inptr ); + if (!outptr) + { + log_error(" unable to allocate %d bytes of memory\n", + (int)sizeof(cl_int) * num_elements); + align_free((void *)inptr); return -1; } - for (i=0; i #include #include +#include #include "procs.h" @@ -325,6 +326,7 @@ static const char *float_kernel_name[] = { "test_buffer_read_float", "test_buffe static const char *buffer_read_half_kernel_code[] = { + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "__kernel void test_buffer_read_half(__global half *dst)\n" "{\n" " int tid = get_global_id(0);\n" @@ -332,6 +334,7 @@ static const char *buffer_read_half_kernel_code[] = { " dst[tid] = (half)119;\n" "}\n", + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "__kernel void test_buffer_read_half2(__global half2 *dst)\n" "{\n" " int tid = get_global_id(0);\n" @@ -339,6 +342,7 @@ static const char *buffer_read_half_kernel_code[] = { " dst[tid] = (half)119;\n" "}\n", + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "__kernel void test_buffer_read_half4(__global half4 *dst)\n" "{\n" " int tid = get_global_id(0);\n" @@ -346,6 +350,7 @@ static const char *buffer_read_half_kernel_code[] = { " dst[tid] = (half)119;\n" "}\n", + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "__kernel void test_buffer_read_half8(__global half8 *dst)\n" "{\n" " int tid = get_global_id(0);\n" @@ -353,12 +358,14 @@ static const char *buffer_read_half_kernel_code[] = { " dst[tid] = (half)119;\n" "}\n", + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" "__kernel void test_buffer_read_half16(__global half16 *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = (half)119;\n" - "}\n" }; + "}\n" +}; static const char *half_kernel_name[] = { "test_buffer_read_half", "test_buffer_read_half2", "test_buffer_read_half4", "test_buffer_read_half8", "test_buffer_read_half16" }; @@ -557,11 +564,11 @@ static int verify_read_float( void *ptr, int n ) static int verify_read_half( void *ptr, int n ) { int i; - float *outptr = (float *)ptr; // FIXME: should this be cl_half_float? + cl_half *outptr = (cl_half *)ptr; - for ( i = 0; i < n / 2; i++ ){ - if ( outptr[i] != TEST_PRIME_HALF ) - return -1; + for (i = 0; i < n; i++) + { + if (cl_half_to_float(outptr[i]) != TEST_PRIME_HALF) return -1; } return 0; @@ -1099,8 +1106,10 @@ DECLARE_READ_TEST(float, cl_float) DECLARE_READ_TEST(char, cl_char) DECLARE_READ_TEST(uchar, cl_uchar) -int test_buffer_half_read( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements ) +int test_buffer_read_half(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) { + PASSIVE_REQUIRE_FP16_SUPPORT(deviceID) return test_buffer_read( deviceID, context, queue, num_elements, sizeof( cl_float ) / 2, (char*)"half", 5, buffer_read_half_kernel_code, half_kernel_name, verify_read_half ); } @@ -1141,76 +1150,6 @@ DECLARE_BARRIER_TEST(char, cl_char) DECLARE_BARRIER_TEST(uchar, cl_uchar) DECLARE_BARRIER_TEST(float, cl_float) -/* - int test_buffer_half_read(cl_device_group device, cl_device id, cl_context context, int num_elements) - { - cl_mem buffers[1]; - float *outptr; - cl_program program[1]; - cl_kernel kernel[1]; - void *values[1]; - size_t sizes[1] = { sizeof(cl_buffer) }; - uint threads[1]; - int err; - int i; - size_t ptrSize; // sizeof(half) - - ptrSize = sizeof(cl_float)/2; - outptr = (float *)malloc(ptrSize * num_elements); - buffers[0] = clCreateBuffer(device, (cl_mem_flags)(CL_MEM_READ_WRITE), ptrSize * num_elements, NULL); - if( !buffers[0] ){ - log_error("clCreateBuffer failed\n"); - return -1; - } - - err = create_program_and_kernel(device, buffer_read_half_kernel_code, "test_buffer_read_half", &program[0], &kernel[0]); - if( err ){ - log_error( " Error creating program for half\n" ); - clReleaseMemObject(buffers[0]); - free( (void *)outptr ); - return -1; - } - - values[0] = buffers[0]; - err = clSetKernelArgs(context, kernel[0], 1, NULL, &(values[i]), sizes); - if( err != CL_SUCCESS ){ - log_error("clSetKernelArgs failed\n"); - return -1; - } - - global_work_size[0] = (cl_uint)num_elements; - err = clEnqueueNDRangeKernel(queue, kernel[0], 1, NULL, threads, NULL, 0, NULL, NULL ); - if( err != CL_SUCCESS ){ - log_error("clEnqueueNDRangeKernel failed\n"); - return -1; - } - - err = clEnqueueReadBuffer( queue, buffers[0], true, 0, ptrSize*num_elements, (void *)outptr, 0, NULL, NULL ); - if( err != CL_SUCCESS ){ - log_error("clEnqueueReadBuffer failed: %d\n", err); - return -1; - } - - if( verify_read_half( outptr, num_elements >> 1 ) ){ - log_error( "buffer_READ half test failed\n" ); - err = -1; - } - else{ - log_info( "buffer_READ half test passed\n" ); - err = 0; - } - - // cleanup - clReleaseMemObject( buffers[0] ); - clReleaseKernel( kernel[0] ); - clReleaseProgram( program[0] ); - free( (void *)outptr ); - - return err; - - } // end test_buffer_half_read() - */ - int test_buffer_read_struct(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { cl_mem buffers[1]; diff --git a/test_conformance/buffers/test_buffer_write.cpp b/test_conformance/buffers/test_buffer_write.cpp index 49340520..c9420a16 100644 --- a/test_conformance/buffers/test_buffer_write.cpp +++ b/test_conformance/buffers/test_buffer_write.cpp @@ -315,40 +315,51 @@ static const char *float_kernel_name[] = { "test_buffer_write_float", "test_buff const char *buffer_write_half_kernel_code[] = { - "__kernel void test_buffer_write_half(__global half *src, __global float *dst)\n" + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" + "__kernel void test_buffer_write_half(__global half *src, __global half " + "*dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" - " dst[tid] = vload_half( tid * 2, src );\n" + " dst[tid] = src[tid];\n" "}\n", - "__kernel void test_buffer_write_half2(__global half2 *src, __global float2 *dst)\n" + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" + "__kernel void test_buffer_write_half2(__global half2 *src, __global half2 " + "*dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" - " dst[tid] = vload_half2( tid * 2, src );\n" + " dst[tid] = src[tid];\n" "}\n", - "__kernel void test_buffer_write_half4(__global half4 *src, __global float4 *dst)\n" + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" + "__kernel void test_buffer_write_half4(__global half4 *src, __global half4 " + "*dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" - " dst[tid] = vload_half4( tid * 2, src );\n" + " dst[tid] = src[tid];\n" "}\n", - "__kernel void test_buffer_write_half8(__global half8 *src, __global float8 *dst)\n" + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" + "__kernel void test_buffer_write_half8(__global half8 *src, __global half8 " + "*dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" - " dst[tid] = vload_half8( tid * 2, src );\n" + " dst[tid] = src[tid];\n" "}\n", - "__kernel void test_buffer_write_half16(__global half16 *src, __global float16 *dst)\n" + "#pragma OPENCL EXTENSION cl_khr_fp16 : enable\n" + "__kernel void test_buffer_write_half16(__global half16 *src, __global " + "half16 *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" - " dst[tid] = vload_half16( tid * 2, src );\n" - "}\n" }; + " dst[tid] = src[tid];\n" + "}\n" +}; static const char *half_kernel_name[] = { "test_buffer_write_half", "test_buffer_write_half2", "test_buffer_write_half4", "test_buffer_write_half8", "test_buffer_write_half16" }; @@ -1398,6 +1409,7 @@ int test_buffer_write_float( cl_device_id deviceID, cl_context context, cl_comma int test_buffer_write_half( cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements ) { + PASSIVE_REQUIRE_FP16_SUPPORT(deviceID) float *inptr[5]; size_t ptrSizes[5]; int i, err; @@ -1422,8 +1434,10 @@ int test_buffer_write_half( cl_device_id deviceID, cl_context context, cl_comman inptr[i][j] = get_random_float( -FLT_MAX, FLT_MAX, d ); } - err = test_buffer_write( deviceID, context, queue, num_elements, sizeof( cl_float ) / 2, (char*)"half", 5, (void**)inptr, - buffer_write_half_kernel_code, half_kernel_name, foo, d ); + err = test_buffer_write(deviceID, context, queue, num_elements, + sizeof(cl_half), (char *)"half", 5, (void **)inptr, + buffer_write_half_kernel_code, half_kernel_name, + foo, d); for ( i = 0; i < 5; i++ ){ align_free( (void *)inptr[i] ); From 16ddfbb1aed77603d7e816467cbcb51299371384 Mon Sep 17 00:00:00 2001 From: Sreelakshmi Haridas Maruthur Date: Mon, 9 Nov 2020 04:04:57 -0700 Subject: [PATCH 23/36] gles: Fix compile errors. (#976) * fix gles build error * fix format check fail * fix Werror and link error * gles: Makefile changes Change-Id: Ie493a730e6004f9251bbf9b534f758e0dc920191 Co-authored-by: Guang <891528583@qq.com> --- CMakeLists.txt | 4 +++ test_common/gles/gl_headers.h | 21 ++++++++++----- test_common/gles/helpers.cpp | 1 + test_conformance/gles/CMakeLists.txt | 7 +---- test_conformance/gles/main.cpp | 20 ++++++++++----- test_conformance/gles/setup_egl.cpp | 31 ++++++++++++++--------- test_conformance/gles/test_fence_sync.cpp | 2 +- 7 files changed, 54 insertions(+), 32 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64f513e8..844283aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -197,6 +197,10 @@ if(LINK_PTHREAD) list(APPEND CLConform_LIBRARIES pthread) endif() +if(DEFINED USE_GLES3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLES3") +endif() + if(APPLE) find_library(corefoundation CoreFoundation) find_library(iokit IOKit) diff --git a/test_common/gles/gl_headers.h b/test_common/gles/gl_headers.h index 849da719..e0d46322 100644 --- a/test_common/gles/gl_headers.h +++ b/test_common/gles/gl_headers.h @@ -24,10 +24,12 @@ #include #else #include +#define glTexImage3DOES glTexImage3D +#define glUnmapBufferOES glUnmapBuffer +#define glMapBufferRangeEXT glMapBufferRange #endif #include -#include // Some macros to minimize the changes in the tests from GL to GLES2 #define glGenRenderbuffersEXT glGenRenderbuffers @@ -40,21 +42,26 @@ #define glDeleteFramebuffersEXT glDeleteFramebuffers #define glBindFramebufferEXT glBindFramebuffer #define glFramebufferRenderbufferEXT glFramebufferRenderbuffer -#define glTexImage3D glTexImage3DOES + +#ifndef GL_ES_VERSION_3_0 +#define GL_RGBA32F GL_RGBA32F_EXT +#define GL_READ_ONLY GL_BUFFER_ACCESS_OES +#define GL_HALF_FLOAT_ARB GL_HALF_FLOAT_OES +#define GL_BGRA GL_BGRA_EXT +#else +#define GL_HALF_FLOAT_ARB GL_HALF_FLOAT +#endif + #define glutGetProcAddress eglGetProcAddress #define GL_FRAMEBUFFER_EXT GL_FRAMEBUFFER #define GL_FRAMEBUFFER_COMPLETE_EXT GL_FRAMEBUFFER_COMPLETE #define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT GL_RENDERBUFFER_INTERNAL_FORMAT #define GL_RENDERBUFFER_EXT GL_RENDERBUFFER -#define GL_COLOR_ATTACHMENT0_EXT GL_COLOR_ATTACHMENT0 #define GL_DEPTH_ATTACHMENT_EXT GL_DEPTH_ATTACHMENT -#define GL_TEXTURE_3D GL_TEXTURE_3D_OES -#define GL_READ_ONLY GL_BUFFER_ACCESS_OES -#define GL_HALF_FLOAT_ARB GL_HALF_FLOAT_OES -#define GL_BGRA GL_BGRA_EXT #define GL_RGBA32F_ARB GL_RGBA +#define GL_BGRA GL_BGRA_EXT typedef unsigned short GLhalf; diff --git a/test_common/gles/helpers.cpp b/test_common/gles/helpers.cpp index 579c841b..34f40b4c 100644 --- a/test_common/gles/helpers.cpp +++ b/test_common/gles/helpers.cpp @@ -16,6 +16,7 @@ #include "helpers.h" #include "gl_headers.h" +#include "CL/cl_half.h" #define CHECK_ERROR()\ {GLint __error = glGetError(); if(__error) {log_error( "GL ERROR: %s!\n", gluErrorString( err ));}} diff --git a/test_conformance/gles/CMakeLists.txt b/test_conformance/gles/CMakeLists.txt index f3674903..c76fe512 100644 --- a/test_conformance/gles/CMakeLists.txt +++ b/test_conformance/gles/CMakeLists.txt @@ -15,11 +15,6 @@ set (${MODULE_NAME}_SOURCES ../../test_common/gles/helpers.cpp ) -if(ANDROID) - list(APPEND CLConform_LIBRARIES GLESv2) -elseif(WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DGLES3") - list(APPEND CLConform_LIBRARIES libEGL libGLESv2 ) -endif(ANDROID) +list(APPEND CLConform_LIBRARIES EGL GLESv2) include(../CMakeCommon.txt) diff --git a/test_conformance/gles/main.cpp b/test_conformance/gles/main.cpp index d0c12c91..644fa63c 100644 --- a/test_conformance/gles/main.cpp +++ b/test_conformance/gles/main.cpp @@ -62,8 +62,8 @@ TEST_FN_REDIRECTOR( renderbuffer_read ) TEST_FN_REDIRECTOR( renderbuffer_write ) TEST_FN_REDIRECTOR( renderbuffer_getinfo ) -#ifndef GL_ES_VERSION_2_0 -TEST_FN_REDIRECTOR( test_fence_sync ) +#ifdef GL_ES_VERSION_3_0 +TEST_FN_REDIRECTOR(fence_sync) #endif test_definition test_list[] = { @@ -82,14 +82,17 @@ test_definition test_list[] = { TEST_FN_REDIRECT( renderbuffer_getinfo ) }; -#ifndef GL_ES_VERSION_2_0 +#ifdef GL_ES_VERSION_3_0 test_definition test_list32[] = { TEST_FN_REDIRECT( fence_sync ) }; #endif const int test_num = ARRAY_SIZE( test_list ); + +#ifdef GL_ES_VERSION_3_0 const int test_num32 = ARRAY_SIZE( test_list32 ); +#endif int main(int argc, const char *argv[]) @@ -113,12 +116,15 @@ int main(int argc, const char *argv[]) for( int i = 0; i < test_num; i++ ) log_info( "\t%s\n", test_list[i].name ); +#ifdef GL_ES_VERSION_3_0 log_info( "Available 3.2 tests:\n" ); for( int i = 0; i < test_num32; i++ ) log_info( "\t%s\n", test_list32[i].name ); +#endif - log_info( "Note: Any 3.2 test names must follow 2.1 test names on the command line." ); - log_info( "Use environment variables to specify desired device." ); + log_info("Note: Any 3.2 test names must follow 2.1 test names on the " + "command line."); + log_info("Use environment variables to specify desired device."); return 0; } @@ -141,12 +147,14 @@ int main(int argc, const char *argv[]) // Check to see if any 2.x or 3.2 test names were specified on the command line. unsigned first_32_testname = 0; +#ifdef GL_ES_VERSION_3_0 for (int j=1; (j Date: Mon, 9 Nov 2020 11:07:59 +0000 Subject: [PATCH 24/36] Implement test for CL_KERNEL_PRIVATE_MEM_SIZE (#459) (#1013) Implement a test to ensure that the CL_KERNEL_PRIVATE_MEM_SIZE flag for clGetKernelWorkGroupInfo passes. Change-Id: Ibd6d64d185c00ddbd23467692717c534498bb901 Signed-off-by: Chetankumar Mistry --- .../api/test_kernel_private_memory_size.cpp | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 test_conformance/api/test_kernel_private_memory_size.cpp diff --git a/test_conformance/api/test_kernel_private_memory_size.cpp b/test_conformance/api/test_kernel_private_memory_size.cpp new file mode 100644 index 00000000..e0652714 --- /dev/null +++ b/test_conformance/api/test_kernel_private_memory_size.cpp @@ -0,0 +1,42 @@ +// +// 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 "harness/errorHelpers.h" +#include "harness/typeWrappers.h" +#include +#include "procs.h" + +int test_kernel_private_memory_size(cl_device_id deviceID, cl_context context, + cl_command_queue queue, int num_elements) +{ + const char* TEST_KERNEL = + R"(__kernel void private_memory( __global ulong *buffer ){ + volatile __private ulong x[1]; + buffer[0] = x[0]; + })"; + + clProgramWrapper program; + clKernelWrapper kernel; + cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, + &kernels[i], "private_memory"); + test_error(err, "create_single_kernel_helper"); + cl_ulong size = CL_ULONG_MAX; + err = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_PRIVATE_MEM_SIZE, + sizeof(cl_ulong), &size, nullptr); + + test_error(err, "clGetKernelWorkGroupInfo"); + + return TEST_PASS; +} From f22e3a31d0a970e750b9c385870cfd23c45804ce Mon Sep 17 00:00:00 2001 From: James Price Date: Tue, 10 Nov 2020 05:01:04 -0500 Subject: [PATCH 25/36] Fixes for kernel private memory size test (#1053) * Add kernel private memory size to CMake build * Fix kernel private memory size build error * Use uint for kernel private memory size test Not all devices support 64-bit types. * Register kernel private memory size test --- test_conformance/api/CMakeLists.txt | 1 + test_conformance/api/main.cpp | 1 + test_conformance/api/procs.h | 4 ++++ test_conformance/api/test_kernel_private_memory_size.cpp | 6 +++--- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test_conformance/api/CMakeLists.txt b/test_conformance/api/CMakeLists.txt index 9bd6c6e4..eedf6b49 100644 --- a/test_conformance/api/CMakeLists.txt +++ b/test_conformance/api/CMakeLists.txt @@ -10,6 +10,7 @@ set(${MODULE_NAME}_SOURCES test_queries_compatibility.cpp test_create_kernels.cpp test_kernels.cpp + test_kernel_private_memory_size.cpp test_api_min_max.cpp test_kernel_arg_changes.cpp test_kernel_arg_multi_setup.cpp diff --git a/test_conformance/api/main.cpp b/test_conformance/api/main.cpp index e41249a7..06f87392 100644 --- a/test_conformance/api/main.cpp +++ b/test_conformance/api/main.cpp @@ -54,6 +54,7 @@ test_definition test_list[] = { ADD_TEST(get_kernel_arg_info_compatibility), ADD_TEST(create_kernels_in_program), ADD_TEST(get_kernel_info), + ADD_TEST(kernel_private_memory_size), ADD_TEST(execute_kernel_local_sizes), ADD_TEST(set_kernel_arg_by_index), ADD_TEST(set_kernel_arg_constant), diff --git a/test_conformance/api/procs.h b/test_conformance/api/procs.h index 5d91c73f..0dcc9a69 100644 --- a/test_conformance/api/procs.h +++ b/test_conformance/api/procs.h @@ -47,6 +47,10 @@ extern int test_release_kernel_order(cl_device_id deviceID, cl_context co extern int test_release_during_execute(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_get_kernel_info(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); +extern int test_kernel_private_memory_size(cl_device_id deviceID, + cl_context context, + cl_command_queue queue, + int num_elements); extern int test_execute_kernel_local_sizes(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_set_kernel_arg_by_index(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); extern int test_set_kernel_arg_struct(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements); diff --git a/test_conformance/api/test_kernel_private_memory_size.cpp b/test_conformance/api/test_kernel_private_memory_size.cpp index e0652714..a789b4d1 100644 --- a/test_conformance/api/test_kernel_private_memory_size.cpp +++ b/test_conformance/api/test_kernel_private_memory_size.cpp @@ -22,15 +22,15 @@ int test_kernel_private_memory_size(cl_device_id deviceID, cl_context context, cl_command_queue queue, int num_elements) { const char* TEST_KERNEL = - R"(__kernel void private_memory( __global ulong *buffer ){ - volatile __private ulong x[1]; + R"(__kernel void private_memory( __global uint *buffer ){ + volatile __private uint x[1]; buffer[0] = x[0]; })"; clProgramWrapper program; clKernelWrapper kernel; cl_int err = create_single_kernel_helper(context, &program, &kernel, 1, - &kernels[i], "private_memory"); + &TEST_KERNEL, "private_memory"); test_error(err, "create_single_kernel_helper"); cl_ulong size = CL_ULONG_MAX; err = clGetKernelWorkGroupInfo(kernel, deviceID, CL_KERNEL_PRIVATE_MEM_SIZE, From bf3d3fef75b9e647c624678854b7e6f3a84747f7 Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 20 Nov 2020 15:06:32 +0100 Subject: [PATCH 26/36] Remove unused code in kernel_image_methods (#1048) These declarations either aren't used or aren't needed, as testBase.h already declares them. Signed-off-by: Radek Szymanski --- .../images/kernel_image_methods/main.cpp | 13 ++----------- .../images/kernel_image_methods/test_1D.cpp | 5 +---- .../images/kernel_image_methods/test_1D_array.cpp | 5 +---- .../images/kernel_image_methods/test_2D.cpp | 5 +---- .../images/kernel_image_methods/test_2D_array.cpp | 5 +---- .../images/kernel_image_methods/test_3D.cpp | 5 ----- .../images/kernel_image_methods/test_loops.cpp | 7 ------- 7 files changed, 6 insertions(+), 39 deletions(-) diff --git a/test_conformance/images/kernel_image_methods/main.cpp b/test_conformance/images/kernel_image_methods/main.cpp index ef6bd2cb..a08f133d 100644 --- a/test_conformance/images/kernel_image_methods/main.cpp +++ b/test_conformance/images/kernel_image_methods/main.cpp @@ -13,23 +13,16 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" -#include "../harness/parseParameters.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" +#include "../harness/parseParameters.h" bool gDebugTrace; bool gTestSmallImages; bool gTestMaxImages; -int gTypesToTest; bool gDeviceLt20 = false; cl_channel_type gChannelTypeToUse = (cl_channel_type)-1; @@ -39,8 +32,6 @@ extern int test_image_set( cl_device_id device, cl_context context, cl_command_q static void printUsage( const char *execName ); -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - int test_1D(cl_device_id device, cl_context context, cl_command_queue queue, int num_elements) { return test_image_set( device, context, queue, CL_MEM_OBJECT_IMAGE1D ); diff --git a/test_conformance/images/kernel_image_methods/test_1D.cpp b/test_conformance/images/kernel_image_methods/test_1D.cpp index f0c7685e..1093eafe 100644 --- a/test_conformance/images/kernel_image_methods/test_1D.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D.cpp @@ -15,10 +15,7 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; +extern bool gDeviceLt20; struct image_kernel_data { 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 5353fa65..2cc39a72 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_array.cpp @@ -15,10 +15,7 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; +extern bool gDeviceLt20; struct image_kernel_data { diff --git a/test_conformance/images/kernel_image_methods/test_2D.cpp b/test_conformance/images/kernel_image_methods/test_2D.cpp index 05e63628..d036c3ea 100644 --- a/test_conformance/images/kernel_image_methods/test_2D.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D.cpp @@ -15,10 +15,7 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; +extern bool gDeviceLt20; struct image_kernel_data { 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 b9bd6bd5..73c6db2f 100644 --- a/test_conformance/images/kernel_image_methods/test_2D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D_array.cpp @@ -15,10 +15,7 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; +extern bool gDeviceLt20; struct image_kernel_data { diff --git a/test_conformance/images/kernel_image_methods/test_3D.cpp b/test_conformance/images/kernel_image_methods/test_3D.cpp index 390bf8f6..3ac7a250 100644 --- a/test_conformance/images/kernel_image_methods/test_3D.cpp +++ b/test_conformance/images/kernel_image_methods/test_3D.cpp @@ -15,11 +15,6 @@ // #include "../testBase.h" -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gTestMaxImages, gDeviceLt20; - extern int test_get_image_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ); int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) diff --git a/test_conformance/images/kernel_image_methods/test_loops.cpp b/test_conformance/images/kernel_image_methods/test_loops.cpp index 3b56d3ef..8c0a4ead 100644 --- a/test_conformance/images/kernel_image_methods/test_loops.cpp +++ b/test_conformance/images/kernel_image_methods/test_loops.cpp @@ -16,15 +16,8 @@ #include "../testBase.h" #include "../common.h" -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; -extern int gNormalizedModeToUse; -extern cl_channel_type gChannelTypeToUse; extern bool gDeviceLt20; -extern bool gDebugTrace; - extern int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); extern int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); From 956d9a05e610c107e9273837d45025e8198b7826 Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 20 Nov 2020 15:06:40 +0100 Subject: [PATCH 27/36] Remove unused code in kernel_read_write (#1050) These declarations either aren't used or aren't needed, as testBase.h already declares them. Some definitions got moved to test_common.h, as these are duplicated across few files. There's further opportunity to improve code reuse via test_common.h, but that's for future patch. Signed-off-by: Radek Szymanski --- .../images/kernel_read_write/main.cpp | 12 +----------- .../images/kernel_read_write/test_common.h | 9 +++++++++ .../kernel_read_write/test_iterations.cpp | 16 +--------------- .../images/kernel_read_write/test_loops.cpp | 9 +-------- .../images/kernel_read_write/test_read_1D.cpp | 17 ----------------- .../kernel_read_write/test_read_1D_array.cpp | 17 ----------------- .../kernel_read_write/test_read_2D_array.cpp | 15 --------------- .../images/kernel_read_write/test_read_3D.cpp | 17 ----------------- .../images/kernel_read_write/test_write_1D.cpp | 3 --- .../kernel_read_write/test_write_1D_array.cpp | 2 -- .../kernel_read_write/test_write_2D_array.cpp | 3 --- .../images/kernel_read_write/test_write_3D.cpp | 3 --- .../kernel_read_write/test_write_image.cpp | 3 +-- 13 files changed, 13 insertions(+), 113 deletions(-) diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 98506934..243cff7c 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -13,22 +13,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" #include "../harness/fpcontrol.h" #include "../harness/parseParameters.h" -#include - #if defined(__PPC__) // Global varaiable used to hold the FPU control register state. The FPSCR register can not // be used because not all Power implementations retain or observed the NI (non-IEEE @@ -58,8 +50,6 @@ bool gEnablePitch = false; int gtestTypesToRun = 0; static int testTypesToRun; -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - static void printUsage( const char *execName ); extern int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, test_format_set_fn formatTestFn, cl_mem_object_type imageType ); diff --git a/test_conformance/images/kernel_read_write/test_common.h b/test_conformance/images/kernel_read_write/test_common.h index 1a1a8a1a..cb0d54a4 100644 --- a/test_conformance/images/kernel_read_write/test_common.h +++ b/test_conformance/images/kernel_read_write/test_common.h @@ -2,6 +2,15 @@ #include "../testBase.h" #define ABS_ERROR(result, expected) (fabs(expected - result)) +#define CLAMP(_val, _min, _max) \ + ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) + +#define MAX_ERR 0.005f +#define MAX_TRIES 1 +#define MAX_CLAMPED 1 extern cl_sampler create_sampler(cl_context context, image_sampler_data *sdata, bool test_mipmaps, cl_int *error); +extern bool gExtraValidateInfo; +extern bool gDisableOffsets; +extern bool gUseKernelSamplers; diff --git a/test_conformance/images/kernel_read_write/test_iterations.cpp b/test_conformance/images/kernel_read_write/test_iterations.cpp index c518b768..06c6c9cf 100644 --- a/test_conformance/images/kernel_read_write/test_iterations.cpp +++ b/test_conformance/images/kernel_read_write/test_iterations.cpp @@ -22,21 +22,12 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestImage2DFromBuffer, gTestMipmaps; -extern bool gUseKernelSamplers; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; +extern bool gTestImage2DFromBuffer; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 - // Utility function to clamp down image sizes for certain tests to avoid // using too much memory. static size_t reduceImageSizeRange(size_t maxDimSize) { @@ -290,8 +281,6 @@ template int determine_validation_error( void *imagePtr, image_descrip return 0; } -#define CLAMP( _val, _min, _max ) ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) - static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *imageSampler, float *xOffsets, float *yOffsets, float xfract, float yfract, int normalized_coords, MTdata d ) { size_t i = 0; @@ -404,9 +393,6 @@ static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *im } } } -#ifndef MAX - #define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) -#endif int validate_image_2D_depth_results(void *imageValues, void *resultValues, double formatAbsoluteError, float *xOffsetValues, float *yOffsetValues, ExplicitType outputType, int &numTries, int &numClamped, image_sampler_data *imageSampler, image_descriptor *imageInfo, size_t lod, char *imagePtr) diff --git a/test_conformance/images/kernel_read_write/test_loops.cpp b/test_conformance/images/kernel_read_write/test_loops.cpp index 1789df04..b1e0b7e4 100644 --- a/test_conformance/images/kernel_read_write/test_loops.cpp +++ b/test_conformance/images/kernel_read_write/test_loops.cpp @@ -18,16 +18,9 @@ extern cl_filter_mode gFilterModeToUse; extern cl_addressing_mode gAddressModeToUse; -extern int gTypesToTest; extern int gNormalizedModeToUse; -extern cl_channel_type gChannelTypeToUse; -extern cl_channel_order gChannelOrderToUse; - -extern bool gDebugTrace; -extern bool gTestMipmaps; - +extern int gTypesToTest; extern int gtestTypesToRun; -extern bool gDeviceLt20; extern int test_read_image_set_1D(cl_device_id device, cl_context context, cl_command_queue queue, 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 f094ed63..3e3b930d 100644 --- a/test_conformance/images/kernel_read_write/test_read_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_1D.cpp @@ -23,21 +23,11 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern bool gUseKernelSamplers; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 - const char *read1DKernelSourcePattern = "__kernel void sample_kernel( read_only image1d_t input,%s __global float *xOffsets, __global %s4 *results %s)\n" "{\n" @@ -184,8 +174,6 @@ template int determine_validation_error_1D( void *imagePtr, image_desc return 0; } -#define CLAMP( _val, _min, _max ) ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) - static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *imageSampler, float *xOffsets, float xfract, int normalized_coords, MTdata d, int lod) { size_t i = 0; @@ -228,11 +216,6 @@ static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *im } } -#ifndef MAX - #define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) -#endif - - int test_read_image_1D( cl_context context, cl_command_queue queue, cl_kernel kernel, image_descriptor *imageInfo, image_sampler_data *imageSampler, bool useFloatCoords, ExplicitType outputType, MTdata d ) 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 1826f208..44797b19 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 @@ -22,21 +22,11 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern bool gUseKernelSamplers; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; extern uint64_t gRoundingStartValue; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 - const char *read1DArrayKernelSourcePattern = "__kernel void sample_kernel( read_only image1d_array_t input,%s __global float *xOffsets, __global float *yOffsets, __global %s4 *results %s)\n" "{\n" @@ -218,8 +208,6 @@ template int determine_validation_error_1D_arr( void *imagePtr, image_ return 0; } -#define CLAMP( _val, _min, _max ) ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) - static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *imageSampler, float *xOffsets, float *yOffsets, float xfract, float yfract, int normalized_coords, MTdata d , int lod) { size_t i = 0; @@ -277,11 +265,6 @@ static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *im } } -#ifndef MAX -#define MAX( _a, _b ) ((_a) > (_b) ? (_a) : (_b)) -#endif - - int test_read_image_1D_array( cl_context context, cl_command_queue queue, cl_kernel kernel, image_descriptor *imageInfo, image_sampler_data *imageSampler, bool useFloatCoords, ExplicitType outputType, MTdata d ) 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 ceabceaa..d424fbdd 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 @@ -16,18 +16,9 @@ #include "test_common.h" #include -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern bool gUseKernelSamplers; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 // Utility function to clamp down image sizes for certain tests to avoid // using too much memory. @@ -230,8 +221,6 @@ template int determine_validation_error_offset_2D_array( void *imagePt return 0; } -#define CLAMP( _val, _min, _max ) ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) - static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *imageSampler, float *xOffsets, float *yOffsets, float *zOffsets, float xfract, float yfract, float zfract, int normalized_coords, MTdata d , int lod) { size_t i = 0; @@ -308,10 +297,6 @@ static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *im } } -#ifndef MAX -#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) -#endif - int test_read_image_2D_array( cl_context context, cl_command_queue queue, cl_kernel kernel, image_descriptor *imageInfo, image_sampler_data *imageSampler, bool useFloatCoords, ExplicitType outputType, MTdata d ) 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 ffb5779a..ae8d737d 100644 --- a/test_conformance/images/kernel_read_write/test_read_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_read_3D.cpp @@ -16,21 +16,10 @@ #include "test_common.h" #include -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gExtraValidateInfo, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern bool gUseKernelSamplers; -extern cl_filter_mode gFilterModeToUse; -extern cl_addressing_mode gAddressModeToUse; extern cl_mem_flags gMemFlagsToUse; - extern int gtestTypesToRun; extern bool gDeviceLt20; -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 - // Utility function to clamp down image sizes for certain tests to avoid // using too much memory. static size_t reduceImageSizeRange(size_t maxDimSize, RandomSeed& seed) { @@ -214,8 +203,6 @@ template int determine_validation_error_offset( void *imagePtr, image_ return 0; } -#define CLAMP( _val, _min, _max ) ((_val) < (_min) ? (_min) : (_val) > (_max) ? (_max) : (_val)) - static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *imageSampler, float *xOffsets, float *yOffsets, float *zOffsets, float xfract, float yfract, float zfract, int normalized_coords, MTdata d , int lod) { size_t i = 0; @@ -309,10 +296,6 @@ static void InitFloatCoords( image_descriptor *imageInfo, image_sampler_data *im } } -#ifndef MAX -#define MAX(_a, _b) ((_a) > (_b) ? (_a) : (_b)) -#endif - int test_read_image_3D( cl_context context, cl_command_queue queue, cl_kernel kernel, image_descriptor *imageInfo, image_sampler_data *imageSampler, bool useFloatCoords, ExplicitType outputType, MTdata d ) 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 bda5a442..68b913e9 100644 --- a/test_conformance/images/kernel_read_write/test_write_1D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_1D.cpp @@ -19,10 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; - extern int gtestTypesToRun; extern bool gDeviceLt20; 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 1ab59604..57bdd546 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 @@ -19,8 +19,6 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; 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 949bc690..3de46710 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 @@ -19,10 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; - extern int gtestTypesToRun; extern bool gDeviceLt20; 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 1ec3f6d7..c6223d8a 100644 --- a/test_conformance/images/kernel_read_write/test_write_3D.cpp +++ b/test_conformance/images/kernel_read_write/test_write_3D.cpp @@ -19,10 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestMipmaps; -extern cl_filter_mode gFilterModeToSkip; extern cl_mem_flags gMemFlagsToUse; - extern int gtestTypesToRun; extern bool gDeviceLt20; 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 5830370f..e848ab4f 100644 --- a/test_conformance/images/kernel_read_write/test_write_image.cpp +++ b/test_conformance/images/kernel_read_write/test_write_image.cpp @@ -19,8 +19,7 @@ #include #endif -extern bool gDebugTrace, gDisableOffsets, gTestSmallImages, gEnablePitch, gTestMaxImages, gTestImage2DFromBuffer, gTestMipmaps; -extern cl_filter_mode gFilterModeToSkip; +extern bool gTestImage2DFromBuffer; extern cl_mem_flags gMemFlagsToUse; extern int gtestTypesToRun; extern bool gDeviceLt20; From 05d533150901a87cc02b0bfa409b8ec38b553326 Mon Sep 17 00:00:00 2001 From: Radek Szymanski Date: Fri, 20 Nov 2020 15:06:48 +0100 Subject: [PATCH 28/36] Remove unused code in samplerlessReads (#1051) These declarations either aren't used or aren't needed, as testBase.h already declares them. Signed-off-by: Radek Szymanski --- test_conformance/images/samplerlessReads/main.cpp | 10 +--------- .../images/samplerlessReads/test_iterations.cpp | 10 ++-------- .../images/samplerlessReads/test_loops.cpp | 11 +++-------- .../images/samplerlessReads/test_read_1D.cpp | 10 ++-------- .../images/samplerlessReads/test_read_1D_array.cpp | 10 ++-------- .../images/samplerlessReads/test_read_1D_buffer.cpp | 8 +------- .../images/samplerlessReads/test_read_2D_array.cpp | 7 ++----- .../images/samplerlessReads/test_read_3D.cpp | 7 ++----- 8 files changed, 15 insertions(+), 58 deletions(-) diff --git a/test_conformance/images/samplerlessReads/main.cpp b/test_conformance/images/samplerlessReads/main.cpp index e62765d7..8f69e73c 100644 --- a/test_conformance/images/samplerlessReads/main.cpp +++ b/test_conformance/images/samplerlessReads/main.cpp @@ -13,17 +13,11 @@ // See the License for the specific language governing permissions and // limitations under the License. // -#include "../harness/compat.h" #include #include - -#if !defined(_WIN32) -#include -#include -#endif - #include "../testBase.h" +#include "../harness/compat.h" #include "../harness/fpcontrol.h" #include "../harness/parseParameters.h" @@ -44,8 +38,6 @@ cl_channel_order gChannelOrderToUse = (cl_channel_order)-1; bool gEnablePitch = false; bool gDeviceLt20 = false; -#define MAX_ALLOWED_STD_DEVIATION_IN_MB 8.0 - static void printUsage( const char *execName ); extern int test_image_set( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type imageType ); diff --git a/test_conformance/images/samplerlessReads/test_iterations.cpp b/test_conformance/images/samplerlessReads/test_iterations.cpp index c33007f1..11b364f9 100644 --- a/test_conformance/images/samplerlessReads/test_iterations.cpp +++ b/test_conformance/images/samplerlessReads/test_iterations.cpp @@ -22,14 +22,8 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; -extern bool gTestReadWrite; - -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 +extern bool gDeviceLt20; +extern bool gTestReadWrite; const char *read2DKernelSourcePattern = "__kernel void sample_kernel( read_only %s input, sampler_t sampler, __global int *results )\n" diff --git a/test_conformance/images/samplerlessReads/test_loops.cpp b/test_conformance/images/samplerlessReads/test_loops.cpp index 639efa80..27840ca7 100644 --- a/test_conformance/images/samplerlessReads/test_loops.cpp +++ b/test_conformance/images/samplerlessReads/test_loops.cpp @@ -16,14 +16,9 @@ #include "../testBase.h" #include "../common.h" -extern int gTypesToTest; -extern cl_channel_type gChannelTypeToUse; -extern cl_channel_order gChannelOrderToUse; - -extern bool gDebugTrace; -extern bool gDeviceLt20; - -extern bool gTestReadWrite; +extern int gTypesToTest; +extern bool gDeviceLt20; +extern bool gTestReadWrite; extern int test_read_image_set_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, image_sampler_data *imageSampler, ExplicitType outputType ); extern int test_read_image_set_1D_buffer( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format, image_sampler_data *imageSampler, ExplicitType outputType ); diff --git a/test_conformance/images/samplerlessReads/test_read_1D.cpp b/test_conformance/images/samplerlessReads/test_read_1D.cpp index f38a2e64..d17fdfcf 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D.cpp @@ -22,14 +22,8 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; -extern bool gTestReadWrite; - -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 +extern bool gDeviceLt20; +extern bool gTestReadWrite; const char *read1DKernelSourcePattern = "__kernel void sample_kernel( read_only image1d_t input, sampler_t sampler, __global int *results )\n" diff --git a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp index be0d4900..6a0e1d53 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_array.cpp @@ -22,14 +22,8 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; -extern bool gTestReadWrite; - -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 +extern bool gDeviceLt20; +extern bool gTestReadWrite; const char *read1DArrayKernelSourcePattern = "__kernel void sample_kernel( read_only image1d_array_t input, sampler_t sampler, __global int *results )\n" diff --git a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp index 4cd02f08..c21b12c8 100644 --- a/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp +++ b/test_conformance/images/samplerlessReads/test_read_1D_buffer.cpp @@ -22,13 +22,7 @@ #include #endif -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; - -#define MAX_TRIES 1 -#define MAX_CLAMPED 1 +extern bool gDeviceLt20; const char *read1DBufferKernelSourcePattern = "__kernel void sample_kernel( read_only image1d_buffer_t inputA, read_only image1d_t inputB, sampler_t sampler, __global int *results )\n" diff --git a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp index fe221ee5..cfc12725 100644 --- a/test_conformance/images/samplerlessReads/test_read_2D_array.cpp +++ b/test_conformance/images/samplerlessReads/test_read_2D_array.cpp @@ -16,11 +16,8 @@ #include "../testBase.h" #include -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; -extern bool gTestReadWrite; +extern bool gDeviceLt20; +extern bool gTestReadWrite; const char *read2DArrayKernelSourcePattern = "__kernel void sample_kernel( read_only %s input, sampler_t sampler, __global int *results )\n" diff --git a/test_conformance/images/samplerlessReads/test_read_3D.cpp b/test_conformance/images/samplerlessReads/test_read_3D.cpp index e06a347c..da5466f7 100644 --- a/test_conformance/images/samplerlessReads/test_read_3D.cpp +++ b/test_conformance/images/samplerlessReads/test_read_3D.cpp @@ -16,11 +16,8 @@ #include "../testBase.h" #include -#define MAX_ERR 0.005f -#define MAX_HALF_LINEAR_ERR 0.3f - -extern bool gDebugTrace, gTestSmallImages, gEnablePitch, gTestMaxImages, gDeviceLt20; -extern bool gTestReadWrite; +extern bool gDeviceLt20; +extern bool gTestReadWrite; const char *read3DKernelSourcePattern = "__kernel void sample_kernel( read_only image3d_t input, sampler_t sampler, __global int *results )\n" From f84fcb055beb3403fe2ce669b1e7fc6bf285f465 Mon Sep 17 00:00:00 2001 From: julienhascoet Date: Fri, 20 Nov 2020 15:07:14 +0100 Subject: [PATCH 29/36] Fix aliasing issue for test_half (#45) (#1004) OpenCL-C code must respect aliasing rules as in C99. Therefore, accessing data from multiple pointer sizes must all point to character type to keep strict aliasing rules. If not, when the compiler performs optimization, the dataflow was broken leading to failure. We also fix the formatting and refactor few things. --- test_conformance/half/Test_vLoadHalf.cpp | 33 +++++++++++++++++++----- 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/test_conformance/half/Test_vLoadHalf.cpp b/test_conformance/half/Test_vLoadHalf.cpp index 1c53492a..52867c25 100644 --- a/test_conformance/half/Test_vLoadHalf.cpp +++ b/test_conformance/half/Test_vLoadHalf.cpp @@ -170,17 +170,38 @@ int Test_vLoadHalf_private( cl_device_id device, bool aligned ) }; const char *source_local2[] = { - "__kernel void test( const __global half *p, __global float", vector_size_name_extensions[vectorSize], " *f )\n" + "#define VECTOR_LEN (", + vector_size_names[vectorSize], + "/", + align_divisors[vectorSize], + ")\n" + "#define ALIGN_TYPE ", + align_types[vectorSize], + "\n" + "__kernel void test( const __global half *p, __global float", + vector_size_name_extensions[vectorSize], + " *f )\n" "{\n" - " __local ", align_types[vectorSize], " data[", local_buf_size, "/", align_divisors[vectorSize], "];\n" + " __local uchar data[", + local_buf_size, + "/", + align_divisors[vectorSize], + "*sizeof(ALIGN_TYPE)] ", + "__attribute__((aligned(sizeof(ALIGN_TYPE))));\n" " __local half* hdata_p = (__local half*) data;\n" - " __global ", align_types[vectorSize], "* i_p = (__global ", align_types[vectorSize],"*)p;\n" + " __global ALIGN_TYPE* i_p = (__global ALIGN_TYPE*)p;\n" " size_t i = get_global_id(0);\n" " size_t lid = get_local_id(0);\n" " int k;\n" - " for (k=0; k<",vector_size_names[vectorSize],"/",align_divisors[vectorSize],"; k++)\n" - " data[lid*",vector_size_names[vectorSize],"/",align_divisors[vectorSize],"+k] = i_p[i*",vector_size_names[vectorSize],"/",align_divisors[vectorSize],"+k];\n" - " f[i] = vload", aligned ? "a" : "", "_half",vector_size_name_extensions[vectorSize],"( lid, hdata_p );\n" + " for (k=0; k Date: Fri, 20 Nov 2020 14:33:30 +0000 Subject: [PATCH 30/36] Remove code under USE_LOCAL_WORK_GROUP (#1063) Local work groups are not relevant to these tests. Fixes #1019 Signed-off-by: Ellen Norris-Thompson --- test_conformance/buffers/test_buffer_fill.cpp | 26 ---------- test_conformance/buffers/test_buffer_mem.cpp | 16 ------ test_conformance/buffers/test_buffer_read.cpp | 50 ------------------- .../buffers/test_buffer_write.cpp | 38 +------------- 4 files changed, 1 insertion(+), 129 deletions(-) diff --git a/test_conformance/buffers/test_buffer_fill.cpp b/test_conformance/buffers/test_buffer_fill.cpp index 142b7da0..5c1dd48e 100644 --- a/test_conformance/buffers/test_buffer_fill.cpp +++ b/test_conformance/buffers/test_buffer_fill.cpp @@ -24,8 +24,6 @@ #include "procs.h" #include "harness/errorHelpers.h" -#define USE_LOCAL_WORK_GROUP 1 - #define TEST_PRIME_CHAR 0x77 #define TEST_PRIME_INT ((1<<16)+1) #define TEST_PRIME_UINT ((1U<<16)+1U) @@ -571,9 +569,6 @@ int test_buffer_fill( cl_device_id deviceID, cl_context context, cl_command_queu cl_event event[2]; size_t ptrSizes[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif int err; int i, ii; int src_flag_id; @@ -645,11 +640,6 @@ int test_buffer_fill( cl_device_id deviceID, cl_context context, cl_command_queu return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg( kernel[i], 0, sizeof( cl_mem ), (void *)&buffers[ii] ); err |= clSetKernelArg( kernel[i], 1, sizeof( cl_mem ), (void *)&buffers[ii+1] ); if ( err != CL_SUCCESS ){ @@ -674,11 +664,7 @@ int test_buffer_fill( cl_device_id deviceID, cl_context context, cl_command_queu } clReleaseEvent(event[0]); -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if (err != CL_SUCCESS){ print_error( err, "clEnqueueNDRangeKernel failed" ); return -1; @@ -730,9 +716,6 @@ int test_buffer_fill_struct( cl_device_id deviceID, cl_context context, cl_comma cl_event event[2]; size_t ptrSize = sizeof( TestStruct ); size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif int n, err; size_t j, offset_elements, fill_elements; int src_flag_id; @@ -851,11 +834,6 @@ int test_buffer_fill_struct( cl_device_id deviceID, cl_context context, cl_comma return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel, global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg( kernel, 0, sizeof( cl_mem ), (void *)&buffers[0] ); err |= clSetKernelArg( kernel, 1, sizeof( cl_mem ), (void *)&buffers[1] ); if ( err != CL_SUCCESS ){ @@ -892,11 +870,7 @@ int test_buffer_fill_struct( cl_device_id deviceID, cl_context context, cl_comma } clReleaseEvent( event[0] ); -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel( queue, kernel, 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel, 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, " clEnqueueNDRangeKernel failed" ); clReleaseKernel( kernel ); diff --git a/test_conformance/buffers/test_buffer_mem.cpp b/test_conformance/buffers/test_buffer_mem.cpp index 2753eab5..52eb7235 100644 --- a/test_conformance/buffers/test_buffer_mem.cpp +++ b/test_conformance/buffers/test_buffer_mem.cpp @@ -27,8 +27,6 @@ typedef unsigned char uchar; #endif -#define USE_LOCAL_WORK_GROUP 1 - const char *mem_read_write_kernel_code = "__kernel void test_mem_read_write(__global int *dst)\n" @@ -77,9 +75,6 @@ int test_mem_flags(cl_context context, cl_command_queue queue, int num_elements, clProgramWrapper program; clKernelWrapper kernel; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i; @@ -158,12 +153,6 @@ int test_mem_flags(cl_context context, cl_command_queue queue, int num_elements, return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size(context, kernel, global_work_size[0], - &local_work_size[0]); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg(kernel, 0, sizeof(cl_mem), (void *)&buffers[0]); if (test_read_only && (err == CL_SUCCESS)) { @@ -176,13 +165,8 @@ int test_mem_flags(cl_context context, cl_command_queue queue, int num_elements, return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, global_work_size, - local_work_size, 0, NULL, NULL); -#else err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, global_work_size, NULL, 0, NULL, NULL); -#endif if (err != CL_SUCCESS){ log_error("clEnqueueNDRangeKernel failed\n"); align_free( (void *)outptr ); diff --git a/test_conformance/buffers/test_buffer_read.cpp b/test_conformance/buffers/test_buffer_read.cpp index fa981b75..a3d02544 100644 --- a/test_conformance/buffers/test_buffer_read.cpp +++ b/test_conformance/buffers/test_buffer_read.cpp @@ -627,9 +627,6 @@ int test_buffer_read( cl_device_id deviceID, cl_context context, cl_command_queu cl_program program[5]; cl_kernel kernel[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i; size_t ptrSizes[5]; @@ -701,14 +698,7 @@ int test_buffer_read( cl_device_id deviceID, cl_context context, cl_command_queu return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); - - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, "clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[i] ); @@ -781,9 +771,6 @@ int test_buffer_read_async( cl_device_id deviceID, cl_context context, cl_comman void *outptr[5]; void *inptr[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i; size_t lastIndex; @@ -857,14 +844,7 @@ int test_buffer_read_async( cl_device_id deviceID, cl_context context, cl_comman return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); - - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, "clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[i] ); @@ -936,9 +916,6 @@ int test_buffer_read_array_barrier( cl_device_id deviceID, cl_context context, c cl_event event; void *outptr[5], *inptr[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i; size_t lastIndex; @@ -1011,14 +988,7 @@ int test_buffer_read_array_barrier( cl_device_id deviceID, cl_context context, c return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); - - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, "clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[i] ); @@ -1157,9 +1127,6 @@ int test_buffer_read_struct(cl_device_id deviceID, cl_context context, cl_comman cl_program program[1]; cl_kernel kernel[1]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; size_t objSize = sizeof(TestStruct); @@ -1197,14 +1164,7 @@ int test_buffer_read_struct(cl_device_id deviceID, cl_context context, cl_comman return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[0], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); - - err = clEnqueueNDRangeKernel( queue, kernel[0], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[0], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, "clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[0] ); @@ -1250,9 +1210,6 @@ static int testRandomReadSize( cl_device_id deviceID, cl_context context, cl_com cl_program program[3]; cl_kernel kernel[3]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i, j; size_t ptrSizes[3]; // sizeof(int), sizeof(int2), sizeof(int4) @@ -1334,14 +1291,7 @@ static int testRandomReadSize( cl_device_id deviceID, cl_context context, cl_com return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); - - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, "clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[i] ); diff --git a/test_conformance/buffers/test_buffer_write.cpp b/test_conformance/buffers/test_buffer_write.cpp index c9420a16..83b17795 100644 --- a/test_conformance/buffers/test_buffer_write.cpp +++ b/test_conformance/buffers/test_buffer_write.cpp @@ -24,7 +24,6 @@ #include "procs.h" #include "harness/errorHelpers.h" -#define USE_LOCAL_WORK_GROUP 1 #ifndef uchar typedef unsigned char uchar; @@ -631,9 +630,6 @@ int test_buffer_write( cl_device_id deviceID, cl_context context, cl_command_que cl_kernel kernel[5]; size_t ptrSizes[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i, ii; int src_flag_id, dst_flag_id; @@ -729,11 +725,6 @@ int test_buffer_write( cl_device_id deviceID, cl_context context, cl_command_que return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg( kernel[i], 0, sizeof( cl_mem ), (void *)&buffers[ii] ); err |= clSetKernelArg( kernel[i], 1, sizeof( cl_mem ), (void *)&buffers[ii+1] ); if ( err != CL_SUCCESS ){ @@ -746,11 +737,7 @@ int test_buffer_write( cl_device_id deviceID, cl_context context, cl_command_que return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, " clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[ii] ); @@ -811,9 +798,6 @@ int test_buffer_write_struct( cl_device_id deviceID, cl_context context, cl_comm size_t ptrSizes[5]; size_t size = sizeof( TestStruct ); size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i, ii; cl_uint j; @@ -916,11 +900,6 @@ int test_buffer_write_struct( cl_device_id deviceID, cl_context context, cl_comm return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg( kernel[i], 0, sizeof( cl_mem ), (void *)&buffers[ii] ); err |= clSetKernelArg( kernel[i], 1, sizeof( cl_mem ), (void *)&buffers[ii+1] ); if ( err != CL_SUCCESS ){ @@ -934,11 +913,7 @@ int test_buffer_write_struct( cl_device_id deviceID, cl_context context, cl_comm return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif if ( err != CL_SUCCESS ){ print_error( err, " clEnqueueNDRangeKernel failed" ); clReleaseMemObject( buffers[ii] ); @@ -997,9 +972,6 @@ int test_buffer_write_array_async( cl_device_id deviceID, cl_context context, cl cl_event event[2]; size_t ptrSizes[5]; size_t global_work_size[3]; -#ifdef USE_LOCAL_WORK_GROUP - size_t local_work_size[3]; -#endif cl_int err; int i, ii; int src_flag_id, dst_flag_id; @@ -1056,11 +1028,6 @@ int test_buffer_write_array_async( cl_device_id deviceID, cl_context context, cl return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = get_max_common_work_group_size( context, kernel[i], global_work_size[0], &local_work_size[0] ); - test_error( err, "Unable to get work group size to use" ); -#endif - err = clSetKernelArg( kernel[i], 0, sizeof( cl_mem ), (void *)&buffers[ii] ); err |= clSetKernelArg( kernel[i], 1, sizeof( cl_mem ), (void *)&buffers[ii+1] ); if ( err != CL_SUCCESS ){ @@ -1084,11 +1051,8 @@ int test_buffer_write_array_async( cl_device_id deviceID, cl_context context, cl return -1; } -#ifdef USE_LOCAL_WORK_GROUP - err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, local_work_size, 0, NULL, NULL ); -#else err = clEnqueueNDRangeKernel( queue, kernel[i], 1, NULL, global_work_size, NULL, 0, NULL, NULL ); -#endif + if (err != CL_SUCCESS){ print_error( err, "clEnqueueNDRangeKernel failed" ); return -1; From 5bd85b7384f7a61b5a768f7d4c3dd73175412af9 Mon Sep 17 00:00:00 2001 From: james-morrissey-arm Date: Sat, 21 Nov 2020 08:33:04 +0000 Subject: [PATCH 31/36] Fix write-only image tests in kernel_image_methods (#330) (#1014) Pass the right flags to the tests that create images to ensure valid usage. Fixes issue #330 Signed-off-by: James Morrissey Co-authored-by: Alessandro Navone --- .../images/kernel_image_methods/test_1D.cpp | 59 +++++++---- .../kernel_image_methods/test_1D_array.cpp | 63 ++++++----- .../images/kernel_image_methods/test_2D.cpp | 100 +++++++++++------- .../kernel_image_methods/test_2D_array.cpp | 71 ++++++++----- .../images/kernel_image_methods/test_3D.cpp | 28 ++++- .../kernel_image_methods/test_loops.cpp | 37 +++++-- 6 files changed, 227 insertions(+), 131 deletions(-) diff --git a/test_conformance/images/kernel_image_methods/test_1D.cpp b/test_conformance/images/kernel_image_methods/test_1D.cpp index 1093eafe..1ea8eb88 100644 --- a/test_conformance/images/kernel_image_methods/test_1D.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D.cpp @@ -27,24 +27,28 @@ struct image_kernel_data }; static const char *methodTest1DImageKernelPattern = -"typedef struct {\n" -" int width;\n" -" int channelType;\n" -" int channelOrder;\n" -" int expectedChannelType;\n" -" int expectedChannelOrder;\n" -" } image_kernel_data;\n" -"__kernel void sample_kernel( read_only image1d_t input, __global image_kernel_data *outData )\n" -"{\n" -" outData->width = get_image_width( input );\n" -" outData->channelType = get_image_channel_data_type( input );\n" -" outData->channelOrder = get_image_channel_order( input );\n" -"\n" -" outData->expectedChannelType = %s;\n" -" outData->expectedChannelOrder = %s;\n" -"}"; + "typedef struct {\n" + " int width;\n" + " int channelType;\n" + " int channelOrder;\n" + " int expectedChannelType;\n" + " int expectedChannelOrder;\n" + " } image_kernel_data;\n" + "__kernel void sample_kernel( %s image1d_t input, __global " + "image_kernel_data *outData )\n" + "{\n" + " outData->width = get_image_width( input );\n" + " outData->channelType = get_image_channel_data_type( input );\n" + " outData->channelOrder = get_image_channel_order( input );\n" + "\n" + " outData->expectedChannelType = %s;\n" + " outData->expectedChannelOrder = %s;\n" + "}"; -static int test_get_1Dimage_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) +static int test_get_1Dimage_info_single(cl_context context, + cl_command_queue queue, + image_descriptor *imageInfo, MTdata d, + cl_mem_flags flags) { int error = 0; @@ -62,7 +66,9 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu // Construct testing source if( gDebugTrace ) log_info( " - Creating 1D image %d ...\n", (int)imageInfo->width ); - image = create_image_1d( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, 0, NULL, NULL, &error ); + + image = create_image_1d(context, flags, imageInfo->format, imageInfo->width, + 0, NULL, NULL, &error); if( image == NULL ) { log_error( "ERROR: Unable to create 1D image of size %d (%s)", (int)imageInfo->width, IGetErrorString( error ) ); @@ -74,6 +80,8 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu const char* channelTypeName = GetChannelTypeName( imageInfo->format->image_channel_data_type ); const char* channelOrderName = GetChannelOrderName( imageInfo->format->image_channel_order ); + const char *image_access_qualifier = + (flags == CL_MEM_READ_ONLY) ? "read_only" : "write_only"; if(channelTypeName && strlen(channelTypeName)) sprintf(channelTypeConstantString, "CLK_%s", &channelTypeName[3]); // replace CL_* with CLK_* @@ -82,7 +90,7 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu sprintf(channelOrderConstantString, "CLK_%s", &channelOrderName[3]); // replace CL_* with CLK_* // Create a program to run against - sprintf( programSrc, methodTest1DImageKernelPattern, + sprintf(programSrc, methodTest1DImageKernelPattern, image_access_qualifier, channelTypeConstantString, channelOrderConstantString); //log_info("-----------------------------------\n%s\n", programSrc); @@ -141,7 +149,9 @@ static int test_get_1Dimage_info_single( cl_context context, cl_command_queue qu return error; } -int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) +int test_get_image_info_1D(cl_device_id device, cl_context context, + cl_command_queue queue, cl_image_format *format, + cl_mem_flags flags) { size_t maxWidth; cl_ulong maxAllocSize, memSize; @@ -171,7 +181,8 @@ int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_ if( gDebugTrace ) log_info( " at size %d\n", (int)imageInfo.width ); - int ret = test_get_1Dimage_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_1Dimage_info_single(context, queue, &imageInfo, + seed, flags); if( ret ) return -1; } @@ -192,7 +203,8 @@ int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_ log_info( "Testing %d\n", (int)sizes[ idx ][ 0 ]); if( gDebugTrace ) log_info( " at max size %d\n", (int)sizes[ idx ][ 0 ] ); - if( test_get_1Dimage_info_single( context, queue, &imageInfo, seed ) ) + if (test_get_1Dimage_info_single(context, queue, &imageInfo, seed, + flags)) return -1; } } @@ -221,7 +233,8 @@ int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_ if( gDebugTrace ) log_info( " at size %d (row pitch %d) out of %d\n", (int)imageInfo.width, (int)imageInfo.rowPitch, (int)maxWidth ); - int ret = test_get_1Dimage_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_1Dimage_info_single(context, queue, &imageInfo, + seed, flags); if( ret ) return -1; } 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 2cc39a72..18c190bb 100644 --- a/test_conformance/images/kernel_image_methods/test_1D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_1D_array.cpp @@ -28,26 +28,30 @@ struct image_kernel_data }; static const char *methodTestKernelPattern = -"typedef struct {\n" -" int width;\n" -" int arraySize;\n" -" int channelType;\n" -" int channelOrder;\n" -" int expectedChannelType;\n" -" int expectedChannelOrder;\n" -" } image_kernel_data;\n" -"__kernel void sample_kernel( read_only image1d_array_t input, __global image_kernel_data *outData )\n" -"{\n" -" outData->width = get_image_width( input );\n" -" outData->arraySize = get_image_array_size( input );\n" -" outData->channelType = get_image_channel_data_type( input );\n" -" outData->channelOrder = get_image_channel_order( input );\n" -"\n" -" outData->expectedChannelType = %s;\n" -" outData->expectedChannelOrder = %s;\n" -"}"; + "typedef struct {\n" + " int width;\n" + " int arraySize;\n" + " int channelType;\n" + " int channelOrder;\n" + " int expectedChannelType;\n" + " int expectedChannelOrder;\n" + " } image_kernel_data;\n" + "__kernel void sample_kernel( %s image1d_array_t input, __global " + "image_kernel_data *outData )\n" + "{\n" + " outData->width = get_image_width( input );\n" + " outData->arraySize = get_image_array_size( input );\n" + " outData->channelType = get_image_channel_data_type( input );\n" + " outData->channelOrder = get_image_channel_order( input );\n" + "\n" + " outData->expectedChannelType = %s;\n" + " outData->expectedChannelOrder = %s;\n" + "}"; -int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) +int test_get_1Dimage_array_info_single(cl_context context, + cl_command_queue queue, + image_descriptor *imageInfo, MTdata d, + cl_mem_flags flags) { int error = 0; @@ -66,7 +70,9 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que if( gDebugTrace ) log_info( " - Creating 1D image array %d by %d...\n", (int)imageInfo->width, (int)imageInfo->arraySize ); - image = create_image_1d_array( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, imageInfo->arraySize, 0, 0, NULL, &error ); + image = create_image_1d_array(context, flags, imageInfo->format, + imageInfo->width, imageInfo->arraySize, 0, 0, + NULL, &error); if( image == NULL ) { log_error( "ERROR: Unable to create 1D image array of size %d x %d (%s)", (int)imageInfo->width, (int)imageInfo->arraySize, IGetErrorString( error ) ); @@ -78,6 +84,8 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que const char* channelTypeName = GetChannelTypeName( imageInfo->format->image_channel_data_type ); const char* channelOrderName = GetChannelOrderName( imageInfo->format->image_channel_order ); + const char *image_access_qualifier = + (flags == CL_MEM_READ_ONLY) ? "read_only" : "write_only"; if(channelTypeName && strlen(channelTypeName)) sprintf(channelTypeConstantString, "CLK_%s", &channelTypeName[3]); // replace CL_* with CLK_* @@ -86,7 +94,7 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que sprintf(channelOrderConstantString, "CLK_%s", &channelOrderName[3]); // replace CL_* with CLK_* // Create a program to run against - sprintf( programSrc, methodTestKernelPattern, + sprintf(programSrc, methodTestKernelPattern, image_access_qualifier, channelTypeConstantString, channelOrderConstantString); //log_info("-----------------------------------\n%s\n", programSrc); @@ -150,7 +158,9 @@ int test_get_1Dimage_array_info_single( cl_context context, cl_command_queue que return error; } -int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) +int test_get_image_info_1D_array(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, cl_mem_flags flags) { size_t maxWidth, maxArraySize; cl_ulong maxAllocSize, memSize; @@ -184,7 +194,8 @@ int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_co if( gDebugTrace ) log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.arraySize ); - int ret = test_get_1Dimage_array_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_1Dimage_array_info_single( + context, queue, &imageInfo, seed, flags); if( ret ) return -1; } @@ -208,7 +219,8 @@ int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_co log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ]); if( gDebugTrace ) log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 2 ] ); - if( test_get_1Dimage_array_info_single( context, queue, &imageInfo, seed ) ) + if (test_get_1Dimage_array_info_single(context, queue, &imageInfo, + seed, flags)) return -1; } } @@ -240,7 +252,8 @@ int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_co if( gDebugTrace ) log_info( " at size %d,%d (row pitch %d) out of %d,%d\n", (int)imageInfo.width, (int)imageInfo.arraySize, (int)imageInfo.rowPitch, (int)maxWidth, (int)maxArraySize ); - int ret = test_get_1Dimage_array_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_1Dimage_array_info_single( + context, queue, &imageInfo, seed, flags); if( ret ) return -1; } diff --git a/test_conformance/images/kernel_image_methods/test_2D.cpp b/test_conformance/images/kernel_image_methods/test_2D.cpp index d036c3ea..2ebc5460 100644 --- a/test_conformance/images/kernel_image_methods/test_2D.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D.cpp @@ -32,38 +32,42 @@ struct image_kernel_data }; static const char *methodTestKernelPattern = -"typedef struct {\n" -" int width;\n" -" int height;\n" -" int depth;\n" -" int widthDim;\n" -" int heightDim;\n" -" int depthDim;\n" -" int channelType;\n" -" int channelOrder;\n" -" int expectedChannelType;\n" -" int expectedChannelOrder;\n" -" } image_kernel_data;\n" -"__kernel void sample_kernel( read_only image%dd%s_t input, __global image_kernel_data *outData )\n" -"{\n" -" outData->width = get_image_width( input );\n" -" outData->height = get_image_height( input );\n" -"%s\n" -" int%d dim = get_image_dim( input );\n" -" outData->widthDim = dim.x;\n" -" outData->heightDim = dim.y;\n" -"%s\n" -" outData->channelType = get_image_channel_data_type( input );\n" -" outData->channelOrder = get_image_channel_order( input );\n" -"\n" -" outData->expectedChannelType = %s;\n" -" outData->expectedChannelOrder = %s;\n" -"}"; + "typedef struct {\n" + " int width;\n" + " int height;\n" + " int depth;\n" + " int widthDim;\n" + " int heightDim;\n" + " int depthDim;\n" + " int channelType;\n" + " int channelOrder;\n" + " int expectedChannelType;\n" + " int expectedChannelOrder;\n" + " } image_kernel_data;\n" + " %s\n" + "__kernel void sample_kernel( %s image%dd%s_t input, __global " + "image_kernel_data *outData )\n" + "{\n" + " outData->width = get_image_width( input );\n" + " outData->height = get_image_height( input );\n" + "%s\n" + " int%d dim = get_image_dim( input );\n" + " outData->widthDim = dim.x;\n" + " outData->heightDim = dim.y;\n" + "%s\n" + " outData->channelType = get_image_channel_data_type( input );\n" + " outData->channelOrder = get_image_channel_order( input );\n" + "\n" + " outData->expectedChannelType = %s;\n" + " outData->expectedChannelOrder = %s;\n" + "}"; static const char *depthKernelLine = " outData->depth = get_image_depth( input );\n"; static const char *depthDimKernelLine = " outData->depthDim = dim.z;\n"; -int test_get_image_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) +int test_get_image_info_single(cl_context context, cl_command_queue queue, + image_descriptor *imageInfo, MTdata d, + cl_mem_flags flags) { int error = 0; @@ -83,9 +87,13 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag log_info( " - Creating image %d by %d...\n", (int)imageInfo->width, (int)imageInfo->height ); if( imageInfo->depth != 0 ) - image = create_image_3d( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, imageInfo->height, imageInfo->depth, 0, 0, NULL, &error ); + image = create_image_3d(context, flags, imageInfo->format, + imageInfo->width, imageInfo->height, + imageInfo->depth, 0, 0, NULL, &error); else - image = create_image_2d( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, imageInfo->height, 0, NULL, &error ); + image = + create_image_2d(context, flags, imageInfo->format, imageInfo->width, + imageInfo->height, 0, NULL, &error); if( image == NULL ) { log_error( "ERROR: Unable to create image of size %d x %d x %d (%s)", (int)imageInfo->width, (int)imageInfo->height, (int)imageInfo->depth, IGetErrorString( error ) ); @@ -97,6 +105,12 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag const char* channelTypeName = GetChannelTypeName( imageInfo->format->image_channel_data_type ); const char* channelOrderName = GetChannelOrderName( imageInfo->format->image_channel_order ); + const char *image_access_qualifier = + (flags == CL_MEM_READ_ONLY) ? "read_only" : "write_only"; + const char *cl_khr_3d_image_writes_enabler = ""; + if ((flags != CL_MEM_READ_ONLY) && (imageInfo->depth != 0)) + cl_khr_3d_image_writes_enabler = + "#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable"; if(channelTypeName && strlen(channelTypeName)) sprintf(channelTypeConstantString, "CLK_%s", &channelTypeName[3]); // replace CL_* with CLK_* @@ -105,12 +119,13 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag sprintf(channelOrderConstantString, "CLK_%s", &channelOrderName[3]); // replace CL_* with CLK_* // Create a program to run against - sprintf( programSrc, methodTestKernelPattern, - ( imageInfo->depth != 0 ) ? 3 : 2, - (imageInfo->format->image_channel_order == CL_DEPTH) ? "_depth" : "", - ( imageInfo->depth != 0 ) ? depthKernelLine : "", - ( imageInfo->depth != 0 ) ? 4 : 2, - ( imageInfo->depth != 0 ) ? depthDimKernelLine : "", + sprintf(programSrc, methodTestKernelPattern, cl_khr_3d_image_writes_enabler, + image_access_qualifier, (imageInfo->depth != 0) ? 3 : 2, + (imageInfo->format->image_channel_order == CL_DEPTH) ? "_depth" + : "", + (imageInfo->depth != 0) ? depthKernelLine : "", + (imageInfo->depth != 0) ? 4 : 2, + (imageInfo->depth != 0) ? depthDimKernelLine : "", channelTypeConstantString, channelOrderConstantString); //log_info("-----------------------------------\n%s\n", programSrc); @@ -194,7 +209,9 @@ int test_get_image_info_single( cl_context context, cl_command_queue queue, imag return error; } -int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) +int test_get_image_info_2D(cl_device_id device, cl_context context, + cl_command_queue queue, cl_image_format *format, + cl_mem_flags flags) { size_t maxWidth, maxHeight; cl_ulong maxAllocSize, memSize; @@ -227,7 +244,8 @@ int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_ if( gDebugTrace ) log_info( " at size %d,%d\n", (int)imageInfo.width, (int)imageInfo.height ); - int ret = test_get_image_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_image_info_single(context, queue, &imageInfo, + seed, flags); if( ret ) return -1; } @@ -250,7 +268,8 @@ int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_ log_info( "Testing %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ]); if( gDebugTrace ) log_info( " at max size %d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ] ); - if( test_get_image_info_single( context, queue, &imageInfo, seed ) ) + if (test_get_image_info_single(context, queue, &imageInfo, seed, + flags)) return -1; } } @@ -280,7 +299,8 @@ int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_ if( gDebugTrace ) log_info( " at size %d,%d (row pitch %d) out of %d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.rowPitch, (int)maxWidth, (int)maxHeight ); - int ret = test_get_image_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_image_info_single(context, queue, &imageInfo, + seed, flags); if( ret ) return -1; } 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 73c6db2f..98c11062 100644 --- a/test_conformance/images/kernel_image_methods/test_2D_array.cpp +++ b/test_conformance/images/kernel_image_methods/test_2D_array.cpp @@ -29,28 +29,32 @@ struct image_kernel_data }; static const char *methodTestKernelPattern = -"typedef struct {\n" -" int width;\n" -" int height;\n" -" int arraySize;\n" -" int channelType;\n" -" int channelOrder;\n" -" int expectedChannelType;\n" -" int expectedChannelOrder;\n" -" } image_kernel_data;\n" -"__kernel void sample_kernel( read_only %s input, __global image_kernel_data *outData )\n" -"{\n" -" outData->width = get_image_width( input );\n" -" outData->height = get_image_height( input );\n" -" outData->arraySize = get_image_array_size( input );\n" -" outData->channelType = get_image_channel_data_type( input );\n" -" outData->channelOrder = get_image_channel_order( input );\n" -"\n" -" outData->expectedChannelType = %s;\n" -" outData->expectedChannelOrder = %s;\n" -"}"; + "typedef struct {\n" + " int width;\n" + " int height;\n" + " int arraySize;\n" + " int channelType;\n" + " int channelOrder;\n" + " int expectedChannelType;\n" + " int expectedChannelOrder;\n" + " } image_kernel_data;\n" + "__kernel void sample_kernel( %s %s input, __global image_kernel_data " + "*outData )\n" + "{\n" + " outData->width = get_image_width( input );\n" + " outData->height = get_image_height( input );\n" + " outData->arraySize = get_image_array_size( input );\n" + " outData->channelType = get_image_channel_data_type( input );\n" + " outData->channelOrder = get_image_channel_order( input );\n" + "\n" + " outData->expectedChannelType = %s;\n" + " outData->expectedChannelOrder = %s;\n" + "}"; -int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ) +int test_get_2Dimage_array_info_single(cl_context context, + cl_command_queue queue, + image_descriptor *imageInfo, MTdata d, + cl_mem_flags flags) { int error = 0; @@ -69,7 +73,9 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que if( gDebugTrace ) log_info( " - Creating 2D image array %d by %d by %d...\n", (int)imageInfo->width, (int)imageInfo->height, (int)imageInfo->arraySize ); - image = create_image_2d_array( context, (cl_mem_flags)(CL_MEM_READ_ONLY), imageInfo->format, imageInfo->width, imageInfo->height, imageInfo->arraySize, 0, 0, NULL, &error ); + image = create_image_2d_array(context, flags, imageInfo->format, + imageInfo->width, imageInfo->height, + imageInfo->arraySize, 0, 0, NULL, &error); if( image == NULL ) { log_error( "ERROR: Unable to create 2D image array of size %d x %d x %d (%s)", (int)imageInfo->width, (int)imageInfo->height, (int)imageInfo->arraySize, IGetErrorString( error ) ); @@ -81,6 +87,8 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que const char* channelTypeName = GetChannelTypeName( imageInfo->format->image_channel_data_type ); const char* channelOrderName = GetChannelOrderName( imageInfo->format->image_channel_order ); + const char *image_access_qualifier = + (flags == CL_MEM_READ_ONLY) ? "read_only" : "write_only"; if(channelTypeName && strlen(channelTypeName)) sprintf(channelTypeConstantString, "CLK_%s", &channelTypeName[3]); // replace CL_* with CLK_* @@ -89,8 +97,10 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que sprintf(channelOrderConstantString, "CLK_%s", &channelOrderName[3]); // replace CL_* with CLK_* // Create a program to run against - sprintf( programSrc, methodTestKernelPattern, - (imageInfo->format->image_channel_order == CL_DEPTH) ? "image2d_array_depth_t" : "image2d_array_t" , + sprintf(programSrc, methodTestKernelPattern, image_access_qualifier, + (imageInfo->format->image_channel_order == CL_DEPTH) + ? "image2d_array_depth_t" + : "image2d_array_t", channelTypeConstantString, channelOrderConstantString); //log_info("-----------------------------------\n%s\n", programSrc); @@ -159,7 +169,9 @@ int test_get_2Dimage_array_info_single( cl_context context, cl_command_queue que return error; } -int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) +int test_get_image_info_2D_array(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, cl_mem_flags flags) { size_t maxWidth, maxHeight, maxArraySize; cl_ulong maxAllocSize, memSize; @@ -195,7 +207,8 @@ int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_co { if( gDebugTrace ) log_info( " at size %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize ); - int ret = test_get_2Dimage_array_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_2Dimage_array_info_single( + context, queue, &imageInfo, seed, flags); if( ret ) return -1; } @@ -221,7 +234,8 @@ int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_co log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] ); if( gDebugTrace ) log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] ); - if( test_get_2Dimage_array_info_single( context, queue, &imageInfo, seed ) ) + if (test_get_2Dimage_array_info_single(context, queue, &imageInfo, + seed, flags)) return -1; } } @@ -257,7 +271,8 @@ int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_co if( gDebugTrace ) log_info( " at size %d,%d,%d (pitch %d,%d) out of %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.arraySize, (int)imageInfo.rowPitch, (int)imageInfo.slicePitch, (int)maxWidth, (int)maxHeight, (int)maxArraySize ); - int ret = test_get_2Dimage_array_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_2Dimage_array_info_single( + context, queue, &imageInfo, seed, flags); if( ret ) return -1; } diff --git a/test_conformance/images/kernel_image_methods/test_3D.cpp b/test_conformance/images/kernel_image_methods/test_3D.cpp index 3ac7a250..287005a5 100644 --- a/test_conformance/images/kernel_image_methods/test_3D.cpp +++ b/test_conformance/images/kernel_image_methods/test_3D.cpp @@ -15,9 +15,14 @@ // #include "../testBase.h" -extern int test_get_image_info_single( cl_context context, cl_command_queue queue, image_descriptor *imageInfo, MTdata d ); +extern int test_get_image_info_single(cl_context context, + cl_command_queue queue, + image_descriptor *imageInfo, MTdata d, + cl_mem_flags flags); -int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ) +int test_get_image_info_3D(cl_device_id device, cl_context context, + cl_command_queue queue, cl_image_format *format, + cl_mem_flags flags) { size_t maxWidth, maxHeight, maxDepth; cl_ulong maxAllocSize, memSize; @@ -25,6 +30,16 @@ int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_ RandomSeed seed( gRandomSeed ); size_t pixelSize; + if ((flags != CL_MEM_READ_ONLY) + && !is_extension_available(device, "cl_khr_3d_image_writes")) + { + log_info("-----------------------------------------------------\n"); + log_info("This device does not support cl_khr_3d_image_writes.\n" + "Skipping 3d image write test.\n"); + log_info("-----------------------------------------------------\n\n"); + return 0; + } + imageInfo.type = CL_MEM_OBJECT_IMAGE3D; imageInfo.format = format; pixelSize = get_pixel_size( imageInfo.format ); @@ -53,7 +68,8 @@ int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_ { if( gDebugTrace ) log_info( " at size %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.depth ); - int ret = test_get_image_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_image_info_single( + context, queue, &imageInfo, seed, flags); if( ret ) return -1; } @@ -79,7 +95,8 @@ int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_ log_info( "Testing %d x %d x %d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] ); if( gDebugTrace ) log_info( " at max size %d,%d,%d\n", (int)sizes[ idx ][ 0 ], (int)sizes[ idx ][ 1 ], (int)sizes[ idx ][ 2 ] ); - if( test_get_image_info_single( context, queue, &imageInfo, seed ) ) + if (test_get_image_info_single(context, queue, &imageInfo, seed, + flags)) return -1; } } @@ -115,7 +132,8 @@ int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_ if( gDebugTrace ) log_info( " at size %d,%d,%d (pitch %d,%d) out of %d,%d,%d\n", (int)imageInfo.width, (int)imageInfo.height, (int)imageInfo.depth, (int)imageInfo.rowPitch, (int)imageInfo.slicePitch, (int)maxWidth, (int)maxHeight, (int)maxDepth ); - int ret = test_get_image_info_single( context, queue, &imageInfo, seed ); + int ret = test_get_image_info_single(context, queue, &imageInfo, + seed, flags); if( ret ) return -1; } diff --git a/test_conformance/images/kernel_image_methods/test_loops.cpp b/test_conformance/images/kernel_image_methods/test_loops.cpp index 8c0a4ead..8dfebd2f 100644 --- a/test_conformance/images/kernel_image_methods/test_loops.cpp +++ b/test_conformance/images/kernel_image_methods/test_loops.cpp @@ -18,11 +18,23 @@ extern bool gDeviceLt20; -extern int test_get_image_info_1D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); -extern int test_get_image_info_2D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); -extern int test_get_image_info_3D( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); -extern int test_get_image_info_1D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); -extern int test_get_image_info_2D_array( cl_device_id device, cl_context context, cl_command_queue queue, cl_image_format *format ); +extern int test_get_image_info_1D(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, cl_mem_flags flags); +extern int test_get_image_info_2D(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, cl_mem_flags flags); +extern int test_get_image_info_3D(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, cl_mem_flags flags); +extern int test_get_image_info_1D_array(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, + cl_mem_flags flags); +extern int test_get_image_info_2D_array(cl_device_id device, cl_context context, + cl_command_queue queue, + cl_image_format *format, + cl_mem_flags flags); int test_image_type( cl_device_id device, cl_context context, cl_command_queue queue, cl_mem_object_type imageType, cl_mem_flags flags ) { @@ -64,19 +76,24 @@ int test_image_type( cl_device_id device, cl_context context, cl_command_queue q switch (imageType) { case CL_MEM_OBJECT_IMAGE1D: - test_return = test_get_image_info_1D( device, context, queue, &formatList[ i ] ); + test_return = test_get_image_info_1D(device, context, queue, + &formatList[i], flags); break; case CL_MEM_OBJECT_IMAGE2D: - test_return = test_get_image_info_2D( device, context, queue, &formatList[ i ] ); + test_return = test_get_image_info_2D(device, context, queue, + &formatList[i], flags); break; case CL_MEM_OBJECT_IMAGE3D: - test_return = test_get_image_info_3D( device, context, queue, &formatList[ i ] ); + test_return = test_get_image_info_3D(device, context, queue, + &formatList[i], flags); break; case CL_MEM_OBJECT_IMAGE1D_ARRAY: - test_return = test_get_image_info_1D_array( device, context, queue, &formatList[ i ] ); + test_return = test_get_image_info_1D_array( + device, context, queue, &formatList[i], flags); break; case CL_MEM_OBJECT_IMAGE2D_ARRAY: - test_return = test_get_image_info_2D_array( device, context, queue, &formatList[ i ] ); + test_return = test_get_image_info_2D_array( + device, context, queue, &formatList[i], flags); break; } From 827dffbd83407ae0bc678e0fe575cc3ee0c21aed Mon Sep 17 00:00:00 2001 From: Grzegorz Wawiorko Date: Wed, 2 Dec 2020 11:48:49 +0100 Subject: [PATCH 32/36] Fix support verification for read write images (#1072) --- test_conformance/basic/test_rw_image_access_qualifier.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_conformance/basic/test_rw_image_access_qualifier.cpp b/test_conformance/basic/test_rw_image_access_qualifier.cpp index ffb8fe15..87e3f60b 100644 --- a/test_conformance/basic/test_rw_image_access_qualifier.cpp +++ b/test_conformance/basic/test_rw_image_access_qualifier.cpp @@ -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 @@ -57,7 +57,7 @@ int test_rw_image_access_qualifier(cl_device_id device_id, cl_context context, c { cl_uint are_rw_images_supported{}; test_error( - clGetDeviceInfo(device_id, CL_DEVICE_MAX_READ_IMAGE_ARGS, + clGetDeviceInfo(device_id, CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS, sizeof(are_rw_images_supported), &are_rw_images_supported, nullptr), "clGetDeviceInfo failed for CL_DEVICE_MAX_READ_IMAGE_ARGS\n"); From ff9676f8785599445ee3a520d94033439c5a2e12 Mon Sep 17 00:00:00 2001 From: James Price Date: Wed, 9 Dec 2020 11:06:30 -0500 Subject: [PATCH 33/36] Fix build_with_il on devices older than 2.1 (#1065) The get_device_il_version_string() function throws an exception if the device does not support the CL_DEVICE_IL_VERSION query, so don't call this unless the version is recent enough. --- .../test_unload_platform_compiler.cpp | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test_conformance/compiler/test_unload_platform_compiler.cpp b/test_conformance/compiler/test_unload_platform_compiler.cpp index a180a58d..039d4720 100644 --- a/test_conformance/compiler/test_unload_platform_compiler.cpp +++ b/test_conformance/compiler/test_unload_platform_compiler.cpp @@ -262,13 +262,20 @@ public: const cl_device_id device) : build_base{ context, device } { + /* Disable build_with_il if neither core nor extension functionality is + * available */ + m_enabled = false; + 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.empty())) + if (version >= Version(2, 1)) { + std::string sILVersion = get_device_il_version_string(device); + if (version < Version(3, 0) || !sILVersion.empty()) + { + m_enabled = true; + } + m_CreateProgramWithIL = clCreateProgramWithIL; - m_enabled = true; } else if (is_extension_available(device, "cl_khr_il_program")) { @@ -282,12 +289,6 @@ public: } m_enabled = true; } - else - { - /* Disable build_with_il if neither core nor extension functionality - * is available */ - m_enabled = false; - } cl_uint address_bits{}; const cl_int err = From b7adaa5c3bf0a6a70c20ae126a0264cec2dc9332 Mon Sep 17 00:00:00 2001 From: alan-baker Date: Wed, 9 Dec 2020 11:12:19 -0500 Subject: [PATCH 34/36] Add more relaxed math conformance tests (#1079) * Add relaxed tests for functions (in an implementation that uses derived functions) that define an absolute ULP error requirement, but were not tested in the current conformance suite * acos * asin * atan * cospi * sinpi * log10 --- .../math_brute_force/FunctionList.cpp | 15 +++++++++------ .../math_brute_force/reference_math.cpp | 12 ++++++++++++ .../math_brute_force/reference_math.h | 6 ++++++ test_conformance/math_brute_force/unary.cpp | 13 +++++++++++-- 4 files changed, 38 insertions(+), 8 deletions(-) diff --git a/test_conformance/math_brute_force/FunctionList.cpp b/test_conformance/math_brute_force/FunctionList.cpp index 0aa35508..a07fa069 100644 --- a/test_conformance/math_brute_force/FunctionList.cpp +++ b/test_conformance/math_brute_force/FunctionList.cpp @@ -135,13 +135,13 @@ extern const vtbl _mad_tbl; // float mad( float, float, float ) #endif // FUNCTION_LIST_ULPS_ONLY const Func functionList[] = { - ENTRY(acos, 4.0f, 4.0f, FTZ_OFF, unaryF), + ENTRY_EXT(acos, 4.0f, 4.0f, 4096.0f, FTZ_OFF, unaryF, 4096.0f), ENTRY(acosh, 4.0f, 4.0f, FTZ_OFF, unaryF), ENTRY(acospi, 5.0f, 5.0f, FTZ_OFF, unaryF), - ENTRY(asin, 4.0f, 4.0f, FTZ_OFF, unaryF), + ENTRY_EXT(asin, 4.0f, 4.0f, 4096.0f, FTZ_OFF, unaryF, 4096.0f), ENTRY(asinh, 4.0f, 4.0f, FTZ_OFF, unaryF), ENTRY(asinpi, 5.0f, 5.0f, FTZ_OFF, unaryF), - ENTRY(atan, 5.0f, 5.0f, FTZ_OFF, unaryF), + ENTRY_EXT(atan, 5.0f, 5.0f, 4096.0f, FTZ_OFF, unaryF, 4096.0f), ENTRY(atanh, 5.0f, 5.0f, FTZ_OFF, unaryF), ENTRY(atanpi, 5.0f, 5.0f, FTZ_OFF, unaryF), ENTRY(atan2, 6.0f, 6.0f, FTZ_OFF, binaryF), @@ -152,7 +152,8 @@ const Func functionList[] = { ENTRY_EXT(cos, 4.0f, 4.0f, 0.00048828125f, FTZ_OFF, unaryF, 0.00048828125f), // relaxed ulp 2^-11 ENTRY(cosh, 4.0f, 4.0f, FTZ_OFF, unaryF), - ENTRY(cospi, 4.0f, 4.0f, FTZ_OFF, unaryF), + ENTRY_EXT(cospi, 4.0f, 4.0f, 0.00048828125f, FTZ_OFF, unaryF, + 0.00048828125f), // relaxed ulp 2^-11 // ENTRY( erfc, 16.0f, // 16.0f, FTZ_OFF, unaryF), // //disabled for 1.0 due to lack of @@ -202,7 +203,8 @@ const Func functionList[] = { 4.76837158203125e-7f), // relaxed ulp 2^-21 ENTRY_EXT(log2, 3.0f, 4.0f, 4.76837158203125e-7f, FTZ_OFF, unaryF, 4.76837158203125e-7f), // relaxed ulp 2^-21 - ENTRY(log10, 3.0f, 4.0f, FTZ_OFF, unaryF), + ENTRY_EXT(log10, 3.0f, 4.0f, 4.76837158203125e-7f, FTZ_OFF, unaryF, + 4.76837158203125e-7f), // relaxed ulp 2^-21 ENTRY(log1p, 2.0f, 4.0f, FTZ_OFF, unaryF), ENTRY(logb, 0.0f, 0.0f, FTZ_OFF, unaryF), ENTRY_EXT(mad, INFINITY, INFINITY, INFINITY, FTZ_OFF, mad_function, @@ -233,7 +235,8 @@ const Func functionList[] = { ENTRY_EXT(sincos, 4.0f, 4.0f, 0.00048828125f, FTZ_OFF, unaryF_two_results, 0.00048828125f), // relaxed ulp 2^-11 ENTRY(sinh, 4.0f, 4.0f, FTZ_OFF, unaryF), - ENTRY(sinpi, 4.0f, 4.0f, FTZ_OFF, unaryF), + ENTRY_EXT(sinpi, 4.0f, 4.0f, 0.00048828125f, FTZ_OFF, unaryF, + 0.00048828125f), // relaxed ulp 2^-11 { "sqrt", "sqrt", { (void*)reference_sqrt }, diff --git a/test_conformance/math_brute_force/reference_math.cpp b/test_conformance/math_brute_force/reference_math.cpp index a739b3a5..01c99c14 100644 --- a/test_conformance/math_brute_force/reference_math.cpp +++ b/test_conformance/math_brute_force/reference_math.cpp @@ -124,6 +124,8 @@ double reference_cospi( double x) return reference_sin( x * M_PI ); } +double reference_relaxed_cospi(double x) { return reference_cospi(x); } + double reference_relaxed_divide( double x, double y ) { return (float)(((float) x ) / ( (float) y )); } double reference_divide( double x, double y ) { return x / y; } @@ -719,6 +721,8 @@ double reference_sinpi( double x) return reference_sin( r * M_PI ); } +double reference_relaxed_sinpi(double x) { return reference_sinpi(x); } + double reference_tanpi( double x) { // set aside the sign (allows us to preserve sign of -0) @@ -1200,6 +1204,8 @@ double reference_atanh( double x ) return signed_half * reference_log1p(2.0 * x / (1-x)); } +double reference_relaxed_atan(double x) { return reference_atan(x); } + double reference_relaxed_exp2( double x ) { return reference_exp2(x); @@ -5263,6 +5269,8 @@ long double reference_acosl(long double x) return head + ((y + tail) - x); } +double reference_relaxed_acos(double x) { return reference_acos(x); } + double reference_log10(double x) { if( x == 0.0 ) @@ -5280,6 +5288,8 @@ double reference_log10(double x) return logxHi*log2Hi; } +double reference_relaxed_log10(double x) { return reference_log10(x); } + long double reference_log10l(long double x) { if( x == 0.0 ) @@ -5410,6 +5420,8 @@ double reference_asin(double x) return asin( x ); } +double reference_relaxed_asin(double x) { return reference_asin(x); } + double reference_fabs(double x) { return fabs( x); diff --git a/test_conformance/math_brute_force/reference_math.h b/test_conformance/math_brute_force/reference_math.h index bcd0df8e..7c751f68 100644 --- a/test_conformance/math_brute_force/reference_math.h +++ b/test_conformance/math_brute_force/reference_math.h @@ -117,10 +117,15 @@ double reference_assignment( double x ); int reference_not( double x ); // -- for testing fast-relaxed +double reference_relaxed_acos(double); +double reference_relaxed_asin(double); +double reference_relaxed_atan(double); double reference_relaxed_mad( double, double, double ); double reference_relaxed_divide( double x, double y ); double reference_relaxed_sin( double x ); +double reference_relaxed_sinpi(double x); double reference_relaxed_cos( double x ); +double reference_relaxed_cospi(double x); double reference_relaxed_sincos( double x, double * y); double reference_relaxed_tan( double x ); double reference_relaxed_exp( double x ); @@ -128,6 +133,7 @@ double reference_relaxed_exp2( double x ); double reference_relaxed_exp10( double x ); double reference_relaxed_log( double x ); double reference_relaxed_log2( double x ); +double reference_relaxed_log10(double x); double reference_relaxed_pow( double x, double y); double reference_relaxed_reciprocal( double x ); diff --git a/test_conformance/math_brute_force/unary.cpp b/test_conformance/math_brute_force/unary.cpp index 91bc92d9..0cde4f30 100644 --- a/test_conformance/math_brute_force/unary.cpp +++ b/test_conformance/math_brute_force/unary.cpp @@ -629,6 +629,15 @@ static cl_int TestFloat( cl_uint job_id, cl_uint thread_id, void *data ) fail = ! (fabsf(abs_error) <= ulps); use_abs_error = 1; } + if (strcmp(fname, "sinpi") == 0 + || strcmp(fname, "cospi") == 0) + { + if (s[j] >= -1.0 && s[j] <= 1.0) + { + fail = !(fabsf(abs_error) <= ulps); + use_abs_error = 1; + } + } if ( strcmp(fname, "reciprocal") == 0 ) { @@ -663,7 +672,8 @@ static cl_int TestFloat( cl_uint job_id, cl_uint thread_id, void *data ) } // Else fast math derived implementation does not require ULP verification } - if ( strcmp(fname,"log") == 0 || strcmp(fname,"log2") == 0 ) + if (strcmp(fname, "log") == 0 || strcmp(fname, "log2") == 0 + || strcmp(fname, "log10") == 0) { if( s[j] >= 0.5 && s[j] <= 2 ) { @@ -674,7 +684,6 @@ static cl_int TestFloat( cl_uint job_id, cl_uint thread_id, void *data ) ulps = gIsEmbedded ? job->f->float_embedded_ulps : job->f->float_ulps; fail = ! (fabsf(err) <= ulps); } - } From 5ae5e7a1fa9bd1dcdf68ab66e4426398cc68b60b Mon Sep 17 00:00:00 2001 From: ellnor01 <51320439+ellnor01@users.noreply.github.com> Date: Wed, 9 Dec 2020 16:12:40 +0000 Subject: [PATCH 35/36] Remove imageSupportRequired parameter to runTestHarness (#1077) * Tests requiring image support use runTestHarnessWithCheck Removing special case for images in runTestHarness. Fixes #710 * Remove imageSupportRequired argument Tests which require image support now specify this while calling runTestHarnessWithCheck. Fixes #710 Signed-off-by: Ellen Norris-Thompson --- test_common/harness/testHarness.cpp | 8 +++----- test_common/harness/testHarness.h | 2 +- test_conformance/api/main.cpp | 2 +- test_conformance/atomics/main.cpp | 2 +- test_conformance/basic/main.cpp | 2 +- test_conformance/buffers/main.cpp | 2 +- test_conformance/clcpp/address_spaces/main.cpp | 2 +- test_conformance/clcpp/api/main.cpp | 2 +- test_conformance/clcpp/atomics/main.cpp | 2 +- test_conformance/clcpp/attributes/main.cpp | 2 +- test_conformance/clcpp/common_funcs/main.cpp | 2 +- test_conformance/clcpp/convert/main.cpp | 2 +- test_conformance/clcpp/device_queue/main.cpp | 2 +- test_conformance/clcpp/geometric_funcs/main.cpp | 2 +- test_conformance/clcpp/images/main.cpp | 2 +- test_conformance/clcpp/integer_funcs/main.cpp | 2 +- test_conformance/clcpp/math_funcs/main.cpp | 2 +- test_conformance/clcpp/pipes/main.cpp | 2 +- test_conformance/clcpp/program_scope_ctors_dtors/main.cpp | 2 +- test_conformance/clcpp/reinterpret/main.cpp | 2 +- test_conformance/clcpp/relational_funcs/main.cpp | 2 +- test_conformance/clcpp/spec_constants/main.cpp | 2 +- test_conformance/clcpp/subgroups/main.cpp | 2 +- test_conformance/clcpp/synchronization/main.cpp | 2 +- test_conformance/clcpp/vload_vstore/main.cpp | 2 +- test_conformance/clcpp/workgroups/main.cpp | 2 +- test_conformance/clcpp/workitems/main.cpp | 2 +- test_conformance/commonfns/main.cpp | 2 +- test_conformance/compiler/main.cpp | 2 +- test_conformance/computeinfo/main.cpp | 3 +-- test_conformance/device_partition/main.cpp | 2 +- test_conformance/events/main.cpp | 2 +- test_conformance/geometrics/main.cpp | 2 +- test_conformance/images/clCopyImage/main.cpp | 3 ++- test_conformance/images/clFillImage/main.cpp | 3 ++- test_conformance/images/clGetInfo/main.cpp | 3 ++- test_conformance/images/clReadWriteImage/main.cpp | 3 ++- test_conformance/images/kernel_image_methods/main.cpp | 3 ++- test_conformance/images/kernel_read_write/main.cpp | 3 ++- test_conformance/images/samplerlessReads/main.cpp | 3 ++- test_conformance/integer_ops/main.cpp | 2 +- test_conformance/mem_host_flags/main.cpp | 2 +- test_conformance/multiple_device_context/main.cpp | 2 +- test_conformance/profiling/main.cpp | 3 ++- test_conformance/relationals/main.cpp | 2 +- test_conformance/select/test_select.cpp | 4 ++-- test_conformance/thread_dimensions/main.cpp | 2 +- test_conformance/vectors/main.cpp | 2 +- test_extensions/media_sharing/main.cpp | 2 +- 49 files changed, 60 insertions(+), 55 deletions(-) diff --git a/test_common/harness/testHarness.cpp b/test_common/harness/testHarness.cpp index 6a3cacc9..b2516331 100644 --- a/test_common/harness/testHarness.cpp +++ b/test_common/harness/testHarness.cpp @@ -61,13 +61,11 @@ bool gCoreILProgram = true; #define DEFAULT_NUM_ELEMENTS 0x4000 int runTestHarness(int argc, const char *argv[], int testNum, - test_definition testList[], int imageSupportRequired, - int forceNoContextCreation, + test_definition testList[], int forceNoContextCreation, cl_command_queue_properties queueProps) { - return runTestHarnessWithCheck( - argc, argv, testNum, testList, forceNoContextCreation, queueProps, - (imageSupportRequired) ? verifyImageSupport : NULL); + return runTestHarnessWithCheck(argc, argv, testNum, testList, + forceNoContextCreation, queueProps, NULL); } int skip_init_info(int count) diff --git a/test_common/harness/testHarness.h b/test_common/harness/testHarness.h index 235926ac..d681616a 100644 --- a/test_common/harness/testHarness.h +++ b/test_common/harness/testHarness.h @@ -92,7 +92,7 @@ extern cl_uint gRandomSeed; // dictatated by the passed arguments. Returns EXIT_SUCCESS iff all tests // succeeded or the tests were listed, otherwise return EXIT_FAILURE. extern int runTestHarness(int argc, const char *argv[], int testNum, - test_definition testList[], int imageSupportRequired, + test_definition testList[], int forceNoContextCreation, cl_command_queue_properties queueProps); diff --git a/test_conformance/api/main.cpp b/test_conformance/api/main.cpp index 06f87392..10e2b57e 100644 --- a/test_conformance/api/main.cpp +++ b/test_conformance/api/main.cpp @@ -152,5 +152,5 @@ const int test_num = ARRAY_SIZE(test_list); int main(int argc, const char *argv[]) { - return runTestHarness(argc, argv, test_num, test_list, false, false, 0); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/atomics/main.cpp b/test_conformance/atomics/main.cpp index 6904d7c3..afdea376 100644 --- a/test_conformance/atomics/main.cpp +++ b/test_conformance/atomics/main.cpp @@ -45,6 +45,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/basic/main.cpp b/test_conformance/basic/main.cpp index 911f5e7b..d1a35fae 100644 --- a/test_conformance/basic/main.cpp +++ b/test_conformance/basic/main.cpp @@ -157,6 +157,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/buffers/main.cpp b/test_conformance/buffers/main.cpp index c8713127..7c5502a7 100644 --- a/test_conformance/buffers/main.cpp +++ b/test_conformance/buffers/main.cpp @@ -141,5 +141,5 @@ const char* flag_set_names[] = { int main( int argc, const char *argv[] ) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/clcpp/address_spaces/main.cpp b/test_conformance/clcpp/address_spaces/main.cpp index 3bda012d..d618e179 100644 --- a/test_conformance/clcpp/address_spaces/main.cpp +++ b/test_conformance/clcpp/address_spaces/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/api/main.cpp b/test_conformance/clcpp/api/main.cpp index 89f8f1b9..76528384 100644 --- a/test_conformance/clcpp/api/main.cpp +++ b/test_conformance/clcpp/api/main.cpp @@ -23,5 +23,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/atomics/main.cpp b/test_conformance/clcpp/atomics/main.cpp index 71039985..b9f964fa 100644 --- a/test_conformance/clcpp/atomics/main.cpp +++ b/test_conformance/clcpp/atomics/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/attributes/main.cpp b/test_conformance/clcpp/attributes/main.cpp index 765867e7..e731c001 100644 --- a/test_conformance/clcpp/attributes/main.cpp +++ b/test_conformance/clcpp/attributes/main.cpp @@ -23,5 +23,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/common_funcs/main.cpp b/test_conformance/clcpp/common_funcs/main.cpp index a66d8f2f..4a6277a3 100644 --- a/test_conformance/clcpp/common_funcs/main.cpp +++ b/test_conformance/clcpp/common_funcs/main.cpp @@ -39,5 +39,5 @@ int main(int argc, const char *argv[]) } auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/convert/main.cpp b/test_conformance/clcpp/convert/main.cpp index 9f4ed09f..78e37637 100644 --- a/test_conformance/clcpp/convert/main.cpp +++ b/test_conformance/clcpp/convert/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/device_queue/main.cpp b/test_conformance/clcpp/device_queue/main.cpp index 1075c78b..0467b19f 100644 --- a/test_conformance/clcpp/device_queue/main.cpp +++ b/test_conformance/clcpp/device_queue/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/geometric_funcs/main.cpp b/test_conformance/clcpp/geometric_funcs/main.cpp index ee3a51bd..ed35805c 100644 --- a/test_conformance/clcpp/geometric_funcs/main.cpp +++ b/test_conformance/clcpp/geometric_funcs/main.cpp @@ -40,5 +40,5 @@ int main(int argc, const char *argv[]) } auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/images/main.cpp b/test_conformance/clcpp/images/main.cpp index 8c41bb6a..bbda559d 100644 --- a/test_conformance/clcpp/images/main.cpp +++ b/test_conformance/clcpp/images/main.cpp @@ -26,5 +26,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/integer_funcs/main.cpp b/test_conformance/clcpp/integer_funcs/main.cpp index ab2664a2..c6cdfb61 100644 --- a/test_conformance/clcpp/integer_funcs/main.cpp +++ b/test_conformance/clcpp/integer_funcs/main.cpp @@ -22,5 +22,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/math_funcs/main.cpp b/test_conformance/clcpp/math_funcs/main.cpp index aada85f7..b5134871 100644 --- a/test_conformance/clcpp/math_funcs/main.cpp +++ b/test_conformance/clcpp/math_funcs/main.cpp @@ -46,5 +46,5 @@ int main(int argc, const char *argv[]) } auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/pipes/main.cpp b/test_conformance/clcpp/pipes/main.cpp index de6e6221..0ed4ef68 100644 --- a/test_conformance/clcpp/pipes/main.cpp +++ b/test_conformance/clcpp/pipes/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/program_scope_ctors_dtors/main.cpp b/test_conformance/clcpp/program_scope_ctors_dtors/main.cpp index 08c19082..78b07739 100644 --- a/test_conformance/clcpp/program_scope_ctors_dtors/main.cpp +++ b/test_conformance/clcpp/program_scope_ctors_dtors/main.cpp @@ -20,5 +20,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/reinterpret/main.cpp b/test_conformance/clcpp/reinterpret/main.cpp index 8eddf1d1..06d7056f 100644 --- a/test_conformance/clcpp/reinterpret/main.cpp +++ b/test_conformance/clcpp/reinterpret/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/relational_funcs/main.cpp b/test_conformance/clcpp/relational_funcs/main.cpp index 99b0e5a9..2b72d3d2 100644 --- a/test_conformance/clcpp/relational_funcs/main.cpp +++ b/test_conformance/clcpp/relational_funcs/main.cpp @@ -22,5 +22,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/spec_constants/main.cpp b/test_conformance/clcpp/spec_constants/main.cpp index 0582ed54..305eb7dc 100644 --- a/test_conformance/clcpp/spec_constants/main.cpp +++ b/test_conformance/clcpp/spec_constants/main.cpp @@ -22,5 +22,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/subgroups/main.cpp b/test_conformance/clcpp/subgroups/main.cpp index c0262288..c81f2315 100644 --- a/test_conformance/clcpp/subgroups/main.cpp +++ b/test_conformance/clcpp/subgroups/main.cpp @@ -25,5 +25,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/synchronization/main.cpp b/test_conformance/clcpp/synchronization/main.cpp index b337238c..04b5f36a 100644 --- a/test_conformance/clcpp/synchronization/main.cpp +++ b/test_conformance/clcpp/synchronization/main.cpp @@ -23,5 +23,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/vload_vstore/main.cpp b/test_conformance/clcpp/vload_vstore/main.cpp index 3893905d..e5c4fdd0 100644 --- a/test_conformance/clcpp/vload_vstore/main.cpp +++ b/test_conformance/clcpp/vload_vstore/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/workgroups/main.cpp b/test_conformance/clcpp/workgroups/main.cpp index 508753cf..924bb44c 100644 --- a/test_conformance/clcpp/workgroups/main.cpp +++ b/test_conformance/clcpp/workgroups/main.cpp @@ -25,5 +25,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/clcpp/workitems/main.cpp b/test_conformance/clcpp/workitems/main.cpp index 1c322dfd..aacbdd49 100644 --- a/test_conformance/clcpp/workitems/main.cpp +++ b/test_conformance/clcpp/workitems/main.cpp @@ -21,5 +21,5 @@ int main(int argc, const char *argv[]) { auto& tests = autotest::test_suite::global_test_suite().test_defs; - return runTestHarness(argc, argv, tests.size(), tests.data(), false, false, 0); + return runTestHarness(argc, argv, tests.size(), tests.data(), false, 0); } diff --git a/test_conformance/commonfns/main.cpp b/test_conformance/commonfns/main.cpp index 739e09ee..b8364d5a 100644 --- a/test_conformance/commonfns/main.cpp +++ b/test_conformance/commonfns/main.cpp @@ -58,6 +58,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { initVecSizes(); - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/compiler/main.cpp b/test_conformance/compiler/main.cpp index 19479285..f0a9ef3a 100644 --- a/test_conformance/compiler/main.cpp +++ b/test_conformance/compiler/main.cpp @@ -107,5 +107,5 @@ const int test_num = ARRAY_SIZE(test_list); int main(int argc, const char *argv[]) { - return runTestHarness(argc, argv, test_num, test_list, false, false, 0); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/computeinfo/main.cpp b/test_conformance/computeinfo/main.cpp index 19aadb7a..47975f86 100644 --- a/test_conformance/computeinfo/main.cpp +++ b/test_conformance/computeinfo/main.cpp @@ -1455,6 +1455,5 @@ int main(int argc, const char** argv) } } - return runTestHarness(argCount, argList, test_num, test_list, false, true, - 0); + return runTestHarness(argCount, argList, test_num, test_list, true, 0); } diff --git a/test_conformance/device_partition/main.cpp b/test_conformance/device_partition/main.cpp index f5f081ea..a8af6ffb 100644 --- a/test_conformance/device_partition/main.cpp +++ b/test_conformance/device_partition/main.cpp @@ -41,5 +41,5 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, true, 0 ); + return runTestHarness(argc, argv, test_num, test_list, true, 0); } diff --git a/test_conformance/events/main.cpp b/test_conformance/events/main.cpp index 2aafb0e5..777d2d36 100644 --- a/test_conformance/events/main.cpp +++ b/test_conformance/events/main.cpp @@ -62,6 +62,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/geometrics/main.cpp b/test_conformance/geometrics/main.cpp index 038999de..45f2b069 100644 --- a/test_conformance/geometrics/main.cpp +++ b/test_conformance/geometrics/main.cpp @@ -38,6 +38,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/images/clCopyImage/main.cpp b/test_conformance/images/clCopyImage/main.cpp index f64119e9..c2cad010 100644 --- a/test_conformance/images/clCopyImage/main.cpp +++ b/test_conformance/images/clCopyImage/main.cpp @@ -151,7 +151,8 @@ int main(int argc, const char *argv[]) if( gTestSmallImages ) log_info( "Note: Using small test images\n" ); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); free(argList); return ret; diff --git a/test_conformance/images/clFillImage/main.cpp b/test_conformance/images/clFillImage/main.cpp index 1f09a49e..b19d85af 100644 --- a/test_conformance/images/clFillImage/main.cpp +++ b/test_conformance/images/clFillImage/main.cpp @@ -124,7 +124,8 @@ int main(int argc, const char *argv[]) if ( gTestSmallImages ) log_info( "Note: Using small test images\n" ); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); free(argList); return ret; diff --git a/test_conformance/images/clGetInfo/main.cpp b/test_conformance/images/clGetInfo/main.cpp index 10694186..80b3cbb2 100644 --- a/test_conformance/images/clGetInfo/main.cpp +++ b/test_conformance/images/clGetInfo/main.cpp @@ -108,7 +108,8 @@ int main(int argc, const char *argv[]) if( gTestSmallImages ) log_info( "Note: Using small test images\n" ); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); free(argList); return ret; diff --git a/test_conformance/images/clReadWriteImage/main.cpp b/test_conformance/images/clReadWriteImage/main.cpp index 5fd5367d..18c7e239 100644 --- a/test_conformance/images/clReadWriteImage/main.cpp +++ b/test_conformance/images/clReadWriteImage/main.cpp @@ -112,7 +112,8 @@ int main(int argc, const char *argv[]) if( gTestSmallImages ) log_info( "Note: Using small test images\n" ); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); free(argList); return ret; diff --git a/test_conformance/images/kernel_image_methods/main.cpp b/test_conformance/images/kernel_image_methods/main.cpp index a08f133d..e1320ce3 100644 --- a/test_conformance/images/kernel_image_methods/main.cpp +++ b/test_conformance/images/kernel_image_methods/main.cpp @@ -112,7 +112,8 @@ int main(int argc, const char *argv[]) if( gTestSmallImages ) log_info( "Note: Using small test images\n" ); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); free(argList); return ret; diff --git a/test_conformance/images/kernel_read_write/main.cpp b/test_conformance/images/kernel_read_write/main.cpp index 243cff7c..f430c7f5 100644 --- a/test_conformance/images/kernel_read_write/main.cpp +++ b/test_conformance/images/kernel_read_write/main.cpp @@ -395,7 +395,8 @@ int main(int argc, const char *argv[]) FPU_mode_type oldMode; DisableFTZ(&oldMode); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); // Restore FP state before leaving RestoreFPState(&oldMode); diff --git a/test_conformance/images/samplerlessReads/main.cpp b/test_conformance/images/samplerlessReads/main.cpp index 8f69e73c..cb442592 100644 --- a/test_conformance/images/samplerlessReads/main.cpp +++ b/test_conformance/images/samplerlessReads/main.cpp @@ -152,7 +152,8 @@ int main(int argc, const char *argv[]) FPU_mode_type oldMode; DisableFTZ(&oldMode); - int ret = runTestHarness( argCount, argList, test_num, test_list, true, false, 0 ); + int ret = runTestHarnessWithCheck(argCount, argList, test_num, test_list, + false, 0, verifyImageSupport); // Restore FP state before leaving RestoreFPState(&oldMode); diff --git a/test_conformance/integer_ops/main.cpp b/test_conformance/integer_ops/main.cpp index 1a8bad5f..00e91661 100644 --- a/test_conformance/integer_ops/main.cpp +++ b/test_conformance/integer_ops/main.cpp @@ -212,6 +212,6 @@ void fill_test_values( cl_long *outBufferA, cl_long *outBufferB, size_t numEleme int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/mem_host_flags/main.cpp b/test_conformance/mem_host_flags/main.cpp index 01bad676..f0649808 100644 --- a/test_conformance/mem_host_flags/main.cpp +++ b/test_conformance/mem_host_flags/main.cpp @@ -47,5 +47,5 @@ int main(int argc, const char *argv[]) { log_info("1st part, non gl-sharing objects...\n"); gTestRounding = true; - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/multiple_device_context/main.cpp b/test_conformance/multiple_device_context/main.cpp index 10276668..6e16c244 100644 --- a/test_conformance/multiple_device_context/main.cpp +++ b/test_conformance/multiple_device_context/main.cpp @@ -41,6 +41,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, true, 0 ); + return runTestHarness(argc, argv, test_num, test_list, true, 0); } diff --git a/test_conformance/profiling/main.cpp b/test_conformance/profiling/main.cpp index bd367976..6e59f611 100644 --- a/test_conformance/profiling/main.cpp +++ b/test_conformance/profiling/main.cpp @@ -126,6 +126,7 @@ int check_times(cl_ulong queueStart, cl_ulong commandSubmit, cl_ulong commandSta int main( int argc, const char *argv[] ) { - return runTestHarness( argc, argv, test_num, test_list, false, false, CL_QUEUE_PROFILING_ENABLE ); + return runTestHarness(argc, argv, test_num, test_list, false, + CL_QUEUE_PROFILING_ENABLE); } diff --git a/test_conformance/relationals/main.cpp b/test_conformance/relationals/main.cpp index ec495c89..61bde2d0 100644 --- a/test_conformance/relationals/main.cpp +++ b/test_conformance/relationals/main.cpp @@ -70,6 +70,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/select/test_select.cpp b/test_conformance/select/test_select.cpp index da136b48..35f154ac 100644 --- a/test_conformance/select/test_select.cpp +++ b/test_conformance/select/test_select.cpp @@ -343,7 +343,7 @@ static int doTest(cl_command_queue queue, cl_context context, Type stype, Type c programs[vecsize] = makeSelectProgram(&kernels[vecsize], context, stype, cmptype, element_count[vecsize] ); if (!programs[vecsize] || !kernels[vecsize]) { ++s_test_fail; - ++s_test_cnt; + ++s_test_cnt; return -1; } } @@ -645,7 +645,7 @@ int main(int argc, const char* argv[]) log_info("*** Wimpy Reduction Factor: %-27u ***\n\n", s_wimpy_reduction_factor); } - int err = runTestHarness( argCount, argList, test_num, test_list, false, false, 0 ); + int err = runTestHarness(argCount, argList, test_num, test_list, false, 0); free( argList ); diff --git a/test_conformance/thread_dimensions/main.cpp b/test_conformance/thread_dimensions/main.cpp index bddbc0f9..9a1ce609 100644 --- a/test_conformance/thread_dimensions/main.cpp +++ b/test_conformance/thread_dimensions/main.cpp @@ -38,6 +38,6 @@ const int test_num = ARRAY_SIZE( test_list ); int main(int argc, const char *argv[]) { - return runTestHarness( argc, argv, test_num, test_list, false, false, 0 ); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_conformance/vectors/main.cpp b/test_conformance/vectors/main.cpp index 98f278c3..e499faf9 100644 --- a/test_conformance/vectors/main.cpp +++ b/test_conformance/vectors/main.cpp @@ -40,5 +40,5 @@ const int test_num = ARRAY_SIZE(test_list); int main(int argc, const char *argv[]) { - return runTestHarness(argc, argv, test_num, test_list, false, false, 0); + return runTestHarness(argc, argv, test_num, test_list, false, 0); } diff --git a/test_extensions/media_sharing/main.cpp b/test_extensions/media_sharing/main.cpp index 98b766ac..f0c3aff8 100644 --- a/test_extensions/media_sharing/main.cpp +++ b/test_extensions/media_sharing/main.cpp @@ -200,5 +200,5 @@ int main(int argc, const char *argv[]) if (!MediaSurfaceSharingExtensionInit()) return TEST_FAIL; - return runTestHarness(argc, argv, test_num, test_list, false, true, 0); + return runTestHarness(argc, argv, test_num, test_list, true, 0); } From b34ac1038d8748f2cb24fcecbe44d2159b661c47 Mon Sep 17 00:00:00 2001 From: "Filip @ Intel" Date: Fri, 11 Dec 2020 17:21:15 +0100 Subject: [PATCH 36/36] Correct test_consistency_svm (#1071) Do not use NULL svm pointers. Add a check for clEnqueueSVMMigrateMem. Signed-off-by: Filip Hazubski --- test_conformance/api/test_api_consistency.cpp | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/test_conformance/api/test_api_consistency.cpp b/test_conformance/api/test_api_consistency.cpp index 4b0a4504..d6c4bba7 100644 --- a/test_conformance/api/test_api_consistency.cpp +++ b/test_conformance/api/test_api_consistency.cpp @@ -79,44 +79,51 @@ int test_consistency_svm(cl_device_id deviceID, cl_context context, // CL_INVALID_OPERATION if the device associated with command_queue does // not support Shared Virtual Memory. + // These calls purposefully pass bogus pointers to the functions to + // better test that they are a NOP when SVM is not supported. + void* bogus0 = (void*)0xDEADBEEF; + void* bogus1 = (void*)0xDEADDEAD; cl_uint pattern = 0xAAAAAAAA; - error = clEnqueueSVMMemFill(queue, ptr0, &pattern, sizeof(pattern), + error = clEnqueueSVMMemFill(queue, bogus0, &pattern, sizeof(pattern), allocSize, 0, NULL, NULL); test_failure_error( error, CL_INVALID_OPERATION, "CL_DEVICE_SVM_CAPABILITIES returned 0 but clEnqueueSVMMemFill did " "not return CL_INVALID_OPERATION"); - error = clEnqueueSVMMemcpy(queue, CL_TRUE, ptr1, ptr0, allocSize, 0, + error = clEnqueueSVMMemcpy(queue, CL_TRUE, bogus1, bogus0, allocSize, 0, NULL, NULL); test_failure_error( error, CL_INVALID_OPERATION, "CL_DEVICE_SVM_CAPABILITIES returned 0 but " "clEnqueueSVMMemcpy did not return CL_INVALID_OPERATION"); - error = clEnqueueSVMMap(queue, CL_TRUE, CL_MAP_READ, ptr1, allocSize, 0, - NULL, NULL); + error = clEnqueueSVMMap(queue, CL_TRUE, CL_MAP_READ, bogus1, allocSize, + 0, NULL, NULL); test_failure_error( error, CL_INVALID_OPERATION, "CL_DEVICE_SVM_CAPABILITIES returned 0 but " "clEnqueueSVMMap did not return CL_INVALID_OPERATION"); - error = clEnqueueSVMUnmap(queue, ptr1, 0, NULL, NULL); + error = clEnqueueSVMUnmap(queue, bogus1, 0, NULL, NULL); test_failure_error( error, CL_INVALID_OPERATION, "CL_DEVICE_SVM_CAPABILITIES returned 0 but " "clEnqueueSVMUnmap did not return CL_INVALID_OPERATION"); + error = clEnqueueSVMMigrateMem(queue, 1, (const void**)&bogus1, NULL, 0, + 0, NULL, NULL); + test_failure_error( + error, CL_INVALID_OPERATION, + "CL_DEVICE_SVM_CAPABILITIES returned 0 but " + "clEnqueueSVMMigrateMem did not return CL_INVALID_OPERATION"); + // If the enqueue calls above did not return errors, a clFinish would be // needed here to ensure the SVM operations are complete before freeing // the SVM pointers. - // These calls to free SVM purposefully passes a bogus pointer to the - // free function to better test that it they are a NOP when SVM is not - // supported. - void* bogus = (void*)0xDEADBEEF; - clSVMFree(context, bogus); - error = clEnqueueSVMFree(queue, 1, &bogus, NULL, NULL, 0, NULL, NULL); + clSVMFree(context, bogus0); + error = clEnqueueSVMFree(queue, 1, &bogus0, NULL, NULL, 0, NULL, NULL); test_failure_error( error, CL_INVALID_OPERATION, "CL_DEVICE_SVM_CAPABILITIES returned 0 but "