@@ -52,7 +52,12 @@ __all__ = [
5252 " SyclContext" ,
5353 " SyclDevice" ,
5454 " SyclEvent" ,
55- " SyclQueue"
55+ " SyclQueue" ,
56+ " SyclKernelInvalidRangeError" ,
57+ " SyclKernelSubmitError" ,
58+ " SyclQueueCreationError" ,
59+ " UnsupportedBackendError" ,
60+ " UnsupportedDeviceError" ,
5661]
5762
5863_logger = logging.getLogger(__name__ )
@@ -65,10 +70,10 @@ class device_type(Enum):
6570 ================== ============
6671 Device type Enum value
6772 ================== ============
68- GPU 1
69- CPU 2
70- Accelerator 3
71- Host 4
73+ gpu 1
74+ cpu 2
75+ accelerator 3
76+ host_device 4
7277 ================== ============
7378
7479 """
@@ -84,10 +89,10 @@ class backend_type(Enum):
8489 ================== ============
8590 Name of backend Enum value
8691 ================== ============
87- OpenCL 1
88- Level Zero 2
89- Cuda 3
90- Host 4
92+ opencl 1
93+ level_zero 2
94+ cuda 3
95+ host 4
9196 ================== ============
9297
9398 """
@@ -96,38 +101,50 @@ class backend_type(Enum):
96101 cuda = auto ()
97102 host = auto ()
98103
99- cdef class UnsupportedBackendError (Exception ):
100- """ This exception is raised when a device type other than CPU or GPU is
101- encountered.
104+ cdef class UnsupportedBackendError(Exception ):
105+ """
106+ An UnsupportedBackendError exception is raised when a backend value
107+ is other than `backend_type.opencl` or `backend_type.level_zero` is
108+ encountered. All other backends are currently not supported.
109+
102110 """
103111 pass
104112
105- cdef class UnsupportedDeviceError (Exception ):
106- """ This exception is raised when a device type other than CPU or GPU is
107- encountered.
113+ cdef class UnsupportedDeviceError(Exception ):
114+ """
115+ An UnsupportedDeviceError exception is raised when a device type value
116+ other than `device_type.cpu` or `device_type.gpu` is encountered.
117+
108118 """
109119 pass
110120
111- cdef class SyclKernelSubmitError (Exception ):
112- """ This exception is raised when a SYCL program could not be built from
113- either a SPIR-V binary file or a string source.
121+ cdef class SyclKernelSubmitError(Exception ):
122+ """
123+ A SyclKernelSubmitError exception is raised when the provided
124+ :class:`.SyclKernel` could not be submitted to the :class:`.SyclQueue`.
125+
114126 """
115127 pass
116128
117- cdef class SyclKernelInvalidRangeError (Exception ):
118- """ This exception is raised when a range that has more than three
119- dimensions or less than one dimension.
129+ cdef class SyclKernelInvalidRangeError(Exception ):
130+ """
131+ A SyclKernelInvalidRangeError is raised when the provided range has less
132+ than one or more than three dimensions.
120133 """
121134 pass
122135
123- cdef class SyclQueueCreationError (Exception ):
124- """ This exception is raised when a range that has more than three
125- dimensions or less than one dimension.
136+ cdef class SyclQueueCreationError(Exception ):
137+ """
138+ A SyclQueueCreationError exception is raised when a :class:`.SyclQueue`
139+ could not be created. :class:`.SyclQueue` creation can fail if the filter
140+ string is invalid, or the backend or device type values are not supported.
141+
126142 """
127143 pass
128144
129145cdef class SyclContext:
130-
146+ """ Python wrapper class for cl::sycl::context.
147+ """
131148 @staticmethod
132149 cdef SyclContext _create (DPCTLSyclContextRef ctxt):
133150 cdef SyclContext ret = SyclContext.__new__ (SyclContext)
@@ -147,17 +164,17 @@ cdef class SyclContext:
147164 return self ._ctxt_ref
148165
149166 def addressof_ref (self ):
150- """ Returns the address of the DPCTLSyclContextRef pointer as a
151- long .
167+ """
168+ Returns the address of the DPCTLSyclContextRef pointer as a size_t .
152169
153170 Returns:
154171 The address of the DPCTLSyclContextRef object used to create this
155- SyclContext cast to a long .
172+ SyclContext cast to a size_t .
156173 """
157174 return int (< size_t> self ._ctx_ref)
158175
159176cdef class SyclDevice:
160- """ Wrapper class for a Sycl Device
177+ """ Python wrapper class for cl::sycl::device.
161178 """
162179
163180 @staticmethod
@@ -274,17 +291,17 @@ cdef class SyclDevice:
274291 return self ._device_ref
275292
276293 def addressof_ref (self ):
277- """ Returns the address of the DPCTLSyclDeviceRef pointer as a
278- long .
294+ """
295+ Returns the address of the DPCTLSyclDeviceRef pointer as a size_t .
279296
280297 Returns:
281298 The address of the DPCTLSyclDeviceRef object used to create this
282- SyclDevice cast to a long .
299+ SyclDevice cast to a size_t .
283300 """
284301 return int (< size_t> self ._device_ref)
285302
286303cdef class SyclEvent:
287- """ Wrapper class for a Sycl Event
304+ """ Python wrapper class for cl::sycl::event.
288305 """
289306
290307 @staticmethod
@@ -308,18 +325,18 @@ cdef class SyclEvent:
308325
309326 def addressof_ref (self ):
310327 """ Returns the address of the C API DPCTLSyclEventRef pointer as
311- a long .
328+ a size_t .
312329
313330 Returns:
314331 The address of the DPCTLSyclEventRef object used to create this
315- SyclEvent cast to a long .
332+ SyclEvent cast to a size_t .
316333 """
317334 return int (< size_t> self ._event_ref)
318335
319336import ctypes
320337
321338cdef class SyclQueue:
322- """ Wrapper class for a Sycl queue.
339+ """ Python wrapper class for cl::sycl:: queue.
323340 """
324341
325342 @staticmethod
@@ -464,11 +481,12 @@ cdef class SyclQueue:
464481 return self ._queue_ref
465482
466483 def addressof_ref (self ):
467- """ Returns the address of the C API DPCTLSyclQueueRef pointer as a long.
484+ """
485+ Returns the address of the C API DPCTLSyclQueueRef pointer as a size_t.
468486
469487 Returns:
470488 The address of the DPCTLSyclQueueRef object used to create this
471- SyclQueue cast to a long .
489+ SyclQueue cast to a size_t .
472490 """
473491 return int (< size_t> self ._queue_ref)
474492
@@ -618,7 +636,7 @@ cdef class SyclQueue:
618636
619637
620638cdef class _SyclRTManager:
621- """ Wrapper for the C API 's sycl queue manager interface.
639+ """ Provides a wrapper for dpCtl 's SYCL queue manager interface.
622640 """
623641 cdef dict _backend_str_ty_dict
624642 cdef dict _device_str_ty_dict
@@ -1010,7 +1028,7 @@ from contextlib import contextmanager
10101028@contextmanager
10111029def device_context (str queue_str = " opencl:gpu:0" ):
10121030 """
1013- Yeilds a SYCL queue corresponding to the input filter string.
1031+ Yields a SYCL queue corresponding to the input filter string.
10141032
10151033 This context manager "activates", *i.e.*, sets as the currently usable
10161034 queue, the SYCL queue defined by the "backend:device type:device id" tuple.
@@ -1025,7 +1043,8 @@ def device_context(str queue_str="opencl:gpu:0"):
10251043 "backend:device-type:device-id", defaults to "opencl:gpu:0".
10261044
10271045 Yields:
1028- SyclQueue: A SYCL queue corresponding to the specified filter string.
1046+ :class:`.SyclQueue`: A SYCL queue corresponding to the specified \
1047+ filter string.
10291048
10301049 Raises:
10311050 ValueError: If the filter string is malformed.
0 commit comments