mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06: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:
@@ -162,7 +162,7 @@ int Test_roundTrip( void )
|
||||
|
||||
// Figure out how many elements are in a work block
|
||||
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
||||
size_t blockCount = (size_t)getBufferSize(gDevice) / elementSize; //elementSize is a power of two
|
||||
size_t blockCount = (size_t)gBufferSize / elementSize; //elementSize is a power of two
|
||||
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of cl_half
|
||||
size_t stride = blockCount;
|
||||
|
||||
|
||||
@@ -453,7 +453,7 @@ int Test_vLoadHalf_private( bool aligned )
|
||||
|
||||
// Figure out how many elements are in a work block
|
||||
size_t elementSize = MAX( sizeof(cl_half), sizeof(cl_float));
|
||||
size_t blockCount = getBufferSize(gDevice) / elementSize; // elementSize is power of 2
|
||||
size_t blockCount = gBufferSize / elementSize; // elementSize is power of 2
|
||||
uint64_t lastCase = 1ULL << (8*sizeof(cl_half)); // number of things of size cl_half
|
||||
|
||||
// we handle 64-bit types a bit differently.
|
||||
@@ -503,7 +503,7 @@ int Test_vLoadHalf_private( bool aligned )
|
||||
continue;
|
||||
}
|
||||
*/
|
||||
memset_pattern4( gOut_single, &pattern, getBufferSize(gDevice));
|
||||
memset_pattern4( gOut_single, &pattern, gBufferSize);
|
||||
if( (error = clEnqueueWriteBuffer(gQueue, gOutBuffer_single, CL_TRUE, 0, count * sizeof( float ), gOut_single, 0, NULL, NULL)) )
|
||||
{
|
||||
vlog_error( "Failure in clWriteArray\n" );
|
||||
|
||||
@@ -1044,7 +1044,7 @@ int Test_vStoreHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const c
|
||||
size_t stride = blockCount;
|
||||
|
||||
if (gWimpyMode)
|
||||
stride = 0x10000000U;
|
||||
stride = (uint64_t)blockCount * (uint64_t)gWimpyReductionFactor;
|
||||
|
||||
// we handle 64-bit types a bit differently.
|
||||
if( lastCase == 0 )
|
||||
@@ -1654,7 +1654,7 @@ int Test_vStoreaHalf_private( f2h referenceFunc, d2h doubleReferenceFunc, const
|
||||
size_t stride = blockCount;
|
||||
|
||||
if (gWimpyMode)
|
||||
stride = 0x10000000U;
|
||||
stride = (uint64_t)blockCount * (uint64_t)gWimpyReductionFactor;
|
||||
|
||||
// we handle 64-bit types a bit differently.
|
||||
if( lastCase == 0 )
|
||||
|
||||
@@ -61,9 +61,11 @@ size_t gWorkGroupSize = 0;
|
||||
int gTestCount = 0;
|
||||
int gFailCount = 0;
|
||||
bool gWimpyMode = false;
|
||||
int gWimpyReductionFactor = 512;
|
||||
int gTestDouble = 0;
|
||||
uint32_t gDeviceIndex = 0;
|
||||
int gIsEmbedded = 0;
|
||||
size_t gBufferSize = 0;
|
||||
|
||||
#if defined( __APPLE__ )
|
||||
int gReportTimes = 1;
|
||||
@@ -184,17 +186,19 @@ int InitCL( void )
|
||||
#if defined( __APPLE__ )
|
||||
// FIXME: use clProtectedArray
|
||||
#endif
|
||||
gBufferSize = getBufferSize(gDevice);
|
||||
|
||||
//Allocate buffers
|
||||
gIn_half = malloc( getBufferSize(gDevice)/2 );
|
||||
gIn_half = malloc( gBufferSize/2 );
|
||||
gOut_half = malloc( BUFFER_SIZE/2 );
|
||||
gOut_half_reference = malloc( BUFFER_SIZE/2 );
|
||||
gOut_half_reference_double = malloc( BUFFER_SIZE/2 );
|
||||
gIn_single = malloc( BUFFER_SIZE );
|
||||
gOut_single = malloc( getBufferSize(gDevice) );
|
||||
gOut_single_reference = malloc( getBufferSize(gDevice) );
|
||||
gOut_single = malloc( gBufferSize );
|
||||
gOut_single_reference = malloc( gBufferSize );
|
||||
gIn_double = malloc( 2*BUFFER_SIZE );
|
||||
// gOut_double = malloc( (2*getBufferSize(gDevice)) );
|
||||
// gOut_double_reference = malloc( (2*getBufferSize(gDevice)) );
|
||||
// gOut_double = malloc( (2*gBufferSize) );
|
||||
// gOut_double_reference = malloc( (2*gBufferSize) );
|
||||
|
||||
if ( NULL == gIn_half ||
|
||||
NULL == gOut_half ||
|
||||
@@ -207,7 +211,7 @@ int InitCL( void )
|
||||
)
|
||||
return -3;
|
||||
|
||||
gInBuffer_half = clCreateBuffer(gContext, CL_MEM_READ_ONLY, getBufferSize(gDevice) / 2, NULL, &error);
|
||||
gInBuffer_half = clCreateBuffer(gContext, CL_MEM_READ_ONLY, gBufferSize / 2, NULL, &error);
|
||||
if( gInBuffer_half == NULL )
|
||||
{
|
||||
vlog_error( "clCreateArray failed for input (%d)\n", error );
|
||||
@@ -235,7 +239,7 @@ int InitCL( void )
|
||||
return -5;
|
||||
}
|
||||
|
||||
gOutBuffer_single = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, getBufferSize(gDevice), NULL, &error );
|
||||
gOutBuffer_single = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, gBufferSize, NULL, &error );
|
||||
if( gOutBuffer_single == NULL )
|
||||
{
|
||||
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
||||
@@ -243,7 +247,7 @@ int InitCL( void )
|
||||
}
|
||||
|
||||
#if 0
|
||||
gOutBuffer_double = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, (size_t)(2*getBufferSize(gDevice)), NULL, &error );
|
||||
gOutBuffer_double = clCreateBuffer(gContext, CL_MEM_WRITE_ONLY, (size_t)(2*gBufferSize), NULL, &error );
|
||||
if( gOutBuffer_double == NULL )
|
||||
{
|
||||
vlog_error( "clCreateArray failed for output (%d)\n", error );
|
||||
@@ -317,6 +321,15 @@ void ReleaseCL(void)
|
||||
// clReleaseMemObject(gOutBuffer_double);
|
||||
clReleaseCommandQueue(gQueue);
|
||||
clReleaseContext(gContext);
|
||||
|
||||
free(gIn_half);
|
||||
free(gOut_half);
|
||||
free(gOut_half_reference);
|
||||
free(gOut_half_reference_double);
|
||||
free(gIn_single);
|
||||
free(gOut_single);
|
||||
free(gOut_single_reference);
|
||||
free(gIn_double);
|
||||
}
|
||||
|
||||
cl_uint numVecs(cl_uint count, int vectorSizeIdx, bool aligned) {
|
||||
@@ -453,19 +466,30 @@ size_t getBufferSize(cl_device_id device_id)
|
||||
|
||||
if(s_initialized == 0 || s_device_id != device_id)
|
||||
{
|
||||
cl_ulong result;
|
||||
cl_ulong result, maxGlobalSize;
|
||||
cl_int err = clGetDeviceInfo (device_id,
|
||||
CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE,
|
||||
sizeof(result), (void *)&result,
|
||||
NULL);
|
||||
if(err)
|
||||
{
|
||||
vlog_error("clGetDeviceInfo() failed\n");
|
||||
vlog_error("clGetDeviceInfo(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE) failed\n");
|
||||
s_result = 64*1024;
|
||||
goto exit;
|
||||
}
|
||||
result = result / 2;
|
||||
log_info("Const buffer size is %llx (%llu)\n", result, result);
|
||||
err = clGetDeviceInfo (device_id,
|
||||
CL_DEVICE_GLOBAL_MEM_SIZE,
|
||||
sizeof(maxGlobalSize), (void *)&maxGlobalSize,
|
||||
NULL);
|
||||
if(err)
|
||||
{
|
||||
vlog_error("clGetDeviceInfo(CL_DEVICE_GLOBAL_MEM_SIZE) failed\n");
|
||||
goto exit;
|
||||
}
|
||||
result = result / 2;
|
||||
if(maxGlobalSize < result * 10)
|
||||
result = result / 10;
|
||||
s_initialized = 1;
|
||||
s_device_id = device_id;
|
||||
s_result = result;
|
||||
|
||||
@@ -73,11 +73,13 @@ extern int gFailCount;
|
||||
extern int gTestDouble;
|
||||
extern int gReportTimes;
|
||||
extern int gIsEmbedded;
|
||||
extern size_t gBufferSize;
|
||||
|
||||
// gWimpyMode indicates if we run the test in wimpy mode where we limit the
|
||||
// size of 32 bit ranges to a much smaller set. This is meant to be used
|
||||
// as a smoke test
|
||||
extern bool gWimpyMode;
|
||||
extern int gWimpyReductionFactor;
|
||||
|
||||
uint64_t ReadTime( void );
|
||||
double SubtractTime( uint64_t endTime, uint64_t startTime );
|
||||
|
||||
@@ -236,7 +236,27 @@ static int ParseArgs( int argc, const char **argv )
|
||||
case 'w': // Wimpy mode
|
||||
gWimpyMode = true;
|
||||
break;
|
||||
|
||||
case '[':
|
||||
// wimpy reduction factor can be set with the option -[2^n]
|
||||
// Default factor is 512, and n practically can be from 1 to 12
|
||||
{
|
||||
const char *arg_temp = strchr(&arg[1], ']');
|
||||
if (arg_temp != 0)
|
||||
{
|
||||
int new_factor = atoi(&arg[1]);
|
||||
arg = arg_temp; // Advance until ']'
|
||||
if (new_factor && !(new_factor & (new_factor - 1)))
|
||||
{
|
||||
vlog(" WimpyReduction factor changed from %d to %d \n", gWimpyReductionFactor, new_factor);
|
||||
gWimpyReductionFactor = new_factor;
|
||||
}
|
||||
else
|
||||
{
|
||||
vlog(" Error in WimpyReduction factor, must be power of 2 \n");
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
vlog_error( " <-- unknown flag: %c (0x%2.2x)\n)", *arg, *arg );
|
||||
PrintUsage();
|
||||
@@ -278,6 +298,7 @@ static int ParseArgs( int argc, const char **argv )
|
||||
vlog( "*** WARNING: Testing in Wimpy mode! ***\n" );
|
||||
vlog( "*** Wimpy mode is not sufficient to verify correctness. ***\n" );
|
||||
vlog( "*** It gives warm fuzzy feelings and then nevers calls. ***\n\n" );
|
||||
vlog( "*** Wimpy Reduction Factor: %-27u ***\n\n", gWimpyReductionFactor);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -288,6 +309,7 @@ static void PrintUsage( void )
|
||||
vlog( "\t\t-d\tToggle double precision testing (default: on if double supported)\n" );
|
||||
vlog( "\t\t-t\tToggle reporting performance data.\n" );
|
||||
vlog( "\t\t-w\tRun in wimpy mode\n" );
|
||||
vlog( "\t\t-[2^n]\tSet wimpy reduction factor, recommended range of n is 1-12, default factor(%u)\n", gWimpyReductionFactor);
|
||||
vlog( "\t\t-h\tHelp\n" );
|
||||
vlog( "\n" );
|
||||
}
|
||||
@@ -307,6 +329,8 @@ static void PrintArch( void )
|
||||
vlog( "ARCH:\tx86_64\n" );
|
||||
#elif defined( __arm__ )
|
||||
vlog( "ARCH:\tarm\n" );
|
||||
#elif defined( __aarch64__ )
|
||||
vlog( "\tARCH:\taarch64\n" );
|
||||
#else
|
||||
#error unknown arch
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user