Relax float16 tolerance in cupy trigonometric binary tests#3005
Merged
Conversation
check_binary asserted with a flat atol=1e-5, which is tighter than the
resolution of float16 (one ULP near 0.38 is ~2.4e-4). This made
test_arctan2 (and other binary trig tests) flaky for the float16 ("e")
dtype: the Intel OpenCL CPU runtime's transcendental arctan2 can round
the last bit differently depending on the runner CPU microarchitecture,
producing a 1-ULP disagreement with NumPy that exceeded atol=1e-5.
Use a float16-aware tolerance (atol={float16: 1e-3, default: 1e-5}),
mirroring the pattern already used by check_unary_unit in the same file.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
antonwolfy
marked this pull request as ready for review
July 22, 2026 14:01
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
July 22, 2026 14:01
vlad-perevezentsev
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you @antonwolfy
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev3=py314h509198e_10 ran successfully. |
Collaborator
vlad-perevezentsev
self-requested a review
July 23, 2026 10:07
vlad-perevezentsev
approved these changes
Jul 23, 2026
github-actions Bot
added a commit
that referenced
this pull request
Jul 23, 2026
The GitHub workflow might fail on
`third_party/cupy/math_tests/test_trigonometric.py::TestTrigonometric::test_arctan2`:
```
Mismatched elements: 1 / 6 (16.7%)
[0, 1]: 0.38037109375 (ACTUAL, dpnp), 0.380615234375 (DESIRED, numpy)
Max absolute difference: 0.0002441
```
This is the `float16` (`"e"` dtype) parametrization of
`check_binary("arctan2")`, which asserts with a flat `atol=1e-5`. That
tolerance is tighter than the resolution of float16 — one ULP near 0.38
is ~2.4e-4.
This PR proposes to use a float16-aware tolerance. for `check_binary`.
This mirrors the pattern already used by `check_unary_unit` in the same
file, and leaves the default `1e-5` tolerance unchanged for all
higher-precision dtypes. 615dbf5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The GitHub workflow might fail on
third_party/cupy/math_tests/test_trigonometric.py::TestTrigonometric::test_arctan2:This is the
float16("e"dtype) parametrization ofcheck_binary("arctan2"), which asserts with a flatatol=1e-5. That tolerance is tighter than the resolution of float16 — one ULP near 0.38 is ~2.4e-4.This PR proposes to use a float16-aware tolerance. for
check_binary.This mirrors the pattern already used by
check_unary_unitin the same file, and leaves the default1e-5tolerance unchanged for all higher-precision dtypes.