Use clMemWrapper in math_brute_force (#1476)

Simplify code by avoiding manual resource management.

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:
Sven van Haastregt
2022-09-01 06:43:43 +01:00
committed by GitHub
parent 8f5a2f0ae8
commit f94c135755
13 changed files with 57 additions and 92 deletions

View File

@@ -124,9 +124,11 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p)
// Thread specific data for a worker thread
struct ThreadInfo
{
cl_mem inBuf; // input buffer for the thread
cl_mem inBuf2; // input buffer for the thread
cl_mem outBuf[VECTOR_SIZE_COUNT]; // output buffers for the thread
// Input and output buffers for the thread
clMemWrapper inBuf;
clMemWrapper inBuf2;
Buffers outBuf;
float maxError; // max error value. Init to 0.
double
maxErrorValue; // position of the max error value (param 1). Init to 0.
@@ -793,10 +795,6 @@ exit:
for (auto &threadInfo : test_info.tinfo)
{
free_mtdata(threadInfo.d);
clReleaseMemObject(threadInfo.inBuf);
clReleaseMemObject(threadInfo.inBuf2);
for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++)
clReleaseMemObject(threadInfo.outBuf[j]);
}
return error;