@@ -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 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
+
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.
@@ -1520,7 +1548,7 @@ cdef class SyclDevice(_SyclDevice):
1520
1548
Created sub-devices.
1521
1549
1522
1550
Raises:
1523
- dpctl.SyclSubdeviceCreationError :
1551
+ dpctl.SyclSubDeviceCreationError :
1524
1552
if sub-devices can not be created.
1525
1553
"""
1526
1554
cdef DPCTLDeviceVectorRef DVRef = NULL
@@ -1546,7 +1574,7 @@ cdef class SyclDevice(_SyclDevice):
1546
1574
Created sub-devices.
1547
1575
1548
1576
Raises:
1549
- dpctl.SyclSubdeviceCreationError :
1577
+ dpctl.SyclSubDeviceCreationError :
1550
1578
if sub-devices can not be created.
1551
1579
"""
1552
1580
cdef int ncounts = len (counts)
@@ -1592,7 +1620,7 @@ cdef class SyclDevice(_SyclDevice):
1592
1620
Created sub-devices.
1593
1621
1594
1622
Raises:
1595
- dpctl.SyclSubdeviceCreationError :
1623
+ dpctl.SyclSubDeviceCreationError :
1596
1624
if sub-devices can not be created.
1597
1625
"""
1598
1626
cdef DPCTLDeviceVectorRef DVRef = NULL
@@ -1662,7 +1690,7 @@ cdef class SyclDevice(_SyclDevice):
1662
1690
If the ``partition`` keyword argument is not specified or
1663
1691
the affinity domain string is not legal or is not one of the
1664
1692
three supported options.
1665
- dpctl.SyclSubdeviceCreationError :
1693
+ dpctl.SyclSubDeviceCreationError :
1666
1694
If sub-devices can not be created.
1667
1695
"""
1668
1696
if " partition" not in kwargs:
@@ -1728,6 +1756,43 @@ 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
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
+
1731
1796
@property
1732
1797
def profiling_timer_resolution (self ):
1733
1798
""" Profiling timer resolution.
0 commit comments