mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
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:
committed by
GitHub
parent
11782f7650
commit
1e5b5c96e2
@@ -168,14 +168,12 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
int skipNanInf = (0 == strcmp("fma", f->nameInCode)) && !gInfNanSupport;
|
||||
|
||||
// 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)
|
||||
{
|
||||
@@ -254,7 +252,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog_error(
|
||||
"\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n",
|
||||
error, j);
|
||||
goto exit;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -280,25 +278,25 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
&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 =
|
||||
@@ -306,7 +304,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
&localCount, NULL, 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("FAILED -- could not execute kernel\n");
|
||||
goto exit;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -344,7 +342,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
BUFFER_SIZE, gOut[j], 0, NULL, NULL)))
|
||||
{
|
||||
vlog_error("ReadArray failed %d\n", error);
|
||||
goto exit;
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,8 +770,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
f->name, sizeNames[k], err, s[j], s2[j], s3[j],
|
||||
((cl_uint *)s)[j], ((cl_uint *)s2)[j],
|
||||
((cl_uint *)s3)[j], ((float *)gOut_Ref)[j], test);
|
||||
error = -1;
|
||||
goto exit;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -807,6 +804,5 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
return error;
|
||||
return CL_SUCCESS;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user