diff --git a/python/taichi/lang/misc.py b/python/taichi/lang/misc.py index 90e2bb270b5bb..0ff541f659e58 100644 --- a/python/taichi/lang/misc.py +++ b/python/taichi/lang/misc.py @@ -356,6 +356,17 @@ def init(arch=None, if require_version is not None: check_require_version(require_version) + if "packed" in kwargs: + if kwargs["packed"] is True: + warnings.warn( + "Currently packed=True is the default setting and the switch will be removed in v1.4.0.", + DeprecationWarning) + else: + warnings.warn( + "The automatic padding mode (packed=False) will no longer exist in v1.4.0. The switch will " + "also be removed then. Make sure your code doesn't rely on it.", + DeprecationWarning) + if "default_up" in kwargs: raise KeyError( "'default_up' is always the unsigned type of 'default_ip'. Please set 'default_ip' instead." diff --git a/taichi/ir/snode.cpp b/taichi/ir/snode.cpp index 1f5195a160ee5..5d44cc06d6b42 100644 --- a/taichi/ir/snode.cpp +++ b/taichi/ir/snode.cpp @@ -64,11 +64,9 @@ SNode &SNode::create_node(std::vector axes, } else { TI_WARN_IF( packed && !bit::is_power_of_two(sizes[i]), - "Non-first division of an axis on a SNodeTree path should be a power " - "of two to achieve best performance:\n{} We plan to turn this " - "warning into an error at v1.4.0. If you do have a use case that " - "needs to violate this rule, please submit an issue to notify us.", - tb); + "Shape {} is detected on non-first division of axis {}:\n{} For " + "best performance, we recommend that you set it to a power of two.", + sizes[i], char('i' + ind), tb); } new_node.extractors[ind].activate( bit::log2int(bit::least_pot_bound(sizes[i]))); diff --git a/tests/python/test_deprecation.py b/tests/python/test_deprecation.py index 3aaaf477d6813..2c56b02277670 100644 --- a/tests/python/test_deprecation.py +++ b/tests/python/test_deprecation.py @@ -92,3 +92,21 @@ def test_deprecate_metal_sparse(): "Dynamic SNode on metal backend is deprecated and removed in this release." ): ti.root.dynamic(ti.i, 10) + + +def test_deprecated_packed_true(): + with pytest.warns( + DeprecationWarning, + match= + "Currently packed=True is the default setting and the switch will be removed in v1.4.0." + ): + ti.init(packed=True) + + +def test_deprecated_packed_false(): + with pytest.warns( + DeprecationWarning, + match= + r"The automatic padding mode \(packed=False\) will no longer exist in v1.4.0. The switch will " + "also be removed then. Make sure your code doesn't rely on it."): + ti.init(packed=False)