diff --git a/test_conformance/math_brute_force/binary_float.cpp b/test_conformance/math_brute_force/binary_float.cpp index 3bab4057..deea1ce9 100644 --- a/test_conformance/math_brute_force/binary_float.cpp +++ b/test_conformance/math_brute_force/binary_float.cpp @@ -201,7 +201,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; int ftz = job->ftz; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); MTdata d = tinfo->d; cl_int error; std::vector overflow(buffer_elements, false); diff --git a/test_conformance/math_brute_force/binary_operator_float.cpp b/test_conformance/math_brute_force/binary_operator_float.cpp index 741c396c..6f5a3645 100644 --- a/test_conformance/math_brute_force/binary_operator_float.cpp +++ b/test_conformance/math_brute_force/binary_operator_float.cpp @@ -197,7 +197,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; int ftz = job->ftz; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); MTdata d = tinfo->d; cl_int error; std::vector overflow(buffer_elements, false); diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index cd93d3c9..7d1f6cda 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -88,7 +88,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) fptr func = job->f->func; const char *fname = job->f->name; bool relaxedMode = job->relaxedMode; - float ulps = getAllowedUlpError(job->f, relaxedMode); + float ulps = getAllowedUlpError(job->f, kfloat, relaxedMode); if (relaxedMode) { func = job->f->rfunc; 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 8a5d3000..3fd16cd3 100644 --- a/test_conformance/math_brute_force/unary_two_results_float.cpp +++ b/test_conformance/math_brute_force/unary_two_results_float.cpp @@ -57,7 +57,7 @@ int TestFunc_Float2_Float(const Func *f, MTdata d, bool relaxedMode) logFunctionInfo(f->name, sizeof(cl_float), relaxedMode); - float float_ulps = getAllowedUlpError(f, relaxedMode); + float float_ulps = getAllowedUlpError(f, kfloat, relaxedMode); // Init the kernels BuildKernelInfo build_info{ 1, kernels, programs, f->nameInCode, relaxedMode }; diff --git a/test_conformance/math_brute_force/utility.cpp b/test_conformance/math_brute_force/utility.cpp index 9b0191ab..53dd928c 100644 --- a/test_conformance/math_brute_force/utility.cpp +++ b/test_conformance/math_brute_force/utility.cpp @@ -15,6 +15,9 @@ // #include "utility.h" + +#include + #include "function_list.h" #if defined(__PPC__) @@ -161,32 +164,42 @@ void logFunctionInfo(const char *fname, unsigned int float_size, vlog("%15s %4s %4s", fname, fpSizeStr, fpFastRelaxedStr); } -float getAllowedUlpError(const Func *f, const bool relaxed) +float getAllowedUlpError(const Func *f, Type t, const bool relaxed) { - float ulp; - - if (relaxed) + switch (t) { - if (gIsEmbedded) - { - ulp = f->relaxed_embedded_error; - } - else - { - ulp = f->relaxed_error; - } + case kfloat: + if (relaxed) + { + if (gIsEmbedded) + { + return f->relaxed_embedded_error; + } + else + { + return f->relaxed_error; + } + } + else + { + if (gIsEmbedded) + { + return f->float_embedded_ulps; + } + else + { + return f->float_ulps; + } + } + case kdouble: + // TODO: distinguish between embedded and full profile. + return f->double_ulps; + case khalf: + // TODO: distinguish between embedded and full profile. + return f->half_ulps; + default: + assert(false && "unsupported type in getAllowedUlpError"); + // Return a negative value which will make any test fail. + return -1.f; } - else - { - if (gIsEmbedded) - { - ulp = f->float_embedded_ulps; - } - else - { - ulp = f->float_ulps; - } - } - - return ulp; } diff --git a/test_conformance/math_brute_force/utility.h b/test_conformance/math_brute_force/utility.h index 8e9b3a1a..c321fcb1 100644 --- a/test_conformance/math_brute_force/utility.h +++ b/test_conformance/math_brute_force/utility.h @@ -257,7 +257,7 @@ int compareDoubles(double x, double y); void logFunctionInfo(const char *fname, unsigned int float_size, unsigned int isFastRelaxed); -float getAllowedUlpError(const Func *f, const bool relaxed); +float getAllowedUlpError(const Func *f, Type t, const bool relaxed); inline cl_uint getTestScale(size_t typeSize) {