Skip to content

Commit 6b744f5

Browse files
Static methods _init_helper made into functions
and removed from PXD files
1 parent 8a55469 commit 6b744f5

File tree

6 files changed

+21
-26
lines changed

6 files changed

+21
-26
lines changed

dpctl/_sycl_context.pxd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ cdef public class SyclContext(_SyclContext) [object PySyclContextObject, type Py
3838

3939
@staticmethod
4040
cdef SyclContext _create (DPCTLSyclContextRef CRef)
41-
@staticmethod
42-
cdef void _init_helper(_SyclContext self, DPCTLSyclContextRef CRef)
4341
cdef int _init_context_from__SyclContext(self, _SyclContext other)
4442
cdef int _init_context_from_one_device(self, SyclDevice device, int props)
4543
cdef int _init_context_from_devices(self, object devices, int props)

dpctl/_sycl_context.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ cdef void _context_capsule_deleter(object o):
6565
DPCTLContext_Delete(CRef)
6666

6767

68+
cdef void _init_helper(_SyclContext context, DPCTLSyclContextRef CRef):
69+
"Populate context attributes from opaque reference CRef"
70+
context._ctxt_ref = CRef
71+
72+
6873
cdef class _SyclContext:
6974
""" Data owner for SyclContext
7075
"""
@@ -157,11 +162,6 @@ cdef class SyclContext(_SyclContext):
157162
be renamed.
158163
159164
"""
160-
161-
@staticmethod
162-
cdef void _init_helper(_SyclContext context, DPCTLSyclContextRef CRef):
163-
context._ctxt_ref = CRef
164-
165165
@staticmethod
166166
cdef SyclContext _create(DPCTLSyclContextRef ctxt):
167167
"""

dpctl/_sycl_device.pxd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ cdef class _SyclDevice:
4242
cdef public class SyclDevice(_SyclDevice) [object PySyclDeviceObject, type PySyclDeviceType]:
4343
@staticmethod
4444
cdef SyclDevice _create(DPCTLSyclDeviceRef dref)
45-
@staticmethod
46-
cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef)
4745
cdef int _init_from__SyclDevice(self, _SyclDevice other)
4846
cdef int _init_from_selector(self, DPCTLSyclDeviceSelectorRef DSRef)
4947
cdef DPCTLSyclDeviceRef get_device_ref(self)

dpctl/_sycl_device.pyx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ cdef str _device_type_to_filter_string_part(_device_type DTy):
162162
else:
163163
return "unknown"
164164

165+
cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef):
166+
"Populate attributes of device from opaque device reference DRef"
167+
device._device_ref = DRef
168+
device._name = DPCTLDevice_GetName(DRef)
169+
device._driver_version = DPCTLDevice_GetDriverVersion(DRef)
170+
device._vendor = DPCTLDevice_GetVendor(DRef)
171+
device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes(DRef)
172+
165173

166174
cdef class SyclDevice(_SyclDevice):
167175
""" SyclDevice(arg=None)
@@ -203,14 +211,6 @@ cdef class SyclDevice(_SyclDevice):
203211
gpu.print_device_info()
204212
205213
"""
206-
@staticmethod
207-
cdef void _init_helper(_SyclDevice device, DPCTLSyclDeviceRef DRef):
208-
device._device_ref = DRef
209-
device._name = DPCTLDevice_GetName(DRef)
210-
device._driver_version = DPCTLDevice_GetDriverVersion(DRef)
211-
device._vendor = DPCTLDevice_GetVendor(DRef)
212-
device._max_work_item_sizes = DPCTLDevice_GetMaxWorkItemSizes(DRef)
213-
214214
@staticmethod
215215
cdef SyclDevice _create(DPCTLSyclDeviceRef dref):
216216
"""

dpctl/_sycl_platform.pxd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ cdef class _SyclPlatform:
3636
cdef class SyclPlatform(_SyclPlatform):
3737
@staticmethod
3838
cdef SyclPlatform _create(DPCTLSyclPlatformRef dref)
39-
@staticmethod
40-
cdef void _init_helper(_SyclPlatform platform, DPCTLSyclPlatformRef DRef)
4139
cdef int _init_from_cstring(self, const char *string)
4240
cdef int _init_from_selector(self, DPCTLSyclDeviceSelectorRef DSRef)
4341
cdef int _init_from__SyclPlatform(self, _SyclPlatform other)

dpctl/_sycl_platform.pyx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ cdef class _SyclPlatform:
6565
DPCTLCString_Delete(self._version)
6666

6767

68+
cdef void _init_helper(_SyclPlatform platform, DPCTLSyclPlatformRef PRef):
69+
"Populate attributes of class from opaque reference PRef"
70+
platform._platform_ref = PRef
71+
platform._name = DPCTLPlatform_GetName(PRef)
72+
platform._version = DPCTLPlatform_GetVersion(PRef)
73+
platform._vendor = DPCTLPlatform_GetVendor(PRef)
74+
75+
6876
cdef class SyclPlatform(_SyclPlatform):
6977
""" SyclPlatform(self, arg=None)
7078
Python class representing ``cl::sycl::platform`` class.
@@ -73,13 +81,6 @@ cdef class SyclPlatform(_SyclPlatform):
7381
SyclPlatform(filter_selector) - create platform selected by filter
7482
selector
7583
"""
76-
@staticmethod
77-
cdef void _init_helper(_SyclPlatform platform, DPCTLSyclPlatformRef PRef):
78-
platform._platform_ref = PRef
79-
platform._name = DPCTLPlatform_GetName(PRef)
80-
platform._version = DPCTLPlatform_GetVersion(PRef)
81-
platform._vendor = DPCTLPlatform_GetVendor(PRef)
82-
8384
@staticmethod
8485
cdef SyclPlatform _create(DPCTLSyclPlatformRef pref):
8586
"""

0 commit comments

Comments
 (0)