Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too much precision expected of OpenCL length() function #844

Open
etomzak opened this issue Oct 15, 2019 · 0 comments
Open

Too much precision expected of OpenCL length() function #844

etomzak opened this issue Oct 15, 2019 · 0 comments

Comments

@etomzak
Copy link

etomzak commented Oct 15, 2019

The test_closure::triangle_area and test_extrema::max_vector_length (and possibly others) expect too much precision of the OpenCL built-in length() function when calculating the lengths of vectors.

The precision of length() is defined in ULP as <= 3 + 0.5 * ((0.5 * n) + 0.5 * (n - 1)) where n is the number of vector elements. [source] For the float4s used in triangle_area, this works out to 4.75 ULP. Given the expected result is 1.0f, the actual answer should be approximately 1.0 +/- 5.7e-07 [1]. The precision expected by the test is 1.0e-6 percent, or 1.0e-8.

That is, the triangle_area test can fail even on a conformant OpenCL implementation. The max_vector_length test has a similar problem.

[1] This doesn't take into account the division by 2 in the test, which introduces further error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant