@@ -159,16 +159,17 @@ bool oclHandleInvalidWorkGroupSize(const device_impl &DeviceImpl,
159
159
}
160
160
}
161
161
}
162
+
163
+ // TODO: required number of sub-groups, OpenCL 2.1:
164
+ // CL_INVALID_WORK_GROUP_SIZE if local_work_size is specified and is not
165
+ // consistent with the required number of sub-groups for kernel in the
166
+ // program source.
162
167
163
- // TODO: required number of sub-groups, OpenCL 2.1:
164
- // PI_INVALID_WORK_GROUP_SIZE if local_work_size is specified and is not
165
- // consistent with the required number of sub-groups for kernel in the
166
- // program source.
168
+ // Fallback
167
169
168
- // Fallback
169
170
constexpr pi_result Error = PI_INVALID_WORK_GROUP_SIZE;
170
171
throw runtime_error (
171
- " OpenCL API failed. OpenCL API returns: " + codeToString (Error), Error);
172
+ " OpenCL API failed. OpenCL API returns: " + codeToString (Error), Error);
172
173
}
173
174
174
175
bool handleInvalidWorkGroupSize (const device_impl &DeviceImpl, pi_kernel Kernel,
@@ -218,9 +219,9 @@ bool handleInvalidWorkItemSize(const device_impl &DeviceImpl,
218
219
219
220
size_t MaxWISize[] = {0 , 0 , 0 };
220
221
221
- Plugin.call <PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_MAX_WORK_ITEM_SIZE,
222
- sizeof (MaxWISize), &MaxWISize,
223
- nullptr );
222
+ Plugin.call <PiApiKind::piDeviceGetInfo>(
223
+ Device, PI_DEVICE_INFO_MAX_WORK_ITEM_SIZES, sizeof (MaxWISize), &MaxWISize,
224
+ nullptr );
224
225
for (int i = 0 ; i < NDRDesc.Dims ; i++) {
225
226
if (NDRDesc.LocalSize [i] > MaxWISize[i])
226
227
throw sycl::nd_range_error (" Number of local work group number " +
@@ -238,7 +239,43 @@ bool handleError(pi_result Error, const device_impl &DeviceImpl,
238
239
switch (Error) {
239
240
case PI_INVALID_WORK_GROUP_SIZE:
240
241
return handleInvalidWorkGroupSize (DeviceImpl, Kernel, NDRDesc);
241
- // TODO: Handle other error codes
242
+
243
+ case PI_INVALID_KERNEL_ARGS:
244
+ throw sycl::nd_range_error (
245
+ " The kernel argument values have not been specified "
246
+ " OR "
247
+ " a kernel argument declared to be a pointer to a type"
248
+ " does not point to a named address space" ,
249
+ PI_INVALID_KERNEL_ARGS);
250
+
251
+ case PI_INVALID_WORK_ITEM_SIZE:
252
+ return handleInvalidWorkItemSize (DeviceImpl, NDRDesc);
253
+
254
+ case PI_IMAGE_FORMAT_NOT_SUPPORTED:
255
+ throw sycl::nd_range_error (
256
+ " image object is specified as an argument value"
257
+ " and the image format is not supported by device associated"
258
+ " with queue" ,
259
+ PI_IMAGE_FORMAT_NOT_SUPPORTED);
260
+
261
+ case PI_MISALIGNED_SUB_BUFFER_OFFSET:
262
+ throw sycl::nd_range_error (
263
+ " a sub-buffer object is specified as the value for an argument "
264
+ " that is a buffer object and the offset specified "
265
+ " when the sub-buffer object is created is not aligned "
266
+ " to CL_DEVICE_MEM_BASE_ADDR_ALIGN value for device associated"
267
+ " with queue" ,
268
+ PI_MISALIGNED_SUB_BUFFER_OFFSET);
269
+
270
+ case PI_MEM_OBJECT_ALLOCATION_FAILURE:
271
+ throw sycl::nd_range_error (
272
+ " failure to allocate memory for data store associated with image"
273
+ " or "
274
+ " buffer objects specified as arguments to kernel" ,
275
+ PI_MEM_OBJECT_ALLOCATION_FAILURE);
276
+
277
+ // TODO: Handle other error codes
278
+
242
279
default :
243
280
throw runtime_error (
244
281
" OpenCL API failed. OpenCL API returns: " + codeToString (Error), Error);
0 commit comments