diff --git a/test_conformance/math_brute_force/binary_double.cpp b/test_conformance/math_brute_force/binary_double.cpp index 431bcab5..cd47c76b 100644 --- a/test_conformance/math_brute_force/binary_double.cpp +++ b/test_conformance/math_brute_force/binary_double.cpp @@ -285,14 +285,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -303,12 +303,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -323,7 +323,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -368,7 +368,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -396,7 +396,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -542,8 +542,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "%.13la}: *%.13la vs. %.13la\n", name, sizeNames[k], err, s[j], s2[j], r[j], test); - error = -1; - goto exit; + return -1; } } } @@ -579,8 +578,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -636,7 +634,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -646,7 +644,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -659,7 +657,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -667,27 +665,26 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -700,8 +697,6 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -712,6 +707,5 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index f964920c..3bab4057 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -291,14 +291,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -309,12 +309,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -329,7 +329,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -374,7 +374,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -386,7 +386,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clFinish(tinfo->tQueue))) { vlog_error("Error: clFinish failed! err: %d\n", error); - goto exit; + return error; } return CL_SUCCESS; } @@ -441,7 +441,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -698,8 +698,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) name, sizeNames[k], err, s[j], ((cl_uint *)s)[j], s2[j], ((cl_uint *)s2)[j], r[j], test, ((cl_uint *)&test)[0], j); - error = -1; - goto exit; + return -1; } } } @@ -738,8 +737,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -795,7 +793,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -805,7 +803,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -818,7 +816,7 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -826,27 +824,26 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -859,8 +856,6 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -871,6 +866,5 @@ int TestFunc_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/binary_i_double.cpp b/test_conformance/math_brute_force/binary_i_double.cpp index 3b4d1e4b..a6c28557 100644 --- a/test_conformance/math_brute_force/binary_i_double.cpp +++ b/test_conformance/math_brute_force/binary_i_double.cpp @@ -288,14 +288,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size / 2, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -306,12 +306,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -326,7 +326,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -371,7 +371,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -399,7 +399,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -465,8 +465,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "*%.13la vs. %.13la\n", name, sizeNames[k], err, s[j], s2[j], r[j], test); - error = -1; - goto exit; + return -1; } } } @@ -485,7 +484,6 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clFlush(tinfo->tQueue))) vlog("clFlush 3 failed\n"); - if (0 == (base & 0x0fffffff)) { if (gVerboseBruteForce) @@ -502,8 +500,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -555,7 +552,7 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } cl_buffer_region region2 = { i * test_info.subBufferSize * sizeof(cl_int), @@ -568,7 +565,7 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -581,7 +578,7 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -589,27 +586,26 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -622,8 +618,6 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -634,6 +628,5 @@ int TestFunc_Double_Double_Int(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/binary_i_float.cpp b/test_conformance/math_brute_force/binary_i_float.cpp index 5c8e7224..dfe25efc 100644 --- a/test_conformance/math_brute_force/binary_i_float.cpp +++ b/test_conformance/math_brute_force/binary_i_float.cpp @@ -279,14 +279,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -297,12 +297,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -317,7 +317,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -362,7 +362,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -390,7 +390,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -458,8 +458,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) name, sizeNames[k], err, s[j], ((uint32_t *)s)[j], s2[j], r[j], ((uint32_t *)r)[j], test, ((cl_uint *)&test)[0], j); - error = -1; - goto exit; + return -1; } } } @@ -495,8 +494,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -549,7 +547,7 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } cl_buffer_region region2 = { i * test_info.subBufferSize * sizeof(cl_int), @@ -562,7 +560,7 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -575,7 +573,7 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -583,27 +581,26 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -616,8 +613,6 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -628,6 +623,5 @@ int TestFunc_Float_Float_Int(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/binary_operator_double.cpp b/test_conformance/math_brute_force/binary_operator_double.cpp index 2d202e9f..7600ab16 100644 --- a/test_conformance/math_brute_force/binary_operator_double.cpp +++ b/test_conformance/math_brute_force/binary_operator_double.cpp @@ -279,14 +279,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -297,12 +297,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -317,7 +317,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -362,7 +362,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -390,7 +390,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -512,8 +512,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) vlog_error( "\nERROR: %s%s: %f ulp error at {%a, %a}: *%a vs. %a\n", name, sizeNames[k], err, s[j], s2[j], r[j], test); - error = -1; - goto exit; + return -1; } } } @@ -549,8 +548,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -602,7 +600,7 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -612,7 +610,7 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -625,7 +623,7 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -633,27 +631,26 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -666,8 +663,6 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -678,6 +673,5 @@ int TestFunc_Double_Double_Double_Operator(const Func *f, MTdata d, vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index cc91a3a3..741c396c 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -292,14 +292,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -310,12 +310,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -330,7 +330,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -375,7 +375,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -432,7 +432,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -638,8 +638,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "vs. %a (0x%8.8x) at index: %zu\n", name, sizeNames[k], err, s[j], s2[j], r[j], test, ((cl_uint *)&test)[0], j); - error = -1; - goto exit; + return -1; } } } @@ -675,8 +674,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -730,7 +728,7 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -740,7 +738,7 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -753,7 +751,7 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -761,27 +759,26 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -794,8 +791,6 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -806,6 +801,5 @@ int TestFunc_Float_Float_Float_Operator(const Func *f, MTdata d, vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 cc5b2886..2cd7514a 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 @@ -112,14 +112,12 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) int testingRemquo = !strcmp(f->name, "remquo"); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -160,7 +158,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -171,7 +169,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -206,25 +204,25 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -232,7 +230,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -271,14 +269,14 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -488,8 +486,7 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) ((cl_ulong *)gOut_Ref)[j], ((cl_uint *)gOut_Ref2)[j], test, q2[j], ((cl_ulong *)q)[j], ((cl_uint *)q2)[j]); - error = -1; - goto exit; + return -1; } } } @@ -523,6 +520,5 @@ int TestFunc_DoubleI_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 12545898..4b74baab 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 @@ -115,14 +115,12 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) int testingRemquo = !strcmp(f->name, "remquo"); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -163,7 +161,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -174,7 +172,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -209,25 +207,25 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -235,7 +233,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -274,14 +272,14 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -473,8 +471,7 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) ((cl_uint *)gOut_Ref)[j], ((cl_uint *)gOut_Ref2)[j], test, q2[j], ((cl_uint *)&test)[0], ((cl_uint *)q2)[j]); - error = -1; - goto exit; + return -1; } } } @@ -508,6 +505,5 @@ int TestFunc_FloatI_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/macro_binary_double.cpp b/test_conformance/math_brute_force/macro_binary_double.cpp index 6398d851..51d5b64b 100644 --- a/test_conformance/math_brute_force/macro_binary_double.cpp +++ b/test_conformance/math_brute_force/macro_binary_double.cpp @@ -269,14 +269,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -287,12 +287,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -307,7 +307,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -352,7 +352,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -379,7 +379,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -430,8 +430,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "vs. %" PRId64 " (index: %zu)\n", name, err, ((double *)s)[j], ((double *)s2)[j], t[j], q[j], j); - error = -1; - goto exit; + return -1; } @@ -479,8 +478,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) " (index: %zu)\n", name, sizeNames[k], err, ((double *)s)[j], ((double *)s2)[j], -t[j], q[j], j); - error = -1; - goto exit; + return -1; } } } @@ -515,8 +513,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -564,7 +561,7 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -574,7 +571,7 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -587,7 +584,7 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -595,29 +592,26 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); - - if (error) goto exit; + if (error) return error; if (gWimpyMode) vlog("Wimp pass"); @@ -627,6 +621,5 @@ int TestMacro_Int_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/macro_binary_float.cpp b/test_conformance/math_brute_force/macro_binary_float.cpp index 67212563..b00a29ff 100644 --- a/test_conformance/math_brute_force/macro_binary_float.cpp +++ b/test_conformance/math_brute_force/macro_binary_float.cpp @@ -262,14 +262,14 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) buffer_size, p, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } if ((error = clEnqueueWriteBuffer(tinfo->tQueue, tinfo->inBuf2, CL_FALSE, 0, buffer_size, p2, 0, NULL, NULL))) { vlog_error("Error: clEnqueueWriteBuffer failed! err: %d\n", error); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -280,12 +280,12 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if ((error = clWaitForEvents(1, e + j))) { vlog_error("Error: clWaitForEvents failed! err: %d\n", error); - goto exit; + return error; } if ((error = clReleaseEvent(e[j]))) { vlog_error("Error: clReleaseEvent failed! err: %d\n", error); - goto exit; + return error; } } @@ -300,7 +300,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueUnmapMemObject failed! err: %d\n", error); - goto exit; + return error; } } else @@ -345,7 +345,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) &vectorCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -372,7 +372,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) { vlog_error("Error: clEnqueueMapBuffer %d failed! err: %d\n", j, error); - goto exit; + return error; } } @@ -420,8 +420,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "0x%8.8x (index: %zu)\n", name, err, ((float *)s)[j], ((float *)s2)[j], t[j], q[j], j); - error = -1; - goto exit; + return -1; } for (auto k = std::max(1U, gMinVectorSizeIndex); @@ -466,8 +465,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) "vs. 0x%8.8x (index: %zu)\n", name, sizeNames[k], err, ((float *)s)[j], ((float *)s2)[j], -t[j], q[j], j); - error = -1; - goto exit; + return -1; } } } @@ -502,8 +500,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fflush(stdout); } -exit: - return error; + return CL_SUCCESS; } } // anonymous namespace @@ -552,7 +549,7 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } test_info.tinfo[i].inBuf2 = clCreateSubBuffer(gInBuffer2, CL_MEM_READ_ONLY, @@ -562,7 +559,7 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer2 for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -575,7 +572,7 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -583,29 +580,26 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } test_info.tinfo[i].d = MTdataHolder(genrand_int32(d)); } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); - - if (error) goto exit; + if (error) return error; if (gWimpyMode) vlog("Wimp pass"); @@ -615,6 +609,5 @@ int TestMacro_Int_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/macro_unary_double.cpp b/test_conformance/math_brute_force/macro_unary_double.cpp index dd196a1c..2d75bc5c 100644 --- a/test_conformance/math_brute_force/macro_unary_double.cpp +++ b/test_conformance/math_brute_force/macro_unary_double.cpp @@ -352,7 +352,7 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -365,7 +365,7 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -373,27 +373,24 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); - - if (error) goto exit; + if (error) return error; if (gWimpyMode) vlog("Wimp pass"); @@ -403,6 +400,5 @@ int TestMacro_Int_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/macro_unary_float.cpp b/test_conformance/math_brute_force/macro_unary_float.cpp index f4cfdc85..53679788 100644 --- a/test_conformance/math_brute_force/macro_unary_float.cpp +++ b/test_conformance/math_brute_force/macro_unary_float.cpp @@ -364,7 +364,7 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -377,7 +377,7 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -385,27 +385,24 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); - - if (error) goto exit; + if (error) return error; if (gWimpyMode) vlog("Wimp pass"); @@ -415,6 +412,5 @@ int TestMacro_Int_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/mad_double.cpp b/test_conformance/math_brute_force/mad_double.cpp index db202b3f..a686560d 100644 --- a/test_conformance/math_brute_force/mad_double.cpp +++ b/test_conformance/math_brute_force/mad_double.cpp @@ -70,14 +70,12 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_double), relaxedMode); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -127,7 +125,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -153,25 +151,25 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer3), &gInBuffer3))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -179,7 +177,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -202,7 +200,7 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -230,6 +228,5 @@ int TestFunc_mad_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/mad_float.cpp b/test_conformance/math_brute_force/mad_float.cpp index ff98f2c4..3aaa523a 100644 --- a/test_conformance/math_brute_force/mad_float.cpp +++ b/test_conformance/math_brute_force/mad_float.cpp @@ -71,14 +71,12 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) uint64_t step = getTestStep(sizeof(float), BUFFER_SIZE); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -128,7 +126,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -154,25 +152,25 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer3), &gInBuffer3))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -180,7 +178,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -203,7 +201,7 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -231,6 +229,5 @@ int TestFunc_mad_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/ternary_double.cpp b/test_conformance/math_brute_force/ternary_double.cpp index a21fbf37..affb2526 100644 --- a/test_conformance/math_brute_force/ternary_double.cpp +++ b/test_conformance/math_brute_force/ternary_double.cpp @@ -150,14 +150,12 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, Force64BitFPUPrecision(); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -232,7 +230,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -258,25 +256,25 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer3), &gInBuffer3))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -284,7 +282,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -307,7 +305,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -635,8 +633,7 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, "%.13la, %.13la}: *%.13la vs. %.13la\n", f->name, sizeNames[k], err, s[j], s2[j], s3[j], ((double *)gOut_Ref)[j], test); - error = -1; - goto exit; + return -1; } } } @@ -671,6 +668,5 @@ int TestFunc_Double_Double_Double_Double(const Func *f, MTdata d, vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/ternary_float.cpp b/test_conformance/math_brute_force/ternary_float.cpp index 5584f153..71edfd9a 100644 --- a/test_conformance/math_brute_force/ternary_float.cpp +++ b/test_conformance/math_brute_force/ternary_float.cpp @@ -168,14 +168,12 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) int skipNanInf = (0 == strcmp("fma", f->nameInCode)) && !gInfNanSupport; // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -254,7 +252,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -280,25 +278,25 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer2), &gInBuffer2))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 3, sizeof(gInBuffer3), &gInBuffer3))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -306,7 +304,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -344,7 +342,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -772,8 +770,7 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) f->name, sizeNames[k], err, s[j], s2[j], s3[j], ((cl_uint *)s)[j], ((cl_uint *)s2)[j], ((cl_uint *)s3)[j], ((float *)gOut_Ref)[j], test); - error = -1; - goto exit; + return -1; } } } @@ -807,6 +804,5 @@ int TestFunc_Float_Float_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/unary_double.cpp b/test_conformance/math_brute_force/unary_double.cpp index 368f065f..5da18f84 100644 --- a/test_conformance/math_brute_force/unary_double.cpp +++ b/test_conformance/math_brute_force/unary_double.cpp @@ -377,7 +377,7 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -390,7 +390,7 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -398,25 +398,24 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -428,8 +427,6 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -440,6 +437,5 @@ int TestFunc_Double_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index 3d328981..0c497bc4 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -531,7 +531,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of gInBuffer for " "region {%zd, %zd}\n", region.origin, region.size); - goto exit; + return error; } for (auto j = gMinVectorSizeIndex; j < gMaxVectorSizeIndex; j++) @@ -544,7 +544,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error("Error: Unable to create sub-buffer of " "gOutBuffer[%d] for region {%zd, %zd}\n", (int)j, region.origin, region.size); - goto exit; + return error; } } test_info.tinfo[i].tQueue = @@ -552,7 +552,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) if (NULL == test_info.tinfo[i].tQueue || error) { vlog_error("clCreateCommandQueue failed. (%d)\n", error); - goto exit; + return error; } } @@ -575,20 +575,19 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) } // Init the kernels - { - BuildKernelInfo build_info{ test_info.threadCount, test_info.k, - test_info.programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - goto exit; - } + BuildKernelInfo build_info{ test_info.threadCount, test_info.k, + test_info.programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; // Run the kernels if (!gSkipCorrectnessTesting || skipTestingRelaxed) { error = ThreadPool_Do(Test, test_info.jobCount, &test_info); + if (error) return error; // Accumulate the arithmetic errors for (cl_uint i = 0; i < test_info.threadCount; i++) @@ -600,8 +599,6 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) } } - if (error) goto exit; - if (gWimpyMode) vlog("Wimp pass"); else @@ -610,7 +607,7 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) if (skipTestingRelaxed) { vlog(" (rlx skip correctness testing)\n"); - goto exit; + return error; } vlog("\t%8.2f @ %a", maxError, maxErrorVal); @@ -618,6 +615,5 @@ int TestFunc_Float_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 5e5b6bfa..9c3dc846 100644 --- a/test_conformance/math_brute_force/unary_two_results_double.cpp +++ b/test_conformance/math_brute_force/unary_two_results_double.cpp @@ -76,14 +76,12 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) Force64BitFPUPrecision(); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -120,7 +118,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -131,7 +129,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -165,19 +163,19 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -185,7 +183,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -211,14 +209,14 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -357,8 +355,7 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) f->name, sizeNames[k], err, err2, ((double *)gIn)[j], ((double *)gOut_Ref)[j], ((double *)gOut_Ref2)[j], test, test2); - error = -1; - goto exit; + return -1; } } } @@ -393,6 +390,5 @@ int TestFunc_Double2_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 b2f253fd..922f2858 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -77,14 +77,12 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) float float_ulps = getAllowedUlpError(f, relaxedMode); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -136,7 +134,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -147,7 +145,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -181,19 +179,19 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -201,7 +199,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -267,14 +265,14 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -489,8 +487,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) f->name, sizeNames[k], err, err2, ((float *)gIn)[j], ((float *)gOut_Ref)[j], ((float *)gOut_Ref2)[j], test, test2); - error = -1; - goto exit; + return -1; } } } @@ -527,6 +524,5 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 25c0db49..d9985bb1 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 @@ -84,14 +84,12 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) Force64BitFPUPrecision(); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -128,7 +126,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -139,7 +137,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -173,19 +171,19 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -193,7 +191,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -215,14 +213,14 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -329,8 +327,7 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) f->name, sizeNames[k], err, (int)iErr, ((double *)gIn)[j], ((double *)gOut_Ref)[j], ((int *)gOut_Ref2)[j], test, q2[j]); - error = -1; - goto exit; + return -1; } } } @@ -365,6 +362,5 @@ int TestFunc_DoubleI_Double(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } 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 faa9d92b..6639c510 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 @@ -89,14 +89,12 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) maxiError = float_ulps == INFINITY ? CL_ULONG_MAX : 0; // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -133,7 +131,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } memset_pattern4(gOut2[j], &pattern, BUFFER_SIZE); @@ -144,7 +142,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2b(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -178,19 +176,19 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gOutBuffer2[j]), &gOutBuffer2[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 2, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -198,7 +196,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -220,14 +218,14 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } if ((error = clEnqueueReadBuffer(gQueue, gOutBuffer2[j], CL_TRUE, 0, BUFFER_SIZE, gOut2[j], 0, NULL, NULL))) { vlog_error("ReadArray2 failed %d\n", error); - goto exit; + return error; } } @@ -329,8 +327,7 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) f->name, sizeNames[k], err, (int)iErr, ((float *)gIn)[j], ((float *)gOut_Ref)[j], ((int *)gOut_Ref2)[j], test, q2[j]); - error = -1; - goto exit; + return -1; } } } @@ -365,6 +362,5 @@ int TestFunc_FloatI_Float(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/unary_u_double.cpp b/test_conformance/math_brute_force/unary_u_double.cpp index ae2ae5be..9b3e7625 100644 --- a/test_conformance/math_brute_force/unary_u_double.cpp +++ b/test_conformance/math_brute_force/unary_u_double.cpp @@ -76,14 +76,12 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) Force64BitFPUPrecision(); // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -113,7 +111,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -138,13 +136,13 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -152,7 +150,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -173,7 +171,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -220,8 +218,7 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) "*%.13la vs. %.13la\n", f->name, sizeNames[k], err, ((uint64_t *)gIn)[j], ((double *)gOut_Ref)[j], test); - error = -1; - goto exit; + return -1; } } } @@ -255,6 +252,5 @@ int TestFunc_Double_ULong(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; } diff --git a/test_conformance/math_brute_force/unary_u_float.cpp b/test_conformance/math_brute_force/unary_u_float.cpp index 0bdbcebe..b7f01260 100644 --- a/test_conformance/math_brute_force/unary_u_float.cpp +++ b/test_conformance/math_brute_force/unary_u_float.cpp @@ -76,14 +76,12 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) float_ulps = f->float_ulps; // Init the kernels - { - BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, - relaxedMode }; - if ((error = ThreadPool_Do(BuildKernelFn, - gMaxVectorSizeIndex - gMinVectorSizeIndex, - &build_info))) - return error; - } + BuildKernelInfo2 build_info{ kernels, programs, f->nameInCode, + relaxedMode }; + if ((error = ThreadPool_Do(BuildKernelFn, + gMaxVectorSizeIndex - gMinVectorSizeIndex, + &build_info))) + return error; for (uint64_t i = 0; i < (1ULL << 32); i += step) { @@ -120,7 +118,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) vlog_error( "\n*** Error %d in clEnqueueWriteBuffer2(%d) ***\n", error, j); - goto exit; + return error; } } else @@ -145,13 +143,13 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) &gOutBuffer[j]))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = clSetKernelArg(kernels[j], 1, sizeof(gInBuffer), &gInBuffer))) { LogBuildError(programs[j]); - goto exit; + return error; } if ((error = @@ -159,7 +157,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) &localCount, NULL, 0, NULL, NULL))) { vlog_error("FAILED -- could not execute kernel\n"); - goto exit; + return error; } } @@ -180,7 +178,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) BUFFER_SIZE, gOut[j], 0, NULL, NULL))) { vlog_error("ReadArray failed %d\n", error); - goto exit; + return error; } } @@ -225,8 +223,7 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) "\n%s%s: %f ulp error at 0x%8.8x: *%a vs. %a\n", f->name, sizeNames[k], err, ((uint32_t *)gIn)[j], ((float *)gOut_Ref)[j], test); - error = -1; - goto exit; + return -1; } } } @@ -260,6 +257,5 @@ int TestFunc_Float_UInt(const Func *f, MTdata d, bool relaxedMode) vlog("\n"); -exit: - return error; + return CL_SUCCESS; }