From aa77f9941fad8fe6d7b3c39d7391a759f84aded1 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 15 Oct 2026 12:49:37 +0200 Subject: [PATCH 1/2] Deprecate unused dpnp.config settings __DPNP_QUEUE_GPU__, __DPNP_OUTPUT_NUMPY__ and __DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__ are not used anywhere in dpnp. Reading them now emits a DeprecationWarning; they will be removed in a future release. --- dpnp/config.py | 39 ++++++++++++++++++++++----------------- dpnp/tests/test_config.py | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 17 deletions(-) create mode 100644 dpnp/tests/test_config.py diff --git a/dpnp/config.py b/dpnp/config.py index 0d973cdd298e..af004a990477 100644 --- a/dpnp/config.py +++ b/dpnp/config.py @@ -28,32 +28,37 @@ import os +import warnings __DPNP_ORIGIN__ = int(os.getenv("DPNP_ORIGIN", 0)) """ Explicitly use original host Python NumPy """ -__DPNP_QUEUE_GPU__ = int(os.getenv("DPNP_QUEUE_GPU", 0)) -""" -Explicitly use GPU for SYCL queue -""" - -__DPNP_OUTPUT_NUMPY__ = int(os.getenv("DPNP_OUTPUT_NUMPY", 0)) -""" -Explicitly use NumPy.ndarray as return type for creation functions -""" - -__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__ = int( - os.getenv("DPNP_OUTPUT_DPCTL_DEFAULT_SHARED", 0) -) -""" -Explicitly use SYCL shared memory parameter in DPCtl array constructor for creation functions -""" - __DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__ = int( os.getenv("DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK", 1) ) """ Trigger non-implemented exception when DPNP fallbacks on NumPy implementation """ + +# settings that no longer have any effect, kept as deprecated attributes +_DEPRECATED_SETTINGS = { + "__DPNP_QUEUE_GPU__": int(os.getenv("DPNP_QUEUE_GPU", 0)), + "__DPNP_OUTPUT_NUMPY__": int(os.getenv("DPNP_OUTPUT_NUMPY", 0)), + "__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__": int( + os.getenv("DPNP_OUTPUT_DPCTL_DEFAULT_SHARED", 0) + ), +} + + +def __getattr__(name): + if name in _DEPRECATED_SETTINGS: + warnings.warn( + f"`dpnp.config.{name}` is deprecated, and will be removed in a " + "future release. It has no effect.", + DeprecationWarning, + stacklevel=2, + ) + return _DEPRECATED_SETTINGS[name] + raise AttributeError(f"module {__name__!r} has no attribute {name!r}") diff --git a/dpnp/tests/test_config.py b/dpnp/tests/test_config.py new file mode 100644 index 000000000000..b33fa39c1247 --- /dev/null +++ b/dpnp/tests/test_config.py @@ -0,0 +1,22 @@ +import pytest + +import dpnp + + +class TestDeprecatedSettings: + @pytest.mark.parametrize( + "name", + [ + "__DPNP_QUEUE_GPU__", + "__DPNP_OUTPUT_NUMPY__", + "__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__", + ], + ) + def test_warns(self, name): + with pytest.warns(DeprecationWarning, match="has no effect"): + value = getattr(dpnp.config, name) + assert isinstance(value, int) + + def test_unknown_name(self): + with pytest.raises(AttributeError, match="has no attribute"): + getattr(dpnp.config, "__DPNP_UNKNOWN__") From 1506d2bc1e7c503f625fc7b5daa43d7a05453d66 Mon Sep 17 00:00:00 2001 From: Anton Volkov Date: Thu, 15 Oct 2026 12:50:01 +0200 Subject: [PATCH 2/2] Add a changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d6b8161ef84..c62d963172ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ This release is compatible with NumPy 2.5. ### Deprecated * Deprecated setting the shape via the `shape` attribute of `dpnp.ndarray` and `dpnp.tensor.usm_ndarray`. Use `dpnp.reshape`/`dpnp.tensor.reshape` (or the `reshape` method) instead [#2967](https://github.com/IntelPython/dpnp/pull/2967) +* Deprecated `dpnp.config.__DPNP_QUEUE_GPU__`, `dpnp.config.__DPNP_OUTPUT_NUMPY__` and `dpnp.config.__DPNP_OUTPUT_DPCTL_DEFAULT_SHARED__`, which have no effect; reading them now emits a `DeprecationWarning` [#3107](https://github.com/IntelPython/dpnp/pull/3107) ### Removed