Skip to content

Commit c771d1a

Browse files
Renamed Python C-API functions to ObjectName_CamelCasedFunctionName
1 parent 63109d7 commit c771d1a

11 files changed

+61
-61
lines changed

dpctl/_sycl_context.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,15 @@ cdef class SyclContext(_SyclContext):
480480
&_context_capsule_deleter
481481
)
482482

483-
cdef api DPCTLSyclContextRef get_context_ref(SyclContext ctx):
483+
cdef api DPCTLSyclContextRef SyclContext_GetContextRef(SyclContext ctx):
484484
"""
485485
C-API function to get opaque context reference from
486486
:class:`dpctl.SyclContext` instance.
487487
"""
488488
return ctx.get_context_ref()
489489

490490

491-
cdef api SyclContext make_SyclContext(DPCTLSyclContextRef CRef):
491+
cdef api SyclContext SyclContext_Make(DPCTLSyclContextRef CRef):
492492
"""
493493
C-API function to create :class:`dpctl.SyclContext` instance
494494
from the given opaque context reference.

dpctl/_sycl_device.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1130,15 +1130,15 @@ cdef class SyclDevice(_SyclDevice):
11301130
else:
11311131
return str(relId)
11321132

1133-
cdef api DPCTLSyclDeviceRef get_device_ref(SyclDevice dev):
1133+
cdef api DPCTLSyclDeviceRef SyclDevice_GetDeviceRef(SyclDevice dev):
11341134
"""
11351135
C-API function to get opaque device reference from
11361136
:class:`dpctl.SyclDevice` instance.
11371137
"""
11381138
return dev.get_device_ref()
11391139

11401140

1141-
cdef api SyclDevice make_SyclDevice(DPCTLSyclDeviceRef DRef):
1141+
cdef api SyclDevice SyclDevice_Make(DPCTLSyclDeviceRef DRef):
11421142
"""
11431143
C-API function to create :class:`dpctl.SyclDevice` instance
11441144
from the given opaque device reference.

dpctl/_sycl_event.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ __all__ = [
5757
_logger = logging.getLogger(__name__)
5858

5959

60-
cdef api DPCTLSyclEventRef get_event_ref(SyclEvent ev):
60+
cdef api DPCTLSyclEventRef SyclEvent_GetEventRef(SyclEvent ev):
6161
""" C-API function to access opaque event reference from
6262
Python object of type :class:`dpctl.SyclEvent`.
6363
"""
6464
return ev.get_event_ref()
6565

6666

67-
cdef api SyclEvent make_SyclEvent(DPCTLSyclEventRef ERef):
67+
cdef api SyclEvent SyclEvent_Make(DPCTLSyclEventRef ERef):
6868
"""
6969
C-API function to create :class:`dpctl.SyclEvent`
7070
instance from opaque sycl event reference.

dpctl/_sycl_queue.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1001,15 +1001,15 @@ cdef class SyclQueue(_SyclQueue):
10011001
self.sycl_device.print_device_info()
10021002

10031003

1004-
cdef api DPCTLSyclQueueRef get_queue_ref(SyclQueue q):
1004+
cdef api DPCTLSyclQueueRef SyclQueue_GetQueueRef(SyclQueue q):
10051005
"""
10061006
C-API function to get opaque queue reference from
10071007
:class:`dpctl.SyclQueue` instance.
10081008
"""
10091009
return q.get_queue_ref()
10101010

10111011

1012-
cdef api SyclQueue make_SyclQueue(DPCTLSyclQueueRef QRef):
1012+
cdef api SyclQueue SyclQueue_Make(DPCTLSyclQueueRef QRef):
10131013
"""
10141014
C-API function to create :class:`dpctl.SyclQueue` instance
10151015
from the given opaque queue reference.

dpctl/apis/include/dpctl4pybind11.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ template <> struct type_caster<sycl::queue>
4949
{
5050
PyObject *source = src.ptr();
5151
if (PyObject_TypeCheck(source, &PySyclQueueType)) {
52-
DPCTLSyclQueueRef QRef =
53-
get_queue_ref(reinterpret_cast<PySyclQueueObject *>(source));
52+
DPCTLSyclQueueRef QRef = SyclQueue_GetQueueRef(
53+
reinterpret_cast<PySyclQueueObject *>(source));
5454
sycl::queue *q = reinterpret_cast<sycl::queue *>(QRef);
5555
value = *q;
5656
return true;
@@ -63,7 +63,7 @@ template <> struct type_caster<sycl::queue>
6363

6464
static handle cast(sycl::queue src, return_value_policy, handle)
6565
{
66-
auto tmp = make_SyclQueue(reinterpret_cast<DPCTLSyclQueueRef>(&src));
66+
auto tmp = SyclQueue_Make(reinterpret_cast<DPCTLSyclQueueRef>(&src));
6767
return handle(reinterpret_cast<PyObject *>(tmp));
6868
}
6969
};
@@ -87,8 +87,8 @@ template <> struct type_caster<sycl::device>
8787
{
8888
PyObject *source = src.ptr();
8989
if (PyObject_TypeCheck(source, &PySyclDeviceType)) {
90-
DPCTLSyclDeviceRef DRef =
91-
get_device_ref(reinterpret_cast<PySyclDeviceObject *>(source));
90+
DPCTLSyclDeviceRef DRef = SyclDevice_GetDeviceRef(
91+
reinterpret_cast<PySyclDeviceObject *>(source));
9292
sycl::device *d = reinterpret_cast<sycl::device *>(DRef);
9393
value = *d;
9494
return true;
@@ -101,7 +101,7 @@ template <> struct type_caster<sycl::device>
101101

102102
static handle cast(sycl::device src, return_value_policy, handle)
103103
{
104-
auto tmp = make_SyclDevice(reinterpret_cast<DPCTLSyclDeviceRef>(&src));
104+
auto tmp = SyclDevice_Make(reinterpret_cast<DPCTLSyclDeviceRef>(&src));
105105
return handle(reinterpret_cast<PyObject *>(tmp));
106106
}
107107
};
@@ -125,7 +125,7 @@ template <> struct type_caster<sycl::context>
125125
{
126126
PyObject *source = src.ptr();
127127
if (PyObject_TypeCheck(source, &PySyclContextType)) {
128-
DPCTLSyclContextRef CRef = get_context_ref(
128+
DPCTLSyclContextRef CRef = SyclContext_GetContextRef(
129129
reinterpret_cast<PySyclContextObject *>(source));
130130
sycl::context *ctx = reinterpret_cast<sycl::context *>(CRef);
131131
value = *ctx;
@@ -140,7 +140,7 @@ template <> struct type_caster<sycl::context>
140140
static handle cast(sycl::context src, return_value_policy, handle)
141141
{
142142
auto tmp =
143-
make_SyclContext(reinterpret_cast<DPCTLSyclContextRef>(&src));
143+
SyclContext_Make(reinterpret_cast<DPCTLSyclContextRef>(&src));
144144
return handle(reinterpret_cast<PyObject *>(tmp));
145145
}
146146
};
@@ -164,8 +164,8 @@ template <> struct type_caster<sycl::event>
164164
{
165165
PyObject *source = src.ptr();
166166
if (PyObject_TypeCheck(source, &PySyclEventType)) {
167-
DPCTLSyclEventRef ERef =
168-
get_event_ref(reinterpret_cast<PySyclEventObject *>(source));
167+
DPCTLSyclEventRef ERef = SyclEvent_GetEventRef(
168+
reinterpret_cast<PySyclEventObject *>(source));
169169
sycl::event *ev = reinterpret_cast<sycl::event *>(ERef);
170170
value = *ev;
171171
return true;
@@ -178,7 +178,7 @@ template <> struct type_caster<sycl::event>
178178

179179
static handle cast(sycl::event src, return_value_policy, handle)
180180
{
181-
auto tmp = make_SyclEvent(reinterpret_cast<DPCTLSyclEventRef>(&src));
181+
auto tmp = SyclEvent_Make(reinterpret_cast<DPCTLSyclEventRef>(&src));
182182
return handle(reinterpret_cast<PyObject *>(tmp));
183183
}
184184
};

dpctl/memory/_memory.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -751,24 +751,24 @@ def as_usm_memory(obj):
751751
)
752752

753753

754-
cdef api DPCTLSyclUSMRef Memory_get_usm_pointer(_Memory obj):
754+
cdef api DPCTLSyclUSMRef Memory_GetUsmPointer(_Memory obj):
755755
"Pointer of USM allocation"
756756
return obj.memory_ptr
757757

758-
cdef api DPCTLSyclContextRef Memory_get_context_ref(_Memory obj):
758+
cdef api DPCTLSyclContextRef Memory_GetContextRef(_Memory obj):
759759
"Context reference to which USM allocation is bound"
760760
return obj.queue._context.get_context_ref()
761761

762-
cdef api DPCTLSyclQueueRef Memory_get_queue_ref(_Memory obj):
762+
cdef api DPCTLSyclQueueRef Memory_GetQueueRef(_Memory obj):
763763
"""Queue associated with this allocation, used
764764
for copying, population, etc."""
765765
return obj.queue.get_queue_ref()
766766

767-
cdef api size_t Memory_get_nbytes(_Memory obj):
767+
cdef api size_t Memory_GetNumBytes(_Memory obj):
768768
"Size of the allocation in bytes."
769769
return <size_t>obj.nbytes
770770

771-
cdef api object make_Memory(
771+
cdef api object Memory_Make(
772772
DPCTLSyclUSMRef ptr,
773773
size_t nbytes,
774774
DPCTLSyclQueueRef QRef,

dpctl/tests/test_sycl_context.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ def test_context_repr():
190190
assert type(ctx.__repr__()) is str
191191

192192

193-
def test_cpython_api_get_context_ref():
193+
def test_cpython_api_SyclContext_GetContextRef():
194194
import ctypes
195195
import sys
196196

197197
ctx = dpctl.SyclContext()
198198
mod = sys.modules[ctx.__class__.__module__]
199-
# get capsule storign get_context_ref function ptr
200-
ctx_ref_fn_cap = mod.__pyx_capi__["get_context_ref"]
201-
# construct Python callable to invoke "get_context_ref"
199+
# get capsule storign SyclContext_GetContextRef function ptr
200+
ctx_ref_fn_cap = mod.__pyx_capi__["SyclContext_GetContextRef"]
201+
# construct Python callable to invoke "SyclContext_GetContextRef"
202202
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
203203
cap_ptr_fn.restype = ctypes.c_void_p
204204
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]
@@ -213,15 +213,15 @@ def test_cpython_api_get_context_ref():
213213
assert r1 == r2
214214

215215

216-
def test_cpython_api_make_SyclContext():
216+
def test_cpython_api_SyclContext_Make():
217217
import ctypes
218218
import sys
219219

220220
ctx = dpctl.SyclContext()
221221
mod = sys.modules[ctx.__class__.__module__]
222-
# get capsule storign make_SyclContext function ptr
223-
make_ctx_fn_cap = mod.__pyx_capi__["make_SyclContext"]
224-
# construct Python callable to invoke "make_SyclContext"
222+
# get capsule storign SyclContext_Make function ptr
223+
make_ctx_fn_cap = mod.__pyx_capi__["SyclContext_Make"]
224+
# construct Python callable to invoke "SyclContext_Make"
225225
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
226226
cap_ptr_fn.restype = ctypes.c_void_p
227227
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]

dpctl/tests/test_sycl_device.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -731,15 +731,15 @@ def test_handle_no_device():
731731
dpctl.select_device_with_aspects("cpu", excluded_aspects="cpu")
732732

733733

734-
def test_cpython_api_get_device_ref():
734+
def test_cpython_api_SyclDevice_GetDeviceRef():
735735
import ctypes
736736
import sys
737737

738738
d = dpctl.SyclDevice()
739739
mod = sys.modules[d.__class__.__module__]
740-
# get capsule storign get_device_ref function ptr
741-
d_ref_fn_cap = mod.__pyx_capi__["get_device_ref"]
742-
# construct Python callable to invoke "get_device_ref"
740+
# get capsule storing SyclDevice_GetDeviceRef function ptr
741+
d_ref_fn_cap = mod.__pyx_capi__["SyclDevice_GetDeviceRef"]
742+
# construct Python callable to invoke "SyclDevice_GetDeviceRef"
743743
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
744744
cap_ptr_fn.restype = ctypes.c_void_p
745745
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]
@@ -754,15 +754,15 @@ def test_cpython_api_get_device_ref():
754754
assert r1 == r2
755755

756756

757-
def test_cpython_api_make_SyclDevice():
757+
def test_cpython_api_SyclDevice_Make():
758758
import ctypes
759759
import sys
760760

761761
d = dpctl.SyclDevice()
762762
mod = sys.modules[d.__class__.__module__]
763-
# get capsule storign make_SyclContext function ptr
764-
make_d_fn_cap = mod.__pyx_capi__["make_SyclDevice"]
765-
# construct Python callable to invoke "make_SyclDevice"
763+
# get capsule storign SyclContext_Make function ptr
764+
make_d_fn_cap = mod.__pyx_capi__["SyclDevice_Make"]
765+
# construct Python callable to invoke "SyclDevice_Make"
766766
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
767767
cap_ptr_fn.restype = ctypes.c_void_p
768768
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]

dpctl/tests/test_sycl_event.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,15 @@ def test_addressof_ref():
234234
assert type(ref) is int
235235

236236

237-
def test_cpython_api_get_event_ref():
237+
def test_cpython_api_SyclEvent_GetEventRef():
238238
import ctypes
239239
import sys
240240

241241
ev = dpctl.SyclEvent()
242242
mod = sys.modules[ev.__class__.__module__]
243-
# get capsule storign get_event_ref function ptr
244-
ev_ref_fn_cap = mod.__pyx_capi__["get_event_ref"]
245-
# construct Python callable to invoke "get_event_ref"
243+
# get capsule storign SyclEvent_GetEventRef function ptr
244+
ev_ref_fn_cap = mod.__pyx_capi__["SyclEvent_GetEventRef"]
245+
# construct Python callable to invoke "SyclEvent_GetEventRef"
246246
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
247247
cap_ptr_fn.restype = ctypes.c_void_p
248248
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]
@@ -257,15 +257,15 @@ def test_cpython_api_get_event_ref():
257257
assert r1 == r2
258258

259259

260-
def test_cpython_api_make_SyclEvent():
260+
def test_cpython_api_SyclEvent_Make():
261261
import ctypes
262262
import sys
263263

264264
ev = dpctl.SyclEvent()
265265
mod = sys.modules[ev.__class__.__module__]
266-
# get capsule storing make_SyclEvent function ptr
267-
make_e_fn_cap = mod.__pyx_capi__["make_SyclEvent"]
268-
# construct Python callable to invoke "make_SyclDevice"
266+
# get capsule storing SyclEvent_Make function ptr
267+
make_e_fn_cap = mod.__pyx_capi__["SyclEvent_Make"]
268+
# construct Python callable to invoke "SyclDevice_Make"
269269
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
270270
cap_ptr_fn.restype = ctypes.c_void_p
271271
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]

dpctl/tests/test_sycl_queue.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,12 @@ def test_queue_capsule():
469469
assert q2 != [] # compare with other types
470470

471471

472-
def test_cpython_api_get_queue_ref():
472+
def test_cpython_api_SyclQueue_GetQueueRef():
473473
q = dpctl.SyclQueue()
474474
mod = sys.modules[q.__class__.__module__]
475-
# get capsule storign get_queue_ref function ptr
476-
q_ref_fn_cap = mod.__pyx_capi__["get_queue_ref"]
477-
# construct Python callable to invoke "get_queue_ref"
475+
# get capsule storign SyclQueue_GetQueueRef function ptr
476+
q_ref_fn_cap = mod.__pyx_capi__["SyclQueue_GetQueueRef"]
477+
# construct Python callable to invoke "SyclQueue_GetQueueRef"
478478
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
479479
cap_ptr_fn.restype = ctypes.c_void_p
480480
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]
@@ -489,12 +489,12 @@ def test_cpython_api_get_queue_ref():
489489
assert r1 == r2
490490

491491

492-
def test_cpython_api_make_SyclQueue():
492+
def test_cpython_api_SyclQueue_Make():
493493
q = dpctl.SyclQueue()
494494
mod = sys.modules[q.__class__.__module__]
495-
# get capsule storing make_SyclQueue function ptr
496-
make_SyclQueue_fn_cap = mod.__pyx_capi__["make_SyclQueue"]
497-
# construct Python callable to invoke "make_SyclQueue"
495+
# get capsule storing SyclQueue_Make function ptr
496+
make_SyclQueue_fn_cap = mod.__pyx_capi__["SyclQueue_Make"]
497+
# construct Python callable to invoke "SyclQueue_Make"
498498
cap_ptr_fn = ctypes.pythonapi.PyCapsule_GetPointer
499499
cap_ptr_fn.restype = ctypes.c_void_p
500500
cap_ptr_fn.argtypes = [ctypes.py_object, ctypes.c_char_p]

0 commit comments

Comments
 (0)