This repository was archived by the owner on Mar 1, 2023. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathbackend.pxd
More file actions
113 lines (92 loc) · 4.53 KB
/
Copy pathbackend.pxd
File metadata and controls
113 lines (92 loc) · 4.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
##===------------- backend.pyx - DPPL interface ------*- Cython -*-------===##
##
## Python Data Parallel Processing Library (PyDPPL)
##
## Copyright 2020 Intel Corporation
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##===----------------------------------------------------------------------===##
##
## \file
## This file defines the Cython interface for the backend API of PyDPPL.
##
##===----------------------------------------------------------------------===##
# distutils: language = c++
# cython: language_level=3
from libcpp cimport bool
cdef extern from "dppl_utils.h":
cdef void DPPLCString_Delete (const char *str)
cdef extern from "dppl_sycl_types.h":
cdef struct DPPLOpaqueSyclContext
cdef struct DPPLOpaqueSyclQueue
cdef struct DPPLOpaqueSyclDevice
cdef struct DPPLOpaqueSyclUSM
ctypedef DPPLOpaqueSyclContext* DPPLSyclContextRef
ctypedef DPPLOpaqueSyclQueue* DPPLSyclQueueRef
ctypedef DPPLOpaqueSyclDevice* DPPLSyclDeviceRef
ctypedef DPPLOpaqueSyclUSM* DPPLSyclUSMRef
cdef extern from "dppl_sycl_context_interface.h":
cdef void DPPLContext_Delete (DPPLSyclContextRef CtxtRef) except +
cdef extern from "dppl_sycl_device_interface.h":
cdef void DPPLDevice_DumpInfo (const DPPLSyclDeviceRef DRef) except +
cdef void DPPLDevice_Delete (DPPLSyclDeviceRef DRef) except +
cdef void DPPLDevice_DumpInfo (const DPPLSyclDeviceRef DRef) except +
cdef bool DPPLDevice_IsAccelerator (const DPPLSyclDeviceRef DRef) except +
cdef bool DPPLDevice_IsCPU (const DPPLSyclDeviceRef DRef) except +
cdef bool DPPLDevice_IsGPU (const DPPLSyclDeviceRef DRef) except +
cdef bool DPPLDevice_IsHost (const DPPLSyclDeviceRef DRef) except +
cdef const char* DPPLDevice_GetDriverInfo (const DPPLSyclDeviceRef DRef) \
except +
cdef const char* DPPLDevice_GetName (const DPPLSyclDeviceRef DRef) except +
cdef const char* DPPLDevice_GetVendorName (const DPPLSyclDeviceRef DRef) \
except +
cdef bool DPPLDevice_IsHostUnifiedMemory (const DPPLSyclDeviceRef DRef) \
except +
cdef extern from "dppl_sycl_platform_interface.h":
cdef size_t DPPLPlatform_GetNumPlatforms ()
cdef void DPPLPlatform_DumpInfo ()
cdef extern from "dppl_sycl_queue_interface.h":
cdef void DPPLQueue_Delete (DPPLSyclQueueRef QRef) except +
cdef DPPLSyclContextRef DPPLQueue_GetContext (const DPPLSyclQueueRef Q) \
except+
cdef DPPLSyclDeviceRef DPPLQueue_GetDevice (const DPPLSyclQueueRef Q) \
except +
cdef extern from "dppl_sycl_queue_manager.h":
cdef enum _device_type 'DPPLSyclDeviceType':
_GPU 'DPPL_GPU'
_CPU 'DPPL_CPU'
cdef DPPLSyclQueueRef DPPLQueueMgr_GetCurrentQueue () except +
cdef size_t DPPLQueueMgr_GetNumCPUQueues () except +
cdef size_t DPPLQueueMgr_GetNumGPUQueues () except +
cdef size_t DPPLQueueMgr_GetNumActivatedQueues () except +
cdef DPPLSyclQueueRef DPPLQueueMgr_GetQueue (_device_type DTy,
size_t device_num) except +
cdef void DPPLQueueMgr_PopQueue () except +
cdef DPPLSyclQueueRef DPPLQueueMgr_PushQueue (_device_type DTy,
size_t device_num) except +
cdef void DPPLQueueMgr_SetAsDefaultQueue (_device_type DTy,
size_t device_num) except +
cdef extern from "dppl_sycl_usm_interface.h":
cdef DPPLSyclUSMRef DPPLmalloc_shared (size_t size, DPPLSyclQueueRef QRef) \
except +
cdef DPPLSyclUSMRef DPPLmalloc_host (size_t size, DPPLSyclQueueRef QRef) \
except +
cdef DPPLSyclUSMRef DPPLmalloc_device (size_t size, DPPLSyclQueueRef QRef) \
except +
cdef void DPPLfree_with_queue (DPPLSyclUSMRef MRef,
DPPLSyclQueueRef QRef) except +
cdef void DPPLfree_with_context (DPPLSyclUSMRef MRef,
DPPLSyclContextRef CRef) except +
cdef const char* DPPLUSM_GetPointerType (DPPLSyclUSMRef MRef,
DPPLSyclContextRef CRef) except +