Skip to content

Commit 9746426

Browse files
Workaround to dpnp.allclose() (#1568)
* w/a for dpnp.allclose()
1 parent 6ada5a7 commit 9746426

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

dpnp/backend/kernels/dpnp_krnl_logic.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,28 @@ static sycl::event dpnp_allclose(sycl::queue &q,
173173
partial &= (array1[i] == array2[i]);
174174
continue;
175175
}
176+
177+
// workaround for std::inf which does not work on CPU
178+
// [CMPLRLLVM-51856]
179+
if (array1[i] == std::numeric_limits<_DataType1>::infinity()) {
180+
partial &= (array1[i] == array2[i]);
181+
continue;
182+
}
183+
else if (array1[i] ==
184+
-std::numeric_limits<_DataType1>::infinity()) {
185+
partial &= (array1[i] == array2[i]);
186+
continue;
187+
}
188+
else if (array2[i] ==
189+
std::numeric_limits<_DataType2>::infinity()) {
190+
partial &= (array1[i] == array2[i]);
191+
continue;
192+
}
193+
else if (array2[i] ==
194+
-std::numeric_limits<_DataType2>::infinity()) {
195+
partial &= (array1[i] == array2[i]);
196+
continue;
197+
}
176198
}
177199

178200
// casting integeral to floating type to avoid bad behavior

tests/skipped_tests.tbl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,6 @@ tests/test_linalg.py::test_norm1[None-3-[7]]
7272
tests/test_linalg.py::test_norm1[None-3-[1, 2]]
7373
tests/test_linalg.py::test_norm1[None-3-[1, 0]]
7474

75-
tests/test_logic.py::test_allclose[int32]
76-
tests/test_logic.py::test_allclose[int64]
77-
tests/test_logic.py::test_allclose[float32]
78-
tests/test_logic.py::test_allclose[float64]
79-
tests/test_logic.py::test_allclose[None]
80-
8175
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([[i, i] for i in x])]
8276
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp.asarray([(i, i) for i in x], [("a", int), ("b", int)]).view(dpnp.recarray))]
8377
tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]]

0 commit comments

Comments
 (0)