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

printf z format qualifier

Open alycm opened this issue 4 years ago • 2 comments

OpenCL C has a size_t type, but the OpenCL C printf excludes the z format qualifier. This makes it slightly harder to use printf to print things such as get_global_id(...) values.

The ll, j, z, t, and L length modifiers are not supported by OpenCL C but are reserved.

This can't be changed in an an existing version of OpenCL, but it is a small issue that could be considered in the future.

In terms of specification I think it would just be necessary to drop the restriction from the OpenCL C spec, and extend a few modifier lists. The SPIR-V extension instruction just takes a format string as well, so no additional changes.

For implementations that implement printf by sending a buffer of data back to the host that makes the size of the contents of the buffer device-dependent, but that is already the case for the p format qualifier.

alycm avatar Aug 12 '21 13:08 alycm