mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 22:19:02 +00:00
Fold constant global variable (#1217)
gWimpyBufferSize is never modified and is actually not used to modify the number of tests -- gWimpyReductionFactor is used for that purpose by some tests, but not all. This patch removes this unnecessary global variable to simplify the codebase, and reduce differences between tests. Signed-off-by: Marco Antognini <marco.antognini@arm.com>
This commit is contained in:
@@ -228,8 +228,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
float maxErrorVal = 0.0f;
|
||||
float maxErrorVal2 = 0.0f;
|
||||
float maxErrorVal3 = 0.0f;
|
||||
size_t bufferSize = (gWimpyMode) ? gWimpyBufferSize : BUFFER_SIZE;
|
||||
uint64_t step = getTestStep(sizeof(float), bufferSize);
|
||||
uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE);
|
||||
|
||||
cl_uchar overflow[BUFFER_SIZE / sizeof(float)];
|
||||
|
||||
@@ -265,7 +264,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
float *fp3 = (float *)gIn3;
|
||||
uint32_t x, y, z;
|
||||
x = y = z = 0;
|
||||
for (; j < bufferSize / sizeof(float); j++)
|
||||
for (; j < BUFFER_SIZE / sizeof(float); j++)
|
||||
{
|
||||
fp[j] = specialValues[x];
|
||||
fp2[j] = specialValues[y];
|
||||
@@ -281,11 +280,11 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (j == bufferSize / sizeof(float))
|
||||
if (j == BUFFER_SIZE / sizeof(float))
|
||||
vlog_error("Test Error: not all special cases tested!\n");
|
||||
}
|
||||
|
||||
for (; j < bufferSize / sizeof(float); j++)
|
||||
for (; j < BUFFER_SIZE / sizeof(float); j++)
|
||||
{
|
||||
p[j] = genrand_int32(d);
|
||||
p2[j] = genrand_int32(d);
|
||||
@@ -293,21 +292,21 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
}
|
||||
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gInBuffer, CL_FALSE, 0,
|
||||
bufferSize, gIn, 0, NULL, NULL)))
|
||||
BUFFER_SIZE, gIn, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer ***\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gInBuffer2, CL_FALSE, 0,
|
||||
bufferSize, gIn2, 0, NULL, NULL)))
|
||||
BUFFER_SIZE, gIn2, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2 ***\n", error);
|
||||
return error;
|
||||
}
|
||||
|
||||
if ((error = clEnqueueWriteBuffer(gQueue, gInBuffer3, CL_FALSE, 0,
|
||||
bufferSize, gIn3, 0, NULL, NULL)))
|
||||
BUFFER_SIZE, gIn3, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer3 ***\n", error);
|
||||
return error;
|
||||
@@ -317,10 +316,10 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
for (j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
uint32_t pattern = 0xffffdead;
|
||||
memset_pattern4(gOut[j], &pattern, bufferSize);
|
||||
memset_pattern4(gOut[j], &pattern, BUFFER_SIZE);
|
||||
if ((error =
|
||||
clEnqueueWriteBuffer(gQueue, gOutBuffer[j], CL_FALSE, 0,
|
||||
bufferSize, gOut[j], 0, NULL, NULL)))
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
@@ -332,8 +331,8 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
for (j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
|
||||
{
|
||||
size_t vectorSize = sizeof(cl_float) * sizeValues[j];
|
||||
size_t localCount = (bufferSize + vectorSize - 1)
|
||||
/ vectorSize; // bufferSize / vectorSize rounded up
|
||||
size_t localCount = (BUFFER_SIZE + vectorSize - 1)
|
||||
/ vectorSize; // BUFFER_SIZE / vectorSize rounded up
|
||||
if ((error = clSetKernelArg(kernels[j], 0, sizeof(gOutBuffer[j]),
|
||||
&gOutBuffer[j])))
|
||||
{
|
||||
@@ -378,7 +377,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
float *s3 = (float *)gIn3;
|
||||
if (skipNanInf)
|
||||
{
|
||||
for (j = 0; j < bufferSize / sizeof(float); j++)
|
||||
for (j = 0; j < BUFFER_SIZE / sizeof(float); j++)
|
||||
{
|
||||
feclearexcept(FE_OVERFLOW);
|
||||
r[j] =
|
||||
@@ -389,7 +388,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (j = 0; j < bufferSize / sizeof(float); j++)
|
||||
for (j = 0; j < BUFFER_SIZE / sizeof(float); j++)
|
||||
r[j] =
|
||||
(float)f->func.f_fma(s[j], s2[j], s3[j], CORRECTLY_ROUNDED);
|
||||
}
|
||||
@@ -399,7 +398,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
if ((error =
|
||||
clEnqueueReadBuffer(gQueue, gOutBuffer[j], CL_TRUE, 0,
|
||||
bufferSize, gOut[j], 0, NULL, NULL)))
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("ReadArray failed %d\n", error);
|
||||
goto exit;
|
||||
@@ -410,7 +409,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
|
||||
// Verify data
|
||||
uint32_t *t = (uint32_t *)gOut_Ref;
|
||||
for (j = 0; j < bufferSize / sizeof(float); j++)
|
||||
for (j = 0; j < BUFFER_SIZE / sizeof(float); j++)
|
||||
{
|
||||
for (k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
@@ -842,7 +841,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
if (gVerboseBruteForce)
|
||||
{
|
||||
vlog("base:%14u step:%10u bufferSize:%10zd \n", i, step,
|
||||
bufferSize);
|
||||
BUFFER_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user