math_brute_force: Remove unnecessary gotos (#1605)

Simplify code by returning directly instead of using goto statements.

Although intended as an NFC commit, this changes the behaviour around
clFlush calls.  Before this commit, failure of the third clFlush call
would print "clFlush 3 failed" and return the clFlush error code.
This behaviour is inconsistent with the other clFlush calls in
math_brute_force, which are not fatal.  The lack of a `goto exit`
makes me suspect that this 3rd clFlush call was intended to be
non-fatal too.  As such, this commit makes all clFlush calls non-fatal
by returning `CL_SUCCESS` even when the third clFlush call fails.

Original patch by Marco Antognini.

Signed-off-by: Marco Antognini <marco.antognini@arm.com>
Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2023-02-07 17:01:07 +00:00
committed by paulfradgley
parent a0c14eb819
commit e0d4c5c680
24 changed files with 410 additions and 523 deletions

View File

@@ -150,14 +150,12 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
Force64BitFPUPrecision();
// Init the kernels
{
BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode,
relaxedMode };
if ((error = ThreadPool_Do(BuildKernelFn,
gMaxVectorSizeIndex - gMinVectorSizeIndex,
&build_info)))
return error;
}
BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode,
relaxedMode };
if ((error = ThreadPool_Do(BuildKernelFn,
gMaxVectorSizeIndex - gMinVectorSizeIndex,
&build_info)))
return error;
for (uint64_t i = 0; i < (1ULL << 32); i += step)
{
@@ -232,7 +230,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
vlog_error(
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
error, j);
goto exit;
return error;
}
}
else
@@ -258,25 +256,25 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
&gOutBuffer[j])))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer),
&gInBuffer)))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer2),
&gInBuffer2)))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer3),
&gInBuffer3)))
{
LogBuildError(programs[j]);
goto exit;
return error;
}
if ((error =
@@ -284,7 +282,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
&localCount, NULL, 0, NULL, NULL)))
{
vlog_error("FAILED -- could not execute kernel\n");
goto exit;
return error;
}
}
@@ -307,7 +305,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
{
vlog_error("ReadArray failed %d\n", error);
goto exit;
return error;
}
}
@@ -635,8 +633,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
"%.13la, %.13la}: *%.13la vs. %.13la\n",
f->name, sizeNames[k], err, s[j], s2[j],
s3[j], ((double *)gOut_Ref)[j], test);
error = -1;
goto exit;
return -1;
}
}
}
@@ -671,6 +668,5 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
vlog("\n");
exit:
return error;
return CL_SUCCESS;
}