@@ -34,8 +34,6 @@ from .._backend cimport (
34
34
)
35
35
from ._usmarray cimport USM_ARRAY_C_CONTIGUOUS, USM_ARRAY_WRITABLE, usm_ndarray
36
36
37
- from platform import system as sys_platform
38
-
39
37
import numpy as np
40
38
41
39
import dpctl
@@ -44,10 +42,6 @@ import dpctl.memory as dpmem
44
42
from ._device import Device
45
43
46
44
47
- cdef bint _IS_LINUX = sys_platform() == " Linux"
48
-
49
- del sys_platform
50
-
51
45
cdef extern from ' dlpack/dlpack.h' nogil:
52
46
cdef int DLPACK_MAJOR_VERSION
53
47
@@ -170,12 +164,9 @@ cdef void _managed_tensor_versioned_deleter(DLManagedTensorVersioned *dlmv_tenso
170
164
171
165
cdef object _get_default_context(c_dpctl.SyclDevice dev) except * :
172
166
try :
173
- if _IS_LINUX:
174
- default_context = dev.sycl_platform.default_context
175
- else :
176
- default_context = None
167
+ default_context = dev.sycl_platform.default_context
177
168
except RuntimeError :
178
- # RT does not support default_context, e.g. Windows
169
+ # RT does not support default_context
179
170
default_context = None
180
171
181
172
return default_context
@@ -585,10 +576,7 @@ cpdef usm_ndarray from_dlpack_capsule(object py_caps):
585
576
device_id = dlm_tensor.dl_tensor.device.device_id
586
577
root_device = dpctl.SyclDevice(str (< int > device_id))
587
578
try :
588
- if _IS_LINUX:
589
- default_context = root_device.sycl_platform.default_context
590
- else :
591
- default_context = get_device_cached_queue(root_device).sycl_context
579
+ default_context = root_device.sycl_platform.default_context
592
580
except RuntimeError :
593
581
default_context = get_device_cached_queue(root_device).sycl_context
594
582
if dlm_tensor.dl_tensor.data is NULL :
@@ -771,10 +759,7 @@ cpdef usm_ndarray from_dlpack_versioned_capsule(object py_caps):
771
759
device_id = dlmv_tensor.dl_tensor.device.device_id
772
760
root_device = dpctl.SyclDevice(str (< int > device_id))
773
761
try :
774
- if _IS_LINUX:
775
- default_context = root_device.sycl_platform.default_context
776
- else :
777
- default_context = get_device_cached_queue(root_device).sycl_context
762
+ default_context = root_device.sycl_platform.default_context
778
763
except RuntimeError :
779
764
default_context = get_device_cached_queue(root_device).sycl_context
780
765
if dlmv_tensor.dl_tensor.data is NULL :
0 commit comments