From af956d582edb08af6abf1aba25c7599227b8ab03 Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 22 Sep 2023 14:55:41 +0200 Subject: [PATCH 1/2] w/a for dpnp.allclose --- dpnp/backend/kernels/dpnp_krnl_logic.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dpnp/backend/kernels/dpnp_krnl_logic.cpp b/dpnp/backend/kernels/dpnp_krnl_logic.cpp index 2080306aeade..429f9d96f1ea 100644 --- a/dpnp/backend/kernels/dpnp_krnl_logic.cpp +++ b/dpnp/backend/kernels/dpnp_krnl_logic.cpp @@ -173,6 +173,28 @@ static sycl::event dpnp_allclose(sycl::queue &q, partial &= (array1[i] == array2[i]); continue; } + + // workaround for std::inf which does not work on CPU + // [CMPLRLLVM-51856] + if (array1[i] == std::numeric_limits<_DataType1>::infinity()) { + partial &= (array1[i] == array2[i]); + continue; + } + else if (array1[i] == + -std::numeric_limits<_DataType1>::infinity()) { + partial &= (array1[i] == array2[i]); + continue; + } + else if (array2[i] == + std::numeric_limits<_DataType2>::infinity()) { + partial &= (array1[i] == array2[i]); + continue; + } + else if (array2[i] == + -std::numeric_limits<_DataType2>::infinity()) { + partial &= (array1[i] == array2[i]); + continue; + } } // casting integeral to floating type to avoid bad behavior From 8252949322ae1071fa2a783ccdd6f300b1b7369a Mon Sep 17 00:00:00 2001 From: Vladislav Perevezentsev Date: Fri, 22 Sep 2023 14:56:41 +0200 Subject: [PATCH 2/2] Unmute tests for dpnp.allclose on CPU --- tests/skipped_tests.tbl | 6 ------ 1 file changed, 6 deletions(-) diff --git a/tests/skipped_tests.tbl b/tests/skipped_tests.tbl index 128b7f7f5da2..9d82b93db882 100644 --- a/tests/skipped_tests.tbl +++ b/tests/skipped_tests.tbl @@ -72,12 +72,6 @@ tests/test_linalg.py::test_norm1[None-3-[7]] tests/test_linalg.py::test_norm1[None-3-[1, 2]] tests/test_linalg.py::test_norm1[None-3-[1, 0]] -tests/test_logic.py::test_allclose[int32] -tests/test_logic.py::test_allclose[int64] -tests/test_logic.py::test_allclose[float32] -tests/test_logic.py::test_allclose[float64] -tests/test_logic.py::test_allclose[None] - tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([[i, i] for i in x])] tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: (dpnp.asarray([(i, i) for i in x], [("a", int), ("b", int)]).view(dpnp.recarray))] tests/test_random.py::TestPermutationsTestShuffle::test_shuffle1[lambda x: dpnp.asarray([(i, i) for i in x], [("a", object), ("b", dpnp.int32)])]]