Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

Adept I

Question about the kernel execution?

Hello everyone, to explain my doubt, let's assume that I have an input image, and I'll do any pixel-by-pixel operation, resulting in an output image.

To update the pixel-by-pixel value, first I need to extract a vector in the image that will be used to calculate the new value of each pixel and this vector will be constant throughout the process.

The way it is in my code, for each pixel (work-item) in my image, the vector will be recalculated, I wanted to calculate it only one time and use it in all task groups. One solution would be to calculate it on HOST and send it as a parameter, however wanted to compute it inside the kernel, is there any mechanism that I can use inside the kernel to compute this vector only once time and assign the global variable so that For all task groups.

1 Reply

Re: Question about the kernel execution?

The optimal mechanism depends on the capabilities supported by the target platform (OpenCL version, platform and/or device features etc.) and the application itself (for example, size of the image, cost to calculate the vector etc. may effect the decision as well).  A more details might be helpful to provide further suggestions.