Skip to content

Fix kernel launches over more than INT_MAX work-items with DPC++ 2026.2 - #3089

Open
antonwolfy wants to merge 3 commits into
masterfrom
backport-huge-array-index-tests
Open

antonwolfy wants to merge 3 commits into
masterfrom
backport-huge-array-index-tests

Conversation

@antonwolfy

@antonwolfy antonwolfy commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

This PR fixes a RuntimeError raised by kernels launched over more than INT_MAX work-items when dpnp is built with DPC++ compiler 2026.2:

RuntimeError: The kernel was compiled with -fsycl-id-queries-range=int, but the provided range/offset exceeds the maximum value storable in an int. Either reduce the range/offset or recompile the kernel with -fsycl-id-queries-range=[uint|size_t].

It affects operations on arrays with more than 2**31 elements that go through a strided kernel, e.g. copying a broadcast view, dpnp.take, advanced indexing, dpnp.choose and assignment through __setitem__. Builds with DPC++ 2026.1 are not affected.

Starting with 2026.2, the range a kernel assumes for its work-item IDs is recorded in the device image at the device link step, and the SYCL runtime checks each launch against it. dpnp passed -fno-sycl-id-queries-fit-in-int only at compile time, so the link step recorded the default int range even though the device code was built for size_t.

The existing option spelling is kept because both 2026.1 and 2026.2 accept it.

The third party tests for arrays with more than 2**31 elements are updated:

  • TestHugeArrays: new test_take_negative_index_at_int32_size_boundary, which uses a broadcast view, needs no real allocation and runs by default; reworked test_take_array and test_take_scalar
  • new TestTriLargeDimensions for dpnp.tri with more than 2**31 rows or columns
  • added tests that depend on implementation-internal kernels are marked as skipped

Validated with DPC++ 2026.2 on Intel Data Center GPU Max 1100 (Level Zero) and on CPU (OpenCL), running the slow tests with -m slow; results are the same on both devices:

Test Before After
TestHugeArrays::test_advanced failed passed
TestHugeArrays::test_take_array failed passed
TestHugeArrays::test_take_scalar failed passed
TestHugeArrays::test_choose failed passed
TestTriLargeDimensions (2 tests) passed passed

The default (non-slow) run of the changed test files passes on both devices, and the build has no new warnings.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?

Starting with DPC++ 2026.2 the ID-queries range is recorded in the device
image during the device link step. With the option passed only at compile
time, the link step falls back to the default int range and kernels
launched over more than INT_MAX work-items raise a RuntimeError.
@antonwolfy antonwolfy added this to the 0.21.0 release milestone Oct 7, 2026
@antonwolfy antonwolfy self-assigned this Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

View rendered docs @ https://intelpython.github.io/dpnp/pull/3089/index.html

@coveralls

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 78.667%. remained the same — backport-huge-array-index-tests into master

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Array API standard conformance tests for dpnp=0.21.0dev13=np2py314h8d9cdd5_4 ran successfully.
Passed: 1376
Failed: 0
Skipped: 6

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants