mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
Added helper functions for bruteforce step and scale.
This commit is contained in:
@@ -229,6 +229,36 @@ void logFunctionInfo(const char *fname, unsigned int float_size, unsigned int is
|
||||
|
||||
float getAllowedUlpError(const Func *f, const bool relaxed);
|
||||
|
||||
static inline cl_uint setTestScale(size_t typeSize)
|
||||
{
|
||||
if (gWimpyMode)
|
||||
{
|
||||
return (cl_uint)typeSize * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
return EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
static inline uint64_t setTestStep(size_t typeSize, size_t bufferSize)
|
||||
{
|
||||
if (gWimpyMode)
|
||||
{
|
||||
return (1ULL << 32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
return (BUFFER_SIZE / typeSize) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
else
|
||||
{
|
||||
return bufferSize / typeSize;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* UTILITY_H */
|
||||
|
||||
|
||||
|
||||
@@ -277,15 +277,10 @@ int TestFunc_Float_Float_Float_common(const Func *f, MTdata d, int isNextafter,
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
|
||||
if (gWimpyMode){
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
@@ -1019,16 +1014,11 @@ int TestFunc_Double_Double_Double_common(const Func *f, MTdata d,
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
|
||||
|
||||
if (gWimpyMode){
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
@@ -269,14 +269,9 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d,
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
if (gWimpyMode) {
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = test_info.subBufferSize * test_info.scale;
|
||||
@@ -967,15 +962,10 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d,
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
@@ -266,15 +266,11 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
@@ -785,15 +781,10 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
@@ -287,21 +287,13 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
float maxErrorVal = 0.0f;
|
||||
float maxErrorVal2 = 0.0f;
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( float );
|
||||
uint64_t step = setTestStep(sizeof(float), bufferSize);
|
||||
|
||||
#if defined PARALLEL_REFERENCE
|
||||
cl_uint threadCount = GetThreadCount();
|
||||
#endif
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
|
||||
if(gWimpyMode ){
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(float)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
if( gIsEmbedded )
|
||||
float_ulps = f->float_embedded_ulps;
|
||||
else
|
||||
@@ -720,16 +712,9 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
double maxErrorVal = 0.0f;
|
||||
double maxErrorVal2 = 0.0f;
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( double );
|
||||
uint64_t step = setTestStep(sizeof(double), bufferSize);
|
||||
|
||||
logFunctionInfo(f->name, sizeof(cl_double), relaxedMode);
|
||||
if(gWimpyMode ){
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(double)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
#if defined PARALLEL_REFERENCE
|
||||
cl_uint threadCount = GetThreadCount();
|
||||
|
||||
@@ -191,18 +191,10 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
cl_kernel kernels[ VECTOR_SIZE_COUNT ];
|
||||
int ftz = f->ftz || 0 == (gFloatCapabilities & CL_FP_DENORM) || gForceFTZ;
|
||||
size_t bufferSize = (gWimpyMode)?gWimpyBufferSize:BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( float );
|
||||
uint64_t step = setTestStep(sizeof(float), bufferSize);
|
||||
int scale = (int)((1ULL<<32) / (16 * bufferSize / sizeof( float )) + 1);
|
||||
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(cl_float)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
// This test is not using ThreadPool so we need to disable FTZ here
|
||||
// for reference computations
|
||||
@@ -416,18 +408,10 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
cl_kernel kernels[ VECTOR_SIZE_COUNT ];
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
size_t bufferSize = (gWimpyMode)?gWimpyBufferSize:BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( cl_double );
|
||||
uint64_t step = setTestStep(sizeof(cl_double), bufferSize);
|
||||
int scale = (int)((1ULL<<32) / (16 * bufferSize / sizeof( cl_double )) + 1);
|
||||
|
||||
logFunctionInfo(f->name, sizeof(cl_double), relaxedMode);
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(cl_double)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
// This test is not using ThreadPool so we need to disable FTZ here
|
||||
// for reference computations
|
||||
|
||||
@@ -253,15 +253,10 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
@@ -770,15 +765,10 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
@@ -224,15 +224,10 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
if (gWimpyMode )
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
@@ -628,15 +623,10 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
if (gWimpyMode )
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
@@ -207,16 +207,7 @@ int TestFunc_mad(const Func *f, MTdata d, bool relaxedMode)
|
||||
float maxErrorVal2 = 0.0f;
|
||||
float maxErrorVal3 = 0.0f;
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( float );
|
||||
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(float)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
uint64_t step = setTestStep(sizeof(float), bufferSize);
|
||||
|
||||
// Init the kernels
|
||||
BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs,
|
||||
@@ -680,15 +671,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
|
||||
logFunctionInfo(f->name, sizeof(cl_double), relaxedMode);
|
||||
uint64_t step = bufferSize / sizeof( double );
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(double)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
uint64_t step = setTestStep(sizeof(double), bufferSize);
|
||||
|
||||
// Init the kernels
|
||||
BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs,
|
||||
|
||||
@@ -228,20 +228,12 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
float maxErrorVal3 = 0.0f;
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
|
||||
uint64_t step = bufferSize / sizeof( float );
|
||||
uint64_t step = setTestStep(sizeof(float), bufferSize);
|
||||
int skipNanInf = (0 == strcmp( "fma", f->nameInCode )) && ! gInfNanSupport;
|
||||
cl_uchar overflow[BUFFER_SIZE / sizeof( float )];
|
||||
float float_ulps;
|
||||
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(float)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
if( gIsEmbedded )
|
||||
float_ulps = f->float_embedded_ulps;
|
||||
@@ -878,15 +870,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
|
||||
logFunctionInfo(f->name, sizeof(cl_double), relaxedMode);
|
||||
|
||||
size_t bufferSize = (gWimpyMode)? gWimpyBufferSize: BUFFER_SIZE;
|
||||
uint64_t step = bufferSize / sizeof( double );
|
||||
if( gWimpyMode )
|
||||
{
|
||||
step = (1ULL<<32) * gWimpyReductionFactor / (512);
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
step = (BUFFER_SIZE / sizeof(double)) * EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
uint64_t step = setTestStep(sizeof(double), bufferSize);
|
||||
|
||||
Force64BitFPUPrecision();
|
||||
|
||||
|
||||
@@ -240,15 +240,10 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
test_info.threadCount = GetThreadCount();
|
||||
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_float));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_float) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_float) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
@@ -1032,15 +1027,10 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
memset( &test_info, 0, sizeof( test_info ) );
|
||||
test_info.threadCount = GetThreadCount();
|
||||
test_info.subBufferSize = BUFFER_SIZE / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = 1;
|
||||
test_info.scale = setTestScale(sizeof(cl_double));
|
||||
if (gWimpyMode)
|
||||
{
|
||||
test_info.subBufferSize = gWimpyBufferSize / (sizeof( cl_double) * RoundUpToNextPowerOfTwo(test_info.threadCount));
|
||||
test_info.scale = (cl_uint) sizeof(cl_double) * 2 * gWimpyReductionFactor;
|
||||
}
|
||||
else if (gIsEmbedded)
|
||||
{
|
||||
test_info.scale *= EMBEDDED_REDUCTION_FACTOR;
|
||||
}
|
||||
|
||||
test_info.step = (cl_uint) test_info.subBufferSize * test_info.scale;
|
||||
|
||||
Reference in New Issue
Block a user