Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec consistency around param_value_size parameter for many OpenCL procedures #1216

Open
shajder opened this issue Aug 6, 2024 · 5 comments

Comments

@shajder
Copy link

shajder commented Aug 6, 2024

In few cases of OpenCL API spec mentioned that param_value_size is ignored if related para_value is NULL, eg. :

param_value_size specifies the size in bytes of memory pointed to by param_value. This size must be ≥ size of return type as described in the table below. If param_value is NULL, it is ignored.

This is the case for clGetCommandBufferInfoKHR and clGetCommandQueueInfo.

For below, similar cases this information is missing.

clGetPlatformInfo, clGetDeviceInfo, clCreateSubDevices, clGetContextInfo, clGetSupportedImageFormats, clGetImageInfo, clGetPipeInfo, clGetMemObjectInfo, clGetGLTextureInfo, clGetSamplerInfo, clGetProgramInfo, clGetProgramBuildInfo, clCreateKernelsInProgram, clGetKernelInfo, clGetKernelWorkGroupInfo, clGetKernelSubGroupInfo, clGetKernelArgInfo, clGetEventInfo, clGetSemaphoreHandleForTypeKHR, clGetSemaphoreInfoKHR, clGetEventProfilingInfo, clGetMutableCommandInfoKHR, clGetGLContextInfoKHR

@bashbaug
Copy link
Contributor

bashbaug commented Aug 6, 2024

Discussed in the August 6th teleconference:

  • We'll add the sentence to the other APIs to remove the inconsitency.
  • We'll double-check the error conditions to make sure they are consistent, also.

We'll file an additional issue to possibly de-duplicate this information, or to add stricter error checking.

@kpet
Copy link
Contributor

kpet commented Aug 7, 2024

As part of creating #1220, I noticed that we should consider clGetSemaphoreHandleForTypeKHR too when resolving this issue. The name of the affected parameters are handle_size and handle_ptr but the pattern is exactly the same as with param_value_size/param_value.

@bashbaug
Copy link
Contributor

bashbaug commented Sep 4, 2024

Need to clarify exactly what should be updated for:

  • clCreateSubDevices
  • clGetsupportedImageFormats
  • clCreateKernelsInProgram

These APIs have a slightly different pattern: they return an array of objects and/or the number of objects in the array. For example:

cl_int clCreateKernelsInProgram(
    cl_program program,
    cl_uint num_kernels,  // this is the allocated size of the array
    cl_kernel* kernels,  // this is the array itself, which stores the output from the function
    cl_uint* num_kernels_ret);  // this is the number of objects in the array

Do we want to say that the allocated size of the array ("num_kernels" in the esample above) is ignored if the array is NULL? It might be better to require that the allocated size of array must be zero when the array is NULL instead.

Regardless, I would prefer to resolve this with a separate PR.

@bashbaug
Copy link
Contributor

bashbaug commented Sep 9, 2024

#1254 fixes most of these issues.

Moving to "Needs WG Discussion" to answer the question above regarding clCreateSubDevices, clGetsupportedImageFormats, and clCreateKernelsInProgram.

@bashbaug bashbaug moved this from Next Spec Release to Needs WG discussion in OpenCL specification maintenance Sep 9, 2024
@shajder
Copy link
Author

shajder commented Oct 9, 2024

These APIs have a slightly different pattern: they return an array of objects and/or the number of objects in the array.

Indeed, pattern is not reflected exactly in mentioned cases and it may need a different description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs WG discussion
Development

No branches or pull requests

3 participants