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 <sven.vanhaastregt@arm.com>
This commit is contained in:
Ahmed
2025-03-18 15:55:27 +00:00
committed by GitHub
parent bb604702a5
commit d38b8b4ae8
2 changed files with 3 additions and 10 deletions

View File

@@ -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),

View File

@@ -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)