diff --git a/test_conformance/math_brute_force/binary_double.cpp b/test_conformance/math_brute_force/binary_double.cpp index cbb186ed..16c30617 100644 --- a/test_conformance/math_brute_force/binary_double.cpp +++ b/test_conformance/math_brute_force/binary_double.cpp @@ -22,9 +22,8 @@ const double twoToMinus1022 = MAKE_HEX_DOUBLE(0x1p-1022, 1, -1022); -static int BuildKernelDouble(const char *name, int vectorSize, - cl_uint kernel_count, cl_kernel *k, cl_program *p, - bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_uint kernel_count, + cl_kernel *k, cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -120,14 +119,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernel_count, - info->kernels[i], info->programs + i, - info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -170,7 +167,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const double specialValuesDouble[] = { +static const double specialValues[] = { -NAN, -INFINITY, -DBL_MAX, @@ -280,10 +277,10 @@ static const double specialValuesDouble[] = { +0.0, }; -static size_t specialValuesDoubleCount = - sizeof(specialValuesDouble) / sizeof(specialValuesDouble[0]); +static size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) { @@ -411,7 +408,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -420,7 +417,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -562,7 +559,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -608,8 +605,7 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_ulong *p = (cl_ulong *)gIn + thread_id * buffer_elements; cl_ulong *p2 = (cl_ulong *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesDoubleCount * specialValuesDoubleCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -618,18 +614,18 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_double *fp2 = (cl_double *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesDoubleCount; - y = (job_id * buffer_elements) / specialValuesDoubleCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesDouble[x]; - fp2[j] = specialValuesDouble[y]; - if (++x >= specialValuesDoubleCount) + fp[j] = specialValues[x]; + fp2[j] = specialValues[y]; + if (++x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesDoubleCount) break; + if (y >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index 8dfb9f40..fb56c642 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -117,8 +117,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -166,7 +165,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const float specialValuesFloat[] = { +static const float specialValues[] = { -NAN, -INFINITY, -FLT_MAX, @@ -268,11 +267,10 @@ static const float specialValuesFloat[] = { +0.0f, }; -static const size_t specialValuesFloatCount = - sizeof(specialValuesFloat) / sizeof(specialValuesFloat[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); - -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) { @@ -402,7 +400,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -411,7 +409,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -552,7 +550,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -613,8 +611,7 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) cl_uint *p2 = (cl_uint *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesFloatCount * specialValuesFloatCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -623,19 +620,19 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) float *fp2 = (float *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesFloatCount; - y = (job_id * buffer_elements) / specialValuesFloatCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesFloat[x]; - fp2[j] = specialValuesFloat[y]; + fp[j] = specialValues[x]; + fp2[j] = specialValues[y]; ++x; - if (x >= specialValuesFloatCount) + if (x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesFloatCount) break; + if (y >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/binary_i_double.cpp b/test_conformance/math_brute_force/binary_i_double.cpp index eb2c59e0..74d0819c 100644 --- a/test_conformance/math_brute_force/binary_i_double.cpp +++ b/test_conformance/math_brute_force/binary_i_double.cpp @@ -21,9 +21,8 @@ #include #include -static int BuildKernelDouble(const char *name, int vectorSize, - cl_uint kernel_count, cl_kernel *k, cl_program *p, - bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_uint kernel_count, + cl_kernel *k, cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -119,14 +118,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernel_count, - info->kernels[i], info->programs + i, - info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -165,7 +162,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const double specialValuesDouble[] = { +static const double specialValues[] = { -NAN, -INFINITY, -DBL_MAX, @@ -275,17 +272,17 @@ static const double specialValuesDouble[] = { +0.0, }; -static size_t specialValuesDoubleCount = - sizeof(specialValuesDouble) / sizeof(specialValuesDouble[0]); +static size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static const int specialValuesInt2[] = { 0, 1, 2, 3, - 1022, 1023, 1024, INT_MIN, - INT_MAX, -1, -2, -3, - -1022, -1023, -11024, -INT_MAX }; -static constexpr size_t specialValuesInt2Count = - sizeof(specialValuesInt2) / sizeof(specialValuesInt2[0]); +static const int specialValuesInt[] = { + 0, 1, 2, 3, 1022, 1023, 1024, INT_MIN, + INT_MAX, -1, -2, -3, -1022, -1023, -11024, -INT_MAX, +}; +static constexpr size_t specialValuesIntCount = + sizeof(specialValuesInt) / sizeof(specialValuesInt[0]); -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) { @@ -412,7 +409,7 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -421,7 +418,7 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -564,7 +561,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -608,8 +605,7 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_ulong *p = (cl_ulong *)gIn + thread_id * buffer_elements; cl_int *p2 = (cl_int *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesDoubleCount * specialValuesInt2Count; + int totalSpecialValueCount = specialValuesCount * specialValuesIntCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -618,18 +614,18 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_int *ip2 = (cl_int *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesDoubleCount; - y = (job_id * buffer_elements) / specialValuesDoubleCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesDouble[x]; - ip2[j] = specialValuesInt2[y]; - if (++x >= specialValuesDoubleCount) + fp[j] = specialValues[x]; + ip2[j] = specialValuesInt[y]; + if (++x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesInt2Count) break; + if (y >= specialValuesIntCount) break; } } } diff --git a/test_conformance/math_brute_force/binary_i_float.cpp b/test_conformance/math_brute_force/binary_i_float.cpp index 019c96a5..6b128937 100644 --- a/test_conformance/math_brute_force/binary_i_float.cpp +++ b/test_conformance/math_brute_force/binary_i_float.cpp @@ -116,8 +116,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -161,7 +160,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const float specialValuesFloat[] = { +static const float specialValues[] = { -NAN, -INFINITY, -FLT_MAX, @@ -263,19 +262,19 @@ static const float specialValuesFloat[] = { +0.0f, }; -static const size_t specialValuesFloatCount = - sizeof(specialValuesFloat) / sizeof(specialValuesFloat[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); static const int specialValuesInt[] = { - 0, 1, 2, 3, 126, 127, - 128, 0x02000001, 0x04000001, 1465264071, 1488522147, -1, - -2, -3, -126, -127, -128, -0x02000001, - -0x04000001, -1465264071, -1488522147 + 0, 1, 2, 3, 126, 127, + 128, 0x02000001, 0x04000001, 1465264071, 1488522147, -1, + -2, -3, -126, -127, -128, -0x02000001, + -0x04000001, -1465264071, -1488522147, }; static size_t specialValuesIntCount = sizeof(specialValuesInt) / sizeof(specialValuesInt[0]); -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) { @@ -403,7 +402,7 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -412,7 +411,7 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -553,7 +552,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -596,8 +595,7 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) cl_uint *p2 = (cl_uint *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesFloatCount * specialValuesIntCount; + int totalSpecialValueCount = specialValuesCount * specialValuesIntCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -606,15 +604,15 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) cl_int *ip2 = (cl_int *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesFloatCount; - y = (job_id * buffer_elements) / specialValuesFloatCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesFloat[x]; + fp[j] = specialValues[x]; ip2[j] = specialValuesInt[y]; ++x; - if (x >= specialValuesFloatCount) + if (x >= specialValuesCount) { x = 0; y++; diff --git a/test_conformance/math_brute_force/binary_operator_double.cpp b/test_conformance/math_brute_force/binary_operator_double.cpp index a7fb3cd0..a762e3e9 100644 --- a/test_conformance/math_brute_force/binary_operator_double.cpp +++ b/test_conformance/math_brute_force/binary_operator_double.cpp @@ -20,9 +20,9 @@ #include -static int BuildKernelDouble(const char *name, const char *operator_symbol, - int vectorSize, cl_uint kernel_count, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, const char *operator_symbol, + int vectorSize, cl_uint kernel_count, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void ", @@ -123,14 +123,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->name, info->operator_symbol, i, - info->kernel_count, info->kernels[i], - info->programs + i, info->relaxedMode); + return BuildKernel(info->name, info->operator_symbol, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -171,7 +169,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const double specialValuesDouble[] = { +static const double specialValues[] = { -NAN, -INFINITY, -DBL_MAX, @@ -281,10 +279,10 @@ static const double specialValuesDouble[] = { +0.0, }; -static size_t specialValuesDoubleCount = - sizeof(specialValuesDouble) / sizeof(specialValuesDouble[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, bool relaxedMode) @@ -412,7 +410,7 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, f->name, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -421,7 +419,7 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -563,7 +561,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -608,8 +606,7 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_ulong *p = (cl_ulong *)gIn + thread_id * buffer_elements; cl_ulong *p2 = (cl_ulong *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesDoubleCount * specialValuesDoubleCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -618,18 +615,18 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) cl_double *fp2 = (cl_double *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesDoubleCount; - y = (job_id * buffer_elements) / specialValuesDoubleCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesDouble[x]; - fp2[j] = specialValuesDouble[y]; - if (++x >= specialValuesDoubleCount) + fp[j] = specialValues[x]; + fp2[j] = specialValues[y]; + if (++x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesDoubleCount) break; + if (y >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index a9d3b7cf..5ec6b5d3 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -121,8 +121,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -168,7 +167,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const float specialValuesFloat[] = { +static const float specialValues[] = { -NAN, -INFINITY, -FLT_MAX, @@ -270,10 +269,10 @@ static const float specialValuesFloat[] = { +0.0f, }; -static const size_t specialValuesFloatCount = - sizeof(specialValuesFloat) / sizeof(specialValuesFloat[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, bool relaxedMode) @@ -403,7 +402,7 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, f->name, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -412,7 +411,7 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -553,7 +552,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -604,8 +603,7 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) cl_uint *p2 = (cl_uint *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesFloatCount * specialValuesFloatCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -613,19 +611,19 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) // Insert special values uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesFloatCount; - y = (job_id * buffer_elements) / specialValuesFloatCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - p[j] = ((cl_uint *)specialValuesFloat)[x]; - p2[j] = ((cl_uint *)specialValuesFloat)[y]; + p[j] = ((cl_uint *)specialValues)[x]; + p2[j] = ((cl_uint *)specialValues)[y]; ++x; - if (x >= specialValuesFloatCount) + if (x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesFloatCount) break; + if (y >= specialValuesCount) break; } if (relaxedMode && strcmp(name, "divide") == 0) { 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 7f22af2a..71e11fc6 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 @@ -21,8 +21,8 @@ #include #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -124,13 +124,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } typedef struct ComputeReferenceInfoD_ @@ -194,7 +193,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 1daf2b99..9db5c1c1 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 @@ -122,8 +122,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -195,7 +194,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error; diff --git a/test_conformance/math_brute_force/i_unary_double.cpp b/test_conformance/math_brute_force/i_unary_double.cpp index f52fc136..51243ffa 100644 --- a/test_conformance/math_brute_force/i_unary_double.cpp +++ b/test_conformance/math_brute_force/i_unary_double.cpp @@ -20,8 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -109,13 +109,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode) @@ -143,7 +142,7 @@ int TestFunc_Int_Double(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 6b4a0f8c..d1fb867d 100644 --- a/test_conformance/math_brute_force/i_unary_float.cpp +++ b/test_conformance/math_brute_force/i_unary_float.cpp @@ -107,8 +107,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -141,7 +140,7 @@ int TestFunc_Int_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 2ea785e6..02c042b9 100644 --- a/test_conformance/math_brute_force/macro_binary_double.cpp +++ b/test_conformance/math_brute_force/macro_binary_double.cpp @@ -20,9 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, - cl_uint kernel_count, cl_kernel *k, cl_program *p, - bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_uint kernel_count, + cl_kernel *k, cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -118,14 +117,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernel_count, - info->kernels[i], info->programs + i, - info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -157,7 +154,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const double specialValuesDouble[] = { +static const double specialValues[] = { -NAN, -INFINITY, -DBL_MAX, @@ -267,10 +264,10 @@ static const double specialValuesDouble[] = { +0.0, }; -static size_t specialValuesDoubleCount = - sizeof(specialValuesDouble) / sizeof(specialValuesDouble[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) { @@ -390,7 +387,7 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -399,7 +396,7 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); if (error) goto exit; @@ -530,7 +527,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -573,26 +570,25 @@ static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) double *p = (double *)gIn + thread_id * buffer_elements; double *p2 = (double *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesDoubleCount * specialValuesDoubleCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) { // test edge cases uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesDoubleCount; - y = (job_id * buffer_elements) / specialValuesDoubleCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - p[j] = specialValuesDouble[x]; - p2[j] = specialValuesDouble[y]; - if (++x >= specialValuesDoubleCount) + p[j] = specialValues[x]; + p2[j] = specialValues[y]; + if (++x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesDoubleCount) break; + if (y >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/macro_binary_float.cpp b/test_conformance/math_brute_force/macro_binary_float.cpp index a61ab6b3..8f2e41fc 100644 --- a/test_conformance/math_brute_force/macro_binary_float.cpp +++ b/test_conformance/math_brute_force/macro_binary_float.cpp @@ -115,8 +115,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -153,7 +152,7 @@ typedef struct TestInfo } TestInfo; // A table of more difficult cases to get right -static const float specialValuesFloat[] = { +static const float specialValues[] = { -NAN, -INFINITY, -FLT_MAX, @@ -255,10 +254,10 @@ static const float specialValuesFloat[] = { +0.0f, }; -static const size_t specialValuesFloatCount = - sizeof(specialValuesFloat) / sizeof(specialValuesFloat[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) { @@ -379,7 +378,7 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -388,7 +387,7 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); if (error) goto exit; @@ -516,7 +515,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; @@ -558,8 +557,7 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) cl_uint *p2 = (cl_uint *)gIn2 + thread_id * buffer_elements; j = 0; - int totalSpecialValueCount = - specialValuesFloatCount * specialValuesFloatCount; + int totalSpecialValueCount = specialValuesCount * specialValuesCount; int indx = (totalSpecialValueCount - 1) / buffer_elements; if (job_id <= (cl_uint)indx) @@ -568,19 +566,19 @@ static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) float *fp2 = (float *)p2; uint32_t x, y; - x = (job_id * buffer_elements) % specialValuesFloatCount; - y = (job_id * buffer_elements) / specialValuesFloatCount; + x = (job_id * buffer_elements) % specialValuesCount; + y = (job_id * buffer_elements) / specialValuesCount; for (; j < buffer_elements; j++) { - fp[j] = specialValuesFloat[x]; - fp2[j] = specialValuesFloat[y]; + fp[j] = specialValues[x]; + fp2[j] = specialValues[y]; ++x; - if (x >= specialValuesFloatCount) + if (x >= specialValuesCount) { x = 0; y++; - if (y >= specialValuesFloatCount) break; + if (y >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/macro_unary_double.cpp b/test_conformance/math_brute_force/macro_unary_double.cpp index 6f1e2718..2df22dcc 100644 --- a/test_conformance/math_brute_force/macro_unary_double.cpp +++ b/test_conformance/math_brute_force/macro_unary_double.cpp @@ -20,9 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, - cl_uint kernel_count, cl_kernel *k, cl_program *p, - bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_uint kernel_count, + cl_kernel *k, cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -112,14 +111,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernel_count, - info->kernels[i], info->programs + i, - info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -148,7 +145,7 @@ typedef struct TestInfo } TestInfo; -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) { @@ -256,7 +253,7 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -265,7 +262,7 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); if (error) goto exit; @@ -375,7 +372,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; diff --git a/test_conformance/math_brute_force/macro_unary_float.cpp b/test_conformance/math_brute_force/macro_unary_float.cpp index 86000a36..c44c1775 100644 --- a/test_conformance/math_brute_force/macro_unary_float.cpp +++ b/test_conformance/math_brute_force/macro_unary_float.cpp @@ -110,8 +110,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -145,7 +144,7 @@ typedef struct TestInfo } TestInfo; -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) { @@ -254,7 +253,7 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -263,7 +262,7 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); if (error) goto exit; @@ -372,7 +371,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; diff --git a/test_conformance/math_brute_force/mad_double.cpp b/test_conformance/math_brute_force/mad_double.cpp index 1393b1de..8502ceb2 100644 --- a/test_conformance/math_brute_force/mad_double.cpp +++ b/test_conformance/math_brute_force/mad_double.cpp @@ -20,8 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -122,13 +122,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) @@ -151,7 +150,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error; diff --git a/test_conformance/math_brute_force/mad_float.cpp b/test_conformance/math_brute_force/mad_float.cpp index eaab29fb..453e43e7 100644 --- a/test_conformance/math_brute_force/mad_float.cpp +++ b/test_conformance/math_brute_force/mad_float.cpp @@ -120,8 +120,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -150,7 +149,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error; diff --git a/test_conformance/math_brute_force/ternary_double.cpp b/test_conformance/math_brute_force/ternary_double.cpp index dc4bd8c6..21c00f51 100644 --- a/test_conformance/math_brute_force/ternary_double.cpp +++ b/test_conformance/math_brute_force/ternary_double.cpp @@ -23,8 +23,8 @@ #define CORRECTLY_ROUNDED 0 #define FLUSHED 1 -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -125,17 +125,16 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } // A table of more difficult cases to get right -static const double specialValuesDouble[] = { +static const double specialValues[] = { -NAN, -INFINITY, -DBL_MAX, @@ -203,8 +202,8 @@ static const double specialValuesDouble[] = { +0.0, }; -static const size_t specialValuesDoubleCount = - sizeof(specialValuesDouble) / sizeof(specialValuesDouble[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) @@ -230,7 +229,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error; @@ -249,16 +248,16 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, x = y = z = 0; for (; j < bufferSize / sizeof(double); j++) { - p[j] = specialValuesDouble[x]; - p2[j] = specialValuesDouble[y]; - p3[j] = specialValuesDouble[z]; - if (++x >= specialValuesDoubleCount) + p[j] = specialValues[x]; + p2[j] = specialValues[y]; + p3[j] = specialValues[z]; + if (++x >= specialValuesCount) { x = 0; - if (++y >= specialValuesDoubleCount) + if (++y >= specialValuesCount) { y = 0; - if (++z >= specialValuesDoubleCount) break; + if (++z >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/ternary_float.cpp b/test_conformance/math_brute_force/ternary_float.cpp index 1fcdc4a2..20b3eb71 100644 --- a/test_conformance/math_brute_force/ternary_float.cpp +++ b/test_conformance/math_brute_force/ternary_float.cpp @@ -123,8 +123,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -133,7 +132,7 @@ static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, } // A table of more difficult cases to get right -static const float specialValuesFloat[] = { +static const float specialValues[] = { -NAN, -INFINITY, -FLT_MAX, @@ -211,8 +210,8 @@ static const float specialValuesFloat[] = { +0.0f, }; -static const size_t specialValuesFloatCount = - sizeof(specialValuesFloat) / sizeof(specialValuesFloat[0]); +static const size_t specialValuesCount = + sizeof(specialValues) / sizeof(specialValues[0]); int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) { @@ -246,7 +245,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error; @@ -268,17 +267,17 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) x = y = z = 0; for (; j < bufferSize / sizeof(float); j++) { - fp[j] = specialValuesFloat[x]; - fp2[j] = specialValuesFloat[y]; - fp3[j] = specialValuesFloat[z]; + fp[j] = specialValues[x]; + fp2[j] = specialValues[y]; + fp3[j] = specialValues[z]; - if (++x >= specialValuesFloatCount) + if (++x >= specialValuesCount) { x = 0; - if (++y >= specialValuesFloatCount) + if (++y >= specialValuesCount) { y = 0; - if (++z >= specialValuesFloatCount) break; + if (++z >= specialValuesCount) break; } } } diff --git a/test_conformance/math_brute_force/unary_double.cpp b/test_conformance/math_brute_force/unary_double.cpp index 99959ae3..9ba457c7 100644 --- a/test_conformance/math_brute_force/unary_double.cpp +++ b/test_conformance/math_brute_force/unary_double.cpp @@ -24,9 +24,8 @@ #include #endif -static int BuildKernelDouble(const char *name, int vectorSize, - cl_uint kernel_count, cl_kernel *k, cl_program *p, - bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_uint kernel_count, + cl_kernel *k, cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -116,14 +115,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernel_count, - info->kernels[i], info->programs + i, - info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernel_count, + info->kernels[i], info->programs + i, info->relaxedMode); } // Thread specific data for a worker thread @@ -160,7 +157,7 @@ typedef struct TestInfo // otherwise. } TestInfo; -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) { @@ -276,7 +273,7 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -285,7 +282,7 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting) { - error = ThreadPool_Do(TestDouble, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -424,7 +421,7 @@ exit: return error; } -static cl_int TestDouble(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index 52ba0eb5..ee250f34 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -113,8 +113,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -156,7 +155,7 @@ typedef struct TestInfo // otherwise. } TestInfo; -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *p); +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data); int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) { @@ -287,7 +286,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) gMinVectorSizeIndex, test_info.threadCount, test_info.k, test_info.programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) goto exit; @@ -296,7 +295,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) // Run the kernels if (!gSkipCorrectnessTesting || skipTestingRelaxed) { - error = ThreadPool_Do(TestFloat, test_info.jobCount, &test_info); + error = ThreadPool_Do(Test, test_info.jobCount, &test_info); // Accumulate the arithmetic errors for (i = 0; i < test_info.threadCount; i++) @@ -430,7 +429,7 @@ exit: return error; } -static cl_int TestFloat(cl_uint job_id, cl_uint thread_id, void *data) +static cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { const TestInfo *job = (const TestInfo *)data; size_t buffer_elements = job->subBufferSize; 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 e2231a58..d42b7ce6 100644 --- a/test_conformance/math_brute_force/unary_two_results_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_double.cpp @@ -20,8 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -116,13 +116,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) @@ -149,7 +148,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 d85d60f0..70b24c7a 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -114,8 +114,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -151,7 +150,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 4bf017ce..44eab122 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 @@ -21,8 +21,8 @@ #include #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -117,13 +117,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } static cl_ulong abs_cl_long(cl_long i) @@ -157,7 +156,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 9bf297ed..1312be01 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 @@ -115,8 +115,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -161,7 +160,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 e0641b6a..80acafb3 100644 --- a/test_conformance/math_brute_force/unary_u_double.cpp +++ b/test_conformance/math_brute_force/unary_u_double.cpp @@ -20,8 +20,8 @@ #include -static int BuildKernelDouble(const char *name, int vectorSize, cl_kernel *k, - cl_program *p, bool relaxedMode) +static int BuildKernel(const char *name, int vectorSize, cl_kernel *k, + cl_program *p, bool relaxedMode) { const char *c[] = { "#pragma OPENCL EXTENSION cl_khr_fp64 : enable\n", "__kernel void math_kernel", @@ -111,13 +111,12 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_DoubleFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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 BuildKernelDouble(info->nameInCode, i, info->kernels + i, - info->programs + i, info->relaxedMode); + return BuildKernel(info->nameInCode, i, info->kernels + i, + info->programs + i, info->relaxedMode); } static cl_ulong random64(MTdata d) @@ -146,7 +145,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_DoubleFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) 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 2ff57526..4b453c87 100644 --- a/test_conformance/math_brute_force/unary_u_float.cpp +++ b/test_conformance/math_brute_force/unary_u_float.cpp @@ -108,8 +108,7 @@ typedef struct BuildKernelInfo bool relaxedMode; // Whether to build with -cl-fast-relaxed-math. } BuildKernelInfo; -static cl_int BuildKernel_FloatFn(cl_uint job_id, cl_uint thread_id UNUSED, - void *p) +static 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; @@ -145,7 +144,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) { BuildKernelInfo build_info = { gMinVectorSizeIndex, kernels, programs, f->nameInCode, relaxedMode }; - if ((error = ThreadPool_Do(BuildKernel_FloatFn, + if ((error = ThreadPool_Do(BuildKernelFn, gMaxVectorSizeIndex - gMinVectorSizeIndex, &build_info))) return error;