@@ -34,8 +34,6 @@ from .._backend cimport (
3434)
3535from ._usmarray cimport USM_ARRAY_C_CONTIGUOUS, USM_ARRAY_WRITABLE, usm_ndarray
3636
37- from platform import system as sys_platform
38-
3937import numpy as np
4038
4139import dpctl
@@ -44,10 +42,6 @@ import dpctl.memory as dpmem
4442from ._device import Device
4543
4644
47- cdef bint _IS_LINUX = sys_platform() == " Linux"
48-
49- del sys_platform
50-
5145cdef extern from ' dlpack/dlpack.h' nogil:
5246 cdef int DLPACK_MAJOR_VERSION
5347
@@ -170,12 +164,9 @@ cdef void _managed_tensor_versioned_deleter(DLManagedTensorVersioned *dlmv_tenso
170164
171165cdef object _get_default_context(c_dpctl.SyclDevice dev) except * :
172166 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
177168 except RuntimeError :
178- # RT does not support default_context, e.g. Windows
169+ # RT does not support default_context
179170 default_context = None
180171
181172 return default_context
@@ -585,10 +576,7 @@ cpdef usm_ndarray from_dlpack_capsule(object py_caps):
585576 device_id = dlm_tensor.dl_tensor.device.device_id
586577 root_device = dpctl.SyclDevice(str (< int > device_id))
587578 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
592580 except RuntimeError :
593581 default_context = get_device_cached_queue(root_device).sycl_context
594582 if dlm_tensor.dl_tensor.data is NULL :
@@ -771,10 +759,7 @@ cpdef usm_ndarray from_dlpack_versioned_capsule(object py_caps):
771759 device_id = dlmv_tensor.dl_tensor.device.device_id
772760 root_device = dpctl.SyclDevice(str (< int > device_id))
773761 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
778763 except RuntimeError :
779764 default_context = get_device_cached_queue(root_device).sycl_context
780765 if dlmv_tensor.dl_tensor.data is NULL :
0 commit comments