cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

gcu01
Journeyman III

OpenCL kernel scalar arguments

Hi,

I have two questions related to the arguments of an OpenCL kernel. Please, correct me if I'm wrong in the context that I used to describe my questions.

The scalar arguments (e.g., kernel foo (int a) ) are placed in the private address space (like all the kernel arguments, regardless if they are scalar or not). There is no need of __private keyword; by default arguments are placed in the private address space.

Q1: who takes care of placing the scalar in the GPU private address space? there is no need of explicit transfer operation (from CPU to GPU address space) for a scalar. why is that?

Q2: can I have a scalar as an argument output? I want to get, among other arrays, one value from a kernel calculation.

0 Likes
1 Solution
dipak
Staff

1. OCL runtime takes care of it. When a scalar value is set by calling clSetKernelArg, the runtime copies the content from the host and place it to appropriate location (though exact time of placing may differ as runtime may choose to copy the data temporarily at some other location including system memory).

2. No. You need to wrap it with a buffer object even for a single value.

Regards,

View solution in original post

2 Replies
dipak
Staff

1. OCL runtime takes care of it. When a scalar value is set by calling clSetKernelArg, the runtime copies the content from the host and place it to appropriate location (though exact time of placing may differ as runtime may choose to copy the data temporarily at some other location including system memory).

2. No. You need to wrap it with a buffer object even for a single value.

Regards,

gcu01
Journeyman III

thanks.

0 Likes