Share BuildKernelInfo struct definition (#1453)

Move the main `BuildKernelInfo` definition into `common.h` to reduce
code duplication.

Some tests (e.g. `i_unary_double.cpp`) use a different struct; rename
those structs to `BuildKernelInfo2` for now to avoid ambiguity.

Signed-off-by: Sven van Haastregt <sven.vanhaastregt@arm.com>
This commit is contained in:
Sven van Haastregt
2022-07-29 18:22:18 +01:00
committed by GitHub
parent 0a5a8f90c9
commit b06ccc6cd9
27 changed files with 68 additions and 178 deletions

View File

@@ -117,7 +117,7 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
return MakeKernel(kern, (cl_uint)kernSize, testName, k, p, relaxedMode);
}
struct BuildKernelInfo
struct BuildKernelInfo2
{
cl_uint offset; // the first vector size to build
cl_kernel *kernels;
@@ -128,7 +128,7 @@ struct BuildKernelInfo
cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
{
BuildKernelInfo *info = (BuildKernelInfo *)p;
BuildKernelInfo2 *info = (BuildKernelInfo2 *)p;
cl_uint i = info->offset + job_id;
return BuildKernel(info->nameInCode, i, info->kernels + i,
&(info->programs[i]), info->relaxedMode);
@@ -245,8 +245,8 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode)
// Init the kernels
{
BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs,
f->nameInCode, relaxedMode };
BuildKernelInfo2 build_info = { gMinVectorSizeIndex, kernels, programs,
f->nameInCode, relaxedMode };
if ((error = ThreadPool_Do(BuildKernelFn,
gMaxVectorSizeIndex - gMinVectorSizeIndex,
&build_info)))