5 Replies Latest reply on Aug 31, 2011 2:26 PM by MRusinov

    __constant variable initialization

    MRusinov
      __constant variable initialization

      Hello!

      I'm new to OpenCL and now I'm trying to port one video filter to OCL (primarily for studying :)).

      All works fine except not very fast speed (actually it's a little faster than previous CPU code). Now I'm working on it's optimization. I need to highly reuse 2 constant arrays of float of size less than 128. My GPU is 4850, so I can't use Images. Local memory works, but limits max. Work Group Size to 64. Now I'm trying to use __constant memory. The fastest way I found is to initialize them in kernel as constants (generated in host code before compilation). But I didn't found any way to do it in OpenCL C. Moreover, I can't find example to init. one non-array variable. Code

       

       

      __kernel void test()

      {

      __constant int ow = 1; 

      }



      doesn't compile with error 

       

      error: non-kernel

                function: variable with automatic storage duration cannot be stored

                in a named address space

        __constant int ow = 1; 

                      ^

      in AMD APP KernelAnalyzer.

      If i replace __constant with __private all works, but GRP usage is unacceptable.





      __kernel void test() { __constant int ow = 1; }