Skip to content

Commit b1219af

Browse files
Changed closed-form test to be strict except on non-Intel CPUs
1 parent 89d6850 commit b1219af

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

dpctl/tests/test_tensor_accumulation.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from helper import get_queue_or_skip, skip_if_dtype_not_supported
2222

2323
import dpctl.tensor as dpt
24-
from dpctl.utils import ExecutionPlacementError
24+
from dpctl.utils import ExecutionPlacementError, intel_device_info
2525

2626
sint_types = [
2727
dpt.int8,
@@ -408,11 +408,18 @@ def test_cumulative_logsumexp_closed_form(fpdt):
408408
r = dpt.cumulative_logsumexp(dpt.arange(-n, 0, dtype=fpdt, device=q))
409409
expected = geometric_series_closed_form(n, dtype=fpdt, device=q)
410410

411-
tol = 32 * dpt.finfo(fpdt).eps
412-
atol = tol
413-
rtol = 8 * tol
414-
if not dpt.allclose(r, expected, atol=atol, rtol=rtol):
411+
tol = 4 * dpt.finfo(fpdt).eps
412+
413+
idi = intel_device_info(r.sycl_device)
414+
if not r.sycl_device.has_aspect_cpu or ("device_id" in idi):
415+
assert dpt.allclose(r, expected, atol=tol, rtol=tol)
416+
else:
415417
# on AMD CPUs (in CI) some failures are present
418+
# to be investigated
419+
tol = 2 * tol
420+
atol = tol
421+
rtol = 4 * tol
422+
416423
ad = dpt.abs(r - expected)
417424
viols = ad > atol + rtol * dpt.maximum(dpt.abs(r), dpt.abs(expected))
418425
viols_count = dpt.sum(viols)

0 commit comments

Comments
 (0)