Repository navigation
Remove the legacy backend - #3163
ndgrigorian wants to merge 5 commits into
Conversation
68eef44 to
d7cce7f
Compare
315889e to
142a3d8
Compare
d7cce7f to
71b2060
Compare
142a3d8 to
160719a
Compare
|
Array API standard conformance tests for dpnp=0.22.0dev3=np2py314h8d9cdd5_131 ran successfully. |
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3163/index.html |
71b2060 to
86d7f1b
Compare
160719a to
014a132
Compare
c3083f7 to
5ed41e0
Compare
edee62b to
843a343
Compare
5ed41e0 to
c60c009
Compare
843a343 to
0232b4c
Compare
c60c009 to
9c8c9ec
Compare
804d1ed to
f2ab866
Compare
9c8c9ec to
c5b012f
Compare
c5b012f to
ae88fe1
Compare
46d8cc7 to
8463a23
Compare
ae88fe1 to
02dec42
Compare
dpnp.random no longer uses dpnp_backend_c, and dpnp.partition left it in gh-3138, so nothing calls the backend any more. Drop the whole of dpnp/backend: the RNG kernels, DPNPRandomState and the backend engines, the function-pointer tables, the GTest suite with the DPNP_BACKEND_TESTS option, the examples and the Doxygen docs. With it go the Cython modules dpnp_algo, dpnp_algo_random and dpnp_algo_utils, call_origin, get_dpnp_descriptor with dpnp_descriptor and the DPNP_ORIGIN setting it read. The helpers of dpnp_algo_utils that are still used become a Python module, the vendored CMake modules move to cmake/Modules, and the conda recipes no longer pin onemkl-sycl-rng.
d2f000b to
3194517
Compare
9139b78 to
2e82bd8
Compare
It came only through the ignored mkl-dpcpp run export, so import dpnp failed to load libmkl_sycl_sparse.
dpnp itself never calls it; only the assert wrappers in dpnp/tests/testing/array.py convert their arguments with it.
2e82bd8 to
9427b74
Compare
vlad-perevezentsev
left a comment
There was a problem hiding this comment.
Nothing loads the backend or libmkl_sycl_rng any more, the random streams are bit-identical to #3162, and the tests pass.
A few comments below:
| * Removed the legacy backend implementation of `dpnp.random`, which no longer needs `onemkl-sycl-rng` [#3163](https://github.com/IntelPython/dpnp/pull/3163) | ||
| * Removed the legacy `dpnp_backend_c` library with its GTest suite and the `DPNP_BACKEND_TESTS` CMake option, the Cython module `dpnp.dpnp_algo.dpnp_algo` built on it, and the NumPy fallback helper `call_origin` [#3163](https://github.com/IntelPython/dpnp/pull/3163) | ||
| * Removed `dpnp.get_dpnp_descriptor` and the `dpnp.config.__DPNP_ORIGIN__` setting, set by the `DPNP_ORIGIN` environment variable, which only it read [#3163](https://github.com/IntelPython/dpnp/pull/3163) | ||
| * Removed the `dpnp.config.__DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__` setting, set by the `DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK` environment variable, which nothing reads since dpnp no longer falls back on NumPy [#3163](https://github.com/IntelPython/dpnp/pull/3163) |
There was a problem hiding this comment.
Following up on #3163 (comment): 5671b36 now removes __DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__ without the deprecation it had before, and __DPNP_ORIGIN__ goes the same way. Code that still sets them now fails instead of warning:
import pytest, dpnp
with pytest.MonkeyPatch.context() as mp:
mp.setattr(dpnp.config, "__DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__", 0)
# AttributeError: <module 'dpnp.config' ...> has no attribute '__DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__'
# #3162 head: no errorCould both go into _DEPRECATED_SETTINGS for a release, as the earlier version of this commit did?
| # ***************************************************************************** | ||
|
|
||
|
|
||
| """Helpers to place the result of a computation on its inputs' queue.""" |
There was a problem hiding this comment.
In a tree built in place before this PR, dpnp/dpnp_utils/dpnp_algo_utils.cpython-*.so stays after build_locally.py, and Python imports it instead of this file: extension modules win over .py files. Then import dpnp still loads the old Cython module, libdpnp_backend_c.so and libmkl_sycl_rng, and edits here have no effect:
# a tree built before this PR, after `git checkout` of this PR and `python scripts/build_locally.py`
python -c "import dpnp.dpnp_utils.dpnp_algo_utils as m; print(m.__file__)"
# .../dpnp/dpnp_utils/dpnp_algo_utils.cpython-314-x86_64-linux-gnu.soCould this module get a name an old build does not have, e.g. dpnp_utils/dpnp_utils_usm.py?
| # 8. Paths stored in the CMake System Package Registry | ||
| # 9. Paths specified by the PATHS option (assumed hard-coded guesses) | ||
| set(path_to_cmake_dir ${CMAKE_SOURCE_DIR}/dpnp/backend/cmake/Modules) | ||
| set(path_to_cmake_dir ${CMAKE_SOURCE_DIR}/cmake/Modules) |
There was a problem hiding this comment.
Nit: Nothing links the oneDPL target after this PR: dpnp_backend_c was its only user. So ONEDPL_PAR_BACKEND and find_package(oneDPL REQUIRED ...) at lines 96-97 now only check that oneDPL is installed; gcd.hpp and lcm.hpp in libtensor get <oneapi/dpl/numeric> from the default include path. If the lines stay for that check, a short comment saying so would help.
| run: cp -r dpnp/backend/doc/html ${{ env.PUBLISH_DIR }}/backend_doc | ||
|
|
||
| # Detect if this is a fork PR | ||
| - name: Check if fork PR |
There was a problem hiding this comment.
Nit: With these steps gone, backend_doc/ is no longer built, but publishing to . keeps the files already on gh-pages. So https://intelpython.github.io/dpnp/backend_doc/ will keep serving the docs of the removed backend, with nothing linking to it. Could it be deleted from gh-pages once this is merged?
|
|
||
| # For Windows OS with Python >= 3.7, it is required to explicitly define a path | ||
| # where to search for DLLs towards both DPNP backend and DPCTL Sycl interface, | ||
| # where to search for the DLLs of DPNP and of the DPCTL Sycl interface, |
There was a problem hiding this comment.
Nit: After this PR nothing installs a DLL into dpnp/: the Windows package of this head has only .pyd modules, in dpnp/libtensor and dpnp/tensor. So os.add_dll_directory(mypath) and mypath in PATH below have no use now. Could they go, with this comment naming only the DPCTL interface library?
|
|
||
|
|
||
| @pytest.mark.usefixtures("allow_fall_back_on_numpy") | ||
| def test_bytes(): |
There was a problem hiding this comment.
Nit: import pytest at line 1 is unused now that the usefixtures line is gone.
This PR removes the legacy
dpnp_backend_clibrary and the Cython layer built on it, as the last part of the series splitting #3147. It is stacked on #3162. Withdpnp.randomon the device RNG (#3157-#3162) anddpnp.partitionon libtensor (#3138), nothing calls the backend any more.Removes
dpnp/backend: the RNG kernels,DPNPRandomStateand the mt19937/mcg59 engines, the function-pointer tables, the C++ examples, the GTest suite with theDPNP_BACKEND_TESTSCMake option, and the Doxygen docs with their page in the documentationdpnp_algo,dpnp_algo_randomanddpnp_algo_utils, and the NumPy fallback helpercall_origindpnp.get_dpnp_descriptor, withdpnp_descriptorand thedpnp.config.__DPNP_ORIGIN__setting that only it readdpnp.config.__DPNP_RAISE_EXCEPION_ON_NUMPY_FALLBACK__setting, which nothing reads since dpnp no longer falls back on NumPyonemkl-sycl-rngpin in the conda recipesAlso
get_usm_allocationsandmap_dtype_to_deviceare now in a Python module,dpnp/dpnp_utils/dpnp_algo_utils.py, andconvert_item, which only the test helpers use, moves todpnp/tests/testing/array.pydpnp/__init__.pyimportsdpnp.configitself, which it used to get as a side effect of the Cythondpnp_algo_utilsdpnp/backend/cmake/Modulestocmake/Modules