@@ -32,6 +32,8 @@ from ._backend cimport ( # noqa: E211
3232 DPCTLDevice_CreateSubDevicesEqually,
3333 DPCTLDevice_Delete,
3434 DPCTLDevice_GetBackend,
35+ DPCTLDevice_GetComponentDevices,
36+ DPCTLDevice_GetCompositeDevice,
3537 DPCTLDevice_GetDeviceType,
3638 DPCTLDevice_GetDriverVersion,
3739 DPCTLDevice_GetGlobalMemCacheLineSize,
@@ -795,6 +797,32 @@ cdef class SyclDevice(_SyclDevice):
795797 cdef _aspect_type AT = _aspect_type._emulated
796798 return DPCTLDevice_HasAspect(self ._device_ref, AT)
797799
800+ @property
801+ def has_aspect_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 has_aspect_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+
798826 @property
799827 def image_2d_max_width (self ):
800828 """ Returns the maximum width of a 2D image or 1D image in pixels.
@@ -1520,7 +1548,7 @@ cdef class SyclDevice(_SyclDevice):
15201548 Created sub-devices.
15211549
15221550 Raises:
1523- dpctl.SyclSubdeviceCreationError :
1551+ dpctl.SyclSubDeviceCreationError :
15241552 if sub-devices can not be created.
15251553 """
15261554 cdef DPCTLDeviceVectorRef DVRef = NULL
@@ -1546,7 +1574,7 @@ cdef class SyclDevice(_SyclDevice):
15461574 Created sub-devices.
15471575
15481576 Raises:
1549- dpctl.SyclSubdeviceCreationError :
1577+ dpctl.SyclSubDeviceCreationError :
15501578 if sub-devices can not be created.
15511579 """
15521580 cdef int ncounts = len (counts)
@@ -1592,7 +1620,7 @@ cdef class SyclDevice(_SyclDevice):
15921620 Created sub-devices.
15931621
15941622 Raises:
1595- dpctl.SyclSubdeviceCreationError :
1623+ dpctl.SyclSubDeviceCreationError :
15961624 if sub-devices can not be created.
15971625 """
15981626 cdef DPCTLDeviceVectorRef DVRef = NULL
@@ -1662,7 +1690,7 @@ cdef class SyclDevice(_SyclDevice):
16621690 If the ``partition`` keyword argument is not specified or
16631691 the affinity domain string is not legal or is not one of the
16641692 three supported options.
1665- dpctl.SyclSubdeviceCreationError :
1693+ dpctl.SyclSubDeviceCreationError :
16661694 If sub-devices can not be created.
16671695 """
16681696 if " partition" not in kwargs:
@@ -1728,6 +1756,43 @@ cdef class SyclDevice(_SyclDevice):
17281756 return None
17291757 return SyclDevice._create(pDRef)
17301758
1759+ @property
1760+ def composite_device (self ):
1761+ """ The composite device for a component device, or ``None`` for a
1762+ non-component device.
1763+
1764+ Returns:
1765+ dpctl.SyclDevice:
1766+ The composite :class:`dpctl.SyclDevice` instance for a
1767+ component device, or ``None`` for a non-component device.
1768+ """
1769+ cdef DPCTLSyclDeviceRef CDRef = NULL
1770+ CDRef = DPCTLDevice_GetCompositeDevice(self ._device_ref)
1771+ if (CDRef is NULL ):
1772+ return None
1773+ return SyclDevice._create(CDRef)
1774+
1775+ def component_devices (self ):
1776+ """ Returns a list of component devices contained in this SYCL device.
1777+
1778+ The returned list will be empty if this SYCL device is not a composite
1779+ device, i.e., if `is_composite` is ``False``.
1780+
1781+ Returns:
1782+ List[:class:`dpctl.SyclDevice`]:
1783+ List of component devices.
1784+
1785+ Raises:
1786+ ValueError:
1787+ If the ``DPCTLDevice_GetComponentDevices`` call returned
1788+ ``NULL`` instead of a ``DPCTLDeviceVectorRef`` object.
1789+ """
1790+ cdef DPCTLDeviceVectorRef cDVRef = NULL
1791+ cDVRef = DPCTLDevice_GetComponentDevices(self ._device_ref)
1792+ if cDVRef is NULL :
1793+ raise ValueError (" Internal error: NULL device vector encountered" )
1794+ return _get_devices(cDVRef)
1795+
17311796 @property
17321797 def profiling_timer_resolution (self ):
17331798 """ Profiling timer resolution.
0 commit comments