@@ -123,6 +123,41 @@ cdef class kernel_arg_type_attribute:
123
123
124
124
125
125
cdef class LocalAccessor:
126
+ """
127
+ LocalAccessor(ndim, dtype, dim0, dim1, dim2)
128
+
129
+ Python class for specifying the dimensionality and type of a
130
+ ``sycl::local_accessor``, to be used as a kernel argument type.
131
+
132
+ Args:
133
+ ndim (size_t):
134
+ number of dimensions.
135
+ Can be between one and three.
136
+ dtype (str):
137
+ the data type of the local memory.
138
+ The permitted values are
139
+
140
+ `'i1'`, `'i2'`, `'i4'`, `'i8'`:
141
+ signed integral types int8_t, int16_t, int32_t, int64_t
142
+ `'u1'`, `'u2'`, `'u4'`, `'u8'`
143
+ unsigned integral types uint8_t, uint16_t, uint32_t,
144
+ uint64_t
145
+ `'f4'`, `'f8'`,
146
+ single- and double-precision floating-point types float and
147
+ double
148
+ dim0 (size_t):
149
+ Size of the first dimension.
150
+ dim1 (size_t):
151
+ Size of the second dimension.
152
+ dim2 (size_t):
153
+ Size of the third dimension.
154
+
155
+ Raises:
156
+ ValueError:
157
+ If the given dimension is not between one and three.
158
+ ValueError:
159
+ If the dtype string is unrecognized.
160
+ """
126
161
cdef _md_local_accessor lacc
127
162
128
163
def __cinit__ (self , size_t ndim , str dtype , size_t dim0 , size_t dim1 , size_t dim2 ):
@@ -132,7 +167,7 @@ cdef class LocalAccessor:
132
167
self .lacc.dim2 = dim2
133
168
134
169
if ndim < 1 or ndim > 3 :
135
- raise ValueError
170
+ raise ValueError ( " LocalAccessor must have dimension between one and three " )
136
171
if dtype == ' i1' :
137
172
self .lacc.dpctl_type_id = _arg_data_type._INT8_T
138
173
elif dtype == ' u1' :
@@ -160,6 +195,10 @@ cdef class LocalAccessor:
160
195
return " LocalAccessor(" + self .ndim + " )"
161
196
162
197
cdef size_t addressof(self ):
198
+ """
199
+ Returns the address of the _md_local_accessor for this LocalAccessor
200
+ cast to ``size_t``.
201
+ """
163
202
return < size_t> & self .lacc
164
203
165
204
0 commit comments