mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-21 23:09:01 +00:00
Synchronise with Khronos-private Gitlab branch
The maintenance of the conformance tests is moving to Github. This commit contains all the changes that have been done in Gitlab since the first public release of the conformance tests. Signed-off-by: Kevin Petit <kevin.petit@arm.com>
This commit is contained in:
@@ -207,7 +207,10 @@ 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);
|
||||
@@ -241,8 +244,11 @@ int32_t float2int (float fx);
|
||||
// stdio.h
|
||||
//
|
||||
|
||||
#if defined( _MSC_VER )
|
||||
#define snprintf sprintf_s
|
||||
#if defined(_MSC_VER)
|
||||
// snprintf added in _MSC_VER == 1900 (Visual Studio 2015)
|
||||
#if _MSC_VER < 1900
|
||||
#define snprintf sprintf_s
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -479,16 +479,6 @@ struct AddressingTable
|
||||
|
||||
static AddressingTable sAddressingTable;
|
||||
|
||||
bool alpha_is_x(cl_image_format *format){
|
||||
switch (format->image_channel_order) {
|
||||
case CL_RGBx:
|
||||
case CL_sRGBx:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_sRGBA_order(cl_channel_order image_channel_order){
|
||||
switch (image_channel_order) {
|
||||
case CL_sRGB:
|
||||
@@ -508,19 +498,21 @@ int has_alpha(cl_image_format *format) {
|
||||
case CL_R:
|
||||
return 0;
|
||||
case CL_A:
|
||||
case CL_Rx:
|
||||
return 1;
|
||||
case CL_Rx:
|
||||
return 0;
|
||||
case CL_RG:
|
||||
return 0;
|
||||
case CL_RA:
|
||||
case CL_RGx:
|
||||
return 1;
|
||||
case CL_RGx:
|
||||
return 0;
|
||||
case CL_RGB:
|
||||
case CL_sRGB:
|
||||
return 0;
|
||||
case CL_RGBx:
|
||||
case CL_sRGBx:
|
||||
return 1;
|
||||
return 0;
|
||||
case CL_RGBA:
|
||||
return 1;
|
||||
case CL_BGRA:
|
||||
@@ -719,13 +711,6 @@ void get_max_sizes(size_t *numberOfSizes, const int maxNumberOfSizes,
|
||||
}
|
||||
}
|
||||
|
||||
int issubnormal(float a)
|
||||
{
|
||||
union { cl_int i; cl_float f; } u;
|
||||
u.f = a;
|
||||
return (u.i & 0x7f800000U) == 0;
|
||||
}
|
||||
|
||||
float get_max_absolute_error( cl_image_format *format, image_sampler_data *sampler) {
|
||||
if (sampler->filter_mode == CL_FILTER_NEAREST)
|
||||
return 0.0f;
|
||||
@@ -1412,16 +1397,9 @@ void read_image_pixel_float( void *imageData, image_descriptor *imageInfo,
|
||||
|| ( depth_lod != 0 && z >= (int)depth_lod )
|
||||
|| ( imageInfo->arraySize != 0 && z >= (int)imageInfo->arraySize ) )
|
||||
{
|
||||
// Border color
|
||||
if (imageInfo->format->image_channel_order == CL_DEPTH)
|
||||
{
|
||||
outData[ 0 ] = 0;
|
||||
}
|
||||
else {
|
||||
outData[ 0 ] = outData[ 1 ] = outData[ 2 ] = outData[ 3 ] = 0;
|
||||
if (!has_alpha(imageInfo->format))
|
||||
outData[3] = alpha_is_x(imageInfo->format) ? 0 : 1;
|
||||
}
|
||||
outData[3] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -136,8 +136,6 @@ extern void copy_image_data( image_descriptor *srcImageInfo, image_descriptor *d
|
||||
|
||||
int has_alpha(cl_image_format *format);
|
||||
|
||||
extern bool alpha_is_x(cl_image_format *format);
|
||||
|
||||
extern bool is_sRGBA_order(cl_channel_order image_channel_order);
|
||||
|
||||
inline float calculate_array_index( float coord, float extent );
|
||||
@@ -594,7 +592,6 @@ extern char *create_random_image_data( ExplicitType dataType, image_descriptor *
|
||||
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 int issubnormal(float);
|
||||
|
||||
|
||||
#define errMax( _x , _y ) ( (_x) != (_x) ? (_x) : (_x) > (_y) ? (_x) : (_y) )
|
||||
|
||||
@@ -645,14 +645,14 @@ size_t get_pixel_bytes( const cl_image_format *fmt )
|
||||
return 0;
|
||||
}
|
||||
|
||||
int verifyImageSupport( cl_device_id device )
|
||||
test_status verifyImageSupport( cl_device_id device )
|
||||
{
|
||||
if( checkForImageSupport( device ) )
|
||||
{
|
||||
log_error( "ERROR: Device does not supported images as required by this test!\n" );
|
||||
return CL_IMAGE_FORMAT_NOT_SUPPORTED;
|
||||
return TEST_FAIL;
|
||||
}
|
||||
return 0;
|
||||
return TEST_PASS;
|
||||
}
|
||||
|
||||
int checkForImageSupport( cl_device_id device )
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#define _kernelHelpers_h
|
||||
|
||||
#include "compat.h"
|
||||
#include "testHarness.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -90,8 +91,8 @@ extern int is_image_format_supported( cl_context context, cl_mem_flags flags, cl
|
||||
/* Helper to get pixel size for a pixel format */
|
||||
size_t get_pixel_bytes( const cl_image_format *fmt );
|
||||
|
||||
/* Verify the given device supports images. 0 means you're good to go, otherwise an error */
|
||||
extern int verifyImageSupport( cl_device_id device );
|
||||
/* Verify the given device supports images. */
|
||||
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 );
|
||||
|
||||
@@ -566,6 +566,7 @@ long int lrintf (float x)
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
#if _MSC_VER < 1900
|
||||
int fetestexcept(int excepts)
|
||||
{
|
||||
unsigned int status = _statusfp();
|
||||
@@ -583,6 +584,7 @@ int feclearexcept(int excepts)
|
||||
_clearfp();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __INTEL_COMPILER
|
||||
|
||||
|
||||
42
test_common/harness/parseParameters.cpp
Normal file
42
test_common/harness/parseParameters.cpp
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "parseParameters.h"
|
||||
#include "errorHelpers.h"
|
||||
#include <string.h>
|
||||
|
||||
bool is_power_of_two(int number)
|
||||
{
|
||||
return number && !(number & (number - 1));
|
||||
}
|
||||
|
||||
extern void parseWimpyReductionFactor(const char *&arg, int &wimpyReductionFactor)
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if (arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
24
test_common/harness/parseParameters.h
Normal file
24
test_common/harness/parseParameters.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef _parseParameters_h
|
||||
#define _parseParameters_h
|
||||
|
||||
#include "compat.h"
|
||||
#include <string>
|
||||
|
||||
extern void parseWimpyReductionFactor(const char *&arg, int &wimpyReductionFactor);
|
||||
|
||||
#endif // _parseParameters_h
|
||||
@@ -135,7 +135,7 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
|
||||
log_info( "\tid<num>\t\tIndicates device at index <num> should be used (default 0).\n" );
|
||||
log_info( "\t<device_type>\tcpu|gpu|accelerator|<CL_DEVICE_TYPE_*> (default CL_DEVICE_TYPE_DEFAULT)\n" );
|
||||
|
||||
for( i = 0; i < num_fns - 1; i++ )
|
||||
for( i = 0; i < num_fns; i++ )
|
||||
{
|
||||
log_info( "\t\t%s\n", fnNames[ i ] );
|
||||
}
|
||||
@@ -431,10 +431,18 @@ int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
|
||||
|
||||
|
||||
/* If we have a device checking function, run it */
|
||||
if( ( deviceCheckFn != NULL ) && deviceCheckFn( device ) != CL_SUCCESS )
|
||||
if( ( deviceCheckFn != NULL ) )
|
||||
{
|
||||
test_finish();
|
||||
return -1;
|
||||
test_status status = deviceCheckFn( device );
|
||||
switch (status)
|
||||
{
|
||||
case TEST_PASS:
|
||||
break;
|
||||
case TEST_FAIL:
|
||||
return 1;
|
||||
case TEST_SKIP:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (num_elements <= 0)
|
||||
|
||||
@@ -23,6 +23,13 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum test_status
|
||||
{
|
||||
TEST_PASS = 0,
|
||||
TEST_FAIL = 1,
|
||||
TEST_SKIP = 2,
|
||||
} test_status;
|
||||
|
||||
extern cl_uint gReSeed;
|
||||
extern cl_uint gRandomSeed;
|
||||
|
||||
@@ -32,8 +39,8 @@ extern int runTestHarness( int argc, const char *argv[], unsigned int num_fns,
|
||||
basefn fnList[], const char *fnNames[],
|
||||
int imageSupportRequired, int forceNoContextCreation, cl_command_queue_properties queueProps );
|
||||
|
||||
// Device checking function. See runTestHarnessWithCheck. If this function returns anything other than CL_SUCCESS (0), the harness exits.
|
||||
typedef int (*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.
|
||||
extern int runTestHarnessWithCheck( int argc, const char *argv[], unsigned int num_fns,
|
||||
|
||||
Reference in New Issue
Block a user