diff --git a/python/taichi/_snode/fields_builder.py b/python/taichi/_snode/fields_builder.py index 191ffdb45ca52..da576aa8d4b9a 100644 --- a/python/taichi/_snode/fields_builder.py +++ b/python/taichi/_snode/fields_builder.py @@ -1,4 +1,3 @@ -import warnings from typing import Any, Optional, Sequence, Union from taichi._lib import core as _ti_core @@ -76,9 +75,8 @@ def pointer(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int]): """Same as :func:`taichi.lang.snode.SNode.pointer`""" if impl.current_cfg().arch == _ti_core.metal: - warnings.warn( - "Pointer SNode on metal backend is deprecated, and it will be removed in v1.4.0.", - DeprecationWarning) + raise TaichiRuntimeError( + "Pointer SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.pointer(indices, dimensions) @@ -94,8 +92,7 @@ def dynamic(self, """Same as :func:`taichi.lang.snode.SNode.dynamic`""" if impl.current_cfg().arch == _ti_core.metal: raise TaichiRuntimeError( - "Dynamic SNode on metal backend is deprecated and removed in this release." - ) + "Dynamic SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.dynamic(index, dimension, chunk_size) @@ -104,9 +101,8 @@ def bitmasked(self, indices: Union[Sequence[_Axis], _Axis], dimensions: Union[Sequence[int], int]): """Same as :func:`taichi.lang.snode.SNode.bitmasked`""" if impl.current_cfg().arch == _ti_core.metal: - warnings.warn( - "Bitmasked SNode on metal backend is deprecated, and it will be removed in v1.4.0.", - DeprecationWarning) + raise TaichiRuntimeError( + "Bitmasked SNode on metal backend is deprecated and removed.") self._check_not_finalized() self.empty = False return self.root.bitmasked(indices, dimensions) diff --git a/python/taichi/examples/features/sparse/taichi_bitmasked.py b/python/taichi/examples/features/sparse/taichi_bitmasked.py index eb19b75e5f0f2..7a5a365e7ce1c 100644 --- a/python/taichi/examples/features/sparse/taichi_bitmasked.py +++ b/python/taichi/examples/features/sparse/taichi_bitmasked.py @@ -2,7 +2,7 @@ import taichi as ti -ti.init(arch=ti.gpu) +ti.init(arch=ti.cuda) n = 256 x = ti.field(ti.f32) diff --git a/python/taichi/examples/simulation/comet.py b/python/taichi/examples/simulation/comet.py index f0182f77be625..c8064fc64546b 100644 --- a/python/taichi/examples/simulation/comet.py +++ b/python/taichi/examples/simulation/comet.py @@ -2,7 +2,7 @@ import taichi as ti -ti.init(arch=[ti.cuda, ti.metal]) +ti.init(arch=ti.cuda) dim = 3 N = 1024 * 8 diff --git a/python/taichi/lang/snode.py b/python/taichi/lang/snode.py index 75898e76b856a..15fab24924d80 100644 --- a/python/taichi/lang/snode.py +++ b/python/taichi/lang/snode.py @@ -1,8 +1,8 @@ import numbers -import warnings from taichi._lib import core as _ti_core from taichi.lang import expr, impl, matrix +from taichi.lang.exception import TaichiRuntimeError from taichi.lang.field import BitpackedFields, Field from taichi.lang.util import get_traceback @@ -49,9 +49,8 @@ def pointer(self, axes, dimensions): The added :class:`~taichi.lang.SNode` instance. """ if impl.current_cfg().arch == _ti_core.metal: - warnings.warn( - "Pointer SNode on metal backend is deprecated, and it will be removed in v1.4.0.", - DeprecationWarning) + raise TaichiRuntimeError( + "Pointer SNode on metal backend is deprecated and removed.") if isinstance(dimensions, numbers.Number): dimensions = [dimensions] * len(axes) return SNode( @@ -80,9 +79,8 @@ def dynamic(self, axis, dimension, chunk_size=None): The added :class:`~taichi.lang.SNode` instance. """ if impl.current_cfg().arch == _ti_core.metal: - raise TaichiCompilationError( - "Dynamic SNode on metal backend is deprecated and removed in this release." - ) + raise TaichiRuntimeError( + "Dynamic SNode on metal backend is deprecated and removed.") assert len(axis) == 1 if chunk_size is None: chunk_size = dimension @@ -101,9 +99,8 @@ def bitmasked(self, axes, dimensions): The added :class:`~taichi.lang.SNode` instance. """ if impl.current_cfg().arch == _ti_core.metal: - warnings.warn( - "Bitmasked SNode on metal backend is deprecated, and it will be removed in v1.4.0.", - DeprecationWarning) + raise TaichiRuntimeError( + "Bitmasked SNode on metal backend is deprecated and removed.") if isinstance(dimensions, numbers.Number): dimensions = [dimensions] * len(axes) return SNode( diff --git a/tests/python/test_deprecation.py b/tests/python/test_deprecation.py index 77ad0ac3210b5..195da0cd1aec8 100644 --- a/tests/python/test_deprecation.py +++ b/tests/python/test_deprecation.py @@ -74,26 +74,22 @@ def test_deprecate_element_shape_ndarray_arg(): element_shape=(1, )) +# Remove this before v1.5.0 @test_utils.test(arch=ti.metal) def test_deprecate_metal_sparse(): - with pytest.warns( - DeprecationWarning, - match= - "Pointer SNode on metal backend is deprecated, and it will be removed in v1.4.0." - ): - a = ti.root.pointer(ti.i, 10) - with pytest.warns( - DeprecationWarning, - match= - "Bitmasked SNode on metal backend is deprecated, and it will be removed in v1.4.0." + with pytest.raises( + ti.TaichiRuntimeError, + match="Pointer SNode on metal backend is deprecated and removed."): + ti.root.pointer(ti.i, 10) + with pytest.raises( + ti.TaichiRuntimeError, + match="Bitmasked SNode on metal backend is deprecated and removed." ): - b = a.bitmasked(ti.j, 10) + ti.root.bitmasked(ti.j, 10) with pytest.raises( ti.TaichiRuntimeError, - match= - "Dynamic SNode on metal backend is deprecated and removed in this release." - ): + match="Dynamic SNode on metal backend is deprecated and removed."): ti.root.dynamic(ti.i, 10) diff --git a/tests/python/test_matrix.py b/tests/python/test_matrix.py index 178d5fc6cfc9a..1cc9da49bdf9b 100644 --- a/tests/python/test_matrix.py +++ b/tests/python/test_matrix.py @@ -442,7 +442,7 @@ def test_matrix_field_dynamic_index_different_path_length(): assert v._get_dynamic_index_stride() is None -@test_utils.test() +@test_utils.test(require=ti.extension.sparse, exclude=[ti.metal]) def test_matrix_field_dynamic_index_not_pure_dense(): v = ti.Vector.field(2, ti.i32) x = v.get_scalar_field(0)