Repository navigation
Fix more kernel launches over INT_MAX work-items with DPC++ 2026.2 - #3104
Merged
Merged
Conversation
With DPC++ 2026.2 the work-item ID range is recorded at the device link step, so modules built without the option at link time fail to launch kernels over more than INT_MAX work-items. Pass it at compile and link time to the ufunc, window and statistics extensions and to the dpnp_backend_c library, whose kernels can be launched over such ranges.
antonwolfy
requested review from
ndgrigorian and
vlad-perevezentsev
as code owners
October 15, 2026 09:36
Contributor
|
View rendered docs @ https://intelpython.github.io/dpnp/pull/3104/index.html |
Contributor
|
Array API standard conformance tests for dpnp=0.21.0dev15=np2py314h8d9cdd5_18 ran successfully. |
Collaborator
3 of 7 tasks
The syrk copy kernel can be launched over more than INT_MAX work-items.
vlad-perevezentsev
self-requested a review
October 23, 2026 08:18
vlad-perevezentsev
approved these changes
Oct 23, 2026
vlad-perevezentsev
left a comment
Contributor
There was a problem hiding this comment.
LGTM
Thank you @antonwolfy !
Contributor
Author
|
@exai-bot /review |
antonwolfy
added a commit
that referenced
this pull request
Oct 26, 2026
This PR moves the setup that the nine pybind11 extensions in `dpnp/backend/extensions` repeat into one CMake function, and raises the minimum CMake version so the workarounds for older versions can be removed. It is stacked on #3104 and will be rebased onto master once that PR is merged. 1. **Require CMake 3.27.** `cmake_minimum_required(VERSION 3.21...3.27)` claimed that CMake 3.21 was enough, but `pyproject.toml` and the conda recipes already require CMake 3.31.6 or newer, and `FetchContent_Declare(... FIND_PACKAGE_ARGS)` for pybind11 needs at least 3.24. The minimum is now 3.27, which removes the 11 copies of the Windows workaround for `target_link_options` in CMake older than 3.27. The policy level stays at 3.27, as builds use today, so no CMake policy changes behavior. 2. **Shared helper.** The nine extension `CMakeLists.txt` files repeated about 80 identical lines: the pybind11 module, SYCL, the `_usmarray` dependency, fat-binary options, include directories, math flags, device code split, coverage, the redistribution rpath and install. `build_dpnp_pybind11_ext` in `dpnp/CMakeLists.txt` now does this. Each extension lists its sources and extra include directories, keeps its own oneMKL/oneMath linking, and passes `LARGE_RANGES` when its kernels can be launched over more than `INT_MAX` work-items (`indexing`, `statistics`, `ufunc`, `window`), which adds `-fno-sycl-id-queries-fit-in-int` at compile and link time. A new extension can no longer miss one of these options by copying an outdated file. The only change in the generated build is for the `vm` extension: it had no fat-binary block, so it was the one extension built without `-fsycl-targets` when `DPNP_TARGET_CUDA`, `DPNP_TARGET_HIP` or `DPNP_SYCL_TARGETS` is set. It now gets these options like the others. `vm` compiles no kernels of its own, and in CUDA/HIP builds it compiles only `vm_py.cpp` and the two shared elementwise helper sources that `ufunc` already compiles with these options. **Verification.** The project was configured with CMake 4.4.4, Ninja and icpx 2026.1, with and without this change on top of the same base, and every compile and link command (`ninja -t commands` and `compile_commands.json`), the generated install rules and the configure warnings were compared: | Configuration | Result | |---|---| | Release (oneMKL) | identical | | Coverage with `DPNP_GENERATE_COVERAGE`, `DPNP_WITH_REDIST` and `DPNP_SYCL_TARGETS=spir64-unknown-unknown` | identical, except `-fsycl-targets` on the `vm` compile and link commands | | Release with `DPNP_USE_ONEMATH=ON` | identical | Windows builds are covered by CI.
github-actions Bot
added a commit
that referenced
this pull request
Oct 26, 2026
This PR moves the setup that the nine pybind11 extensions in `dpnp/backend/extensions` repeat into one CMake function, and raises the minimum CMake version so the workarounds for older versions can be removed. It is stacked on #3104 and will be rebased onto master once that PR is merged. 1. **Require CMake 3.27.** `cmake_minimum_required(VERSION 3.21...3.27)` claimed that CMake 3.21 was enough, but `pyproject.toml` and the conda recipes already require CMake 3.31.6 or newer, and `FetchContent_Declare(... FIND_PACKAGE_ARGS)` for pybind11 needs at least 3.24. The minimum is now 3.27, which removes the 11 copies of the Windows workaround for `target_link_options` in CMake older than 3.27. The policy level stays at 3.27, as builds use today, so no CMake policy changes behavior. 2. **Shared helper.** The nine extension `CMakeLists.txt` files repeated about 80 identical lines: the pybind11 module, SYCL, the `_usmarray` dependency, fat-binary options, include directories, math flags, device code split, coverage, the redistribution rpath and install. `build_dpnp_pybind11_ext` in `dpnp/CMakeLists.txt` now does this. Each extension lists its sources and extra include directories, keeps its own oneMKL/oneMath linking, and passes `LARGE_RANGES` when its kernels can be launched over more than `INT_MAX` work-items (`indexing`, `statistics`, `ufunc`, `window`), which adds `-fno-sycl-id-queries-fit-in-int` at compile and link time. A new extension can no longer miss one of these options by copying an outdated file. The only change in the generated build is for the `vm` extension: it had no fat-binary block, so it was the one extension built without `-fsycl-targets` when `DPNP_TARGET_CUDA`, `DPNP_TARGET_HIP` or `DPNP_SYCL_TARGETS` is set. It now gets these options like the others. `vm` compiles no kernels of its own, and in CUDA/HIP builds it compiles only `vm_py.cpp` and the two shared elementwise helper sources that `ufunc` already compiles with these options. **Verification.** The project was configured with CMake 4.4.4, Ninja and icpx 2026.1, with and without this change on top of the same base, and every compile and link command (`ninja -t commands` and `compile_commands.json`), the generated install rules and the configure warnings were compared: | Configuration | Result | |---|---| | Release (oneMKL) | identical | | Coverage with `DPNP_GENERATE_COVERAGE`, `DPNP_WITH_REDIST` and `DPNP_SYCL_TARGETS=spir64-unknown-unknown` | identical, except `-fsycl-targets` on the `vm` compile and link commands | | Release with `DPNP_USE_ONEMATH=ON` | identical | Windows builds are covered by CI. 2fe6540
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 passes
-fno-sycl-id-queries-fit-in-intat both compile and link time to theufunc,windowandstatisticsextensions and to thedpnp_backend_clibrary. Until now only thedpnp.tensormodules and theindexingextension had it.With DPC++ 2026.2 the range a kernel assumes for its work-item IDs is recorded at the device link step, so these modules recorded the default
intrange, and their kernels failed when launched over more thanINT_MAXwork-items:The other extensions don't need the option:
fft,lapack,sparseandvmcompile no kernels of their own, and the onlyblaskernel (syrk) runs over ann x nrange, where no single dimension can exceedINT_MAX. Instatisticseach work-item processes several elements, so the limit is reached only for very large inputs.Validated with DPC++ 2026.2 on Intel Data Center GPU Max 1100 (Level Zero) and on CPU (OpenCL), on inputs with
2**31 + 1elements; results are the same on both devices:dpnp.gcdon broadcastint8inputsufuncdpnp.hamming(2**31 + 1)windowdpnp.random.logistic(size=2**31 + 1)dpnp_backend_ctest_binary_ufuncs.py,test_histogram.py,test_window.py,test_product.py,test_random_state.py,test_statistics.py,test_fft.pyandtest_special.pypass on both devices, and the build has no new warnings.No new tests are added: these cases need multi-GiB allocations, so as slow tests they would not run in CI and would skip on most devices.