@@ -32,6 +32,8 @@ from ._backend cimport ( # noqa: E211
32
32
DPCTLDevice_CreateSubDevicesEqually,
33
33
DPCTLDevice_Delete,
34
34
DPCTLDevice_GetBackend,
35
+ DPCTLDevice_GetComponentDevices,
36
+ DPCTLDevice_GetCompositeDevice,
35
37
DPCTLDevice_GetDeviceType,
36
38
DPCTLDevice_GetDriverVersion,
37
39
DPCTLDevice_GetGlobalMemCacheLineSize,
@@ -795,6 +797,32 @@ cdef class SyclDevice(_SyclDevice):
795
797
cdef _aspect_type AT = _aspect_type._emulated
796
798
return DPCTLDevice_HasAspect(self ._device_ref, AT)
797
799
800
+ @property
801
+ def is_component (self ):
802
+ """ Returns ``True`` if this device is a component device, ``False``
803
+ otherwise. A device with this aspect will have a composite device
804
+ from which it is descended.
805
+
806
+ Returns:
807
+ bool:
808
+ Indicates if device is a component device.
809
+ """
810
+ cdef _aspect_type AT = _aspect_type._is_component
811
+ return DPCTLDevice_HasAspect(self ._device_ref, AT)
812
+
813
+
814
+ @property
815
+ def is_composite (self ):
816
+ """ Returns ``True`` if this device is a composite device, ``False``
817
+ otherwise. A device with this aspect contains component devices.
818
+
819
+ Returns:
820
+ bool:
821
+ Indicates if device is a composite device.
822
+ """
823
+ cdef _aspect_type AT = _aspect_type._is_composite
824
+ return DPCTLDevice_HasAspect(self ._device_ref, AT)
825
+
798
826
@property
799
827
def image_2d_max_width (self ):
800
828
""" Returns the maximum width of a 2D image or 1D image in pixels.
@@ -1728,6 +1756,41 @@ cdef class SyclDevice(_SyclDevice):
1728
1756
return None
1729
1757
return SyclDevice._create(pDRef)
1730
1758
1759
+ @property
1760
+ def composite_device (self ):
1761
+ """ The composite device for a component device, or None for a non-component device.
1762
+
1763
+ Returns:
1764
+ dpctl.SyclDevice:
1765
+ The composite :class:`dpctl.SyclDevice` instance for a
1766
+ component device, or ``None`` for a non-component device.
1767
+ """
1768
+ cdef DPCTLSyclDeviceRef cDRef = NULL
1769
+ cDRef = DPCTLDevice_GetCompositeDevice(self ._device_ref)
1770
+ if (cDRef is NULL ):
1771
+ return None
1772
+ return SyclDevice._create(cDRef)
1773
+
1774
+ def component_devices (self ):
1775
+ """ Returns a list of component devices contained in this SYCL device.
1776
+
1777
+ The returned list will be empty if this SYCL device is not a composite
1778
+ device, i.e., if `is_composite` is ``False``.
1779
+
1780
+ Returns:
1781
+ List[:class:`dpctl.SyclDevice`]:
1782
+ List of component devices.
1783
+
1784
+ Raises:
1785
+ dpctl.SyclSubdeviceCreationError:
1786
+ if sub-devices can not be created.
1787
+ """
1788
+ cdef DPCTLDeviceVectorRef cDVRef = NULL
1789
+ cDVRef = DPCTLDevice_GetComponentDevices(self ._device_ref)
1790
+ if cDVRef is NULL :
1791
+ raise ValueError (" Internal error: NULL device vector encountered" )
1792
+ return _get_devices(cDVRef)
1793
+
1731
1794
@property
1732
1795
def profiling_timer_resolution (self ):
1733
1796
""" Profiling timer resolution.
0 commit comments