diff --git a/dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py b/dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py index 452314802309..431f1f27d8c7 100644 --- a/dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py +++ b/dpnp/tests/third_party/cupy/binary_tests/test_elementwise.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import unittest from dpnp.tests.third_party.cupy import testing @@ -27,6 +29,38 @@ def test_bitwise_or(self): def test_bitwise_xor(self): self.check_binary_int("bitwise_xor") + @testing.with_requires("numpy>=2.0.0") + @testing.for_int_dtypes(no_bool=True) + @testing.numpy_cupy_array_equal() + def test_bitwise_count(self, xp, dtype): + info = xp.iinfo(dtype) + if xp.issubdtype(dtype, xp.signedinteger): + a = xp.array( + [ + 0, + -1, + 1, + info.min, + info.min + 1, + info.max, + info.max - 1, + info.max // 2, + ], + dtype=dtype, + ) + else: + a = xp.array( + [ + 0, + 1, + info.max, + info.max - 1, + info.max // 2, + ], + dtype=dtype, + ) + return xp.bitwise_count(a) + def test_invert(self): self.check_unary_int("invert") diff --git a/dpnp/tests/third_party/cupy/core_tests/test_core.py b/dpnp/tests/third_party/cupy/core_tests/test_core.py index bf0cbecb24c8..9bcf5ae721c9 100644 --- a/dpnp/tests/third_party/cupy/core_tests/test_core.py +++ b/dpnp/tests/third_party/cupy/core_tests/test_core.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import sys import unittest @@ -97,7 +99,7 @@ def test_cupy_ndarray(self, dtype): @testing.parameterize( *testing.product( { - "cxx": (None, "--std=c++11"), + "cxx": (None, "--std=c++14"), } ) ) diff --git a/dpnp/tests/third_party/cupy/core_tests/test_function.py b/dpnp/tests/third_party/cupy/core_tests/test_function.py index 315dcbd09674..2943fc2bcf02 100644 --- a/dpnp/tests/third_party/cupy/core_tests/test_function.py +++ b/dpnp/tests/third_party/cupy/core_tests/test_function.py @@ -1,6 +1,7 @@ +from __future__ import annotations + import unittest -import numpy import pytest import dpnp as cupy @@ -18,9 +19,7 @@ def _compile_func(kernel_name, code): # workaround for hipRTC extra_source = core._get_header_source() if runtime.is_hip else None - mod = compiler._compile_module_with_cache( - code, options=("--std=c++11",), extra_source=extra_source - ) + mod = compiler._compile_module_with_cache(code, extra_source=extra_source) return mod.get_function(kernel_name) diff --git a/dpnp/tests/third_party/cupy/functional_tests/test_vectorize.py b/dpnp/tests/third_party/cupy/functional_tests/test_vectorize.py index 910ab2dc0aa1..74bfedda505e 100644 --- a/dpnp/tests/third_party/cupy/functional_tests/test_vectorize.py +++ b/dpnp/tests/third_party/cupy/functional_tests/test_vectorize.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import unittest import numpy @@ -8,9 +10,24 @@ # from cupy.cuda import runtime + +# def _rocm_version_major(): +# if not getattr(runtime, "is_hip", False): +# return -1 + +# version = runtime.runtimeGetVersion() +# major = version // 10_000_000 +# return int(major) + + +# _ROCM_VER_MAJOR = _rocm_version_major() +# _IS_HIP_LT7 = bool(_ROCM_VER_MAJOR != -1 and int(_ROCM_VER_MAJOR) < 7) + + pytest.skip("dpnp.vectorize is not implemented", allow_module_level=True) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeOps(unittest.TestCase): def _run(self, func, xp, dtypes): @@ -225,6 +242,7 @@ def my_usub(x): return self._run(my_usub, xp, [dtype]) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeExprs(unittest.TestCase): @testing.for_all_dtypes(name="cond_dtype", no_complex=True) @@ -293,6 +311,7 @@ def my_typecast(x): return f(x) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeInstructions(unittest.TestCase): @testing.for_all_dtypes() @@ -371,6 +390,7 @@ def my_nonconst_result(x): return f(x) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeStmts(unittest.TestCase): @testing.numpy_cupy_array_equal() @@ -567,6 +587,7 @@ def __init__(self, x): self.x = x +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeConstants(unittest.TestCase): @testing.numpy_cupy_array_equal() @@ -594,6 +615,7 @@ def my_func(x1, x2): return f(x1, x2) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorizeBroadcast(unittest.TestCase): @testing.for_all_dtypes(no_bool=True) @@ -630,6 +652,7 @@ def my_func(x1, x2): return f(x1, x2) +# @pytest.mark.skipif(_IS_HIP_LT7, reason="Skip on ROCm < 7 (HIP).") class TestVectorize(unittest.TestCase): @testing.for_all_dtypes(no_bool=True)