From 9ea2805a420f1d5b0d1ff23078c354216963fd3f Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Wed, 22 Jul 2026 15:56:31 +0200 Subject: [PATCH] Relax check_binary tolerance for float16 in cupy trigonometric tests 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) --- dpnp/tests/third_party/cupy/math_tests/test_trigonometric.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dpnp/tests/third_party/cupy/math_tests/test_trigonometric.py b/dpnp/tests/third_party/cupy/math_tests/test_trigonometric.py index 3340565fbcb9..a2283021fcdb 100644 --- a/dpnp/tests/third_party/cupy/math_tests/test_trigonometric.py +++ b/dpnp/tests/third_party/cupy/math_tests/test_trigonometric.py @@ -18,7 +18,10 @@ def check_unary(self, name, xp, dtype): return getattr(xp, name)(a) @testing.for_all_dtypes(no_complex=True) - @testing.numpy_cupy_allclose(atol=1e-5, type_check=has_support_aspect64()) + @testing.numpy_cupy_allclose( + atol={numpy.float16: 1e-3, "default": 1e-5}, + type_check=has_support_aspect64(), + ) def check_binary(self, name, xp, dtype): a = testing.shaped_arange((2, 3), xp, dtype) b = testing.shaped_reverse_arange((2, 3), xp, dtype)