Repository navigation
Expose new SYCL device aspects from DPC++ 2026.x #2416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -960,6 +960,86 @@ cdef class SyclDevice(_SyclDevice): | |
| cdef _aspect_type AT = _aspect_type._ext_oneapi_ipc_memory | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_is_integrated_gpu(self): | ||
| """ Returns ``True`` if this device is a GPU integrated with | ||
| the host processor, sharing its memory, ``False`` otherwise. | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device is an integrated GPU. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_is_integrated_gpu | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_clock_sub_group(self): | ||
| """ Returns ``True`` if this device supports reading a clock | ||
| counter of ``sub_group`` scope in kernels | ||
| (``sycl_ext_oneapi_clock``), ``False`` otherwise. | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device supports a sub-group scope clock. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_clock_sub_group | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_clock_work_group(self): | ||
| """ Returns ``True`` if this device supports reading a clock | ||
| counter of ``work_group`` scope in kernels | ||
| (``sycl_ext_oneapi_clock``), ``False`` otherwise. | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device supports a work-group scope clock. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_clock_work_group | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_clock_device(self): | ||
| """ Returns ``True`` if this device supports reading a clock | ||
| counter of ``device`` scope in kernels | ||
| (``sycl_ext_oneapi_clock``), ``False`` otherwise. | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device supports a device scope clock. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_clock_device | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_native_assert(self): | ||
| """ Returns ``True`` if this device supports ``assert`` in | ||
| kernels natively, ``False`` otherwise. On devices without this | ||
| aspect, ``assert`` statements in kernels are ignored. | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device supports native ``assert`` in kernels. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_native_assert | ||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def has_aspect_ext_oneapi_register_host_memory(self): | ||
| """ Returns ``True`` if host memory allocated outside of SYCL | ||
| can be registered for faster transfers to this device | ||
| (``sycl_ext_oneapi_register_host_memory``), ``False`` otherwise. | ||
|
|
||
| Always ``False`` if dpctl was built with a DPC++ compiler that | ||
| does not support this extension (older than 2026.2). | ||
|
|
||
| Returns: | ||
| bool: | ||
| Indicates if device supports registering host memory. | ||
| """ | ||
| cdef _aspect_type AT = _aspect_type._ext_oneapi_register_host_memory | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With 2026.0/2026.1 (no |
||
| return DPCTLDevice_HasAspect(self._device_ref, AT) | ||
|
|
||
| @property | ||
| def image_2d_max_width(self): | ||
| """ Returns the maximum width of a 2D image or 1D image in pixels. | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,6 +229,26 @@ std::string DPCTL_AspectToStr(aspect aspectTy) | |
| case aspect::ext_oneapi_ipc_memory: | ||
| ss << "ext_oneapi_ipc_memory"; | ||
| break; | ||
| #endif | ||
| case aspect::ext_oneapi_is_integrated_gpu: | ||
| ss << "ext_oneapi_is_integrated_gpu"; | ||
| break; | ||
| case aspect::ext_oneapi_clock_sub_group: | ||
| ss << "ext_oneapi_clock_sub_group"; | ||
| break; | ||
| case aspect::ext_oneapi_clock_work_group: | ||
| ss << "ext_oneapi_clock_work_group"; | ||
| break; | ||
| case aspect::ext_oneapi_clock_device: | ||
| ss << "ext_oneapi_clock_device"; | ||
| break; | ||
| case aspect::ext_oneapi_native_assert: | ||
| ss << "ext_oneapi_native_assert"; | ||
| break; | ||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||
| case aspect::ext_oneapi_register_host_memory: | ||
| ss << "ext_oneapi_register_host_memory"; | ||
| break; | ||
| #endif | ||
| default: | ||
| throw std::runtime_error("Unsupported aspect type"); | ||
|
|
@@ -309,6 +329,26 @@ aspect DPCTL_StrToAspectType(const std::string &aspectTyStr) | |
| else if (aspectTyStr == "ext_oneapi_ipc_memory") { | ||
| aspectTy = aspect::ext_oneapi_ipc_memory; | ||
| } | ||
| #endif | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: |
||
| else if (aspectTyStr == "ext_oneapi_is_integrated_gpu") { | ||
| aspectTy = aspect::ext_oneapi_is_integrated_gpu; | ||
| } | ||
| else if (aspectTyStr == "ext_oneapi_clock_sub_group") { | ||
| aspectTy = aspect::ext_oneapi_clock_sub_group; | ||
| } | ||
| else if (aspectTyStr == "ext_oneapi_clock_work_group") { | ||
| aspectTy = aspect::ext_oneapi_clock_work_group; | ||
| } | ||
| else if (aspectTyStr == "ext_oneapi_clock_device") { | ||
| aspectTy = aspect::ext_oneapi_clock_device; | ||
| } | ||
| else if (aspectTyStr == "ext_oneapi_native_assert") { | ||
| aspectTy = aspect::ext_oneapi_native_assert; | ||
| } | ||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||
| else if (aspectTyStr == "ext_oneapi_register_host_memory") { | ||
| aspectTy = aspect::ext_oneapi_register_host_memory; | ||
| } | ||
| #endif | ||
| else { | ||
| // \todo handle the error | ||
|
|
@@ -365,6 +405,20 @@ aspect DPCTL_DPCTLAspectTypeToSyclAspect(DPCTLSyclAspectType AspectTy) | |
| #ifdef SYCL_EXT_ONEAPI_INTER_PROCESS_COMMUNICATION | ||
| case DPCTLSyclAspectType::ext_oneapi_ipc_memory: | ||
| return aspect::ext_oneapi_ipc_memory; | ||
| #endif | ||
| case DPCTLSyclAspectType::ext_oneapi_is_integrated_gpu: | ||
| return aspect::ext_oneapi_is_integrated_gpu; | ||
| case DPCTLSyclAspectType::ext_oneapi_clock_sub_group: | ||
| return aspect::ext_oneapi_clock_sub_group; | ||
| case DPCTLSyclAspectType::ext_oneapi_clock_work_group: | ||
| return aspect::ext_oneapi_clock_work_group; | ||
| case DPCTLSyclAspectType::ext_oneapi_clock_device: | ||
| return aspect::ext_oneapi_clock_device; | ||
| case DPCTLSyclAspectType::ext_oneapi_native_assert: | ||
| return aspect::ext_oneapi_native_assert; | ||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||
| case DPCTLSyclAspectType::ext_oneapi_register_host_memory: | ||
| return aspect::ext_oneapi_register_host_memory; | ||
| #endif | ||
| default: | ||
| throw std::runtime_error("Unsupported aspect type"); | ||
|
|
@@ -419,6 +473,20 @@ DPCTLSyclAspectType DPCTL_SyclAspectToDPCTLAspectType(aspect Aspect) | |
| #ifdef SYCL_EXT_ONEAPI_INTER_PROCESS_COMMUNICATION | ||
| case aspect::ext_oneapi_ipc_memory: | ||
| return DPCTLSyclAspectType::ext_oneapi_ipc_memory; | ||
| #endif | ||
| case aspect::ext_oneapi_is_integrated_gpu: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| return DPCTLSyclAspectType::ext_oneapi_is_integrated_gpu; | ||
| case aspect::ext_oneapi_clock_sub_group: | ||
| return DPCTLSyclAspectType::ext_oneapi_clock_sub_group; | ||
| case aspect::ext_oneapi_clock_work_group: | ||
| return DPCTLSyclAspectType::ext_oneapi_clock_work_group; | ||
| case aspect::ext_oneapi_clock_device: | ||
| return DPCTLSyclAspectType::ext_oneapi_clock_device; | ||
| case aspect::ext_oneapi_native_assert: | ||
| return DPCTLSyclAspectType::ext_oneapi_native_assert; | ||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||
| case aspect::ext_oneapi_register_host_memory: | ||
| return DPCTLSyclAspectType::ext_oneapi_register_host_memory; | ||
| #endif | ||
| default: | ||
| throw std::runtime_error("Unsupported aspect type"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -131,7 +131,23 @@ auto build_params() | |||
| std::make_pair("is_component", | ||||
| sycl::aspect::ext_oneapi_is_component), | ||||
| std::make_pair("is_composite", | ||||
| sycl::aspect::ext_oneapi_is_composite)); | ||||
| sycl::aspect::ext_oneapi_is_composite), | ||||
| std::make_pair("ext_oneapi_is_integrated_gpu", | ||||
| sycl::aspect::ext_oneapi_is_integrated_gpu), | ||||
| std::make_pair("ext_oneapi_clock_sub_group", | ||||
| sycl::aspect::ext_oneapi_clock_sub_group), | ||||
| std::make_pair("ext_oneapi_clock_work_group", | ||||
| sycl::aspect::ext_oneapi_clock_work_group), | ||||
| std::make_pair("ext_oneapi_clock_device", | ||||
| sycl::aspect::ext_oneapi_clock_device), | ||||
| std::make_pair("ext_oneapi_native_assert", | ||||
| sycl::aspect::ext_oneapi_native_assert) | ||||
| #ifdef SYCL_EXT_ONEAPI_REGISTER_HOST_MEMORY | ||||
| , | ||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||
| std::make_pair("ext_oneapi_register_host_memory", | ||||
| sycl::aspect::ext_oneapi_register_host_memory) | ||||
| #endif | ||||
| ); | ||||
|
|
||||
| auto pairs = | ||||
| build_param_pairs<const char *, std::pair<const char *, sycl::aspect>, | ||||
|
|
||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2412 adds
SyclPlatform.has_aspect_*for a fixed list of device aspects. Whichever of the two PRs is merged second should add these six properties toSyclPlatformtoo. OtherwiseSyclDevicehashas_aspect_ext_oneapi_clock_deviceandSyclPlatformdoes not.