File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -2042,6 +2042,30 @@ cdef class SyclDevice(_SyclDevice):
20422042 else :
20432043 return str (relId)
20442044
2045+ def get_unpartitioned_parent_device (self ):
2046+ """ get_unpartitioned_parent_device(self)
2047+
2048+ Returns the unpartitioned parent device of this device, or None for a
2049+ root device.
2050+
2051+ Returns:
2052+ dpctl.SyclDevice:
2053+ A parent, unpartitioned :class:`dpctl.SyclDevice` instance if
2054+ the device is a sub-device, ``None`` otherwise.
2055+ """
2056+ cdef DPCTLSyclDeviceRef pDRef = NULL
2057+ cdef DPCTLSyclDeviceRef tDRef = NULL
2058+ pDRef = DPCTLDevice_GetParentDevice(self ._device_ref)
2059+ if pDRef is NULL :
2060+ return None
2061+ else :
2062+ tDRef = DPCTLDevice_GetParentDevice(pDRef)
2063+ while tDRef is not NULL :
2064+ DPCTLDevice_Delete(pDRef)
2065+ pDRef = tDRef
2066+ tDRef = DPCTLDevice_GetParentDevice(pDRef)
2067+ return SyclDevice._create(pDRef)
2068+
20452069 def get_device_id (self ):
20462070 """ get_device_id()
20472071 For an unpartitioned device, returns the canonical index of this device
You can’t perform that action at this time.
0 commit comments