Tidy up BuildKernelInfo (#1461)

Remove the `offset` field from both structures, because it was always
set to the global `gMinVectorSizeIndex`.

Improve documentation and rename some variables:
 - `i` becomes `vectorSize`;
 - `kernel_count` becomes `threadCount`.

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
2022-08-04 15:03:52 +01:00
committed by GitHub
parent c44b5b6ae3
commit c12bff46c6
27 changed files with 164 additions and 183 deletions

View File

@@ -121,7 +121,6 @@ int BuildKernel(const char *name, int vectorSize, cl_kernel *k, cl_program *p,
struct BuildKernelInfo2
{
cl_uint offset; // the first vector size to build
cl_kernel *kernels;
Programs &programs;
const char *nameInCode;
@@ -131,9 +130,9 @@ struct BuildKernelInfo2
cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *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);
cl_uint vectorSize = gMinVectorSizeIndex + job_id;
return BuildKernel(info->nameInCode, vectorSize, info->kernels + vectorSize,
&(info->programs[vectorSize]), info->relaxedMode);
}
// A table of more difficult cases to get right
@@ -229,8 +228,8 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d,
// Init the kernels
{
BuildKernelInfo2 build_info = { gMinVectorSizeIndex, kernels, programs,
f->nameInCode, relaxedMode };
BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode,
relaxedMode };
if ((error = ThreadPool_Do(BuildKernelFn,
gMaxVectorSizeIndex - gMinVectorSizeIndex,
&build_info)))