4 Replies Latest reply on Feb 28, 2010 7:10 PM by nou

    Function arguments


      Hi. Can I somehow declare a function that takes first argument as global or as private? For example:

      kernel void k1(global read_only uint *string, constant read_only uint *offset) {

      size_t gid = get_global_id(0);

      f(string + offset[gid]);



      And another kernel:

      kernel void k2() {

      uint string[5];

      // fill



        • Function arguments

          Check the last intro video, 2nd topic from top.  You cannot specify private for kernel arguments.  All work items share one copy of args.

            • Function arguments

              thats not true.you can ommit address qualifier for non pointer arguments which will be by default be __private.

              __kernel k(__global float *a, float b)//b is __private


                • Function arguments

                  jcpalmer: thanks for reply but you misunderstood me. I don't want private argument for kernel but for function that isn't kernel. When I declare f like this:

                  void f(global const uint * const param);

                  I can't use it with kernel k2. When I declare it this way:

                  void f(const uint * const param);

                  ...it works with k2 but not k1.


                  Now my f() is quiet big and having two nearly the same functions really slows down compilation.