Skip to content

Commit 13e4286

Browse files
Diptorup Debdiptorupd
authored andcommitted
Reformat backend.pxd to be closer to black style.
1 parent a8bf721 commit 13e4286

File tree

1 file changed

+146
-119
lines changed

1 file changed

+146
-119
lines changed

dpctl/_backend.pxd

Lines changed: 146 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ from libc.stdint cimport uint32_t
2626

2727

2828
cdef extern from "dpctl_utils.h":
29-
cdef void DPCTLCString_Delete (const char *str)
30-
cdef void DPCTLSize_t_Array_Delete (size_t *arr)
29+
cdef void DPCTLCString_Delete(const char *str)
30+
cdef void DPCTLSize_t_Array_Delete(size_t *arr)
31+
3132

3233
cdef extern from "dpctl_sycl_enum_types.h":
3334
cdef enum _backend_type 'DPCTLSyclBackendType':
@@ -67,6 +68,7 @@ cdef extern from "dpctl_sycl_enum_types.h":
6768

6869
ctypedef _arg_data_type DPCTLKernelArgType
6970

71+
7072
cdef extern from "dpctl_sycl_types.h":
7173
cdef struct DPCTLOpaqueSyclContext
7274
cdef struct DPCTLOpaqueSyclDevice
@@ -76,155 +78,180 @@ cdef extern from "dpctl_sycl_types.h":
7678
cdef struct DPCTLOpaqueSyclQueue
7779
cdef struct DPCTLOpaqueSyclUSM
7880

79-
ctypedef DPCTLOpaqueSyclContext* DPCTLSyclContextRef
80-
ctypedef DPCTLOpaqueSyclDevice* DPCTLSyclDeviceRef
81-
ctypedef DPCTLOpaqueSyclEvent* DPCTLSyclEventRef
82-
ctypedef DPCTLOpaqueSyclKernel* DPCTLSyclKernelRef
83-
ctypedef DPCTLOpaqueSyclProgram* DPCTLSyclProgramRef
84-
ctypedef DPCTLOpaqueSyclQueue* DPCTLSyclQueueRef
85-
ctypedef DPCTLOpaqueSyclUSM* DPCTLSyclUSMRef
81+
ctypedef DPCTLOpaqueSyclContext *DPCTLSyclContextRef
82+
ctypedef DPCTLOpaqueSyclDevice *DPCTLSyclDeviceRef
83+
ctypedef DPCTLOpaqueSyclEvent *DPCTLSyclEventRef
84+
ctypedef DPCTLOpaqueSyclKernel *DPCTLSyclKernelRef
85+
ctypedef DPCTLOpaqueSyclProgram *DPCTLSyclProgramRef
86+
ctypedef DPCTLOpaqueSyclQueue *DPCTLSyclQueueRef
87+
ctypedef DPCTLOpaqueSyclUSM *DPCTLSyclUSMRef
8688

8789

8890
cdef extern from "dpctl_sycl_device_interface.h":
89-
cdef void DPCTLDevice_DumpInfo (const DPCTLSyclDeviceRef DRef)
90-
cdef void DPCTLDevice_Delete (DPCTLSyclDeviceRef DRef)
91-
cdef void DPCTLDevice_DumpInfo (const DPCTLSyclDeviceRef DRef)
92-
cdef bool DPCTLDevice_IsAccelerator (const DPCTLSyclDeviceRef DRef)
93-
cdef bool DPCTLDevice_IsCPU (const DPCTLSyclDeviceRef DRef)
94-
cdef bool DPCTLDevice_IsGPU (const DPCTLSyclDeviceRef DRef)
95-
cdef bool DPCTLDevice_IsHost (const DPCTLSyclDeviceRef DRef)
96-
cpdef const char *DPCTLDevice_GetDriverInfo (const DPCTLSyclDeviceRef DRef)
97-
cpdef const char *DPCTLDevice_GetName (const DPCTLSyclDeviceRef DRef)
98-
cpdef const char *DPCTLDevice_GetVendorName (const DPCTLSyclDeviceRef DRef)
99-
cdef bool DPCTLDevice_IsHostUnifiedMemory (const DPCTLSyclDeviceRef DRef)
100-
cpdef uint32_t DPCTLDevice_GetMaxComputeUnits (const DPCTLSyclDeviceRef DRef)
101-
cpdef uint32_t DPCTLDevice_GetMaxWorkItemDims (const DPCTLSyclDeviceRef DRef)
102-
cpdef size_t *DPCTLDevice_GetMaxWorkItemSizes (const DPCTLSyclDeviceRef DRef)
103-
cpdef size_t DPCTLDevice_GetMaxWorkGroupSize (const DPCTLSyclDeviceRef DRef)
104-
cpdef uint32_t DPCTLDevice_GetMaxNumSubGroups (const DPCTLSyclDeviceRef DRef)
105-
cpdef bool DPCTLDevice_HasInt64BaseAtomics (const DPCTLSyclDeviceRef DRef)
106-
cpdef bool DPCTLDevice_HasInt64ExtendedAtomics (const DPCTLSyclDeviceRef DRef)
91+
cdef void DPCTLDevice_DumpInfo(const DPCTLSyclDeviceRef DRef)
92+
cdef void DPCTLDevice_Delete(DPCTLSyclDeviceRef DRef)
93+
cdef void DPCTLDevice_DumpInfo(const DPCTLSyclDeviceRef DRef)
94+
cdef bool DPCTLDevice_IsAccelerator(const DPCTLSyclDeviceRef DRef)
95+
cdef bool DPCTLDevice_IsCPU(const DPCTLSyclDeviceRef DRef)
96+
cdef bool DPCTLDevice_IsGPU(const DPCTLSyclDeviceRef DRef)
97+
cdef bool DPCTLDevice_IsHost(const DPCTLSyclDeviceRef DRef)
98+
cpdef const char *DPCTLDevice_GetDriverInfo(const DPCTLSyclDeviceRef DRef)
99+
cpdef const char *DPCTLDevice_GetName(const DPCTLSyclDeviceRef DRef)
100+
cpdef const char *DPCTLDevice_GetVendorName(const DPCTLSyclDeviceRef DRef)
101+
cdef bool DPCTLDevice_IsHostUnifiedMemory(const DPCTLSyclDeviceRef DRef)
102+
cpdef uint32_t DPCTLDevice_GetMaxComputeUnits(const DPCTLSyclDeviceRef DRef)
103+
cpdef uint32_t DPCTLDevice_GetMaxWorkItemDims(const DPCTLSyclDeviceRef DRef)
104+
cpdef size_t *DPCTLDevice_GetMaxWorkItemSizes(const DPCTLSyclDeviceRef DRef)
105+
cpdef size_t DPCTLDevice_GetMaxWorkGroupSize(const DPCTLSyclDeviceRef DRef)
106+
cpdef uint32_t DPCTLDevice_GetMaxNumSubGroups(const DPCTLSyclDeviceRef DRef)
107+
cpdef bool DPCTLDevice_HasInt64BaseAtomics(const DPCTLSyclDeviceRef DRef)
108+
cpdef bool DPCTLDevice_HasInt64ExtendedAtomics(
109+
const DPCTLSyclDeviceRef DRef)
107110

108111

109112
cdef extern from "dpctl_sycl_event_interface.h":
110-
cdef void DPCTLEvent_Wait (DPCTLSyclEventRef ERef)
111-
cdef void DPCTLEvent_Delete (DPCTLSyclEventRef ERef)
113+
cdef void DPCTLEvent_Wait(DPCTLSyclEventRef ERef)
114+
cdef void DPCTLEvent_Delete(DPCTLSyclEventRef ERef)
112115

113116

114117
cdef extern from "dpctl_sycl_kernel_interface.h":
115-
cdef const char* DPCTLKernel_GetFunctionName (const DPCTLSyclKernelRef KRef)
116-
cdef size_t DPCTLKernel_GetNumArgs (const DPCTLSyclKernelRef KRef)
117-
cdef void DPCTLKernel_Delete (DPCTLSyclKernelRef KRef)
118+
cdef const char* DPCTLKernel_GetFunctionName(const DPCTLSyclKernelRef KRef)
119+
cdef size_t DPCTLKernel_GetNumArgs(const DPCTLSyclKernelRef KRef)
120+
cdef void DPCTLKernel_Delete(DPCTLSyclKernelRef KRef)
118121

119122

120123
cdef extern from "dpctl_sycl_platform_interface.h":
121-
cdef size_t DPCTLPlatform_GetNumNonHostPlatforms ()
122-
cdef void DPCTLPlatform_DumpInfo ()
123-
cdef size_t DPCTLPlatform_GetNumNonHostBackends ()
124-
cdef DPCTLSyclBackendType *DPCTLPlatform_GetListOfNonHostBackends ()
125-
cdef void DPCTLPlatform_DeleteListOfBackends (DPCTLSyclBackendType * BEs)
124+
cdef size_t DPCTLPlatform_GetNumNonHostPlatforms()
125+
cdef void DPCTLPlatform_DumpInfo()
126+
cdef size_t DPCTLPlatform_GetNumNonHostBackends()
127+
cdef DPCTLSyclBackendType *DPCTLPlatform_GetListOfNonHostBackends()
128+
cdef void DPCTLPlatform_DeleteListOfBackends(DPCTLSyclBackendType * BEs)
126129

127130

128131
cdef extern from "dpctl_sycl_context_interface.h":
129-
cdef bool DPCTLContext_AreEq (const DPCTLSyclContextRef CtxRef1,
132+
cdef bool DPCTLContext_AreEq(const DPCTLSyclContextRef CtxRef1,
130133
const DPCTLSyclContextRef CtxRef2)
131-
cdef DPCTLSyclBackendType DPCTLContext_GetBackend (
132-
const DPCTLSyclContextRef CtxRef)
133-
cdef void DPCTLContext_Delete (DPCTLSyclContextRef CtxRef)
134+
cdef DPCTLSyclBackendType DPCTLContext_GetBackend(
135+
const DPCTLSyclContextRef CtxRef)
136+
cdef void DPCTLContext_Delete(DPCTLSyclContextRef CtxRef)
134137

135138

136139
cdef extern from "dpctl_sycl_program_interface.h":
137-
cdef DPCTLSyclProgramRef DPCTLProgram_CreateFromSpirv (
138-
const DPCTLSyclContextRef Ctx,
139-
const void *IL,
140-
size_t Length,
141-
const char *CompileOpts)
142-
cdef DPCTLSyclProgramRef DPCTLProgram_CreateFromOCLSource (
143-
const DPCTLSyclContextRef Ctx,
144-
const char *Source,
145-
const char *CompileOpts)
146-
cdef DPCTLSyclKernelRef DPCTLProgram_GetKernel (DPCTLSyclProgramRef PRef,
147-
const char *KernelName)
148-
cdef bool DPCTLProgram_HasKernel (DPCTLSyclProgramRef PRef,
140+
cdef DPCTLSyclProgramRef DPCTLProgram_CreateFromSpirv(
141+
const DPCTLSyclContextRef Ctx,
142+
const void *IL,
143+
size_t Length,
144+
const char *CompileOpts)
145+
cdef DPCTLSyclProgramRef DPCTLProgram_CreateFromOCLSource(
146+
const DPCTLSyclContextRef Ctx,
147+
const char *Source,
148+
const char *CompileOpts)
149+
cdef DPCTLSyclKernelRef DPCTLProgram_GetKernel(
150+
DPCTLSyclProgramRef PRef,
151+
const char *KernelName)
152+
cdef bool DPCTLProgram_HasKernel(DPCTLSyclProgramRef PRef,
149153
const char *KernelName)
150-
cdef void DPCTLProgram_Delete (DPCTLSyclProgramRef PRef)
154+
cdef void DPCTLProgram_Delete(DPCTLSyclProgramRef PRef)
151155

152156

153157
cdef extern from "dpctl_sycl_queue_interface.h":
154-
cdef bool DPCTLQueue_AreEq (const DPCTLSyclQueueRef QRef1,
158+
cdef bool DPCTLQueue_AreEq(const DPCTLSyclQueueRef QRef1,
155159
const DPCTLSyclQueueRef QRef2)
156-
cdef void DPCTLQueue_Delete (DPCTLSyclQueueRef QRef)
157-
cdef DPCTLSyclBackendType DPCTLQueue_GetBackend (const DPCTLSyclQueueRef Q)
158-
cdef DPCTLSyclContextRef DPCTLQueue_GetContext (const DPCTLSyclQueueRef Q)
159-
cdef DPCTLSyclDeviceRef DPCTLQueue_GetDevice (const DPCTLSyclQueueRef Q)
160-
cdef DPCTLSyclEventRef DPCTLQueue_SubmitRange (
161-
const DPCTLSyclKernelRef Ref,
162-
const DPCTLSyclQueueRef QRef,
163-
void **Args,
164-
const DPCTLKernelArgType *ArgTypes,
165-
size_t NArgs,
166-
const size_t Range[3],
167-
size_t NDims,
168-
const DPCTLSyclEventRef *DepEvents,
169-
size_t NDepEvents)
160+
cdef void DPCTLQueue_Delete(DPCTLSyclQueueRef QRef)
161+
cdef DPCTLSyclBackendType DPCTLQueue_GetBackend(const DPCTLSyclQueueRef Q)
162+
cdef DPCTLSyclContextRef DPCTLQueue_GetContext(const DPCTLSyclQueueRef Q)
163+
cdef DPCTLSyclDeviceRef DPCTLQueue_GetDevice(const DPCTLSyclQueueRef Q)
164+
cdef DPCTLSyclEventRef DPCTLQueue_SubmitRange(
165+
const DPCTLSyclKernelRef Ref,
166+
const DPCTLSyclQueueRef QRef,
167+
void **Args,
168+
const DPCTLKernelArgType *ArgTypes,
169+
size_t NArgs,
170+
const size_t Range[3],
171+
size_t NDims,
172+
const DPCTLSyclEventRef *DepEvents,
173+
size_t NDepEvents)
170174
cdef DPCTLSyclEventRef DPCTLQueue_SubmitNDRange(
171-
const DPCTLSyclKernelRef Ref,
172-
const DPCTLSyclQueueRef QRef,
173-
void **Args,
174-
const DPCTLKernelArgType *ArgTypes,
175-
size_t NArgs,
176-
const size_t gRange[3],
177-
const size_t lRange[3],
178-
size_t NDims,
179-
const DPCTLSyclEventRef *DepEvents,
180-
size_t NDepEvents)
181-
cdef void DPCTLQueue_Wait (const DPCTLSyclQueueRef QRef)
182-
cdef void DPCTLQueue_Memcpy (const DPCTLSyclQueueRef Q,
183-
void *Dest, const void *Src, size_t Count)
184-
cdef void DPCTLQueue_Prefetch (const DPCTLSyclQueueRef Q,
185-
const void *Src, size_t Count)
186-
cdef void DPCTLQueue_MemAdvise (const DPCTLSyclQueueRef Q,
187-
const void *Src, size_t Count, int Advice)
175+
const DPCTLSyclKernelRef Ref,
176+
const DPCTLSyclQueueRef QRef,
177+
void **Args,
178+
const DPCTLKernelArgType *ArgTypes,
179+
size_t NArgs,
180+
const size_t gRange[3],
181+
const size_t lRange[3],
182+
size_t NDims,
183+
const DPCTLSyclEventRef *DepEvents,
184+
size_t NDepEvents)
185+
cdef void DPCTLQueue_Wait(const DPCTLSyclQueueRef QRef)
186+
cdef void DPCTLQueue_Memcpy(
187+
const DPCTLSyclQueueRef Q,
188+
void *Dest,
189+
const void *Src,
190+
size_t Count)
191+
cdef void DPCTLQueue_Prefetch(
192+
const DPCTLSyclQueueRef Q,
193+
const void *Src,
194+
size_t Count)
195+
cdef void DPCTLQueue_MemAdvise(
196+
const DPCTLSyclQueueRef Q,
197+
const void *Src,
198+
size_t Count,
199+
int Advice)
188200

189201

190202
cdef extern from "dpctl_sycl_queue_manager.h":
191-
cdef DPCTLSyclQueueRef DPCTLQueueMgr_GetCurrentQueue ()
192-
cdef size_t DPCTLQueueMgr_GetNumQueues (DPCTLSyclBackendType BETy,
203+
cdef DPCTLSyclQueueRef DPCTLQueueMgr_GetCurrentQueue()
204+
cdef size_t DPCTLQueueMgr_GetNumQueues(DPCTLSyclBackendType BETy,
193205
DPCTLSyclDeviceType DeviceTy)
194-
cdef size_t DPCTLQueueMgr_GetNumActivatedQueues ()
195-
cdef DPCTLSyclQueueRef DPCTLQueueMgr_GetQueue (DPCTLSyclBackendType BETy,
196-
DPCTLSyclDeviceType DeviceTy,
197-
size_t DNum)
198-
cdef bool DPCTLQueueMgr_IsCurrentQueue (const DPCTLSyclQueueRef QRef)
199-
cdef void DPCTLQueueMgr_PopQueue ()
200-
cdef DPCTLSyclQueueRef DPCTLQueueMgr_PushQueue (DPCTLSyclBackendType BETy,
201-
DPCTLSyclDeviceType DeviceTy,
202-
size_t DNum)
203-
cdef DPCTLSyclQueueRef DPCTLQueueMgr_SetAsDefaultQueue (
204-
DPCTLSyclBackendType BETy,
205-
DPCTLSyclDeviceType DeviceTy,
206-
size_t DNum
207-
)
206+
cdef size_t DPCTLQueueMgr_GetNumActivatedQueues()
207+
cdef DPCTLSyclQueueRef DPCTLQueueMgr_GetQueue(
208+
DPCTLSyclBackendType BETy,
209+
DPCTLSyclDeviceType DeviceTy,
210+
size_t DNum)
211+
cdef bool DPCTLQueueMgr_IsCurrentQueue(const DPCTLSyclQueueRef QRef)
212+
cdef void DPCTLQueueMgr_PopQueue()
213+
cdef DPCTLSyclQueueRef DPCTLQueueMgr_PushQueue(
214+
DPCTLSyclBackendType BETy,
215+
DPCTLSyclDeviceType DeviceTy,
216+
size_t DNum)
217+
cdef DPCTLSyclQueueRef DPCTLQueueMgr_SetAsDefaultQueue(
218+
DPCTLSyclBackendType BETy,
219+
DPCTLSyclDeviceType DeviceTy,
220+
size_t DNum)
208221
cdef DPCTLSyclQueueRef DPCTLQueueMgr_GetQueueFromContextAndDevice(
209222
DPCTLSyclContextRef CRef,
210223
DPCTLSyclDeviceRef DRef)
211224

212225

213226
cdef extern from "dpctl_sycl_usm_interface.h":
214-
cdef DPCTLSyclUSMRef DPCTLmalloc_shared (size_t size, DPCTLSyclQueueRef QRef)
215-
cdef DPCTLSyclUSMRef DPCTLmalloc_host (size_t size, DPCTLSyclQueueRef QRef)
216-
cdef DPCTLSyclUSMRef DPCTLmalloc_device (size_t size, DPCTLSyclQueueRef QRef)
217-
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_shared (size_t alignment,
218-
size_t size, DPCTLSyclQueueRef QRef)
219-
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_host (size_t alignment,
220-
size_t size, DPCTLSyclQueueRef QRef)
221-
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_device (size_t alignment,
222-
size_t size, DPCTLSyclQueueRef QRef)
223-
cdef void DPCTLfree_with_queue (DPCTLSyclUSMRef MRef,
224-
DPCTLSyclQueueRef QRef)
225-
cdef void DPCTLfree_with_context (DPCTLSyclUSMRef MRef,
226-
DPCTLSyclContextRef CRef)
227-
cdef const char* DPCTLUSM_GetPointerType (DPCTLSyclUSMRef MRef,
228-
DPCTLSyclContextRef CRef)
229-
cdef DPCTLSyclDeviceRef DPCTLUSM_GetPointerDevice (DPCTLSyclUSMRef MRef,
230-
DPCTLSyclContextRef CRef)
227+
cdef DPCTLSyclUSMRef DPCTLmalloc_shared(
228+
size_t size,
229+
DPCTLSyclQueueRef QRef)
230+
cdef DPCTLSyclUSMRef DPCTLmalloc_host(
231+
size_t size,
232+
DPCTLSyclQueueRef QRef)
233+
cdef DPCTLSyclUSMRef DPCTLmalloc_device(size_t size, DPCTLSyclQueueRef QRef)
234+
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_shared(
235+
size_t alignment,
236+
size_t size,
237+
DPCTLSyclQueueRef QRef)
238+
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_host(
239+
size_t alignment,
240+
size_t size,
241+
DPCTLSyclQueueRef QRef)
242+
cdef DPCTLSyclUSMRef DPCTLaligned_alloc_device(
243+
size_t alignment,
244+
size_t size,
245+
DPCTLSyclQueueRef QRef)
246+
cdef void DPCTLfree_with_queue(
247+
DPCTLSyclUSMRef MRef,
248+
DPCTLSyclQueueRef QRef)
249+
cdef void DPCTLfree_with_context(
250+
DPCTLSyclUSMRef MRef,
251+
DPCTLSyclContextRef CRef)
252+
cdef const char* DPCTLUSM_GetPointerType(
253+
DPCTLSyclUSMRef MRef,
254+
DPCTLSyclContextRef CRef)
255+
cdef DPCTLSyclDeviceRef DPCTLUSM_GetPointerDevice(
256+
DPCTLSyclUSMRef MRef,
257+
DPCTLSyclContextRef CRef)

0 commit comments

Comments
 (0)