char86

How can I use user made funcions in a OpenCL Kernel ?

Discussion created by char86 on Jan 21, 2011
Latest reply on Jan 21, 2011 by LeeHowes

Hello Guys.

inside my kernel I have a local memory storage:

__local float Uin[Xmax][Ymax]

Now i want to make mathimatical differentials with data from __local Uin. I want this many many times in my code so I want to make it with a funcion.

But i get these errors --------------------------------------------------------------

OpenCL Compile Error: clBuildProgram failed (CL_BUILD_PROGRAM_FAILURE).

Line 8: error: expression must
          have pointer-to-object type
      OUT = IN[ 4*XL + i + 2 ][ YL ] - IN[ 4*XL + i ][ YL ];
                 ^

Line 8: error: expression must
          have pointer-to-object type
      OUT = IN[ 4*XL + i + 2 ][ YL ] - IN[ 4*XL + i ][ YL ];
                                                      ^

Line 209: error: argument of
          type "local float (*)[4]" is incompatible with parameter of type
          "local float *"
          BUFX = DIFFX(XL, i, YL, UinLOC );
                                                 ^

3 errors detected.

 

---------------------------------------------------------------------------

 

 



// My Funcion // float DIFFX(int XL, int i, int YL, __local float *IN ) { float OUT; OUT = IN[ 4*XL + i + 2 ][ YL ] - IN[ 4*XL + i ][ YL ]; return(OUT); } // My code inside Kernel to call it // define LS 4 __local float UinLOC[ LS+2 ][ LS ]; BUFX[i] = DIFFX(XL, i, YL, UinLOC );

Outcomes