From 9010559bf6571cfe5c3d235bff447328bfa06dfc Mon Sep 17 00:00:00 2001 From: Ailing Zhang Date: Fri, 24 Mar 2023 17:13:56 +0800 Subject: [PATCH 1/2] [cc] Add deprecation notice for cc backend --- python/taichi/lang/misc.py | 5 +++++ tests/python/test_deprecation.py | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/python/taichi/lang/misc.py b/python/taichi/lang/misc.py index 7b43609fc2900..96818840be690 100644 --- a/python/taichi/lang/misc.py +++ b/python/taichi/lang/misc.py @@ -369,6 +369,11 @@ def init(arch=None, raise KeyError( "'default_up' is always the unsigned type of 'default_ip'. Please set 'default_ip' instead." ) + + if arch == cc: + warnings.warn( + 'ti.cc will be deprecated in favor of TiRT and its C API, if you still need it please let us know at https://github.com/taichi-dev/taichi/issues/7629.', + DeprecationWarning) # Make a deepcopy in case these args reference to items from ti.cfg, which are # actually references. If no copy is made and the args are indeed references, # ti.reset() could override the args to their default values. diff --git a/tests/python/test_deprecation.py b/tests/python/test_deprecation.py index 9e529668c579b..6537a21269342 100644 --- a/tests/python/test_deprecation.py +++ b/tests/python/test_deprecation.py @@ -280,3 +280,10 @@ def run(): r"fill\(\) on ti.Struct is deprecated, and it will be removed in Taichi v1.6.0." ): run() + + +@test_utils.test(arch=ti.cc) +def test_cc_deprecation(): + ti.reset() + with pytest.warns(DeprecationWarning, match=r""): + ti.init(arch=ti.cc) From 968e6616c36befa5527059813fae50cb206eb00d Mon Sep 17 00:00:00 2001 From: Ailing Date: Fri, 24 Mar 2023 17:54:23 +0800 Subject: [PATCH 2/2] Update test_deprecation.py --- tests/python/test_deprecation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/python/test_deprecation.py b/tests/python/test_deprecation.py index 6537a21269342..426e7aa105cb6 100644 --- a/tests/python/test_deprecation.py +++ b/tests/python/test_deprecation.py @@ -285,5 +285,5 @@ def run(): @test_utils.test(arch=ti.cc) def test_cc_deprecation(): ti.reset() - with pytest.warns(DeprecationWarning, match=r""): + with pytest.warns(DeprecationWarning, match=r"ti.cc will be deprecated"): ti.init(arch=ti.cc)