diff --git a/test_conformance/math_brute_force/binary_double.cpp b/test_conformance/math_brute_force/binary_double.cpp index e987774a..0869acad 100644 --- a/test_conformance/math_brute_force/binary_double.cpp +++ b/test_conformance/math_brute_force/binary_double.cpp @@ -117,7 +117,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -127,7 +127,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -150,7 +150,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -791,7 +793,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index e8baccdc..aea86ca7 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -115,7 +115,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -125,7 +125,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -148,7 +148,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -948,7 +950,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_i_double.cpp b/test_conformance/math_brute_force/binary_i_double.cpp index 3c4ef4a4..eb94b5f7 100644 --- a/test_conformance/math_brute_force/binary_i_double.cpp +++ b/test_conformance/math_brute_force/binary_i_double.cpp @@ -116,7 +116,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -126,7 +126,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -149,7 +149,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -713,7 +715,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_i_float.cpp b/test_conformance/math_brute_force/binary_i_float.cpp index dcda5f82..f6e4d2fc 100644 --- a/test_conformance/math_brute_force/binary_i_float.cpp +++ b/test_conformance/math_brute_force/binary_i_float.cpp @@ -114,7 +114,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -124,7 +124,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -147,7 +147,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -706,7 +708,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_operator_double.cpp b/test_conformance/math_brute_force/binary_operator_double.cpp index 4661f240..f94b8aa4 100644 --- a/test_conformance/math_brute_force/binary_operator_double.cpp +++ b/test_conformance/math_brute_force/binary_operator_double.cpp @@ -116,7 +116,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *operator_symbol; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -126,7 +126,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->operator_symbol, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -149,7 +149,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -758,7 +760,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index 7a239963..64a4c4af 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -114,7 +114,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *operator_symbol; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -124,7 +124,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->operator_symbol, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -147,7 +147,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -885,7 +887,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/binary_two_results_i_double.cpp b/test_conformance/math_brute_force/binary_two_results_i_double.cpp index be7064e4..132ff593 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -121,7 +122,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -131,7 +132,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } struct ComputeReferenceInfoD @@ -172,7 +173,7 @@ cl_int ReferenceD(cl_uint jid, cl_uint tid, void *userInfo) int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int64_t maxError2 = 0; @@ -577,7 +578,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/binary_two_results_i_float.cpp b/test_conformance/math_brute_force/binary_two_results_i_float.cpp index 901c8598..017ad125 100644 --- a/test_conformance/math_brute_force/binary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/binary_two_results_i_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -119,7 +120,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -129,7 +130,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } struct ComputeReferenceInfoF @@ -171,7 +172,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_float), relaxedMode); - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities); @@ -562,7 +563,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/common.h b/test_conformance/math_brute_force/common.h index 3eafb6de..5c1f8e6d 100644 --- a/test_conformance/math_brute_force/common.h +++ b/test_conformance/math_brute_force/common.h @@ -16,6 +16,7 @@ #ifndef COMMON_H #define COMMON_H +#include "harness/typeWrappers.h" #include "utility.h" #include @@ -24,4 +25,7 @@ // Array of thread-specific kernels for each vector size. using KernelMatrix = std::array, VECTOR_SIZE_COUNT>; +// Array of programs for each vector size. +using Programs = std::array; + #endif /* COMMON_H */ diff --git a/test_conformance/math_brute_force/i_unary_double.cpp b/test_conformance/math_brute_force/i_unary_double.cpp index f07dd78d..1900afe4 100644 --- a/test_conformance/math_brute_force/i_unary_double.cpp +++ b/test_conformance/math_brute_force/i_unary_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -106,7 +107,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -116,7 +117,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -124,7 +125,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; int ftz = f->ftz || gForceFTZ; uint64_t step = getTestStep(sizeof(cl_double), BUFFER_SIZE); @@ -299,7 +300,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/i_unary_float.cpp b/test_conformance/math_brute_force/i_unary_float.cpp index c38bdcf9..baf0ab67 100644 --- a/test_conformance/math_brute_force/i_unary_float.cpp +++ b/test_conformance/math_brute_force/i_unary_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -104,7 +105,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -114,7 +115,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -122,7 +123,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities); uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE); @@ -295,7 +296,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/macro_binary_double.cpp b/test_conformance/math_brute_force/macro_binary_double.cpp index a6f65ac4..8f723a08 100644 --- a/test_conformance/math_brute_force/macro_binary_double.cpp +++ b/test_conformance/math_brute_force/macro_binary_double.cpp @@ -115,7 +115,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -125,7 +125,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -143,7 +143,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -703,7 +705,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/macro_binary_float.cpp b/test_conformance/math_brute_force/macro_binary_float.cpp index 3fe02629..bdcb0925 100644 --- a/test_conformance/math_brute_force/macro_binary_float.cpp +++ b/test_conformance/math_brute_force/macro_binary_float.cpp @@ -113,7 +113,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -123,7 +123,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -141,7 +141,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -692,7 +694,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/macro_unary_double.cpp b/test_conformance/math_brute_force/macro_unary_double.cpp index c44ebe21..0d086614 100644 --- a/test_conformance/math_brute_force/macro_unary_double.cpp +++ b/test_conformance/math_brute_force/macro_unary_double.cpp @@ -109,7 +109,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -119,7 +119,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -135,7 +135,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -476,7 +478,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/macro_unary_float.cpp b/test_conformance/math_brute_force/macro_unary_float.cpp index d9d79094..ea485b05 100644 --- a/test_conformance/math_brute_force/macro_unary_float.cpp +++ b/test_conformance/math_brute_force/macro_unary_float.cpp @@ -108,7 +108,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -118,7 +118,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -134,7 +134,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -490,7 +492,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/mad_double.cpp b/test_conformance/math_brute_force/mad_double.cpp index 8e88f9f6..77428d06 100644 --- a/test_conformance/math_brute_force/mad_double.cpp +++ b/test_conformance/math_brute_force/mad_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -119,7 +120,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -129,7 +130,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -137,7 +138,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; double maxErrorVal = 0.0f; @@ -298,7 +299,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/mad_float.cpp b/test_conformance/math_brute_force/mad_float.cpp index 0552ba4b..9a7730f1 100644 --- a/test_conformance/math_brute_force/mad_float.cpp +++ b/test_conformance/math_brute_force/mad_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -117,7 +118,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -127,7 +128,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -138,7 +139,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_float), relaxedMode); - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; float maxErrorVal = 0.0f; @@ -297,7 +298,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/main.cpp b/test_conformance/math_brute_force/main.cpp index 1a6e0c4e..d1d146a1 100644 --- a/test_conformance/math_brute_force/main.cpp +++ b/test_conformance/math_brute_force/main.cpp @@ -1092,7 +1092,6 @@ int MakeKernels(const char **c, cl_uint count, const char *name, clGetProgramBuildInfo(*p, gDevice, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, NULL); vlog_error("Log: %s\n", buffer); - clReleaseProgram(*p); return error; } } diff --git a/test_conformance/math_brute_force/ternary_double.cpp b/test_conformance/math_brute_force/ternary_double.cpp index a3db3353..c4a9a1c4 100644 --- a/test_conformance/math_brute_force/ternary_double.cpp +++ b/test_conformance/math_brute_force/ternary_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -122,7 +123,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -132,7 +133,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } // A table of more difficult cases to get right @@ -213,7 +214,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int ftz = f->ftz || gForceFTZ; @@ -737,7 +738,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/ternary_float.cpp b/test_conformance/math_brute_force/ternary_float.cpp index fdcb48c4..36d957ce 100644 --- a/test_conformance/math_brute_force/ternary_float.cpp +++ b/test_conformance/math_brute_force/ternary_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -120,7 +121,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -130,7 +131,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } // A table of more difficult cases to get right @@ -223,7 +224,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_float), relaxedMode); - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities); @@ -872,7 +873,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_double.cpp b/test_conformance/math_brute_force/unary_double.cpp index 3b91b4cd..3351ea35 100644 --- a/test_conformance/math_brute_force/unary_double.cpp +++ b/test_conformance/math_brute_force/unary_double.cpp @@ -109,7 +109,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -119,7 +119,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -137,7 +137,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -514,7 +516,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index e5576e7e..37a63732 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -107,7 +107,7 @@ struct BuildKernelInfo cl_uint offset; // the first vector size to build cl_uint kernel_count; KernelMatrix &kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -117,7 +117,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernel_count, - info->kernels[i].data(), info->programs + i, + info->kernels[i].data(), &(info->programs[i]), info->relaxedMode); } @@ -135,7 +135,9 @@ struct TestInfo { size_t subBufferSize; // Size of the sub-buffer in elements const Func *f; // A pointer to the function info - cl_program programs[VECTOR_SIZE_COUNT]; // programs for various vector sizes + + // Programs for various vector sizes. + Programs programs; // Thread-specific kernels for each vector size: // k[vector_size][thread_id] @@ -691,7 +693,6 @@ exit: // Release for (auto i = gMinVectorSizeIndex; i < gMaxVectorSizeIndex; i++) { - clReleaseProgram(test_info.programs[i]); for (auto &kernel : test_info.k[i]) { clReleaseKernel(kernel); diff --git a/test_conformance/math_brute_force/unary_two_results_double.cpp b/test_conformance/math_brute_force/unary_two_results_double.cpp index 5556a080..5887f192 100644 --- a/test_conformance/math_brute_force/unary_two_results_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -113,7 +114,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -123,7 +124,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -131,7 +132,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError0 = 0.0f; float maxError1 = 0.0f; @@ -443,7 +444,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_two_results_float.cpp b/test_conformance/math_brute_force/unary_two_results_float.cpp index c95b10d3..fb8d5535 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -111,7 +112,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -121,7 +122,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -129,7 +130,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError0 = 0.0f; float maxError1 = 0.0f; @@ -575,7 +576,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_two_results_i_double.cpp b/test_conformance/math_brute_force/unary_two_results_i_double.cpp index c976061c..6f2de049 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -114,7 +115,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -124,7 +125,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } cl_ulong abs_cl_long(cl_long i) @@ -138,7 +139,7 @@ cl_ulong abs_cl_long(cl_long i) int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int64_t maxError2 = 0; @@ -415,7 +416,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_two_results_i_float.cpp b/test_conformance/math_brute_force/unary_two_results_i_float.cpp index 7a3cd981..529da8dc 100644 --- a/test_conformance/math_brute_force/unary_two_results_i_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_i_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -112,7 +113,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -122,7 +123,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } cl_ulong abs_cl_long(cl_long i) @@ -136,7 +137,7 @@ cl_ulong abs_cl_long(cl_long i) int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int64_t maxError2 = 0; @@ -413,7 +414,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_u_double.cpp b/test_conformance/math_brute_force/unary_u_double.cpp index 621ee6bb..8113b955 100644 --- a/test_conformance/math_brute_force/unary_u_double.cpp +++ b/test_conformance/math_brute_force/unary_u_double.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -108,7 +109,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -118,7 +119,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } cl_ulong random64(MTdata d) @@ -131,7 +132,7 @@ cl_ulong random64(MTdata d) int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int ftz = f->ftz || gForceFTZ; @@ -311,7 +312,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error; diff --git a/test_conformance/math_brute_force/unary_u_float.cpp b/test_conformance/math_brute_force/unary_u_float.cpp index 0eae2e54..ee077c80 100644 --- a/test_conformance/math_brute_force/unary_u_float.cpp +++ b/test_conformance/math_brute_force/unary_u_float.cpp @@ -14,6 +14,7 @@ // limitations under the License. // +#include "common.h" #include "function_list.h" #include "test_functions.h" #include "utility.h" @@ -105,7 +106,7 @@ struct BuildKernelInfo { cl_uint offset; // the first vector size to build cl_kernel *kernels; - cl_program *programs; + Programs &programs; const char *nameInCode; bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. }; @@ -115,7 +116,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) BuildKernelInfo *info = (BuildKernelInfo *)p; cl_uint i = info->offset + job_id; return BuildKernel(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + &(info->programs[i]), info->relaxedMode); } } // anonymous namespace @@ -123,7 +124,7 @@ cl_int BuildKernelFn(cl_uint job_id, cl_uint thread_id UNUSED, void *p) int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) { int error; - cl_program programs[VECTOR_SIZE_COUNT]; + Programs programs; cl_kernel kernels[VECTOR_SIZE_COUNT]; float maxError = 0.0f; int ftz = f->ftz || gForceFTZ || 0 == (CL_FP_DENORM & gFloatCapabilities); @@ -313,7 +314,6 @@ exit: for (auto k = gMinVectorSizeIndex; k < gMaxVectorSizeIndex; k++) { clReleaseKernel(kernels[k]); - clReleaseProgram(programs[k]); } return error;