Repository navigation
Expose new SYCL device aspects from DPC++ 2026.x - #2416
antonwolfy wants to merge 2 commits into
Conversation
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.
|
View rendered docs @ https://intelpython.github.io/dpctl/pulls/2416/index.html |
| std::make_pair("ext_oneapi_native_assert", | ||
| sycl::aspect::ext_oneapi_native_assert) | ||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||
| , |
There was a problem hiding this comment.
🟢 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: |
There was a problem hiding this comment.
All of these will need some kind of guards, so that AdaptiveCpp builds will work
Can also be done in that PR if preferred
| bool: | ||
| Indicates if device supports registering host memory. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_register_host_memory |
There was a problem hiding this comment.
With 2026.0/2026.1 (no SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY), DPCTL_DPCTLAspectTypeToSyclAspect throws for this value and DPCTLDevice_HasAspect passes it to error_handler. The property still returns False, but with DPCTL_VERBOSITY set every call logs "Unsupported aspect type". Could DPCTLDevice_HasAspect return false for this aspect when the macro is undefined?
| else if (aspectTyStr == "ext_oneapi_ipc_memory") { | ||
| aspectTy = aspect::ext_oneapi_ipc_memory; | ||
| } | ||
| #endif |
There was a problem hiding this comment.
Nit: else if right after #endif makes the chain depend on the preprocessor state. Moving the guarded branches (ipc_memory, register_host_memory) to the end of the chain, just before the final else, would read better.
DPC++ 2026.x has device aspects that dpctl doesn't expose yet. This PR adds a
DPCTLSyclAspectTypevalue and aSyclDevice.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,assertin a kernel is silently ignored.ext_oneapi_register_host_memory(2026.2,sycl_ext_oneapi_register_host_memory).aspect::ext_oneapi_register_host_memoryexists only from DPC++ 2026.2 on, while the minimum compiler is 2026.0. Its mappings indpctl_utils_helper.cppare guarded by theSYCL_EXT_ONEAPI_REGISTER_HOST_MEMORYfeature-test macro, the same wayext_oneapi_ipc_memoryis 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_memoryreturnsFalse.The other new aspects are all in 2026.0, so they need no guard.
The property names keep the
ext_oneapi_prefix, ashas_aspect_ext_oneapi_ipc_memorydoes.Tests:
test_sycl_device.py: the new aspects, andext_oneapi_ipc_memory(which was missing), are added tolist_of_supported_aspects. This covers the property anddpctl.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_memoryis 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, whichCheckPropertyHandlingneeds). Values reported on that host:ext_oneapi_is_integrated_gpuext_oneapi_clock_sub_groupext_oneapi_clock_work_groupext_oneapi_clock_deviceext_oneapi_native_assertext_oneapi_register_host_memoryThe build with 2026.0/2026.1, where the guard is off, was not tested locally.