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

Limit size of kernel args no more than 255

Open haonanya opened this issue 3 years ago • 7 comments

Minimum limit for OpFunctionCall actual arguments is 255 according to https://www.khronos.org/registry/SPIR-V/specs/unified1/SPIRV.html#_universal_validation_rules

Signed-off-by: Haonan Yang [email protected]

haonanya avatar Dec 23 '21 07:12 haonanya

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Dec 23 '21 07:12 CLAassistant

[Qualcomm] Our concern is that this change would affect test behavior even on implementations that don't support SPIR-V. Further discussion is needed.

lakshmih avatar May 10 '22 01:05 lakshmih

Discussed in the OpenCL teleconference on May 10th. Short summary:

  • We update the OpenCL specification to restrict the maximum number of kernel arguments to 255 if it is not restricted to a smaller value (via e.g. the minimum supported value for CL_DEVICE_MAX_PARAMETER_SIZE). This will most likely be done as an update to the description of CL_DEVICE_MAX_PARAMETER_SIZE and as a TBD update to the OpenCL C spec. I will file an issue in OpenCL-Docs to track this.

  • I will also file an issue in OpenCL-Docs to track a possible longer-term solution, which may add e.g. an additional query as an extension or as part of a new OpenCL API version.

  • Based on the above, we are OK with this change in principle (still needs review approval, though).

bashbaug avatar May 10 '22 18:05 bashbaug

I don't think we can merge this yet. @haonanya, can you please look at my review comments above?

bashbaug avatar May 17 '22 01:05 bashbaug

I don't think we can merge this yet. @haonanya, can you please look at my review comments above?

Hi, @bashbaug, thanks for your review, I will have a look.

haonanya avatar May 17 '22 01:05 haonanya

I've filed the two issues in OpenCL-Docs described above.

bashbaug avatar Jun 08 '22 06:06 bashbaug

Apologize for late feedback here. If I am reading it correctly, 255 is the minimum limit for actual function arguments of SPIR-V. Does this mean number of kernel arguments should be no more than 255 or implementations supporting SPIR-V need to support minimum of upto 255 kernel arguments and some implementations can choose to support higher limit?

Also, if we decide to cap max number of kernel arguments to 255, is it fair to say all implementations need to limit CL_DEVICE_MAX_PARAMETER_SIZE to 2048? For implementations already reporting CL_DEVICE_MAX_PARAMETER_SIZE > 2048, possibly there may be applications using >255 arguments which may start to fail with this change and this change may potentially break backward compatibility. We have about 40% of reports on GpuInfo reporting >2048 values for CL_DEVICE_MAX_PARAMETER_SIZE spread across vendors. https://opencl.gpuinfo.org/displaydeviceinfo.php?name=CL_DEVICE_MAX_PARAMETER_SIZE

nikhiljnv avatar Jul 05 '22 14:07 nikhiljnv