diff --git a/test_conformance/math_brute_force/binary_double.cpp b/test_conformance/math_brute_force/binary_double.cpp index 490c17b6..1b1f7d4c 100644 --- a/test_conformance/math_brute_force/binary_double.cpp +++ b/test_conformance/math_brute_force/binary_double.cpp @@ -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; diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index 01082bc1..d229a376 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -122,9 +122,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. @@ -950,10 +952,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; diff --git a/test_conformance/math_brute_force/binary_i_double.cpp b/test_conformance/math_brute_force/binary_i_double.cpp index def0bd41..7baa21a2 100644 --- a/test_conformance/math_brute_force/binary_i_double.cpp +++ b/test_conformance/math_brute_force/binary_i_double.cpp @@ -123,9 +123,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. @@ -715,10 +717,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; diff --git a/test_conformance/math_brute_force/binary_i_float.cpp b/test_conformance/math_brute_force/binary_i_float.cpp index ed207098..3f998e2e 100644 --- a/test_conformance/math_brute_force/binary_i_float.cpp +++ b/test_conformance/math_brute_force/binary_i_float.cpp @@ -121,9 +121,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. @@ -708,10 +710,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; diff --git a/test_conformance/math_brute_force/binary_operator_double.cpp b/test_conformance/math_brute_force/binary_operator_double.cpp index 992df276..74883664 100644 --- a/test_conformance/math_brute_force/binary_operator_double.cpp +++ b/test_conformance/math_brute_force/binary_operator_double.cpp @@ -123,9 +123,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. @@ -760,10 +762,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; diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index a555beaa..56f293c1 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -121,9 +121,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. @@ -887,10 +889,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; diff --git a/test_conformance/math_brute_force/common.h b/test_conformance/math_brute_force/common.h index f0d18dd9..6f17898f 100644 --- a/test_conformance/math_brute_force/common.h +++ b/test_conformance/math_brute_force/common.h @@ -28,6 +28,9 @@ using KernelMatrix = std::array, VECTOR_SIZE_COUNT>; // Array of programs for each vector size. using Programs = std::array; +// Array of buffers for each vector size. +using Buffers = std::array; + // Information to generate OpenCL kernels. struct BuildKernelInfo { diff --git a/test_conformance/math_brute_force/macro_binary_double.cpp b/test_conformance/math_brute_force/macro_binary_double.cpp index fb28d823..a697a7be 100644 --- a/test_conformance/math_brute_force/macro_binary_double.cpp +++ b/test_conformance/math_brute_force/macro_binary_double.cpp @@ -122,9 +122,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; + MTdata d; // Per thread command queue to improve performance @@ -705,10 +707,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; diff --git a/test_conformance/math_brute_force/macro_binary_float.cpp b/test_conformance/math_brute_force/macro_binary_float.cpp index fd93e2e6..97e2f675 100644 --- a/test_conformance/math_brute_force/macro_binary_float.cpp +++ b/test_conformance/math_brute_force/macro_binary_float.cpp @@ -120,9 +120,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; + MTdata d; // Per thread command queue to improve performance @@ -694,10 +696,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; diff --git a/test_conformance/math_brute_force/macro_unary_double.cpp b/test_conformance/math_brute_force/macro_unary_double.cpp index 2365a195..5a3ad355 100644 --- a/test_conformance/math_brute_force/macro_unary_double.cpp +++ b/test_conformance/math_brute_force/macro_unary_double.cpp @@ -116,8 +116,9 @@ 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 outBuf[VECTOR_SIZE_COUNT]; // output buffers for the thread + // Input and output buffers for the thread + clMemWrapper inBuf; + Buffers outBuf; // Per thread command queue to improve performance clCommandQueueWrapper tQueue; @@ -475,12 +476,5 @@ exit: } } - for (auto &threadInfo : test_info.tinfo) - { - clReleaseMemObject(threadInfo.inBuf); - for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) - clReleaseMemObject(threadInfo.outBuf[j]); - } - return error; } diff --git a/test_conformance/math_brute_force/macro_unary_float.cpp b/test_conformance/math_brute_force/macro_unary_float.cpp index adc6c3ec..d2982156 100644 --- a/test_conformance/math_brute_force/macro_unary_float.cpp +++ b/test_conformance/math_brute_force/macro_unary_float.cpp @@ -115,8 +115,9 @@ 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 outBuf[VECTOR_SIZE_COUNT]; // output buffers for the thread + // Input and output buffers for the thread + clMemWrapper inBuf; + Buffers outBuf; // Per thread command queue to improve performance clCommandQueueWrapper tQueue; @@ -489,12 +490,5 @@ exit: } } - for (auto &threadInfo : test_info.tinfo) - { - clReleaseMemObject(threadInfo.inBuf); - for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) - clReleaseMemObject(threadInfo.outBuf[j]); - } - return error; } diff --git a/test_conformance/math_brute_force/unary_double.cpp b/test_conformance/math_brute_force/unary_double.cpp index 19402283..7dfc12b1 100644 --- a/test_conformance/math_brute_force/unary_double.cpp +++ b/test_conformance/math_brute_force/unary_double.cpp @@ -116,8 +116,10 @@ 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 outBuf[VECTOR_SIZE_COUNT]; // output buffers for the thread + // Input and output buffers for the thread + clMemWrapper inBuf; + Buffers outBuf; + float maxError; // max error value. Init to 0. double maxErrorValue; // position of the max error value. Init to 0. @@ -513,12 +515,5 @@ exit: } } - for (auto &threadInfo : test_info.tinfo) - { - clReleaseMemObject(threadInfo.inBuf); - for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) - clReleaseMemObject(threadInfo.outBuf[j]); - } - return error; } diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index 5a9a7361..6a5c3539 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -114,8 +114,10 @@ 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 outBuf[VECTOR_SIZE_COUNT]; // output buffers for the thread + // Input and output buffers for the thread + clMemWrapper inBuf; + Buffers outBuf; + float maxError; // max error value. Init to 0. double maxErrorValue; // position of the max error value. Init to 0. @@ -690,12 +692,5 @@ exit: } } - for (auto &threadInfo : test_info.tinfo) - { - clReleaseMemObject(threadInfo.inBuf); - for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) - clReleaseMemObject(threadInfo.outBuf[j]); - } - return error; }