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:
Marco Antognini
2021-04-21 10:45:34 +01:00
committed by GitHub
parent 7542ae2443
commit b8d1ea9962
28 changed files with 210 additions and 306 deletions

View File

@@ -218,8 +218,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
double maxErrorVal = 0.0f;
double maxErrorVal2 = 0.0f;
double maxErrorVal3 = 0.0f;
size_t bufferSize = (gWimpyMode) ? gWimpyBufferSize : BUFFER_SIZE;
uint64_t step = getTestStep(sizeof(double), bufferSize);
uint64_t step = getTestStep(sizeof(double), BUFFER_SIZE);
logFunctionInfo(f->name, sizeof(cl_double), relaxedMode);
@@ -246,7 +245,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
{ // test edge cases
uint32_t x, y, z;
x = y = z = 0;
for (; j < bufferSize / sizeof(double); j++)
for (; j < BUFFER_SIZE / sizeof(double); j++)
{
p[j] = specialValues[x];
p2[j] = specialValues[y];
@@ -261,11 +260,11 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
}
}
}
if (j == bufferSize / sizeof(double))
if (j == BUFFER_SIZE / sizeof(double))
vlog_error("Test Error: not all special cases tested!\n");
}
for (; j < bufferSize / sizeof(double); j++)
for (; j < BUFFER_SIZE / sizeof(double); j++)
{
p[j] = DoubleFromUInt32(genrand_int32(d));
p2[j] = DoubleFromUInt32(genrand_int32(d));
@@ -273,21 +272,21 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
}
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;
@@ -297,10 +296,10 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
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);
@@ -312,8 +311,8 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
for (j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
{
size_t vectorSize = sizeof(cl_double) * 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])))
{
@@ -356,7 +355,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
double *s = (double *)gIn;
double *s2 = (double *)gIn2;
double *s3 = (double *)gIn3;
for (j = 0; j < bufferSize / sizeof(double); j++)
for (j = 0; j < BUFFER_SIZE / sizeof(double); j++)
r[j] = (double)f->dfunc.f_fff(s[j], s2[j], s3[j]);
// Read the data back
@@ -364,7 +363,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
{
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;
@@ -375,7 +374,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
// Verify data
uint64_t *t = (uint64_t *)gOut_Ref;
for (j = 0; j < bufferSize / sizeof(double); j++)
for (j = 0; j < BUFFER_SIZE / sizeof(double); j++)
{
for (k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
{
@@ -707,7 +706,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
if (gVerboseBruteForce)
{
vlog("base:%14u step:%10zu bufferSize:%10zd \n", i, step,
bufferSize);
BUFFER_SIZE);
}
else
{