Skip to content

Expose new SYCL device aspects from DPC++ 2026.x - #2416

Open
antonwolfy wants to merge 2 commits into
masterfrom
new-device-aspects
Open

antonwolfy wants to merge 2 commits into
masterfrom
new-device-aspects

Conversation

@antonwolfy

Copy link
Copy Markdown
Collaborator

DPC++ 2026.x has device aspects that dpctl doesn't expose yet. This PR adds a DPCTLSyclAspectType value and a SyclDevice.has_aspect_* property for each of them:

  • ext_oneapi_is_integrated_gpu (2026.0, sycl_ext_oneapi_device_is_integrated_gpu): lets Python code pick paths specific to client GPUs.
  • ext_oneapi_clock_sub_group, ext_oneapi_clock_work_group, ext_oneapi_clock_device (2026.0, sycl_ext_oneapi_clock).
  • ext_oneapi_native_assert: 2026.0 removed fallback asserts, so on a device without this aspect, assert in a kernel is silently ignored.
  • ext_oneapi_register_host_memory (2026.2, sycl_ext_oneapi_register_host_memory).

aspect::ext_oneapi_register_host_memory exists only from DPC++ 2026.2 on, while the minimum compiler is 2026.0. Its mappings in dpctl_utils_helper.cpp are guarded by the SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY feature-test macro, the same way ext_oneapi_ipc_memory is guarded. The enum value is always defined, so the C-API and the Cython enum don't change with the compiler. Built with 2026.0 or 2026.1, has_aspect_ext_oneapi_register_host_memory returns False.

The other new aspects are all in 2026.0, so they need no guard.

The property names keep the ext_oneapi_ prefix, as has_aspect_ext_oneapi_ipc_memory does.

Tests:

  • test_sycl_device.py: the new aspects, and ext_oneapi_ipc_memory (which was missing), are added to list_of_supported_aspects. This covers the property and dpctl.select_device_with_aspects.
  • _device_attributes_checks.py: a check per new property.
  • test_sycl_device_aspects.cpp: the new aspects are added to the C-API aspect test. ext_oneapi_register_host_memory is added under the same guard.

Tested with icpx 2026.2 on OpenCL CPU and Level Zero GPU (Arrow Lake). The Python test suite has no failures (4515 tests, 1169 skipped), and the C-API tests pass (2504 passed, 808 skipped, run with DPCTL_VERBOSITY=warning, which CheckPropertyHandling needs). Values reported on that host:

aspect OpenCL CPU Level Zero GPU
ext_oneapi_is_integrated_gpu False True
ext_oneapi_clock_sub_group True True
ext_oneapi_clock_work_group True False
ext_oneapi_clock_device True False
ext_oneapi_native_assert True True
ext_oneapi_register_host_memory False False

The build with 2026.0/2026.1, where the guard is off, was not tested locally.

  • 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?
  • If this PR is a work in progress, are you opening the PR as a draft?

Add DPCTLSyclAspectType values and SyclDevice.has_aspect_* properties
for aspects added in DPC++ 2026.x:

- ext_oneapi_is_integrated_gpu
- ext_oneapi_clock_sub_group, ext_oneapi_clock_work_group and
  ext_oneapi_clock_device
- ext_oneapi_native_assert, which tells whether assert in kernels
  works; since 2026.0 removed fallback asserts, it is silently ignored
  on devices without it
- ext_oneapi_register_host_memory

ext_oneapi_register_host_memory is only defined starting with DPC++
2026.2, while the minimum compiler is 2026.0, so its mapping is guarded
by SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY, as is done for
ext_oneapi_ipc_memory. Built with an older compiler, the query returns
False.

Add the new aspects, and the missing ext_oneapi_ipc_memory, to the
Python aspect tests, and the new aspects to the C-API aspect test.
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

@coveralls

coveralls commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 74.837% (-0.06%) from 74.893% — new-device-aspects into master

std::make_pair("ext_oneapi_native_assert",
sycl::aspect::ext_oneapi_native_assert)
#ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY
,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
,

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the new device-aspect APIs and Python properties.

No open issues 🎉

What changed in this PR

Exposes six DPC++ 2026.x device aspects through dpctl’s C API and Python SyclDevice properties, enabling capability queries and aspect-based device selection.

Changes:

  • Adds integrated-GPU, clock-scope, native-assert, and host-memory-registration aspects across the C and Cython layers.
  • Guards host-memory-registration mappings for compatibility with DPC++ versions before 2026.2.
  • Extends Python and C API tests and documents the new properties and compiler-dependent behavior.
File Description
libsyclinterface/​tests/​test_sycl_device_aspects.cpp Adds C API coverage for the new aspects, with a compiler guard where required.
libsyclinterface/​include/​syclinterface/​dpctl_sycl_enum_types.h Adds six public aspect enum values.
libsyclinterface/​helper/​source/​dpctl_utils_helper.cpp Adds string and enum mappings for the new aspects.
dpctl/​tests/​test_sycl_device.py Extends property and selection tests to the new aspects and IPC memory.
dpctl/​tests/​_device_attributes_checks.py Adds attribute-access checks for all six new properties.
dpctl/​_sycl_device.pyx Exposes and documents six new device capability properties.
dpctl/​_backend.pxd Declares the matching Cython enum bindings.
CHANGELOG.md Records the new queries and older-compiler fallback behavior.

Review effort: Balanced

case aspect::ext_oneapi_ipc_memory:
return DPCTLSyclAspectType::ext_oneapi_ipc_memory;
#endif
case aspect::ext_oneapi_is_integrated_gpu:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these will need some kind of guards, so that AdaptiveCpp builds will work

Can also be done in that PR if preferred

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.

4 participants