mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 06:09:01 +00:00
math_brute_force: Use clKernelWrapper in single-threaded tests (#1590)
Simplify code by relying on RAII to free resources. This commit only affects tests that use `BuildKernelInfo2`, which are the single-threaded tests. Original patch by Marco Antognini. Signed-off-by: Marco Antognini <marco.antognini@arm.com> Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com> 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
fb949f9256
commit
884c736525
@@ -37,9 +37,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -49,7 +51,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -92,7 +95,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int64_t maxError2 = 0;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
@@ -496,11 +499,5 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -49,7 +51,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -93,7 +96,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
int64_t maxError2 = 0;
|
||||
@@ -481,11 +484,5 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -57,7 +60,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
uint64_t step = getTestStep(sizeof(cl_double), BUFFER_SIZE);
|
||||
int scale =
|
||||
@@ -228,11 +231,5 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
|
||||
exit:
|
||||
RestoreFPState(&oldMode);
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -57,7 +60,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE);
|
||||
int scale = (int)((1ULL << 32) / (16 * BUFFER_SIZE / sizeof(float)) + 1);
|
||||
@@ -226,11 +229,5 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
|
||||
exit:
|
||||
RestoreFPState(&oldMode);
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -57,7 +60,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
double maxErrorVal = 0.0f;
|
||||
double maxErrorVal2 = 0.0f;
|
||||
@@ -213,11 +216,5 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -60,7 +63,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
float maxErrorVal = 0.0f;
|
||||
float maxErrorVal2 = 0.0f;
|
||||
@@ -214,11 +217,5 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -51,7 +53,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -134,7 +137,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
double maxErrorVal = 0.0f;
|
||||
@@ -654,11 +657,5 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -39,9 +39,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -51,7 +53,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -146,7 +149,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
logFunctionInfo(f->name, sizeof(cl_float), relaxedMode);
|
||||
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
float maxErrorVal = 0.0f;
|
||||
@@ -790,11 +793,5 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -48,7 +50,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -58,7 +61,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError0 = 0.0f;
|
||||
float maxError1 = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
@@ -366,11 +369,5 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -36,9 +36,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -48,7 +50,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -58,7 +61,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError0 = 0.0f;
|
||||
float maxError1 = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
@@ -500,11 +503,5 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -49,7 +51,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -65,7 +68,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int64_t maxError2 = 0;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
@@ -338,11 +341,5 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -49,7 +51,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -65,7 +68,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int64_t maxError2 = 0;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
@@ -338,11 +341,5 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -62,7 +65,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ;
|
||||
double maxErrorVal = 0.0f;
|
||||
@@ -238,11 +241,5 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -35,9 +35,11 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
|
||||
relaxedMode);
|
||||
}
|
||||
|
||||
using Kernels = std::array<clKernelWrapper, VECTOR_SIZE_COUNT>;
|
||||
|
||||
struct BuildKernelInfo2
|
||||
{
|
||||
cl_kernel *kernels;
|
||||
Kernels &kernels;
|
||||
Programs &programs;
|
||||
const char *nameInCode;
|
||||
bool relaxedMode; // Whether to build with -cl-fast-relaxed-math.
|
||||
@@ -47,7 +49,8 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
|
||||
{
|
||||
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
|
||||
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
|
||||
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
|
||||
return BuildKernel(info->nameInCode, vectorSize,
|
||||
&(info->kernels[vectorSize]),
|
||||
&(info->programs[vectorSize]), info->relaxedMode);
|
||||
}
|
||||
|
||||
@@ -57,7 +60,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode)
|
||||
{
|
||||
int error;
|
||||
Programs programs;
|
||||
cl_kernel kernels[VECTOR_SIZE_COUNT];
|
||||
Kernels kernels;
|
||||
float maxError = 0.0f;
|
||||
int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities);
|
||||
float maxErrorVal = 0.0f;
|
||||
@@ -243,11 +246,5 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode)
|
||||
vlog("\n");
|
||||
|
||||
exit:
|
||||
// Release
|
||||
for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++)
|
||||
{
|
||||
clReleaseKernel(kernels[k]);
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user