Repository navigation
Build dpnp as C++20 - #3190
Open
antonwolfy wants to merge 1 commit into
Open
Build dpnp as C++20#3190antonwolfy wants to merge 1 commit into
antonwolfy wants to merge 1 commit into
Conversation
Bump CMAKE_CXX_STANDARD from 17 to 20 in the root CMakeLists.txt and in the pybind11 example, set the clang-format standard to c++20, and replace the dpnp_remove_cvref_t helper in the legacy backend with std::remove_cvref_t.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
November 16, 2026 18:18
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3190/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.22.0dev2=np2py314h8d9cdd5_7 ran successfully. |
Collaborator
| ) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 17) | ||
| set(CMAKE_CXX_STANDARD 20) |
Contributor
There was a problem hiding this comment.
The installed dpnp4pybind11.hpp still compiles as C++17, but this example is its only build in CI. At C++20, nothing would catch a C++20-only change in that header, which would break C++17 extensions built against dpnp. Should the public headers stay C++17-compatible? If yes, could the example stay at C++17?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR moves the dpnp build from C++17 to C++20. DPC++ 2026.0, the minimum supported compiler, compiles SYCL kernels in C++20 mode.
CMakeLists.txtandexamples/pybind11/use_dpnp_array/CMakeLists.txt:CMAKE_CXX_STANDARDis now 20. With CMake's default extensions, icpx gets-std=gnu++20instead of-std=gnu++17..clang-format:Standard: c++20. pre-commit reformats nothing.dpnp/backend/src/dpnp_fptr.hpp: thedpnp_remove_cvref_thelper, which existed only becausestd::remove_cvref_tneeds C++20, is replaced bystd::remove_cvref_t.dpnp/libtensor/AGENTS.md: the C++ standard rule now says C++20.The libtensor headers shipped with dpnp are unchanged and use no C++20 features yet, so extensions that include them and build as C++17 keep working.
Measured with icpx 2026.2 on Linux (12 CPUs, Ubuntu 26.04), Release build, two clean builds of each with
scripts/build_locally.py:.sofilesBuild time grows by about 34 s (+3.8%). Each pybind11 extension in
dpnp/libtensorgrows by 12 to 20 KB,libdpnp_backend_c.soby 4 KB, and the Cython modules are unchanged or differ by at most 48 B.Tests with the C++20 build and with master (C++17) built the same way, run from the in-place builds:
dpnp/tests(SKIP_TENSOR_TESTS=1)dpnp/tests/tensorThe results are the same for C++17 and C++20 on both GPUs. The one failure is
test_init.py::TestImportError::test_import_error, which fails on every in-place build that isn't installed. The pybind11 example builds with-std=gnu++20and no warnings, and its 8 tests pass.On the Max 1100 (112 CPUs, Ubuntu 24.04), the clean build takes 655 s with C++17 and 658 s with C++20, and the
.sofiles grow by 211 KB (+0.11%). That host gives the same 18-Wgcc-install-dir-libstdcxxdriver warnings with both standards, about its GCC 13/14 install layout.Not checked locally: CUDA and HIP targets (no CUDA/HIP SYCL plugins on the hosts) and Windows. The open-source LLVM SYCL, conda-forge and Windows builds run in this PR's CI.