KhronosGroup / KhronosGroup/OpenCL-Docs

Clarification needed in regards to allocation sizes and constant * arguments in clSetKernelArg and clSetKernelArgSVMPointer

Open
#1,504 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Python
Stars
420
Forks
131
Avg merge
5d 13h
Merged PRs (30d)
11

Description

At the moment `clSetKernelArg` states:

> If the argument is declared with the constant qualifier, the size in bytes of the memory object cannot exceed CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE

but no such statement is made for `clSetKernelArgSVMPointer`.

But as far as I can see `clSetKernelArg` doesn't declare an error if the application would do it anyway. I think we should define what expectations to have here. Should `clSetKernelArg` return an error if the allocation is too big? Shouldn't be a problem for applications, because they can always create SubBuffers.

What should we do about `clSetKernelArgSVMPointer`? Doing sub allocation isn't doable with the current API and not sure if unified SVM is going to change that. One could use `CL_MEM_USE_HOST_PTR` with `clCreateBuffer`, but it's also not forbidden to use SVM allocations for `constant *` arguments.

Should application expect that only up to `CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE` is addressable here? Or should the call fail?

@bashbaug for awareness.

Contributor guide

Open the contributing guide

Research direction

Review the documented behavior of clSetKernelArg and clSetKernelArgSVMPointer, focusing on constant-qualified arguments, allocation sizes, CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE, and SVM allocations. Determine which expectations or errors the API documentation needs to specify, then update the relevant OpenCL reference text and verify that the two functions describe consistent behavior.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.