KhronosGroup / OpenCL-Docs

OpenCL API, OpenCL C, Extensions, SPIR-V Environment Specs, Ref page, and C++ for OpenCL doc sources.
Other
361 stars 114 forks source link

Discrepancy in error codes between legacy and new image creation API #1277

Open lakshmih opened 1 month ago

lakshmih commented 1 month ago

Under error codes for clCreateImage/clCreateImageWithProperties, the API spec says:

However for the legacy clCreateImage3D, spec says: CL_INVALID_IMAGE_SIZE if image_width or image_height are 0 or if image_depth ≤ 1, or if they exceed the maximum values specified in CL_DEVICE_IMAGE3D_MAX_WIDTH, CL_DEVICE_IMAGE3D_MAX_HEIGHT or CL_DEVICE_IMAGE3D_MAX_DEPTH respectively for all devices in context, or if values specified by image_row_pitch and image_slice_pitch do not follow rules described in the argument description above. This means, for e.g., that when trying to create a 3D image with depth 0 (and hence invalid), the new APIs are required to return CL_INVALID_IMAGE_DESCRIPTOR whereas the legacy API would return CL_INVALID_IMAGE_SIZE. It would be ideal to reconcile the error descriptions so we use/expand CL_INVALID_IMAGE_SIZE for this case as well rather than restrict it to exceeding the maximum dimension supported.

bashbaug commented 1 month ago

Do you mind if I transfer this issue to OpenCL-Docs? It seems like more of a spec issue than a test issue, unless there is also a test for the current error behavior.

lakshmih commented 4 weeks ago

I did that, thanks for the reminder Ben!