@@ -177,28 +177,6 @@ cdef object _get_default_context(c_dpctl.SyclDevice dev):
177177
178178 return default_context
179179
180-
181- cdef int get_parent_device_ordinal_id(c_dpctl.SyclDevice dev) except - 1 :
182- cdef DPCTLSyclDeviceRef pDRef = NULL
183- cdef DPCTLSyclDeviceRef tDRef = NULL
184- cdef c_dpctl.SyclDevice p_dev
185-
186- pDRef = DPCTLDevice_GetParentDevice(dev.get_device_ref())
187- if pDRef is not NULL :
188- # if dev is a sub-device, find its parent
189- # and return its overall ordinal id
190- tDRef = DPCTLDevice_GetParentDevice(pDRef)
191- while tDRef is not NULL :
192- DPCTLDevice_Delete(pDRef)
193- pDRef = tDRef
194- tDRef = DPCTLDevice_GetParentDevice(pDRef)
195- p_dev = c_dpctl.SyclDevice._create(pDRef)
196- return p_dev.get_overall_ordinal()
197-
198- # return overall ordinal id of argument device
199- return dev.get_overall_ordinal()
200-
201-
202180cdef int get_array_dlpack_device_id(
203181 usm_ndarray usm_ary
204182) except - 1 :
@@ -224,14 +202,13 @@ cdef int get_array_dlpack_device_id(
224202 " on non-partitioned SYCL devices on platforms where "
225203 " default_context oneAPI extension is not supported."
226204 )
227- device_id = ary_sycl_device.get_overall_ordinal()
228205 else :
229206 if not usm_ary.sycl_context == default_context:
230207 raise DLPackCreationError(
231208 " to_dlpack_capsule: DLPack can only export arrays based on USM "
232209 " allocations bound to a default platform SYCL context"
233210 )
234- device_id = get_parent_device_ordinal_id( ary_sycl_device)
211+ device_id = ary_sycl_device.get_device_id( )
235212
236213 if device_id < 0 :
237214 raise DLPackCreationError(
@@ -1086,7 +1063,7 @@ def from_dlpack(x, /, *, device=None, copy=None):
10861063 d = device.sycl_device
10871064 else :
10881065 d = device
1089- dl_device = (device_OneAPI, get_parent_device_ordinal_id( < c_dpctl.SyclDevice > d ))
1066+ dl_device = (device_OneAPI, d.get_device_id( ))
10901067 if dl_device is not None :
10911068 if (dl_device[0 ] not in [device_OneAPI, device_CPU]):
10921069 raise ValueError (
0 commit comments