OpenCL-Docs icon indicating copy to clipboard operation
OpenCL-Docs copied to clipboard

clarify behavior when passing the same image as a read-only and a write-only kernel argument

Open bashbaug opened this issue 10 months ago • 0 comments

In the OpenCL API spec there is a restriction about passing the same image as a read-only and a write-only kernel argument:

https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#image-format-mapping

It is not valid to pass an image supporting writing as both a read_only image and a write_only image parameter, or to a read_write image parameter and any other image parameter.

This is documented in an odd place though. I think it would be better described in the description of clSetKernelArg.

We should also clarify what "invalid" means. Specifically, is this an error (if so, which error, and when is it generated?), or is this undefined behavior?

I'll probably start with a PR that moves the restriction to clSetKernelArg and clarifies that it is undefined behavior and we can start from there.

bashbaug avatar Jan 31 '25 17:01 bashbaug