Fix math tests to allow ftz in relaxed mode. (#1371)

* Fix math tests to allow ftz in relaxed mode.

In recent spec clarification, it is agreed that ftz is
a valid optimization in case of cl-fast-math-relaxed
and doesn't require cl-denorms-are-zero to be passed
explicitly to enforce ftz behavior for implementations
that already support this.

GitHub Spec Issue OpenCL-Docs#579
GitHub Spec Issue OpenCL-Docs#597
GitHub CTS Issue OpenCL-CTS#1267
This commit is contained in:
Nikhil Joshi
2022-07-05 22:28:18 +05:30
committed by GitHub
parent e3e1786761
commit 8d9d1f3e9d
24 changed files with 60 additions and 33 deletions

View File

@@ -297,6 +297,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
float ulps = job->ulps;
dptr func = job->f->dfunc;
int ftz = job->ftz;
bool relaxedMode = job->relaxedMode;
MTdata d = tinfo->d;
cl_int error;
const char *name = job->f->name;
@@ -481,7 +482,7 @@ cl_int Test(cl_uint job_id, cl_uint thread_id, void *data)
float err = Bruteforce_Ulp_Error_Double(test, correct);
int fail = !(fabsf(err) <= ulps);
if (fail && ftz)
if (fail && (ftz || relaxedMode))
{
// retry per section 6.5.3.2
if (IsDoubleResultSubnormal(correct, ulps))
@@ -680,6 +681,7 @@ int TestFunc_Double_Double_Double(const Func *f, MTdata d, bool relaxedMode)
test_info.f = f;
test_info.ulps = f->double_ulps;
test_info.ftz = f->ftz || gForceFTZ;
test_info.relaxedMode = relaxedMode;
test_info.isFDim = 0 == strcmp("fdim", f->nameInCode);
test_info.skipNanInf = 0;