KhronosGroup / KhronosGroup/SYCL-CTS

sinpi: insufficiently precise reference result

Open
#860 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
75
Forks
96
Avg merge
5d 18h
Merged PRs (30d)
4

Description

SYCL-CTS shows an error when using DPC++ with our OpenCL implementation.

```
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The SYCL 2020 Conformance Test Suite is a Catch2 v3.2.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
math_builtin_float_double
-------------------------------------------------------------------------------
/home/harald/SYCL-CTS/tests/math_builtin_api/../common/../../util/proxy.h:47
...............................................................................

/home/harald/SYCL-CTS/util/logger.cpp:41: warning:
value: 0.372822586521810384052599829374230466783046722412109375
[3fd7dc5344149047], reference: 0.
37282258652181010649684367308509536087512969970703125 [3fd7dc5344149042]

/home/harald/SYCL-CTS/util/logger.cpp:41: warning:
Expected accuracy in ULP: 4

/home/harald/SYCL-CTS/tests/math_builtin_api/math_builtin.h:194: FAILED:
CHECK( verify(log, hostRes, ref, accuracy, comment) )
with expansion:
false
with message:
tests case: 4601023. Correctness check failed on host.

===============================================================================
test cases: 14 | 13 passed | 1 failed
assertions: 7721 | 7720 passed | 1 failed
```

The value that causes this is the randomly generated input 0.8783900046.

Evaluation with an arbitrary precision tool (calc, https://github.com/lcn2/calc) tells us that the correct result is

```
$ calc 'epsilon(1e-100), sin(pi() * 0.8783900046)'
~0.37282258652181026821
```

That is, the correct result is just under 0x1.7dc5344149045p-2, SYCL-CTS generates a reference result of 0x1.7dc5344149042p-2 (\~-2.9 ULP), we generate a result of 0x1.7dc5344149047p-2 (\~+2.1 ULP). We are within 4 ULP of the mathematically correct result, which is what the CTS aims to check, so the `sinpi` reference result would need to be calculated with more accuracy to not reject this.

I could attempt to create a PR fixing `sinpi` specifically if so desired, but I suspect this is a bigger problem that applies to other functions as well. I am wondering if rather than re-implementing all the functions, an existing arbitrary-precision tool or library could be reused?

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the math_builtin_float_double failure for sinpi with input 0.8783900046. Read tests/math_builtin_api/math_builtin.h and util/logger.cpp to understand reference generation and the accuracy check. Done means the reference result is accurate enough that this case passes within the stated 4 ULP tolerance, while considering whether related functions need the same treatment.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
testing-qa
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.