From d38b8b4ae83824adb8dd22ffbf84ce119cc5f425 Mon Sep 17 00:00:00 2001 From: Ahmed <36049290+AhmedAmraniAkdi@users.noreply.github.com> Date: Tue, 18 Mar 2025 15:55:27 +0000 Subject: [PATCH] Change relaxed exp exp2 embedded error to 4 + floor(fabs(2x)) (#2326) Reflects the changes to the specification: https://github.com/KhronosGroup/OpenCL-Docs/pull/1318 Relaxed embedded exp and exp2 ulps will be 4 + floor(fabs(2 * x)). Reciprocal and divide are unchanged because the code already handles the embedded profile case, see unary_float.c and binary_operator_float.c. --------- Co-authored-by: Sven van Haastregt --- test_conformance/math_brute_force/function_list.cpp | 5 ++--- test_conformance/math_brute_force/unary_float.cpp | 8 +------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/test_conformance/math_brute_force/function_list.cpp b/test_conformance/math_brute_force/function_list.cpp index 74f29930..90731ea0 100644 --- a/test_conformance/math_brute_force/function_list.cpp +++ b/test_conformance/math_brute_force/function_list.cpp @@ -291,13 +291,12 @@ const Func functionList[] = { ENTRY(erfc, 16.0f, 16.0f, 4.0f, 4.0f, FTZ_OFF, unaryF), ENTRY(erf, 16.0f, 16.0f, 4.0f, 4.0f, FTZ_OFF, unaryF), - // relaxed error is overwritten in unary.c as it is 3+floor(fabs(2*x)) + // floor(fabs(2*x)) is added to the relaxed error in unary.c ENTRY_EXT(exp, 3.0f, 4.0f, 2.0f, 3.0f, 3.0f, FTZ_OFF, unaryF, 4.0f), - // relaxed error is overwritten in unary.c as it is 3+floor(fabs(2*x)) + // floor(fabs(2*x)) is added to the relaxed error in unary.c ENTRY_EXT(exp2, 3.0f, 4.0f, 2.0f, 3.0f, 3.0f, FTZ_OFF, unaryF, 4.0f), - // relaxed error is overwritten in unary.c as it is 3+floor(fabs(2*x)) in derived mode; // in non-derived mode it uses the ulp error for half_exp10. ENTRY_EXT(exp10, 3.0f, 4.0f, 2.0f, 3.0f, 8192.0f, FTZ_OFF, unaryF, 8192.0f), diff --git a/test_conformance/math_brute_force/unary_float.cpp b/test_conformance/math_brute_force/unary_float.cpp index ae0a0646..ee8a61b8 100644 --- a/test_conformance/math_brute_force/unary_float.cpp +++ b/test_conformance/math_brute_force/unary_float.cpp @@ -300,13 +300,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data) if (strcmp(fname, "exp") == 0 || strcmp(fname, "exp2") == 0) { - // For full profile, ULP depends on input value. - // For embedded profile, ULP comes from functionList. - if (!gIsEmbedded) - { - ulps = 3.0f + floor(fabs(2 * s[j])); - } - + ulps += floor(fabs(2 * s[j])); fail = !(fabsf(err) <= ulps); } if (strcmp(fname, "tan") == 0)