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_166 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
d2f000b to
3194517
Compare
9139b78 to
2e82bd8
Compare
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.
9427b74 to
7808dc4
Compare
3194517 to
e334337
Compare
…ke` (#3216) CMake 4.5 identifies the open source DPC++ compiler by a new compiler ID. Its release notes say: "The open-source DPC++ compiler, version 7.0 and newer, is now supported with compiler id DPClang for languages C and CXX". CMake recognizes it by the `__DPCPP__` and `__dpcpp_major__` macros that the compiler defines since its 7.0 release, and keeps `IntelLLVM` for icpx, which defines `__INTEL_LLVM_COMPILER`. There is no policy to get the old `Clang` ID back. The vendored `dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake` accepts only `Clang` and `IntelLLVM`, so with the open source DPC++ and CMake 4.5 the configure step fails: ``` -- The CXX compiler identification is DPClang 7.2.0 CMake Error at dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake:144 (message): Intel SYCL Compiler not found. ``` This PR adds `DPClang` to both compiler-ID checks of the module: the one that decides whether the compiler supports SYCL, and the one that adds `-fsycl`. The version parsing needs no change, as `--version` still prints `clang version 24.0.0git` after the new `DPC++ compiler 7.2.0` line. The oneAPI 2026.3.0 compiler package ships the same module unchanged from 2026.2.0, so it doesn't support `DPClang` either. Nothing else in the build depends on the ID: dpnp's own CMake files don't check it, MKL, TBB and oneDPL come with their own config files, and no C++ code sees it. Built locally with the nightly of 2026-11-30 and `--onemath`: - With CMake 4.5.1 and this change, the generated `build.ninja` has every compile and link command of dpnp, its extensions and oneMath the same as with CMake 4.4.5; the only differences are CMake's own (version header, new phony targets, its `DPClang` modules among the regeneration inputs). Build warnings are the same too. - `dpnp/tests` on the OpenCL CPU device: 97370 passed, 7190 skipped and 3 xfailed, as with CMake 4.4.5. - Without this change, CMake 4.5.1 fails at the configure step as shown above. The `Build with Open Source LLVM SYCL compiler` job can't show this yet: dpctl, which the job builds from source first, has its own `IntelSYCLConfig.cmake` with the same check and needs the same two lines (the local build used them). Until then: - With CMake 4.5.1, which the job installs on master today, it fails at the `Build and install dpctl` step, before dpnp is built. - #3215 pins the job to CMake 4.4.5, which still says `Clang`. Once dpctl accepts `DPClang`, the Dependabot PR that moves the pin to CMake 4.5 runs this code in CI. #3163 moves `dpnp/backend/cmake/Modules/` to `cmake/Modules/`; whichever of the two merges second has to carry the two lines to the moved file.
…ke` (#3216) CMake 4.5 identifies the open source DPC++ compiler by a new compiler ID. Its release notes say: "The open-source DPC++ compiler, version 7.0 and newer, is now supported with compiler id DPClang for languages C and CXX". CMake recognizes it by the `__DPCPP__` and `__dpcpp_major__` macros that the compiler defines since its 7.0 release, and keeps `IntelLLVM` for icpx, which defines `__INTEL_LLVM_COMPILER`. There is no policy to get the old `Clang` ID back. The vendored `dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake` accepts only `Clang` and `IntelLLVM`, so with the open source DPC++ and CMake 4.5 the configure step fails: ``` -- The CXX compiler identification is DPClang 7.2.0 CMake Error at dpnp/backend/cmake/Modules/IntelSYCLConfig.cmake:144 (message): Intel SYCL Compiler not found. ``` This PR adds `DPClang` to both compiler-ID checks of the module: the one that decides whether the compiler supports SYCL, and the one that adds `-fsycl`. The version parsing needs no change, as `--version` still prints `clang version 24.0.0git` after the new `DPC++ compiler 7.2.0` line. The oneAPI 2026.3.0 compiler package ships the same module unchanged from 2026.2.0, so it doesn't support `DPClang` either. Nothing else in the build depends on the ID: dpnp's own CMake files don't check it, MKL, TBB and oneDPL come with their own config files, and no C++ code sees it. Built locally with the nightly of 2026-11-30 and `--onemath`: - With CMake 4.5.1 and this change, the generated `build.ninja` has every compile and link command of dpnp, its extensions and oneMath the same as with CMake 4.4.5; the only differences are CMake's own (version header, new phony targets, its `DPClang` modules among the regeneration inputs). Build warnings are the same too. - `dpnp/tests` on the OpenCL CPU device: 97370 passed, 7190 skipped and 3 xfailed, as with CMake 4.4.5. - Without this change, CMake 4.5.1 fails at the configure step as shown above. The `Build with Open Source LLVM SYCL compiler` job can't show this yet: dpctl, which the job builds from source first, has its own `IntelSYCLConfig.cmake` with the same check and needs the same two lines (the local build used them). Until then: - With CMake 4.5.1, which the job installs on master today, it fails at the `Build and install dpctl` step, before dpnp is built. - #3215 pins the job to CMake 4.4.5, which still says `Clang`. Once dpctl accepts `DPClang`, the Dependabot PR that moves the pin to CMake 4.5 runs this code in CI. #3163 moves `dpnp/backend/cmake/Modules/` to `cmake/Modules/`; whichever of the two merges second has to carry the two lines to the moved file.
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.
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.
e334337 to
9247563
Compare
7808dc4 to
5bce8bf
Compare
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