1 Reply Latest reply on Dec 22, 2016 6:32 AM by dipak

    Question about the kernel execution?

    alexfd7

      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.

        • Re: Question about the kernel execution?
          dipak

          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.

           

          Regards,